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,97 +1,121 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
import { isStyleDescriptorArray } from "../../../utils";
|
|
3
1
|
import type { StyleFunctionResolver } from "../resolve";
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
3
|
+
interface Value {
|
|
4
|
+
value: number;
|
|
5
|
+
isPercent: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const precedence: Record<string, number> = { "+": 1, "-": 1, "*": 2, "/": 2 };
|
|
11
9
|
|
|
12
10
|
export const calc: StyleFunctionResolver = (resolveValue, func) => {
|
|
13
|
-
|
|
14
|
-
const values: number[] = [];
|
|
15
|
-
const ops: string[] = [];
|
|
11
|
+
const tokens = resolveValue(func[2]);
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
if (!Array.isArray(tokens)) {
|
|
14
|
+
return tokens;
|
|
15
|
+
}
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
// --- Step 1: Convert to RPN (Shunting-Yard) ---
|
|
18
|
+
const output: (string | Value)[] = [];
|
|
19
|
+
const ops: string[] = [];
|
|
20
20
|
|
|
21
|
-
for (
|
|
22
|
-
if (typeof
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} else if (token === ")") {
|
|
31
|
-
// Resolve all values within the brackets
|
|
32
|
-
while (ops.length && ops[ops.length - 1] !== "(") {
|
|
33
|
-
applyCalcOperator(ops.pop()!, values.pop(), values.pop(), values);
|
|
34
|
-
}
|
|
35
|
-
ops.pop();
|
|
36
|
-
} else if (token.endsWith("%")) {
|
|
37
|
-
if (!mode) mode = "percentage";
|
|
38
|
-
if (mode !== "percentage") return;
|
|
39
|
-
values.push(Number.parseFloat(token.slice(0, -1)));
|
|
40
|
-
} else {
|
|
41
|
-
// This means we have an operator
|
|
21
|
+
for (const t of tokens) {
|
|
22
|
+
if (typeof t === "number") {
|
|
23
|
+
output.push({ value: round(t), isPercent: false });
|
|
24
|
+
} else if (typeof t === "string") {
|
|
25
|
+
if (t.endsWith("%")) {
|
|
26
|
+
const num = parseFloat(t.slice(0, -1));
|
|
27
|
+
if (Number.isNaN(num)) return undefined;
|
|
28
|
+
output.push({ value: round(num / 100), isPercent: true });
|
|
29
|
+
} else if (t === "+" || t === "-" || t === "*" || t === "/") {
|
|
42
30
|
while (
|
|
43
31
|
ops.length &&
|
|
44
|
-
ops[ops.length - 1]
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
(ops[ops.length - 1] === "+" ||
|
|
33
|
+
ops[ops.length - 1] === "-" ||
|
|
34
|
+
ops[ops.length - 1] === "*" ||
|
|
35
|
+
ops[ops.length - 1] === "/") &&
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
37
|
+
(precedence[ops[ops.length - 1]!] ?? 0) >= (precedence[t] ?? 0)
|
|
47
38
|
) {
|
|
48
|
-
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
40
|
+
output.push(ops.pop()!);
|
|
41
|
+
}
|
|
42
|
+
ops.push(t);
|
|
43
|
+
} else if (t === "(") {
|
|
44
|
+
ops.push(t);
|
|
45
|
+
} else if (t === ")") {
|
|
46
|
+
while (ops.length && ops[ops.length - 1] !== "(") {
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
48
|
+
output.push(ops.pop()!);
|
|
49
49
|
}
|
|
50
|
-
ops.
|
|
50
|
+
if (ops.pop() !== "(") return undefined; // mismatched parens
|
|
51
|
+
} else {
|
|
52
|
+
return undefined; // invalid token
|
|
51
53
|
}
|
|
52
54
|
} else {
|
|
53
|
-
|
|
54
|
-
return;
|
|
55
|
+
return undefined;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
|
-
|
|
58
58
|
while (ops.length) {
|
|
59
|
-
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
60
|
+
const op = ops.pop()!;
|
|
61
|
+
if (op === "(" || op === ")") return undefined;
|
|
62
|
+
output.push(op);
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
// --- Step 2: Evaluate RPN ---
|
|
66
|
+
const stack: Value[] = [];
|
|
67
|
+
for (const t of output) {
|
|
68
|
+
if (typeof t !== "string") {
|
|
69
|
+
stack.push(t);
|
|
70
|
+
} else {
|
|
71
|
+
const b = stack.pop();
|
|
72
|
+
const a = stack.pop();
|
|
73
|
+
if (!a || !b) return undefined;
|
|
63
74
|
|
|
64
|
-
|
|
75
|
+
const res: Value = { value: 0, isPercent: false };
|
|
65
76
|
|
|
66
|
-
|
|
67
|
-
|
|
77
|
+
switch (t) {
|
|
78
|
+
case "+":
|
|
79
|
+
case "-": {
|
|
80
|
+
if (a.isPercent !== b.isPercent) return undefined; // cannot mix
|
|
81
|
+
res.isPercent = a.isPercent;
|
|
82
|
+
res.value =
|
|
83
|
+
t === "+" ? round(a.value + b.value) : round(a.value - b.value);
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
case "*": {
|
|
87
|
+
if (a.isPercent && b.isPercent) return undefined; // ambiguous
|
|
88
|
+
res.isPercent = a.isPercent || b.isPercent;
|
|
89
|
+
res.value = round(a.value * b.value);
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
case "/": {
|
|
93
|
+
if (b.value === 0) return undefined;
|
|
94
|
+
if (a.isPercent && b.isPercent) {
|
|
95
|
+
// % / % → plain number ratio
|
|
96
|
+
res.isPercent = false;
|
|
97
|
+
res.value = round(a.value / b.value);
|
|
98
|
+
} else {
|
|
99
|
+
res.isPercent = a.isPercent || b.isPercent;
|
|
100
|
+
res.value = round(a.value / b.value);
|
|
101
|
+
}
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
stack.push(res);
|
|
106
|
+
}
|
|
68
107
|
}
|
|
69
108
|
|
|
70
|
-
|
|
109
|
+
if (stack.length !== 1) return undefined;
|
|
71
110
|
|
|
72
|
-
|
|
73
|
-
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
112
|
+
const final = stack[0]!;
|
|
113
|
+
if (final.isPercent) {
|
|
114
|
+
return `${final.value * 100}%`;
|
|
74
115
|
}
|
|
75
|
-
|
|
76
|
-
return value;
|
|
116
|
+
return final.value;
|
|
77
117
|
};
|
|
78
118
|
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
b = 0, // These are reversed because we pop them off the stack
|
|
82
|
-
a = 0,
|
|
83
|
-
values: number[],
|
|
84
|
-
) {
|
|
85
|
-
switch (operator) {
|
|
86
|
-
case "+":
|
|
87
|
-
return values.push(a + b);
|
|
88
|
-
case "-":
|
|
89
|
-
return values.push(a - b);
|
|
90
|
-
case "*":
|
|
91
|
-
return values.push(a * b);
|
|
92
|
-
case "/":
|
|
93
|
-
return values.push(a / b);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return;
|
|
119
|
+
function round(number: number) {
|
|
120
|
+
return Math.round((number + Number.EPSILON) * 10000) / 10000;
|
|
97
121
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
2
|
+
|
|
3
|
+
export const max: StyleFunctionResolver = (resolveValue, value) => {
|
|
4
|
+
const args = resolveValue(value[2]);
|
|
5
|
+
|
|
6
|
+
if (!Array.isArray(args) || args.some((arg) => typeof arg !== "number")) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return Math.max(...(args as number[]));
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const min: StyleFunctionResolver = (resolveValue, value) => {
|
|
14
|
+
const args = resolveValue(value[2]);
|
|
15
|
+
|
|
16
|
+
if (!Array.isArray(args) || args.some((arg) => typeof arg !== "number")) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return Math.min(...(args as number[]));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const clamp: StyleFunctionResolver = (resolveValue, value) => {
|
|
24
|
+
const args = resolveValue(value[2]);
|
|
25
|
+
|
|
26
|
+
const [clampValue, min, max] = args as number[];
|
|
27
|
+
|
|
28
|
+
if (
|
|
29
|
+
!Array.isArray(args) ||
|
|
30
|
+
typeof clampValue !== "number" ||
|
|
31
|
+
typeof min !== "number" ||
|
|
32
|
+
typeof max !== "number"
|
|
33
|
+
) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return Math.min(Math.max(clampValue, min), max);
|
|
38
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
2
|
+
|
|
3
|
+
export const join: StyleFunctionResolver = (resolveValue, value) => {
|
|
4
|
+
const args = resolveValue(value[2]);
|
|
5
|
+
|
|
6
|
+
if (!Array.isArray(args)) {
|
|
7
|
+
return args;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const array: unknown = args[0];
|
|
11
|
+
const separator: unknown = args[1] ?? ",";
|
|
12
|
+
|
|
13
|
+
if (!Array.isArray(array)) {
|
|
14
|
+
return array;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (!separator || typeof separator !== "string") {
|
|
18
|
+
return array.join();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return array.join(separator);
|
|
22
|
+
};
|
|
@@ -1,51 +1,84 @@
|
|
|
1
|
+
import { isStyleDescriptorArray } from "../../../utils";
|
|
1
2
|
import type { StyleFunctionResolver } from "../resolve";
|
|
2
3
|
|
|
3
4
|
export const scale: StyleFunctionResolver = (resolveValue, descriptor) => {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return { scale:
|
|
5
|
+
const args = descriptor[2];
|
|
6
|
+
|
|
7
|
+
if (!isStyleDescriptorArray(args)) {
|
|
8
|
+
return { scale: resolveValue(args) };
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const x = resolveValue(args[0]);
|
|
12
|
+
const y = resolveValue(args[1]);
|
|
13
|
+
|
|
14
|
+
const isXValid = typeof x === "string" || typeof x === "number";
|
|
15
|
+
const isYValid = typeof y === "string" || typeof y === "number";
|
|
16
|
+
|
|
17
|
+
if (isXValid && isYValid) {
|
|
18
|
+
return x === y ? { scale: x } : [{ scaleX: x }, { scaleY: y }];
|
|
19
|
+
} else if (isXValid) {
|
|
20
|
+
return { scaleX: x };
|
|
21
|
+
} else if (isYValid) {
|
|
22
|
+
return { scaleY: y };
|
|
18
23
|
}
|
|
24
|
+
|
|
25
|
+
return;
|
|
19
26
|
};
|
|
20
27
|
|
|
21
28
|
export const rotate: StyleFunctionResolver = (resolveValue, descriptor) => {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return {
|
|
29
|
+
const args = descriptor[2];
|
|
30
|
+
|
|
31
|
+
if (!isStyleDescriptorArray(args)) {
|
|
32
|
+
return { rotate: resolveValue(args) };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const x = resolveValue(args[0]);
|
|
36
|
+
const y = resolveValue(args[1]);
|
|
37
|
+
const z = resolveValue(args[2]);
|
|
38
|
+
|
|
39
|
+
const isXValid = typeof x === "string" || typeof x === "number";
|
|
40
|
+
const isYValid = typeof y === "string" || typeof y === "number";
|
|
41
|
+
const isZValid = typeof z === "string" || typeof z === "number";
|
|
42
|
+
|
|
43
|
+
if (isXValid && isYValid && isZValid) {
|
|
44
|
+
return [{ rotateX: x }, { rotateY: y }, { rotateZ: z }];
|
|
45
|
+
} else if (isXValid && isYValid) {
|
|
46
|
+
return [{ rotateX: x }, { rotateY: y }];
|
|
47
|
+
} else if (isXValid && isZValid) {
|
|
48
|
+
return [{ rotateX: x }, { rotateZ: z }];
|
|
49
|
+
} else if (isYValid && isZValid) {
|
|
50
|
+
return [{ rotateY: y }, { rotateZ: z }];
|
|
51
|
+
} else if (isXValid) {
|
|
52
|
+
return { rotateX: x };
|
|
53
|
+
} else if (isYValid) {
|
|
54
|
+
return { rotateY: y };
|
|
55
|
+
} else if (isZValid) {
|
|
56
|
+
return { rotateZ: z };
|
|
38
57
|
}
|
|
58
|
+
|
|
59
|
+
return;
|
|
39
60
|
};
|
|
40
61
|
|
|
41
62
|
export const translate: StyleFunctionResolver = (resolveValue, descriptor) => {
|
|
42
|
-
const
|
|
63
|
+
const args = descriptor[2];
|
|
43
64
|
|
|
44
|
-
if (
|
|
45
|
-
|
|
65
|
+
if (!isStyleDescriptorArray(args)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const x = resolveValue(args[0]);
|
|
70
|
+
const y = resolveValue(args[1]);
|
|
46
71
|
|
|
72
|
+
const isXValid = typeof x === "string" || typeof x === "number";
|
|
73
|
+
const isYValid = typeof y === "string" || typeof y === "number";
|
|
74
|
+
|
|
75
|
+
if (isXValid && isYValid) {
|
|
47
76
|
return [{ translateX: x }, { translateY: y }];
|
|
48
|
-
} else {
|
|
49
|
-
return { translateX:
|
|
77
|
+
} else if (isXValid) {
|
|
78
|
+
return { translateX: x };
|
|
79
|
+
} else if (isYValid) {
|
|
80
|
+
return { translateY: y };
|
|
50
81
|
}
|
|
82
|
+
|
|
83
|
+
return;
|
|
51
84
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
+
import { StyleCollection } from "react-native-css/style-collection";
|
|
3
|
+
|
|
2
4
|
import { applyShorthand } from "../../../utils";
|
|
3
|
-
import { StyleCollection } from "../../injection";
|
|
4
5
|
import type { StyleFunctionResolver } from "../resolve";
|
|
5
6
|
import { shorthandHandler } from "./_handler";
|
|
6
7
|
|
|
@@ -33,22 +33,42 @@ export const boxShadow: StyleFunctionResolver = (
|
|
|
33
33
|
if (!isStyleDescriptorArray(args)) {
|
|
34
34
|
return args;
|
|
35
35
|
} else {
|
|
36
|
-
return args
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} else if (isStyleDescriptorArray(shadows)) {
|
|
40
|
-
if (shadows.length === 0) {
|
|
36
|
+
return args
|
|
37
|
+
.flatMap((shadows) => {
|
|
38
|
+
if (shadows === undefined) {
|
|
41
39
|
return [];
|
|
42
|
-
} else if (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
} else if (isStyleDescriptorArray(shadows)) {
|
|
41
|
+
if (shadows.length === 0) {
|
|
42
|
+
return [];
|
|
43
|
+
} else if (Array.isArray(shadows[0])) {
|
|
44
|
+
return shadows
|
|
45
|
+
.map((shadow) => {
|
|
46
|
+
return omitTransparentShadows(
|
|
47
|
+
handler(resolveValue, shadow, get, options),
|
|
48
|
+
);
|
|
49
|
+
})
|
|
50
|
+
.filter((v) => v !== undefined);
|
|
51
|
+
} else {
|
|
52
|
+
return omitTransparentShadows(
|
|
53
|
+
handler(resolveValue, shadows, get, options),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
46
56
|
} else {
|
|
47
|
-
return
|
|
57
|
+
return omitTransparentShadows(
|
|
58
|
+
handler(resolveValue, shadows, get, options),
|
|
59
|
+
);
|
|
48
60
|
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
});
|
|
61
|
+
})
|
|
62
|
+
.filter((v) => v !== undefined);
|
|
53
63
|
}
|
|
54
64
|
};
|
|
65
|
+
|
|
66
|
+
function omitTransparentShadows(style: unknown) {
|
|
67
|
+
if (typeof style === "object" && style && "color" in style) {
|
|
68
|
+
if (style.color === "#0000" || style.color === "transparent") {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return style;
|
|
74
|
+
}
|
|
@@ -11,7 +11,9 @@ export const transform: StyleFunctionResolver = (
|
|
|
11
11
|
const transforms = resolveValue(transformDescriptor[2]);
|
|
12
12
|
|
|
13
13
|
if (Array.isArray(transforms)) {
|
|
14
|
-
return transforms.filter(
|
|
14
|
+
return transforms.filter(
|
|
15
|
+
(transform) => transform !== undefined && transform !== "initial",
|
|
16
|
+
) as unknown;
|
|
15
17
|
} else if (transforms) {
|
|
16
18
|
// If it's a single transform, wrap it in an array
|
|
17
19
|
return [transforms];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
rootVariables,
|
|
3
|
+
universalVariables,
|
|
4
|
+
} from "react-native-css/style-collection";
|
|
5
|
+
|
|
1
6
|
import type { StyleDescriptor, StyleFunction } from "../../../compiler";
|
|
2
7
|
import { isStyleDescriptorArray } from "../../utils";
|
|
3
8
|
import { VAR_SYMBOL, type Getter } from "../reactivity";
|
|
4
|
-
import { rootVariables, universalVariables } from "../root";
|
|
5
9
|
import type { ResolveValueOptions, SimpleResolveValue } from "./resolve";
|
|
6
10
|
|
|
7
11
|
export function varResolver(
|
|
@@ -24,7 +24,9 @@ export function getDeepPath(source: any, paths: string | string[] | false) {
|
|
|
24
24
|
|
|
25
25
|
return target;
|
|
26
26
|
} else if (transformKeys.has(paths)) {
|
|
27
|
-
return source?.transform
|
|
27
|
+
return Array.isArray(source?.transform)
|
|
28
|
+
? source.transform.find((t: any) => t[paths] !== undefined)
|
|
29
|
+
: source.transform;
|
|
28
30
|
} else {
|
|
29
31
|
return source?.[paths];
|
|
30
32
|
}
|
|
@@ -66,25 +68,14 @@ export function applyValue(
|
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
const transformArray: Record<string, unknown>[] = target.transform;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (transform) {
|
|
76
|
-
if (Array.isArray(value)) {
|
|
77
|
-
target.transform = transformArray.filter((t) => !(prop in t));
|
|
78
|
-
target.transform.push(...value);
|
|
79
|
-
} else {
|
|
80
|
-
transform[prop] = value;
|
|
81
|
-
}
|
|
71
|
+
|
|
72
|
+
// Remove any existing values
|
|
73
|
+
target.transform = transformArray.filter((t) => !(prop in t));
|
|
74
|
+
|
|
75
|
+
if (Array.isArray(value)) {
|
|
76
|
+
target.transform.push(...value);
|
|
82
77
|
} else {
|
|
83
|
-
|
|
84
|
-
transformArray.push(...value);
|
|
85
|
-
} else {
|
|
86
|
-
transformArray.push(value);
|
|
87
|
-
}
|
|
78
|
+
target.transform.push(value);
|
|
88
79
|
}
|
|
89
80
|
return;
|
|
90
81
|
} else if (typeof value === "object" && value && ShortHandSymbol in value) {
|
package/src/runtime/web/api.ts
CHANGED
|
@@ -66,7 +66,7 @@ export const colorScheme: ColorScheme = {
|
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
export function vars(variables: Record
|
|
69
|
+
export function vars(variables: Record<string, string | number>) {
|
|
70
70
|
const $variables: Record<string, string> = {};
|
|
71
71
|
|
|
72
72
|
for (const [key, value] of Object.entries(variables)) {
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Animation,
|
|
3
|
+
ReactNativeCssStyleSheet,
|
|
4
|
+
StyleRuleSet,
|
|
5
|
+
} from "react-native-css/compiler";
|
|
6
|
+
|
|
7
|
+
import { DEFAULT_CONTAINER_NAME } from "../runtime/native/conditions/container-query";
|
|
8
|
+
import {
|
|
9
|
+
family,
|
|
10
|
+
observable,
|
|
11
|
+
observableBatch,
|
|
12
|
+
type Observable,
|
|
13
|
+
} from "../runtime/native/reactivity";
|
|
14
|
+
import { rootVariables, universalVariables } from "./root";
|
|
15
|
+
|
|
16
|
+
export { rootVariables, universalVariables };
|
|
17
|
+
|
|
18
|
+
interface StyleCollectionType {
|
|
19
|
+
styles: ReturnType<typeof family<string, Observable<StyleRuleSet>>>;
|
|
20
|
+
keyframes: ReturnType<typeof family<string, Observable<Animation[1]>>>;
|
|
21
|
+
inject: (options: ReactNativeCssStyleSheet) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare global {
|
|
25
|
+
var __react_native_css_style_collection: StyleCollectionType | undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
globalThis.__react_native_css_style_collection ??= {
|
|
29
|
+
styles: family<string, Observable<StyleRuleSet>>(() => {
|
|
30
|
+
return observable([], isDeepEqual);
|
|
31
|
+
}),
|
|
32
|
+
keyframes: family<string, Observable<Animation[1]>>(() => {
|
|
33
|
+
return observable([], isDeepEqual);
|
|
34
|
+
}),
|
|
35
|
+
inject: function (options: ReactNativeCssStyleSheet) {
|
|
36
|
+
observableBatch.current = new Set();
|
|
37
|
+
|
|
38
|
+
StyleCollection.styles("will-change-variable").set([
|
|
39
|
+
{
|
|
40
|
+
s: [0],
|
|
41
|
+
v: [],
|
|
42
|
+
},
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
StyleCollection.styles("will-change-container").set([
|
|
46
|
+
{
|
|
47
|
+
s: [0],
|
|
48
|
+
c: [DEFAULT_CONTAINER_NAME],
|
|
49
|
+
},
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
StyleCollection.styles("will-change-animation").set([
|
|
53
|
+
{
|
|
54
|
+
s: [0],
|
|
55
|
+
a: true,
|
|
56
|
+
},
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
StyleCollection.styles("will-change-pressable").set([
|
|
60
|
+
{
|
|
61
|
+
s: [0],
|
|
62
|
+
p: {
|
|
63
|
+
h: 1,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
]);
|
|
67
|
+
|
|
68
|
+
if (options.s) {
|
|
69
|
+
for (const style of options.s) {
|
|
70
|
+
StyleCollection.styles(style[0]).set(style[1]);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (options.k) {
|
|
75
|
+
for (const keyframes of options.k) {
|
|
76
|
+
StyleCollection.keyframes(keyframes[0]).set(keyframes[1]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (options.vr) {
|
|
81
|
+
for (const entry of options.vr) {
|
|
82
|
+
rootVariables(entry[0]).set(entry[1]);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (options.vu) {
|
|
87
|
+
for (const entry of options.vu) {
|
|
88
|
+
rootVariables(entry[0]).set(entry[1]);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
for (const effect of observableBatch.current) {
|
|
93
|
+
effect.run();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
observableBatch.current = undefined;
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const StyleCollection = globalThis.__react_native_css_style_collection;
|
|
101
|
+
|
|
102
|
+
function isDeepEqual(a: unknown, b: unknown): boolean {
|
|
103
|
+
const aArray = Array.isArray(a);
|
|
104
|
+
const bArray = Array.isArray(b);
|
|
105
|
+
const requiresKeyComparison =
|
|
106
|
+
typeof a === "object" && typeof b === "object" && aArray === bArray;
|
|
107
|
+
|
|
108
|
+
// Only compare keys when both are an object or array
|
|
109
|
+
// This does not account for complex types like Date/Regex, because we don't use them
|
|
110
|
+
if (!requiresKeyComparison) return a === b;
|
|
111
|
+
|
|
112
|
+
// Make either are not null
|
|
113
|
+
if (!a || !b) {
|
|
114
|
+
return a === b;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Shortcut for arrays
|
|
118
|
+
if (aArray && bArray && a.length !== b.length) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Compare a to b
|
|
123
|
+
for (const key in a) {
|
|
124
|
+
if (
|
|
125
|
+
!isDeepEqual(
|
|
126
|
+
(a as Record<string, unknown>)[key],
|
|
127
|
+
(b as Record<string, unknown>)[key],
|
|
128
|
+
)
|
|
129
|
+
) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Compare b to a
|
|
135
|
+
for (const key in b) {
|
|
136
|
+
if (!(key in a)) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return true;
|
|
142
|
+
}
|