react-native-css 3.0.0-nightly.8dd703d → 3.0.0-nightly.9c84741
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/compiler/compiler.js +12 -5
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +89 -82
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/inheritance.test.js +10 -10
- package/dist/commonjs/compiler/inheritance.test.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 +124 -80
- package/dist/commonjs/compiler/selector-builder.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +18 -6
- 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 +5 -5
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/index.js +6 -3
- 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/index.js +4 -2
- package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/media-query.js +14 -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/reactivity.js +11 -0
- package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/calculate-props.js +25 -8
- package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/functions/calc.js +97 -57
- package/dist/commonjs/runtime/native/styles/functions/calc.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/functions/index.js +22 -0
- package/dist/commonjs/runtime/native/styles/functions/index.js.map +1 -1
- 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/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 +91 -53
- package/dist/commonjs/runtime/native/styles/functions/transform-functions.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/shorthands/animation.js +2 -2
- package/dist/commonjs/runtime/native/styles/shorthands/animation.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js +14 -4
- package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/shorthands/transform.js +1 -1
- package/dist/commonjs/runtime/native/styles/shorthands/transform.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/variables.js +3 -3
- package/dist/commonjs/runtime/native/styles/variables.js.map +1 -1
- package/dist/commonjs/runtime/utils/objects.js +6 -18
- package/dist/commonjs/runtime/utils/objects.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/{runtime/native → style-collection}/root.js +2 -2
- package/dist/commonjs/style-collection/root.js.map +1 -0
- package/dist/module/compiler/compiler.js +12 -5
- 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 +89 -82
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/inheritance.test.js +10 -10
- package/dist/module/compiler/inheritance.test.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 +124 -80
- package/dist/module/compiler/selector-builder.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +18 -6
- 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 +2 -2
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/index.js +6 -3
- 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/index.js +4 -2
- package/dist/module/runtime/native/conditions/index.js.map +1 -1
- package/dist/module/runtime/native/conditions/media-query.js +15 -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/reactivity.js +11 -0
- package/dist/module/runtime/native/reactivity.js.map +1 -1
- package/dist/module/runtime/native/styles/calculate-props.js +25 -8
- package/dist/module/runtime/native/styles/calculate-props.js.map +1 -1
- package/dist/module/runtime/native/styles/functions/calc.js +97 -56
- package/dist/module/runtime/native/styles/functions/calc.js.map +1 -1
- package/dist/module/runtime/native/styles/functions/index.js +2 -0
- package/dist/module/runtime/native/styles/functions/index.js.map +1 -1
- 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/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 +91 -53
- package/dist/module/runtime/native/styles/functions/transform-functions.js.map +1 -1
- package/dist/module/runtime/native/styles/shorthands/animation.js +1 -1
- package/dist/module/runtime/native/styles/shorthands/animation.js.map +1 -1
- package/dist/module/runtime/native/styles/shorthands/box-shadow.js +14 -4
- package/dist/module/runtime/native/styles/shorthands/box-shadow.js.map +1 -1
- package/dist/module/runtime/native/styles/shorthands/transform.js +1 -1
- package/dist/module/runtime/native/styles/shorthands/transform.js.map +1 -1
- package/dist/module/runtime/native/styles/variables.js +1 -1
- package/dist/module/runtime/native/styles/variables.js.map +1 -1
- package/dist/module/runtime/utils/objects.js +6 -18
- package/dist/module/runtime/utils/objects.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/{runtime/native → style-collection}/root.js +2 -2
- package/dist/module/style-collection/root.js.map +1 -0
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +11 -13
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +4 -2
- 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 +1 -0
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +2 -2
- 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 +3 -3
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts +4 -7
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts +4 -1
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/resolver.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts +3 -1
- package/dist/typescript/commonjs/src/runtime/native/api.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/reactivity.d.ts.map +1 -1
- 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/functions/calc.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts.map +1 -1
- 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/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.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/transform.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/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/{runtime/native → style-collection}/root.d.ts +1 -1
- package/dist/typescript/commonjs/src/style-collection/root.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/compiler.d.ts +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +11 -13
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +4 -2
- 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 +1 -0
- package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +2 -2
- 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 +3 -3
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/injection-code.d.ts +4 -7
- package/dist/typescript/module/src/metro/injection-code.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/metro-transformer.d.ts +4 -1
- package/dist/typescript/module/src/metro/metro-transformer.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/resolver.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/api.d.ts +3 -1
- package/dist/typescript/module/src/runtime/native/api.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/reactivity.d.ts.map +1 -1
- 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/functions/calc.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts.map +1 -1
- 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/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.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/shorthands/transform.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/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/{runtime/native → style-collection}/root.d.ts +1 -1
- package/dist/typescript/module/src/style-collection/root.d.ts.map +1 -0
- package/package.json +30 -14
- package/src/compiler/compiler.ts +11 -3
- package/src/compiler/compiler.types.ts +11 -14
- package/src/compiler/declarations.ts +157 -121
- package/src/compiler/inheritance.test.ts +9 -9
- package/src/compiler/pseudo-elements.ts +54 -0
- package/src/compiler/selector-builder.ts +136 -81
- package/src/compiler/stylesheet.ts +26 -11
- 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 +3 -2
- package/src/metro/index.ts +8 -6
- 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/index.ts +4 -2
- package/src/runtime/native/conditions/media-query.ts +16 -12
- package/src/runtime/native/react/rules.ts +27 -17
- package/src/runtime/native/reactivity.ts +12 -0
- package/src/runtime/native/styles/calculate-props.ts +27 -6
- package/src/runtime/native/styles/functions/calc.ts +94 -70
- package/src/runtime/native/styles/functions/index.ts +2 -0
- package/src/runtime/native/styles/functions/numeric-functions.ts +38 -0
- package/src/runtime/native/styles/functions/string-functions.ts +22 -0
- package/src/runtime/native/styles/functions/transform-functions.ts +68 -35
- package/src/runtime/native/styles/shorthands/animation.ts +2 -1
- package/src/runtime/native/styles/shorthands/box-shadow.ts +34 -14
- package/src/runtime/native/styles/shorthands/transform.ts +3 -1
- package/src/runtime/native/styles/variables.ts +5 -1
- package/src/runtime/utils/objects.ts +10 -19
- package/src/runtime/web/api.ts +1 -1
- package/src/style-collection/index.ts +142 -0
- package/src/{runtime/native → style-collection}/root.ts +6 -2
- 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 -99
- package/dist/commonjs/runtime/native/injection.js.map +0 -1
- package/dist/commonjs/runtime/native/root.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 -94
- package/dist/module/runtime/native/injection.js.map +0 -1
- package/dist/module/runtime/native/root.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/root.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/root.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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Selector, SelectorList } from "lightningcss";
|
|
1
|
+
import type { AttrOperation, Selector, SelectorList } from "lightningcss";
|
|
2
2
|
|
|
3
3
|
import { Specificity } from "../runtime/utils";
|
|
4
4
|
import type {
|
|
@@ -19,6 +19,7 @@ interface ReactNativeClassNameSelector {
|
|
|
19
19
|
containerQuery?: ContainerQuery[];
|
|
20
20
|
pseudoClassesQuery?: PseudoClassesQuery;
|
|
21
21
|
attributeQuery?: AttributeQuery[];
|
|
22
|
+
pseudoElementQuery?: string[];
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
interface ReactNativeGlobalSelector {
|
|
@@ -32,10 +33,12 @@ type PartialSelector = Partial<ReactNativeClassNameSelector> & {
|
|
|
32
33
|
|
|
33
34
|
const containerQueryMap = new WeakMap<WeakKey, ContainerQuery[]>();
|
|
34
35
|
const attributeQueryMap = new WeakMap<WeakKey, AttributeQuery[]>();
|
|
36
|
+
const mediaQueryMap = new WeakMap<WeakKey, MediaCondition[]>();
|
|
35
37
|
const pseudoClassesQueryMap = new WeakMap<WeakKey, PseudoClassesQuery>();
|
|
36
38
|
|
|
37
39
|
type ContainerQueryWithSpecificity = ContainerQuery & {
|
|
38
40
|
specificity: SpecificityArray;
|
|
41
|
+
m?: MediaCondition;
|
|
39
42
|
};
|
|
40
43
|
|
|
41
44
|
export function getClassNameSelectors(
|
|
@@ -55,6 +58,8 @@ export function getClassNameSelectors(
|
|
|
55
58
|
(selector): (ReactNativeGlobalSelector | PartialSelector)[] => {
|
|
56
59
|
if (isRootVariableSelector(selector)) {
|
|
57
60
|
return [{ type: "rootVariables" }];
|
|
61
|
+
} else if (isUniversalSelector(selector)) {
|
|
62
|
+
return [{ type: "universalVariables" }];
|
|
58
63
|
} else {
|
|
59
64
|
return (
|
|
60
65
|
parseComponents(
|
|
@@ -121,8 +126,19 @@ function parseComponents(
|
|
|
121
126
|
return [];
|
|
122
127
|
}
|
|
123
128
|
case "pseudo-element": {
|
|
124
|
-
|
|
125
|
-
|
|
129
|
+
switch (component.kind) {
|
|
130
|
+
case "selection":
|
|
131
|
+
case "placeholder": {
|
|
132
|
+
specificity[Specificity.PseudoElements] =
|
|
133
|
+
(specificity[Specificity.PseudoElements] ?? 0) + 1;
|
|
134
|
+
root.pseudoElementQuery ??= [];
|
|
135
|
+
root.pseudoElementQuery.push(component.kind);
|
|
136
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
137
|
+
}
|
|
138
|
+
default: {
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
126
142
|
}
|
|
127
143
|
case "pseudo-class": {
|
|
128
144
|
switch (component.kind) {
|
|
@@ -183,12 +199,16 @@ function parseComponents(
|
|
|
183
199
|
return parents.flatMap((parent) => {
|
|
184
200
|
const originalParent = { ...parent };
|
|
185
201
|
|
|
186
|
-
return isWhereContainerQueries.map((
|
|
202
|
+
return isWhereContainerQueries.map((containerQuery) => {
|
|
203
|
+
const { specificity, m, ...query } = containerQuery;
|
|
187
204
|
parent = { ...originalParent };
|
|
188
205
|
parent.specificity = [...originalParent.specificity];
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
206
|
+
|
|
207
|
+
if (m && m.length > 1) {
|
|
208
|
+
parent.mediaQuery = originalParent.mediaQuery
|
|
209
|
+
? [["&", [...originalParent.mediaQuery, m]]]
|
|
210
|
+
: [m];
|
|
211
|
+
}
|
|
192
212
|
|
|
193
213
|
if (component.kind === "is") {
|
|
194
214
|
for (let i = 0; i < specificity.length; i++) {
|
|
@@ -200,7 +220,12 @@ function parseComponents(
|
|
|
200
220
|
}
|
|
201
221
|
}
|
|
202
222
|
|
|
203
|
-
|
|
223
|
+
if (query.a || query.p || query.n !== undefined) {
|
|
224
|
+
parent.containerQuery = [
|
|
225
|
+
...(originalParent.containerQuery ?? []),
|
|
226
|
+
];
|
|
227
|
+
parent.containerQuery.push(query);
|
|
228
|
+
}
|
|
204
229
|
|
|
205
230
|
return parent;
|
|
206
231
|
});
|
|
@@ -212,47 +237,63 @@ function parseComponents(
|
|
|
212
237
|
}
|
|
213
238
|
}
|
|
214
239
|
case "attribute": {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
? // [data-*] are turned into `dataSet` queries
|
|
219
|
-
["d", toRNProperty(component.name.replace("data-", ""))]
|
|
220
|
-
: // Everything else is turned into `attribute` queries
|
|
221
|
-
["a", toRNProperty(component.name)];
|
|
222
|
-
if (component.operation) {
|
|
223
|
-
let operator: AttrSelectorOperator | undefined;
|
|
224
|
-
switch (component.operation.operator) {
|
|
225
|
-
case "equal":
|
|
226
|
-
operator = "=";
|
|
227
|
-
break;
|
|
228
|
-
case "includes":
|
|
229
|
-
operator = "~=";
|
|
230
|
-
break;
|
|
231
|
-
case "dash-match":
|
|
232
|
-
operator = "|=";
|
|
233
|
-
break;
|
|
234
|
-
case "prefix":
|
|
235
|
-
operator = "^=";
|
|
236
|
-
break;
|
|
237
|
-
case "substring":
|
|
238
|
-
operator = "*=";
|
|
239
|
-
break;
|
|
240
|
-
case "suffix":
|
|
241
|
-
operator = "$=";
|
|
242
|
-
break;
|
|
243
|
-
default:
|
|
244
|
-
component.operation.operator satisfies never;
|
|
245
|
-
break;
|
|
240
|
+
if (component.name === "dir") {
|
|
241
|
+
if (!component.operation) {
|
|
242
|
+
return [];
|
|
246
243
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
244
|
+
const operator = operatorMap[component.operation.operator];
|
|
245
|
+
|
|
246
|
+
if (operator !== "=") {
|
|
247
|
+
return [];
|
|
250
248
|
}
|
|
249
|
+
|
|
250
|
+
getMediaQuery(ref).push([operator, "dir", component.operation.value]);
|
|
251
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
252
|
+
} else {
|
|
253
|
+
// specificity[Specificity.ClassName] =
|
|
254
|
+
// (specificity[Specificity.ClassName] ?? 0) + 1;
|
|
255
|
+
const attributeQuery: AttributeQuery = component.name.startsWith(
|
|
256
|
+
"data-",
|
|
257
|
+
)
|
|
258
|
+
? // [data-*] are turned into `dataSet` queries
|
|
259
|
+
["d", toRNProperty(component.name.replace("data-", ""))]
|
|
260
|
+
: // Everything else is turned into `attribute` queries
|
|
261
|
+
["a", toRNProperty(component.name)];
|
|
262
|
+
if (component.operation) {
|
|
263
|
+
let operator: AttrSelectorOperator | undefined;
|
|
264
|
+
switch (component.operation.operator) {
|
|
265
|
+
case "equal":
|
|
266
|
+
operator = "=";
|
|
267
|
+
break;
|
|
268
|
+
case "includes":
|
|
269
|
+
operator = "~=";
|
|
270
|
+
break;
|
|
271
|
+
case "dash-match":
|
|
272
|
+
operator = "|=";
|
|
273
|
+
break;
|
|
274
|
+
case "prefix":
|
|
275
|
+
operator = "^=";
|
|
276
|
+
break;
|
|
277
|
+
case "substring":
|
|
278
|
+
operator = "*=";
|
|
279
|
+
break;
|
|
280
|
+
case "suffix":
|
|
281
|
+
operator = "$=";
|
|
282
|
+
break;
|
|
283
|
+
default:
|
|
284
|
+
component.operation.operator satisfies never;
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
if (operator) {
|
|
288
|
+
// Append the operator onto the attribute query
|
|
289
|
+
attributeQuery.push(operator, component.operation.value);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
getAttributeQuery(ref).push(attributeQuery);
|
|
293
|
+
specificity[Specificity.ClassName] =
|
|
294
|
+
(specificity[Specificity.ClassName] ?? 0) + 1;
|
|
295
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
251
296
|
}
|
|
252
|
-
getAttributeQuery(ref).push(attributeQuery);
|
|
253
|
-
specificity[Specificity.ClassName] =
|
|
254
|
-
(specificity[Specificity.ClassName] ?? 0) + 1;
|
|
255
|
-
return parseComponents(rest, options, root, ref, specificity);
|
|
256
297
|
}
|
|
257
298
|
case "class": {
|
|
258
299
|
if (component.name === options.selectorPrefix) {
|
|
@@ -282,7 +323,7 @@ function parseComponents(
|
|
|
282
323
|
containerQueries.unshift(ref);
|
|
283
324
|
}
|
|
284
325
|
|
|
285
|
-
ref.n = ref.n ? `${ref.n}.${component.name}` : component.name
|
|
326
|
+
ref.n = ref.n ? `${ref.n}.${component.name}` : `g:${component.name}`;
|
|
286
327
|
}
|
|
287
328
|
|
|
288
329
|
specificity[Specificity.ClassName] =
|
|
@@ -352,6 +393,13 @@ function parseIsWhereComponents(
|
|
|
352
393
|
// specificity[Specificity.ClassName] =
|
|
353
394
|
// (specificity[Specificity.ClassName] ?? 0) + 1;
|
|
354
395
|
switch (component.kind) {
|
|
396
|
+
case "dir": {
|
|
397
|
+
queries ??= [{ specificity: [] }];
|
|
398
|
+
queries.forEach((query) => {
|
|
399
|
+
getMediaQuery(query).push(["=", "dir", component.direction]);
|
|
400
|
+
});
|
|
401
|
+
return parseIsWhereComponents(type, selector, index + 1, queries);
|
|
402
|
+
}
|
|
355
403
|
case "hover": {
|
|
356
404
|
queries ??= [{ specificity: [] }];
|
|
357
405
|
queries.forEach((query) => {
|
|
@@ -389,11 +437,6 @@ function parseIsWhereComponents(
|
|
|
389
437
|
}
|
|
390
438
|
case "where":
|
|
391
439
|
case "is": {
|
|
392
|
-
// :is() and :where() need to be at the start of the selector,
|
|
393
|
-
if (index !== 0) {
|
|
394
|
-
return null;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
440
|
// Now get the selectors inside the `is` or `where` pseudo-class
|
|
398
441
|
queries = component.selectors.flatMap((selector) => {
|
|
399
442
|
return parseIsWhereComponents(type, selector, 0, queries) ?? [];
|
|
@@ -407,6 +450,10 @@ function parseIsWhereComponents(
|
|
|
407
450
|
}
|
|
408
451
|
}
|
|
409
452
|
case "attribute": {
|
|
453
|
+
if (component.name === "dir") {
|
|
454
|
+
return null;
|
|
455
|
+
}
|
|
456
|
+
|
|
410
457
|
if (type !== "where") {
|
|
411
458
|
// specificity[Specificity.ClassName] =
|
|
412
459
|
// (specificity[Specificity.ClassName] ?? 0) + 1;
|
|
@@ -417,34 +464,9 @@ function parseIsWhereComponents(
|
|
|
417
464
|
: // Everything else is turned into `attribute` queries
|
|
418
465
|
["a", toRNProperty(component.name)];
|
|
419
466
|
if (component.operation) {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
operator = "=";
|
|
424
|
-
break;
|
|
425
|
-
case "includes":
|
|
426
|
-
operator = "~=";
|
|
427
|
-
break;
|
|
428
|
-
case "dash-match":
|
|
429
|
-
operator = "|=";
|
|
430
|
-
break;
|
|
431
|
-
case "prefix":
|
|
432
|
-
operator = "^=";
|
|
433
|
-
break;
|
|
434
|
-
case "substring":
|
|
435
|
-
operator = "*=";
|
|
436
|
-
break;
|
|
437
|
-
case "suffix":
|
|
438
|
-
operator = "$=";
|
|
439
|
-
break;
|
|
440
|
-
default:
|
|
441
|
-
component.operation.operator satisfies never;
|
|
442
|
-
break;
|
|
443
|
-
}
|
|
444
|
-
if (operator) {
|
|
445
|
-
// Append the operator onto the attribute query
|
|
446
|
-
attributeQuery.push(operator, component.operation.value);
|
|
447
|
-
}
|
|
467
|
+
const operator = operatorMap[component.operation.operator];
|
|
468
|
+
// Append the operator onto the attribute query
|
|
469
|
+
attributeQuery.push(operator, component.operation.value);
|
|
448
470
|
}
|
|
449
471
|
queries ??= [{ specificity: [] }];
|
|
450
472
|
for (const query of queries) {
|
|
@@ -465,7 +487,9 @@ function parseIsWhereComponents(
|
|
|
465
487
|
(query.specificity[Specificity.ClassName] ?? 0) + 1;
|
|
466
488
|
}
|
|
467
489
|
|
|
468
|
-
query.n = query.n
|
|
490
|
+
query.n = query.n
|
|
491
|
+
? `${query.n}.${component.name}`
|
|
492
|
+
: `g:${component.name}`;
|
|
469
493
|
}
|
|
470
494
|
|
|
471
495
|
return parseIsWhereComponents(type, selector, index + 1, queries);
|
|
@@ -513,12 +537,34 @@ function getAttributeQuery(
|
|
|
513
537
|
return attributeQuery;
|
|
514
538
|
}
|
|
515
539
|
|
|
540
|
+
function getMediaQuery(
|
|
541
|
+
key: PartialSelector | ContainerQuery,
|
|
542
|
+
): MediaCondition[] {
|
|
543
|
+
let mediaQuery = mediaQueryMap.get(key);
|
|
544
|
+
if (!mediaQuery) {
|
|
545
|
+
if ("type" in key) {
|
|
546
|
+
mediaQuery = [];
|
|
547
|
+
key.mediaQuery = mediaQuery;
|
|
548
|
+
} else {
|
|
549
|
+
mediaQuery = [];
|
|
550
|
+
key.m ??= ["&", mediaQuery];
|
|
551
|
+
}
|
|
552
|
+
mediaQueryMap.set(key, mediaQuery);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
return mediaQuery;
|
|
556
|
+
}
|
|
557
|
+
|
|
516
558
|
function isRootVariableSelector([first, second]: Selector) {
|
|
517
559
|
return (
|
|
518
560
|
first && !second && first.type === "pseudo-class" && first.kind === "root"
|
|
519
561
|
);
|
|
520
562
|
}
|
|
521
563
|
|
|
564
|
+
function isUniversalSelector([first, second]: Selector) {
|
|
565
|
+
return first && first.type === "universal" && !second;
|
|
566
|
+
}
|
|
567
|
+
|
|
522
568
|
export function toRNProperty<T extends string>(str: T) {
|
|
523
569
|
return str
|
|
524
570
|
.replace(/^-rn-/, "")
|
|
@@ -529,3 +575,12 @@ type CamelCase<S extends string> =
|
|
|
529
575
|
S extends `${infer P1}-${infer P2}${infer P3}`
|
|
530
576
|
? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}`
|
|
531
577
|
: Lowercase<S>;
|
|
578
|
+
|
|
579
|
+
const operatorMap: Record<AttrOperation["operator"], AttrSelectorOperator> = {
|
|
580
|
+
"equal": "=",
|
|
581
|
+
"includes": "~=",
|
|
582
|
+
"dash-match": "|=",
|
|
583
|
+
"prefix": "^=",
|
|
584
|
+
"substring": "*=",
|
|
585
|
+
"suffix": "$=",
|
|
586
|
+
};
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
specificityCompareFn,
|
|
7
7
|
} from "../runtime/utils";
|
|
8
8
|
import type {
|
|
9
|
-
|
|
9
|
+
AnimationKeyframes,
|
|
10
10
|
AnimationRecord,
|
|
11
11
|
CompilerOptions,
|
|
12
12
|
ContainerQuery,
|
|
@@ -21,6 +21,10 @@ import type {
|
|
|
21
21
|
VariableRecord,
|
|
22
22
|
VariableValue,
|
|
23
23
|
} from "./compiler.types";
|
|
24
|
+
import {
|
|
25
|
+
modifyRuleForPlaceholder,
|
|
26
|
+
modifyRuleForSelection,
|
|
27
|
+
} from "./pseudo-elements";
|
|
24
28
|
import { getClassNameSelectors, toRNProperty } from "./selector-builder";
|
|
25
29
|
|
|
26
30
|
type BuilderMode = "style" | "media" | "container" | "keyframes";
|
|
@@ -35,7 +39,7 @@ const extraRules = new WeakMap<StyleRule, Partial<StyleRule>[]>();
|
|
|
35
39
|
const keywords = new Set(["unset"]);
|
|
36
40
|
|
|
37
41
|
export class StylesheetBuilder {
|
|
38
|
-
animationFrames?:
|
|
42
|
+
animationFrames?: AnimationKeyframes[];
|
|
39
43
|
animationDeclarations: StyleDeclaration[] = [];
|
|
40
44
|
|
|
41
45
|
stylesheet: ReactNativeCssStyleSheet = {};
|
|
@@ -410,22 +414,21 @@ export class StylesheetBuilder {
|
|
|
410
414
|
propPath = property;
|
|
411
415
|
}
|
|
412
416
|
|
|
413
|
-
if (
|
|
417
|
+
if (forceTuple && !Array.isArray(propPath)) {
|
|
418
|
+
propPath = [propPath];
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
if (isStyleFunction(value) || Array.isArray(propPath)) {
|
|
414
422
|
if (delayed) {
|
|
415
423
|
declarations.push([value, propPath, 1]);
|
|
416
424
|
} else {
|
|
417
425
|
declarations.push([value, propPath]);
|
|
418
426
|
}
|
|
419
|
-
} else if (forceTuple || Array.isArray(propPath)) {
|
|
420
|
-
declarations.push([
|
|
421
|
-
value,
|
|
422
|
-
Array.isArray(propPath) ? propPath : [propPath],
|
|
423
|
-
]);
|
|
424
427
|
} else if (Array.isArray(value) && value.some(isStyleFunction)) {
|
|
425
428
|
declarations.push([value, propPath]);
|
|
426
429
|
} else if (typeof value === "string" && keywords.has(value)) {
|
|
427
430
|
declarations.push([value, propPath]);
|
|
428
|
-
} else {
|
|
431
|
+
} else if (typeof propPath === "string") {
|
|
429
432
|
let staticDeclarationRecord = staticDeclarations.get(declarations);
|
|
430
433
|
if (!staticDeclarationRecord) {
|
|
431
434
|
staticDeclarationRecord = {};
|
|
@@ -453,7 +456,19 @@ export class StylesheetBuilder {
|
|
|
453
456
|
|
|
454
457
|
for (const selector of normalizedSelectors) {
|
|
455
458
|
// We are going to be apply the current rule to n selectors, so we clone the rule
|
|
456
|
-
|
|
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
|
+
}
|
|
457
472
|
|
|
458
473
|
if (selector.type === "className") {
|
|
459
474
|
const {
|
|
@@ -492,7 +507,7 @@ export class StylesheetBuilder {
|
|
|
492
507
|
continue;
|
|
493
508
|
}
|
|
494
509
|
|
|
495
|
-
const [first, ...rest] = name.split(".");
|
|
510
|
+
const [first, ...rest] = name.slice(2).split(".");
|
|
496
511
|
|
|
497
512
|
if (typeof first !== "string") {
|
|
498
513
|
continue;
|
|
@@ -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 {
|