react-native-css 3.0.0-nightly.27bd5e2 → 3.0.0-nightly.46bc0ab
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/attributes.test.js +1 -1
- package/dist/commonjs/compiler/attributes.test.js.map +1 -1
- package/dist/commonjs/compiler/compiler.js +57 -18
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +209 -107
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/inheritance.test.js +7 -7
- 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/selector-builder.js +457 -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 +136 -45
- package/dist/commonjs/compiler/stylesheet.js.map +1 -1
- 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/TextInput.js +17 -0
- package/dist/commonjs/components/TextInput.js.map +1 -0
- package/dist/commonjs/components/index.js +40 -0
- package/dist/commonjs/components/index.js.map +1 -1
- package/dist/commonjs/jest/index.js +34 -28
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/index.js +7 -5
- package/dist/commonjs/metro/index.js.map +1 -1
- package/dist/commonjs/poison.pill.js +4 -1
- package/dist/commonjs/poison.pill.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/attributes.js +42 -0
- package/dist/commonjs/runtime/native/conditions/attributes.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/container-query.js +28 -21
- package/dist/commonjs/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/index.js +10 -46
- package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/media-query.js +19 -17
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/runtime/native/injection.js +22 -20
- package/dist/commonjs/runtime/native/injection.js.map +1 -1
- package/dist/commonjs/runtime/native/react/interaction.js +10 -10
- package/dist/commonjs/runtime/native/react/interaction.js.map +1 -1
- package/dist/commonjs/runtime/native/react/rules.js +22 -17
- package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
- package/dist/commonjs/runtime/native/react/useNativeCss.js +3 -2
- package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/commonjs/runtime/native/reactivity.js +1 -12
- package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
- package/dist/commonjs/runtime/native/reanimated.js +17 -0
- package/dist/commonjs/runtime/native/reanimated.js.map +1 -0
- package/dist/commonjs/runtime/native/root.js +28 -0
- package/dist/commonjs/runtime/native/root.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/calculate-props.js +56 -48
- 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/{calc.js → functions/calc.js} +1 -1
- 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 +61 -0
- package/dist/commonjs/runtime/native/styles/functions/index.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/transform-functions.js +83 -0
- package/dist/commonjs/runtime/native/styles/functions/transform-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/index.js +12 -12
- package/dist/commonjs/runtime/native/styles/index.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/resolve.js +21 -44
- package/dist/commonjs/runtime/native/styles/resolve.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/{shorthand.js → shorthands/_handler.js} +5 -5
- package/dist/commonjs/runtime/native/styles/shorthands/_handler.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{animation.js → shorthands/animation.js} +5 -36
- 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/{box-shadow.js → shorthands/box-shadow.js} +3 -3
- 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/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/module/compiler/atRules.js +16 -3
- package/dist/module/compiler/atRules.js.map +1 -1
- package/dist/module/compiler/attributes.test.js +1 -1
- package/dist/module/compiler/attributes.test.js.map +1 -1
- package/dist/module/compiler/compiler.js +57 -18
- package/dist/module/compiler/compiler.js.map +1 -1
- package/dist/module/compiler/compiler.types.js.map +1 -1
- package/dist/module/compiler/declarations.js +204 -103
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/inheritance.test.js +7 -7
- 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/selector-builder.js +452 -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 +135 -44
- package/dist/module/compiler/stylesheet.js.map +1 -1
- 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/TextInput.js +12 -0
- package/dist/module/components/TextInput.js.map +1 -0
- package/dist/module/components/index.js +5 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/jest/index.js +34 -13
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/index.js +7 -5
- package/dist/module/metro/index.js.map +1 -1
- package/dist/module/poison.pill.js +4 -1
- package/dist/module/poison.pill.js.map +1 -1
- package/dist/module/runtime/native/conditions/attributes.js +38 -0
- package/dist/module/runtime/native/conditions/attributes.js.map +1 -0
- package/dist/module/runtime/native/conditions/container-query.js +28 -21
- package/dist/module/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/module/runtime/native/conditions/guards.js.map +1 -1
- package/dist/module/runtime/native/conditions/index.js +10 -46
- package/dist/module/runtime/native/conditions/index.js.map +1 -1
- package/dist/module/runtime/native/conditions/media-query.js +19 -17
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/module/runtime/native/injection.js +21 -19
- package/dist/module/runtime/native/injection.js.map +1 -1
- package/dist/module/runtime/native/react/interaction.js +10 -10
- package/dist/module/runtime/native/react/interaction.js.map +1 -1
- package/dist/module/runtime/native/react/rules.js +22 -17
- package/dist/module/runtime/native/react/rules.js.map +1 -1
- package/dist/module/runtime/native/react/useNativeCss.js +2 -1
- package/dist/module/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/module/runtime/native/reactivity.js +0 -11
- package/dist/module/runtime/native/reactivity.js.map +1 -1
- package/dist/module/runtime/native/reanimated.js +13 -0
- package/dist/module/runtime/native/reanimated.js.map +1 -0
- package/dist/module/runtime/native/root.js +24 -0
- package/dist/module/runtime/native/root.js.map +1 -0
- package/dist/module/runtime/native/styles/calculate-props.js +57 -49
- 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/{calc.js → functions/calc.js} +1 -1
- 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 +8 -0
- package/dist/module/runtime/native/styles/functions/index.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/transform-functions.js +76 -0
- package/dist/module/runtime/native/styles/functions/transform-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/index.js +12 -12
- package/dist/module/runtime/native/styles/index.js.map +1 -1
- package/dist/module/runtime/native/styles/resolve.js +20 -44
- package/dist/module/runtime/native/styles/resolve.js.map +1 -1
- package/dist/module/runtime/native/styles/{shorthand.js → shorthands/_handler.js} +5 -5
- package/dist/module/runtime/native/styles/shorthands/_handler.js.map +1 -0
- package/dist/module/runtime/native/styles/{animation.js → shorthands/animation.js} +3 -34
- package/dist/module/runtime/native/styles/shorthands/animation.js.map +1 -0
- package/dist/module/runtime/native/styles/{border.js → shorthands/border.js} +1 -1
- package/dist/module/runtime/native/styles/shorthands/border.js.map +1 -0
- package/dist/module/runtime/native/styles/{box-shadow.js → shorthands/box-shadow.js} +2 -2
- 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/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/typescript/commonjs/example/app.config.d.ts +4 -0
- package/dist/typescript/commonjs/example/app.config.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +9 -2
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +6 -7
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +16 -19
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts +23 -0
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts +3 -2
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +23 -5
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
- 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/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 +5 -0
- package/dist/typescript/commonjs/src/components/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/jest/index.d.ts +21 -5
- 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/poison.pill.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts +3 -3
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts +2 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +2 -10
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/root.d.ts +11 -0
- package/dist/typescript/commonjs/src/runtime/native/root.d.ts.map +1 -0
- 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 +6 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.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/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/module/example/app.config.d.ts +4 -0
- package/dist/typescript/module/example/app.config.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts +9 -2
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +6 -7
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +16 -19
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/selector-builder.d.ts +23 -0
- package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/selectors.d.ts +3 -2
- package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +23 -5
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
- 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/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 +5 -0
- package/dist/typescript/module/src/components/index.d.ts.map +1 -1
- package/dist/typescript/module/src/jest/index.d.ts +21 -5
- 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/poison.pill.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts +3 -3
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/injection.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts +2 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts +2 -10
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/reanimated.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/reanimated.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/root.d.ts +11 -0
- package/dist/typescript/module/src/runtime/native/root.d.ts.map +1 -0
- 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 +6 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/index.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/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/package.json +28 -4
- package/src/compiler/atRules.ts +17 -3
- package/src/compiler/attributes.test.ts +1 -1
- package/src/compiler/compiler.ts +63 -33
- package/src/compiler/compiler.types.ts +8 -8
- package/src/compiler/declarations.ts +374 -127
- package/src/compiler/inheritance.test.ts +6 -6
- package/src/compiler/keyframes.ts +1 -1
- package/src/compiler/selector-builder.ts +531 -0
- package/src/compiler/selectors.ts +20 -6
- package/src/compiler/stylesheet.ts +179 -42
- 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/TextInput.tsx +17 -0
- package/src/components/index.tsx +5 -0
- package/src/jest/index.ts +45 -13
- package/src/metro/index.ts +12 -6
- package/src/poison.pill.ts +5 -1
- package/src/runtime/native/conditions/attributes.ts +52 -0
- package/src/runtime/native/conditions/container-query.ts +27 -22
- package/src/runtime/native/conditions/guards.ts +1 -2
- package/src/runtime/native/conditions/index.ts +12 -66
- package/src/runtime/native/conditions/media-query.ts +20 -20
- package/src/runtime/native/injection.ts +32 -31
- package/src/runtime/native/react/interaction.ts +12 -12
- package/src/runtime/native/react/rules.ts +23 -14
- package/src/runtime/native/react/useNativeCss.ts +4 -1
- package/src/runtime/native/reactivity.ts +2 -21
- package/src/runtime/native/reanimated.ts +22 -0
- package/src/runtime/native/root.ts +31 -0
- package/src/runtime/native/styles/calculate-props.ts +61 -50
- 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/{calc.ts → functions/calc.ts} +2 -2
- package/src/runtime/native/styles/{filters.ts → functions/filters.ts} +3 -3
- package/src/runtime/native/styles/functions/index.ts +5 -0
- package/src/runtime/native/styles/{platform-functions.ts → functions/platform-functions.ts} +2 -2
- package/src/runtime/native/styles/functions/transform-functions.ts +51 -0
- package/src/runtime/native/styles/index.ts +12 -12
- package/src/runtime/native/styles/resolve.ts +20 -63
- package/src/runtime/native/styles/{shorthand.ts → shorthands/_handler.ts} +5 -5
- package/src/runtime/native/styles/{animation.ts → shorthands/animation.ts} +4 -63
- package/src/runtime/native/styles/{border.ts → shorthands/border.ts} +1 -1
- package/src/runtime/native/styles/{box-shadow.ts → shorthands/box-shadow.ts} +3 -3
- 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} +1 -1
- package/src/runtime/native/styles/units.ts +8 -4
- package/src/runtime/native/styles/variables.ts +2 -6
- package/src/runtime/utils/objects.ts +14 -4
- package/src/runtime/utils/specificity.ts +1 -0
- package/types.d.ts +70 -0
- 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.map +0 -1
- 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/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.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/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/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/dist/commonjs/runtime/native/styles/{transform.js → shorthands/transform.js} +0 -0
- /package/dist/module/runtime/native/styles/{transform.js → shorthands/transform.js} +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { SelectorList } from "lightningcss";
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
isStyleDescriptorArray,
|
|
3
5
|
Specificity,
|
|
@@ -17,8 +19,9 @@ import type {
|
|
|
17
19
|
StyleRuleMapping,
|
|
18
20
|
StyleRuleSet,
|
|
19
21
|
VariableRecord,
|
|
22
|
+
VariableValue,
|
|
20
23
|
} from "./compiler.types";
|
|
21
|
-
import {
|
|
24
|
+
import { getClassNameSelectors, toRNProperty } from "./selector-builder";
|
|
22
25
|
|
|
23
26
|
type BuilderMode = "style" | "media" | "container" | "keyframes";
|
|
24
27
|
|
|
@@ -29,6 +32,8 @@ const staticDeclarations = new WeakMap<
|
|
|
29
32
|
|
|
30
33
|
const extraRules = new WeakMap<StyleRule, Partial<StyleRule>[]>();
|
|
31
34
|
|
|
35
|
+
const keywords = new Set(["unset"]);
|
|
36
|
+
|
|
32
37
|
export class StylesheetBuilder {
|
|
33
38
|
animationFrames?: AnimationKeyframes_V2[];
|
|
34
39
|
animationDeclarations: StyleDeclaration[] = [];
|
|
@@ -47,6 +52,7 @@ export class StylesheetBuilder {
|
|
|
47
52
|
private ruleTemplate: StyleRule = {
|
|
48
53
|
s: [],
|
|
49
54
|
},
|
|
55
|
+
// Any default mapping should be included in the @prop parsing
|
|
50
56
|
private mapping: StyleRuleMapping = {},
|
|
51
57
|
public descriptorProperty?: string,
|
|
52
58
|
private shared: {
|
|
@@ -56,22 +62,49 @@ export class StylesheetBuilder {
|
|
|
56
62
|
animations?: AnimationRecord;
|
|
57
63
|
rem: number;
|
|
58
64
|
ruleOrder: number;
|
|
59
|
-
|
|
65
|
+
warningProperty?: string;
|
|
66
|
+
warningProperties: string[];
|
|
67
|
+
warningValues: Record<string, unknown[]>;
|
|
68
|
+
warningFunctions: string[];
|
|
69
|
+
} = {
|
|
70
|
+
ruleSets: {},
|
|
71
|
+
rem: 14,
|
|
72
|
+
ruleOrder: 0,
|
|
73
|
+
warningProperties: [],
|
|
74
|
+
warningValues: {},
|
|
75
|
+
warningFunctions: [],
|
|
76
|
+
},
|
|
77
|
+
private selectors: SelectorList = [],
|
|
60
78
|
) {}
|
|
61
79
|
|
|
62
|
-
fork(mode = this.mode,
|
|
80
|
+
fork(mode = this.mode, selectors: SelectorList = []): StylesheetBuilder {
|
|
63
81
|
this.shared.ruleOrder++;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* If we already have selectors and we are added more
|
|
85
|
+
* Then these must be nested selectors.
|
|
86
|
+
*
|
|
87
|
+
* We need to extrapolate out the selectors to their full values
|
|
88
|
+
*/
|
|
89
|
+
selectors =
|
|
90
|
+
this.selectors.length && selectors.length
|
|
91
|
+
? this.selectors.flatMap((selectorA) => {
|
|
92
|
+
return selectors.map((selectorB) => [...selectorA, ...selectorB]);
|
|
93
|
+
})
|
|
94
|
+
: [...this.selectors, ...selectors];
|
|
95
|
+
|
|
64
96
|
return new StylesheetBuilder(
|
|
65
97
|
this.options,
|
|
66
98
|
mode,
|
|
67
|
-
this.cloneRule(
|
|
99
|
+
this.cloneRule(),
|
|
68
100
|
{ ...this.mapping },
|
|
69
101
|
this.descriptorProperty,
|
|
70
102
|
this.shared,
|
|
103
|
+
selectors,
|
|
71
104
|
);
|
|
72
105
|
}
|
|
73
106
|
|
|
74
|
-
cloneRule({ ...rule } = this.
|
|
107
|
+
cloneRule({ ...rule } = this.ruleTemplate): StyleRule {
|
|
75
108
|
rule.s = [...rule.s];
|
|
76
109
|
rule.aq &&= [...rule.aq];
|
|
77
110
|
rule.c &&= [...rule.c];
|
|
@@ -123,11 +156,17 @@ export class StylesheetBuilder {
|
|
|
123
156
|
}
|
|
124
157
|
|
|
125
158
|
if (this.shared.rootVariables) {
|
|
126
|
-
stylesheetOptions.vr = Object.entries(this.shared.rootVariables)
|
|
159
|
+
stylesheetOptions.vr = Object.entries(this.shared.rootVariables).map(
|
|
160
|
+
// Reverse these so the most specific variables are first
|
|
161
|
+
([key, value]) => [key, value.reverse()] as const,
|
|
162
|
+
);
|
|
127
163
|
}
|
|
128
164
|
|
|
129
165
|
if (this.shared.universalVariables) {
|
|
130
|
-
stylesheetOptions.vu = Object.entries(this.shared.universalVariables)
|
|
166
|
+
stylesheetOptions.vu = Object.entries(this.shared.universalVariables).map(
|
|
167
|
+
// Reverse these so the most specific variables are first
|
|
168
|
+
([key, value]) => [key, value.reverse()] as const,
|
|
169
|
+
);
|
|
131
170
|
}
|
|
132
171
|
|
|
133
172
|
if (this.shared.animations) {
|
|
@@ -150,11 +189,64 @@ export class StylesheetBuilder {
|
|
|
150
189
|
);
|
|
151
190
|
}
|
|
152
191
|
|
|
192
|
+
setWarningProperty(property: string) {
|
|
193
|
+
this.shared.warningProperty = property;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
addWarning(type: "property" | "value", property: string): void;
|
|
197
|
+
addWarning(type: "style", property: string, value: unknown): void;
|
|
153
198
|
addWarning(
|
|
154
|
-
|
|
155
|
-
|
|
199
|
+
type: "property" | "style" | "value",
|
|
200
|
+
property: string,
|
|
201
|
+
value?: unknown,
|
|
156
202
|
): void {
|
|
157
|
-
|
|
203
|
+
switch (type) {
|
|
204
|
+
case "property":
|
|
205
|
+
this.shared.warningProperties.push(property);
|
|
206
|
+
break;
|
|
207
|
+
case "value": {
|
|
208
|
+
value = property;
|
|
209
|
+
property = this.shared.warningProperty ?? "";
|
|
210
|
+
|
|
211
|
+
if (!property) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
this.shared.warningValues[property] ??= [];
|
|
216
|
+
this.shared.warningValues[property]?.push(value);
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
case "style":
|
|
220
|
+
this.shared.warningValues[property] ??= [];
|
|
221
|
+
this.shared.warningValues[property]?.push(value);
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
getWarnings() {
|
|
227
|
+
const result: {
|
|
228
|
+
properties?: string[];
|
|
229
|
+
values?: Record<string, unknown[]>;
|
|
230
|
+
functions?: string[];
|
|
231
|
+
} = {};
|
|
232
|
+
|
|
233
|
+
if (this.shared.warningProperties.length) {
|
|
234
|
+
result.properties = this.shared.warningProperties;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (Object.keys(this.shared.warningValues).length) {
|
|
238
|
+
result.values = this.shared.warningValues;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (this.shared.warningFunctions.length) {
|
|
242
|
+
result.functions = this.shared.warningFunctions;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return result;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
addMapping(mapping: StyleRuleMapping) {
|
|
249
|
+
this.mapping = { ...this.mapping, ...mapping };
|
|
158
250
|
}
|
|
159
251
|
|
|
160
252
|
newRule(mapping = this.mapping, { important = false } = {}) {
|
|
@@ -166,6 +258,12 @@ export class StylesheetBuilder {
|
|
|
166
258
|
}
|
|
167
259
|
}
|
|
168
260
|
|
|
261
|
+
/** Used by nested declarations (for example @media inside a RuleSet) */
|
|
262
|
+
newNestedRule({ important = false } = {}) {
|
|
263
|
+
this.newRule(this.mapping, { important });
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** Hack for light-dark, which requires adding a new rule without changing the current rule */
|
|
169
267
|
addExtraRule(rule: Partial<StyleRule>) {
|
|
170
268
|
let extraRuleArray = extraRules.get(this.rule);
|
|
171
269
|
if (!extraRuleArray) {
|
|
@@ -184,8 +282,8 @@ export class StylesheetBuilder {
|
|
|
184
282
|
}
|
|
185
283
|
|
|
186
284
|
addMediaQuery(condition: MediaCondition) {
|
|
187
|
-
this.
|
|
188
|
-
this.
|
|
285
|
+
this.ruleTemplate.m ??= [];
|
|
286
|
+
this.ruleTemplate.m.push(condition);
|
|
189
287
|
}
|
|
190
288
|
|
|
191
289
|
addContainer(value: string[] | false) {
|
|
@@ -244,7 +342,10 @@ export class StylesheetBuilder {
|
|
|
244
342
|
const [delayed, usesVariables] = postProcessStyleFunction(value);
|
|
245
343
|
|
|
246
344
|
rule.d ??= [];
|
|
247
|
-
if (
|
|
345
|
+
if (
|
|
346
|
+
value[1].startsWith("animation") ||
|
|
347
|
+
value[1].startsWith("transition")
|
|
348
|
+
) {
|
|
248
349
|
rule.a ??= true;
|
|
249
350
|
}
|
|
250
351
|
|
|
@@ -284,43 +385,46 @@ export class StylesheetBuilder {
|
|
|
284
385
|
}
|
|
285
386
|
|
|
286
387
|
private pushDescriptor(
|
|
287
|
-
|
|
388
|
+
rawProperty: string,
|
|
288
389
|
value: StyleDescriptor,
|
|
289
390
|
declarations: StyleDeclaration[],
|
|
290
391
|
forceTuple = false,
|
|
291
392
|
delayed = false,
|
|
292
393
|
) {
|
|
293
|
-
property = toRNProperty(
|
|
394
|
+
const property = toRNProperty(rawProperty);
|
|
294
395
|
|
|
295
|
-
let propPath: string | string[] =
|
|
296
|
-
this.mapping[property] ?? this.mapping["*"]
|
|
396
|
+
let propPath: string | string[] | undefined =
|
|
397
|
+
this.mapping[rawProperty] ?? this.mapping[property] ?? this.mapping["*"];
|
|
297
398
|
|
|
298
399
|
if (Array.isArray(propPath)) {
|
|
299
|
-
const first = propPath
|
|
400
|
+
const [first, second] = propPath;
|
|
300
401
|
|
|
301
|
-
if (
|
|
302
|
-
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
if (propPath.length === 1) {
|
|
307
|
-
propPath = first;
|
|
402
|
+
if (propPath.length === 2 && first === "*" && second) {
|
|
403
|
+
propPath = second;
|
|
308
404
|
} else {
|
|
309
405
|
forceTuple = true;
|
|
310
406
|
}
|
|
407
|
+
} else if (propPath) {
|
|
408
|
+
forceTuple = true;
|
|
409
|
+
} else {
|
|
410
|
+
propPath = property;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
if (forceTuple && !Array.isArray(propPath)) {
|
|
414
|
+
propPath = [propPath];
|
|
311
415
|
}
|
|
312
416
|
|
|
313
|
-
if (isStyleFunction(value)) {
|
|
417
|
+
if (isStyleFunction(value) || Array.isArray(propPath)) {
|
|
314
418
|
if (delayed) {
|
|
315
419
|
declarations.push([value, propPath, 1]);
|
|
316
420
|
} else {
|
|
317
421
|
declarations.push([value, propPath]);
|
|
318
422
|
}
|
|
319
|
-
} else if (forceTuple || Array.isArray(propPath)) {
|
|
320
|
-
declarations.push([value, propPath]);
|
|
321
423
|
} else if (Array.isArray(value) && value.some(isStyleFunction)) {
|
|
322
424
|
declarations.push([value, propPath]);
|
|
323
|
-
} else {
|
|
425
|
+
} else if (typeof value === "string" && keywords.has(value)) {
|
|
426
|
+
declarations.push([value, propPath]);
|
|
427
|
+
} else if (typeof propPath === "string") {
|
|
324
428
|
let staticDeclarationRecord = staticDeclarations.get(declarations);
|
|
325
429
|
if (!staticDeclarationRecord) {
|
|
326
430
|
staticDeclarationRecord = {};
|
|
@@ -331,13 +435,24 @@ export class StylesheetBuilder {
|
|
|
331
435
|
}
|
|
332
436
|
}
|
|
333
437
|
|
|
334
|
-
applyRuleToSelectors(selectorList
|
|
335
|
-
if (!
|
|
438
|
+
applyRuleToSelectors(selectorList = this.selectors): void {
|
|
439
|
+
if (!selectorList.length) {
|
|
440
|
+
// If there are no selectors, we cannot apply the rule
|
|
336
441
|
return;
|
|
337
442
|
}
|
|
338
443
|
|
|
339
|
-
|
|
340
|
-
|
|
444
|
+
if (!this.rule.d && !this.rule.v && !this.rule.c) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
const normalizedSelectors = getClassNameSelectors(
|
|
449
|
+
selectorList,
|
|
450
|
+
this.options,
|
|
451
|
+
);
|
|
452
|
+
|
|
453
|
+
for (const selector of normalizedSelectors) {
|
|
454
|
+
// We are going to be apply the current rule to n selectors, so we clone the rule
|
|
455
|
+
const rule = this.cloneRule(this.rule);
|
|
341
456
|
|
|
342
457
|
if (selector.type === "className") {
|
|
343
458
|
const {
|
|
@@ -349,6 +464,10 @@ export class StylesheetBuilder {
|
|
|
349
464
|
attributeQuery,
|
|
350
465
|
} = selector;
|
|
351
466
|
|
|
467
|
+
if (!className) {
|
|
468
|
+
continue; // No className, nothing to do
|
|
469
|
+
}
|
|
470
|
+
|
|
352
471
|
// Combine the specificity of the selector with the rule's specificity
|
|
353
472
|
for (let i = 0; i < specificity.length; i++) {
|
|
354
473
|
const spec = specificity[i];
|
|
@@ -372,14 +491,29 @@ export class StylesheetBuilder {
|
|
|
372
491
|
continue;
|
|
373
492
|
}
|
|
374
493
|
|
|
494
|
+
const [first, ...rest] = name.split(".");
|
|
495
|
+
|
|
496
|
+
if (typeof first !== "string") {
|
|
497
|
+
continue;
|
|
498
|
+
}
|
|
499
|
+
|
|
375
500
|
const containerRule: StyleRule = {
|
|
376
501
|
// These are not "real" rules, so they use the lowest specificity
|
|
377
502
|
s: [0],
|
|
378
503
|
c: [name],
|
|
379
504
|
};
|
|
380
505
|
|
|
506
|
+
if (rest.length) {
|
|
507
|
+
containerRule.aq = rest.map((attr) => [
|
|
508
|
+
"a",
|
|
509
|
+
"className",
|
|
510
|
+
"*=",
|
|
511
|
+
attr,
|
|
512
|
+
]);
|
|
513
|
+
}
|
|
514
|
+
|
|
381
515
|
// Create rules for the parent classes
|
|
382
|
-
this.addRuleToRuleSet(
|
|
516
|
+
this.addRuleToRuleSet(first, containerRule);
|
|
383
517
|
}
|
|
384
518
|
}
|
|
385
519
|
|
|
@@ -408,21 +542,24 @@ export class StylesheetBuilder {
|
|
|
408
542
|
if (!this.rule.v) {
|
|
409
543
|
continue;
|
|
410
544
|
}
|
|
411
|
-
|
|
412
|
-
const { type, subtype } = selector;
|
|
413
|
-
|
|
545
|
+
const { type } = selector;
|
|
414
546
|
for (const [name, value] of this.rule.v) {
|
|
415
547
|
this.shared[type] ??= {};
|
|
416
|
-
this.shared[type][name] ??= [
|
|
417
|
-
|
|
548
|
+
this.shared[type][name] ??= [];
|
|
549
|
+
const mediaQueries = this.rule.m;
|
|
550
|
+
const variableValue: VariableValue = mediaQueries
|
|
551
|
+
? [value, [...mediaQueries]]
|
|
552
|
+
: [value];
|
|
553
|
+
// Append extra media queries if they exist
|
|
554
|
+
this.shared[type][name].push(variableValue);
|
|
418
555
|
}
|
|
419
556
|
}
|
|
420
557
|
}
|
|
421
558
|
}
|
|
422
559
|
|
|
423
560
|
addContainerQuery(query: ContainerQuery) {
|
|
424
|
-
this.
|
|
425
|
-
this.
|
|
561
|
+
this.ruleTemplate.cq ??= [];
|
|
562
|
+
this.ruleTemplate.cq.push(query);
|
|
426
563
|
}
|
|
427
564
|
|
|
428
565
|
newAnimationFrames(name: string) {
|
|
@@ -484,7 +621,7 @@ function postProcessStyleFunction(value: StyleDescriptor): [
|
|
|
484
621
|
let [shouldDelay, usesVariables] = postProcessStyleFunction(value[2]);
|
|
485
622
|
|
|
486
623
|
usesVariables ||= value[1] === "var";
|
|
487
|
-
shouldDelay ||= value[3] === 1;
|
|
624
|
+
shouldDelay ||= value[3] === 1 || usesVariables;
|
|
488
625
|
|
|
489
626
|
if (shouldDelay) {
|
|
490
627
|
return [true, usesVariables];
|
|
@@ -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 { 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,9 @@
|
|
|
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";
|
|
3
7
|
export { Text } from "./Text";
|
|
8
|
+
export { TextInput } from "./TextInput";
|
|
4
9
|
export { View } from "./View";
|
package/src/jest/index.ts
CHANGED
|
@@ -1,42 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Appearance, Dimensions } from "react-native";
|
|
2
|
+
|
|
3
|
+
import { inspect } from "node:util";
|
|
3
4
|
|
|
4
5
|
import { compile, type CompilerOptions } from "../compiler";
|
|
5
6
|
import { StyleCollection } from "../runtime/native/injection";
|
|
6
7
|
import { colorScheme, dimensions, rem } from "../runtime/native/reactivity";
|
|
7
8
|
|
|
8
9
|
declare global {
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
9
11
|
namespace jest {
|
|
10
12
|
interface Matchers<R> {
|
|
11
|
-
|
|
12
|
-
toHaveAnimatedStyle(style?: any): R;
|
|
13
|
+
toHaveAnimatedStyle(style?: unknown): R;
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
export * from "@testing-library/react-native";
|
|
18
18
|
export const testID = "react-native-css";
|
|
19
19
|
|
|
20
20
|
beforeEach(() => {
|
|
21
21
|
StyleCollection.styles.clear();
|
|
22
22
|
dimensions.set(Dimensions.get("window"));
|
|
23
23
|
rem.set(14);
|
|
24
|
+
Appearance.setColorScheme(null);
|
|
24
25
|
colorScheme.set(null);
|
|
25
26
|
});
|
|
26
27
|
|
|
28
|
+
const debugDefault = Boolean(
|
|
29
|
+
process.env.REACT_NATIVE_CSS_TEST_DEBUG &&
|
|
30
|
+
process.env.NODE_OPTIONS?.includes("--inspect"),
|
|
31
|
+
);
|
|
32
|
+
|
|
27
33
|
export function registerCSS(
|
|
28
34
|
css: string,
|
|
29
|
-
{
|
|
30
|
-
debugCompiled = process.env.NODE_OPTIONS?.includes("--inspect"),
|
|
31
|
-
...options
|
|
32
|
-
}: CompilerOptions & { debugCompiled?: boolean } = {},
|
|
35
|
+
options: CompilerOptions & { debug?: boolean } = {},
|
|
33
36
|
) {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
const { debug = debugDefault } = options;
|
|
38
|
+
const compiled = compileWithAutoDebug(css, options);
|
|
39
|
+
|
|
40
|
+
if (debug) {
|
|
41
|
+
console.log(
|
|
42
|
+
`Compiled:\n---\n${inspect(
|
|
43
|
+
{
|
|
44
|
+
stylesheet: compiled.stylesheet(),
|
|
45
|
+
warnings: compiled.warnings(),
|
|
46
|
+
},
|
|
47
|
+
{ depth: null, colors: true, compact: false },
|
|
48
|
+
)}`,
|
|
49
|
+
);
|
|
37
50
|
}
|
|
38
51
|
|
|
39
|
-
StyleCollection.inject(compiled);
|
|
52
|
+
StyleCollection.inject(compiled.stylesheet());
|
|
40
53
|
|
|
41
54
|
return compiled;
|
|
42
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_V2 } from "../compiler";
|
|
10
10
|
import { compile } from "../compiler/compiler";
|
|
11
11
|
import { getNativeInjectionCode, getWebInjectionCode } from "./injection-code";
|
|
12
12
|
import { nativeResolver, webResolver } from "./resolver";
|
|
@@ -41,8 +41,11 @@ export function withReactNativeCSS<
|
|
|
41
41
|
disableTypeScriptGeneration,
|
|
42
42
|
typescriptEnvPath,
|
|
43
43
|
globalClassNamePolyfill = false,
|
|
44
|
+
logger = defaultLogger,
|
|
44
45
|
} = options || {};
|
|
45
46
|
|
|
47
|
+
const loggerEnabled = "enabled" in logger ? logger.enabled : true;
|
|
48
|
+
|
|
46
49
|
if (disableTypeScriptGeneration !== true) {
|
|
47
50
|
setupTypeScript(typescriptEnvPath);
|
|
48
51
|
}
|
|
@@ -90,7 +93,10 @@ export function withReactNativeCSS<
|
|
|
90
93
|
if (!bundler.__react_native_css__patched) {
|
|
91
94
|
bundler.__react_native_css__patched = true;
|
|
92
95
|
|
|
93
|
-
const nativeCSSFiles = new Map
|
|
96
|
+
const nativeCSSFiles = new Map<
|
|
97
|
+
string,
|
|
98
|
+
[string, ReactNativeCssStyleSheet_V2]
|
|
99
|
+
>();
|
|
94
100
|
const webCSSFiles = new Set<string>();
|
|
95
101
|
|
|
96
102
|
const nativeInjectionPath = require.resolve(
|
|
@@ -171,7 +177,7 @@ export function withReactNativeCSS<
|
|
|
171
177
|
next,
|
|
172
178
|
compile(next, {
|
|
173
179
|
hexColors: options?.hexColors,
|
|
174
|
-
}),
|
|
180
|
+
}).stylesheet(),
|
|
175
181
|
]);
|
|
176
182
|
|
|
177
183
|
watcher.emit("change", {
|
|
@@ -211,9 +217,9 @@ export function withReactNativeCSS<
|
|
|
211
217
|
Array.from(nativeCSSFiles.values()).map(([, value]) => value),
|
|
212
218
|
);
|
|
213
219
|
|
|
214
|
-
if (
|
|
215
|
-
|
|
216
|
-
|
|
220
|
+
if (loggerEnabled && fileBuffer) {
|
|
221
|
+
logger(`Transformed ${filePath}`);
|
|
222
|
+
logger(fileBuffer?.toString());
|
|
217
223
|
}
|
|
218
224
|
}
|
|
219
225
|
|
package/src/poison.pill.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
const canWarn = process.env.NODE_ENV !== "test";
|
|
2
|
+
|
|
3
|
+
if (canWarn) {
|
|
4
|
+
throw new Error(`react-native-css has encountered a setup error.
|
|
2
5
|
|
|
3
6
|
┌─────-─┐
|
|
4
7
|
| Metro |
|
|
@@ -28,5 +31,6 @@ If you are using NativeWind with the 'withNativeWind' function, follow the Metro
|
|
|
28
31
|
|
|
29
32
|
If you are using another bundler (Vite, Webpack, etc), or non-Metro framework (Next.js, Remix, etc), please ensure you have included 'react-native-css/babel' as a babel preset.
|
|
30
33
|
`);
|
|
34
|
+
}
|
|
31
35
|
|
|
32
36
|
export {};
|