react-native-css 3.0.0-nightly.75f8b74 → 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/atRules.js +16 -3
- package/dist/commonjs/compiler/atRules.js.map +1 -1
- package/dist/commonjs/compiler/compiler.js +37 -21
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +255 -154
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/inheritance.test.js +15 -15
- package/dist/commonjs/compiler/inheritance.test.js.map +1 -1
- package/dist/commonjs/compiler/keyframes.js +1 -1
- package/dist/commonjs/compiler/keyframes.js.map +1 -1
- package/dist/commonjs/compiler/pseudo-elements.js +49 -0
- package/dist/commonjs/compiler/pseudo-elements.js.map +1 -0
- package/dist/commonjs/compiler/selector-builder.js +501 -0
- package/dist/commonjs/compiler/selector-builder.js.map +1 -0
- package/dist/commonjs/compiler/selectors.js +10 -6
- package/dist/commonjs/compiler/selectors.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +137 -46
- 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 +30 -12
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/index.js +7 -4
- package/dist/commonjs/metro/index.js.map +1 -1
- package/dist/commonjs/metro/injection-code.js +5 -10
- package/dist/commonjs/metro/injection-code.js.map +1 -1
- package/dist/commonjs/metro/metro-transformer.js +18 -8
- package/dist/commonjs/metro/metro-transformer.js.map +1 -1
- package/dist/commonjs/metro/resolver.js +3 -0
- package/dist/commonjs/metro/resolver.js.map +1 -1
- package/dist/commonjs/poison.pill.js +14 -11
- package/dist/commonjs/poison.pill.js.map +1 -1
- package/dist/commonjs/runtime/native/api.js +8 -2
- package/dist/commonjs/runtime/native/api.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/attributes.js +42 -0
- package/dist/commonjs/runtime/native/conditions/attributes.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/container-query.js +28 -21
- package/dist/commonjs/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/index.js +12 -46
- package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/media-query.js +26 -21
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/runtime/native/react/interaction.js +10 -10
- package/dist/commonjs/runtime/native/react/interaction.js.map +1 -1
- package/dist/commonjs/runtime/native/react/rules.js +33 -27
- package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
- package/dist/commonjs/runtime/native/react/useNativeCss.js +3 -2
- package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/commonjs/runtime/native/reactivity.js +12 -12
- package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
- package/dist/commonjs/runtime/native/reanimated.js +17 -0
- package/dist/commonjs/runtime/native/reanimated.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/calculate-props.js +63 -38
- package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/defaults.js +1 -1
- package/dist/commonjs/runtime/native/styles/defaults.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/functions/animation-timing.js +34 -0
- package/dist/commonjs/runtime/native/styles/functions/animation-timing.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/calc.js +125 -0
- package/dist/commonjs/runtime/native/styles/functions/calc.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{filters.js → functions/filters.js} +3 -3
- package/dist/commonjs/runtime/native/styles/functions/filters.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/index.js +83 -0
- package/dist/commonjs/runtime/native/styles/functions/index.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/numeric-functions.js +32 -0
- package/dist/commonjs/runtime/native/styles/functions/numeric-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{platform-functions.js → functions/platform-functions.js} +3 -3
- package/dist/commonjs/runtime/native/styles/functions/platform-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/string-functions.js +23 -0
- package/dist/commonjs/runtime/native/styles/functions/string-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/transform-functions.js +121 -0
- package/dist/commonjs/runtime/native/styles/functions/transform-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/index.js +12 -12
- package/dist/commonjs/runtime/native/styles/index.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/resolve.js +21 -44
- package/dist/commonjs/runtime/native/styles/resolve.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/{shorthand.js → shorthands/_handler.js} +5 -5
- package/dist/commonjs/runtime/native/styles/shorthands/_handler.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{animation.js → shorthands/animation.js} +6 -37
- package/dist/commonjs/runtime/native/styles/shorthands/animation.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{border.js → shorthands/border.js} +2 -2
- package/dist/commonjs/runtime/native/styles/shorthands/border.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js +50 -0
- package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/shorthands/index.js +61 -0
- package/dist/commonjs/runtime/native/styles/shorthands/index.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{text-shadow.js → shorthands/text-shadow.js} +2 -2
- package/dist/commonjs/runtime/native/styles/shorthands/text-shadow.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{transform.js → shorthands/transform.js} +1 -1
- package/dist/commonjs/runtime/native/styles/shorthands/transform.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/units.js +7 -4
- package/dist/commonjs/runtime/native/styles/units.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/variables.js +3 -2
- package/dist/commonjs/runtime/native/styles/variables.js.map +1 -1
- package/dist/commonjs/runtime/utils/objects.js +14 -6
- package/dist/commonjs/runtime/utils/objects.js.map +1 -1
- package/dist/commonjs/runtime/utils/specificity.js +2 -1
- package/dist/commonjs/runtime/utils/specificity.js.map +1 -1
- package/dist/commonjs/runtime/web/api.js.map +1 -1
- package/dist/commonjs/style-collection/index.js +110 -0
- package/dist/commonjs/style-collection/index.js.map +1 -0
- package/dist/commonjs/style-collection/root.js +28 -0
- package/dist/commonjs/style-collection/root.js.map +1 -0
- package/dist/module/compiler/atRules.js +16 -3
- package/dist/module/compiler/atRules.js.map +1 -1
- package/dist/module/compiler/compiler.js +37 -21
- 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 +250 -150
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/inheritance.test.js +15 -15
- package/dist/module/compiler/inheritance.test.js.map +1 -1
- package/dist/module/compiler/keyframes.js +1 -1
- package/dist/module/compiler/keyframes.js.map +1 -1
- package/dist/module/compiler/pseudo-elements.js +44 -0
- package/dist/module/compiler/pseudo-elements.js.map +1 -0
- package/dist/module/compiler/selector-builder.js +496 -0
- package/dist/module/compiler/selector-builder.js.map +1 -0
- package/dist/module/compiler/selectors.js +10 -6
- package/dist/module/compiler/selectors.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +136 -45
- 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 +28 -10
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/index.js +7 -4
- package/dist/module/metro/index.js.map +1 -1
- package/dist/module/metro/injection-code.js +5 -10
- package/dist/module/metro/injection-code.js.map +1 -1
- package/dist/module/metro/metro-transformer.js +18 -8
- package/dist/module/metro/metro-transformer.js.map +1 -1
- package/dist/module/metro/resolver.js +3 -0
- package/dist/module/metro/resolver.js.map +1 -1
- package/dist/module/poison.pill.js +14 -11
- package/dist/module/poison.pill.js.map +1 -1
- package/dist/module/runtime/native/api.js +2 -1
- package/dist/module/runtime/native/api.js.map +1 -1
- package/dist/module/runtime/native/conditions/attributes.js +38 -0
- package/dist/module/runtime/native/conditions/attributes.js.map +1 -0
- package/dist/module/runtime/native/conditions/container-query.js +28 -21
- package/dist/module/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/module/runtime/native/conditions/guards.js.map +1 -1
- package/dist/module/runtime/native/conditions/index.js +12 -46
- package/dist/module/runtime/native/conditions/index.js.map +1 -1
- package/dist/module/runtime/native/conditions/media-query.js +27 -22
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/module/runtime/native/react/interaction.js +10 -10
- package/dist/module/runtime/native/react/interaction.js.map +1 -1
- package/dist/module/runtime/native/react/rules.js +31 -26
- package/dist/module/runtime/native/react/rules.js.map +1 -1
- package/dist/module/runtime/native/react/useNativeCss.js +2 -1
- package/dist/module/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/module/runtime/native/reactivity.js +11 -11
- package/dist/module/runtime/native/reactivity.js.map +1 -1
- package/dist/module/runtime/native/reanimated.js +13 -0
- package/dist/module/runtime/native/reanimated.js.map +1 -0
- package/dist/module/runtime/native/styles/calculate-props.js +64 -39
- package/dist/module/runtime/native/styles/calculate-props.js.map +1 -1
- package/dist/module/runtime/native/styles/defaults.js +1 -1
- package/dist/module/runtime/native/styles/defaults.js.map +1 -1
- package/dist/module/runtime/native/styles/functions/animation-timing.js +30 -0
- package/dist/module/runtime/native/styles/functions/animation-timing.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/calc.js +120 -0
- package/dist/module/runtime/native/styles/functions/calc.js.map +1 -0
- package/dist/module/runtime/native/styles/{filters.js → functions/filters.js} +2 -2
- package/dist/module/runtime/native/styles/functions/filters.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/index.js +10 -0
- package/dist/module/runtime/native/styles/functions/index.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/numeric-functions.js +25 -0
- package/dist/module/runtime/native/styles/functions/numeric-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/{platform-functions.js → functions/platform-functions.js} +1 -1
- package/dist/module/runtime/native/styles/functions/platform-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/string-functions.js +18 -0
- package/dist/module/runtime/native/styles/functions/string-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/transform-functions.js +114 -0
- package/dist/module/runtime/native/styles/functions/transform-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/index.js +12 -12
- package/dist/module/runtime/native/styles/index.js.map +1 -1
- package/dist/module/runtime/native/styles/resolve.js +20 -44
- package/dist/module/runtime/native/styles/resolve.js.map +1 -1
- package/dist/module/runtime/native/styles/{shorthand.js → shorthands/_handler.js} +5 -5
- package/dist/module/runtime/native/styles/shorthands/_handler.js.map +1 -0
- package/dist/module/runtime/native/styles/{animation.js → shorthands/animation.js} +3 -34
- package/dist/module/runtime/native/styles/shorthands/animation.js.map +1 -0
- package/dist/module/runtime/native/styles/{border.js → shorthands/border.js} +1 -1
- package/dist/module/runtime/native/styles/shorthands/border.js.map +1 -0
- package/dist/module/runtime/native/styles/{box-shadow.js → shorthands/box-shadow.js} +16 -6
- package/dist/module/runtime/native/styles/shorthands/box-shadow.js.map +1 -0
- package/dist/module/runtime/native/styles/shorthands/index.js +8 -0
- package/dist/module/runtime/native/styles/shorthands/index.js.map +1 -0
- package/dist/module/runtime/native/styles/{text-shadow.js → shorthands/text-shadow.js} +1 -1
- package/dist/module/runtime/native/styles/shorthands/text-shadow.js.map +1 -0
- package/dist/module/runtime/native/styles/{transform.js → shorthands/transform.js} +1 -1
- package/dist/module/runtime/native/styles/shorthands/transform.js.map +1 -0
- package/dist/module/runtime/native/styles/units.js +7 -4
- package/dist/module/runtime/native/styles/units.js.map +1 -1
- package/dist/module/runtime/native/styles/variables.js +2 -1
- package/dist/module/runtime/native/styles/variables.js.map +1 -1
- package/dist/module/runtime/utils/objects.js +14 -6
- package/dist/module/runtime/utils/objects.js.map +1 -1
- package/dist/module/runtime/utils/specificity.js +2 -1
- package/dist/module/runtime/utils/specificity.js.map +1 -1
- package/dist/module/runtime/web/api.js.map +1 -1
- package/dist/module/style-collection/index.js +95 -0
- package/dist/module/style-collection/index.js.map +1 -0
- package/dist/module/style-collection/root.js +24 -0
- package/dist/module/style-collection/root.js.map +1 -0
- package/dist/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +9 -2
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +16 -17
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +18 -19
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/pseudo-elements.d.ts +4 -0
- package/dist/typescript/commonjs/src/compiler/pseudo-elements.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts +24 -0
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts +3 -2
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +23 -9
- 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 +20 -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/poison.pill.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts +3 -1
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts +3 -3
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts +2 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +2 -10
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/defaults.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/animation-timing.d.ts +4 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/animation-timing.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/{filters.d.ts → functions/filters.d.ts} +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/filters.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts +8 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/numeric-functions.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/numeric-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/{platform-functions.d.ts → functions/platform-functions.d.ts} +2 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/platform-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/string-functions.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/string-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/{shorthand.d.ts → shorthands/_handler.d.ts} +2 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/_handler.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts +4 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/border.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/border.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/index.d.ts +6 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/text-shadow.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/text-shadow.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/{transform.d.ts → shorthands/transform.d.ts} +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/web/api.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/web/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/style-collection/index.d.ts +14 -0
- package/dist/typescript/commonjs/src/style-collection/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/style-collection/root.d.ts +11 -0
- package/dist/typescript/commonjs/src/style-collection/root.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts +9 -2
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +16 -17
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +18 -19
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/pseudo-elements.d.ts +4 -0
- package/dist/typescript/module/src/compiler/pseudo-elements.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/selector-builder.d.ts +24 -0
- package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/selectors.d.ts +3 -2
- package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +23 -9
- 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 +20 -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/poison.pill.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/api.d.ts +3 -1
- package/dist/typescript/module/src/runtime/native/api.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts +3 -3
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts +2 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts +2 -10
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/reanimated.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/reanimated.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/defaults.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/functions/animation-timing.d.ts +4 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/animation-timing.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/{filters.d.ts → functions/filters.d.ts} +1 -1
- package/dist/typescript/module/src/runtime/native/styles/functions/filters.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts +8 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/numeric-functions.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/numeric-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/{platform-functions.d.ts → functions/platform-functions.d.ts} +2 -2
- package/dist/typescript/module/src/runtime/native/styles/functions/platform-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/string-functions.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/string-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/{shorthand.d.ts → shorthands/_handler.d.ts} +2 -2
- package/dist/typescript/module/src/runtime/native/styles/shorthands/_handler.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts +4 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/border.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/border.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/index.d.ts +6 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/text-shadow.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/text-shadow.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/{transform.d.ts → shorthands/transform.d.ts} +1 -1
- package/dist/typescript/module/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/utils/objects.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/utils/specificity.d.ts +1 -0
- package/dist/typescript/module/src/runtime/utils/specificity.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/web/api.d.ts +1 -1
- package/dist/typescript/module/src/runtime/web/api.d.ts.map +1 -1
- package/dist/typescript/module/src/style-collection/index.d.ts +14 -0
- package/dist/typescript/module/src/style-collection/index.d.ts.map +1 -0
- package/dist/typescript/module/src/style-collection/root.d.ts +11 -0
- package/dist/typescript/module/src/style-collection/root.d.ts.map +1 -0
- package/package.json +32 -16
- package/src/compiler/atRules.ts +17 -3
- package/src/compiler/compiler.ts +40 -33
- package/src/compiler/compiler.types.ts +18 -19
- package/src/compiler/declarations.ts +447 -192
- package/src/compiler/inheritance.test.ts +13 -13
- package/src/compiler/keyframes.ts +1 -1
- package/src/compiler/pseudo-elements.ts +54 -0
- package/src/compiler/selector-builder.ts +586 -0
- package/src/compiler/selectors.ts +20 -6
- package/src/compiler/stylesheet.ts +188 -53
- 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 +35 -10
- package/src/metro/index.ts +12 -7
- package/src/metro/injection-code.ts +6 -10
- package/src/metro/metro-transformer.ts +27 -10
- package/src/metro/resolver.ts +8 -0
- package/src/poison.pill.ts +15 -11
- package/src/runtime/native/api.ts +3 -1
- package/src/runtime/native/conditions/attributes.ts +52 -0
- package/src/runtime/native/conditions/container-query.ts +27 -22
- package/src/runtime/native/conditions/guards.ts +1 -2
- package/src/runtime/native/conditions/index.ts +14 -66
- package/src/runtime/native/conditions/media-query.ts +29 -25
- package/src/runtime/native/react/interaction.ts +12 -12
- package/src/runtime/native/react/rules.ts +34 -24
- package/src/runtime/native/react/useNativeCss.ts +4 -1
- package/src/runtime/native/reactivity.ts +14 -21
- package/src/runtime/native/reanimated.ts +22 -0
- package/src/runtime/native/styles/calculate-props.ts +71 -39
- package/src/runtime/native/styles/defaults.ts +1 -0
- package/src/runtime/native/styles/functions/animation-timing.ts +44 -0
- package/src/runtime/native/styles/functions/calc.ts +121 -0
- package/src/runtime/native/styles/{filters.ts → functions/filters.ts} +3 -3
- package/src/runtime/native/styles/functions/index.ts +7 -0
- package/src/runtime/native/styles/functions/numeric-functions.ts +38 -0
- package/src/runtime/native/styles/{platform-functions.ts → functions/platform-functions.ts} +2 -2
- package/src/runtime/native/styles/functions/string-functions.ts +22 -0
- package/src/runtime/native/styles/functions/transform-functions.ts +84 -0
- package/src/runtime/native/styles/index.ts +12 -12
- package/src/runtime/native/styles/resolve.ts +20 -63
- package/src/runtime/native/styles/{shorthand.ts → shorthands/_handler.ts} +5 -5
- package/src/runtime/native/styles/{animation.ts → shorthands/animation.ts} +4 -62
- package/src/runtime/native/styles/{border.ts → shorthands/border.ts} +1 -1
- package/src/runtime/native/styles/shorthands/box-shadow.ts +74 -0
- package/src/runtime/native/styles/shorthands/index.ts +5 -0
- package/src/runtime/native/styles/{text-shadow.ts → shorthands/text-shadow.ts} +1 -1
- package/src/runtime/native/styles/{transform.ts → shorthands/transform.ts} +4 -2
- package/src/runtime/native/styles/units.ts +8 -4
- package/src/runtime/native/styles/variables.ts +5 -5
- package/src/runtime/utils/objects.ts +16 -4
- package/src/runtime/utils/specificity.ts +1 -0
- package/src/runtime/web/api.ts +1 -1
- package/src/style-collection/index.ts +142 -0
- package/src/style-collection/root.ts +35 -0
- package/dist/commonjs/compiler/attributes.test.js +0 -20
- package/dist/commonjs/compiler/attributes.test.js.map +0 -1
- package/dist/commonjs/doctor/index.js +0 -6
- package/dist/commonjs/doctor/index.js.map +0 -1
- package/dist/commonjs/runtime/native/injection.js +0 -98
- package/dist/commonjs/runtime/native/injection.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/animation.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/border.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/box-shadow.js +0 -40
- package/dist/commonjs/runtime/native/styles/box-shadow.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/calc.js +0 -85
- package/dist/commonjs/runtime/native/styles/calc.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/filters.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/platform-functions.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/shorthand.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/text-shadow.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/transform.js.map +0 -1
- package/dist/module/compiler/attributes.test.js +0 -20
- package/dist/module/compiler/attributes.test.js.map +0 -1
- package/dist/module/doctor/index.js +0 -4
- package/dist/module/doctor/index.js.map +0 -1
- package/dist/module/runtime/native/injection.js +0 -93
- package/dist/module/runtime/native/injection.js.map +0 -1
- package/dist/module/runtime/native/styles/animation.js.map +0 -1
- package/dist/module/runtime/native/styles/border.js.map +0 -1
- package/dist/module/runtime/native/styles/box-shadow.js.map +0 -1
- package/dist/module/runtime/native/styles/calc.js +0 -79
- package/dist/module/runtime/native/styles/calc.js.map +0 -1
- package/dist/module/runtime/native/styles/filters.js.map +0 -1
- package/dist/module/runtime/native/styles/platform-functions.js.map +0 -1
- package/dist/module/runtime/native/styles/shorthand.js.map +0 -1
- package/dist/module/runtime/native/styles/text-shadow.js.map +0 -1
- package/dist/module/runtime/native/styles/transform.js.map +0 -1
- package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts +0 -2
- package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/doctor/index.d.ts +0 -2
- package/dist/typescript/commonjs/src/doctor/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts +0 -16
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts +0 -9
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts +0 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts +0 -3
- package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts +0 -3
- package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/filters.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/platform-functions.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts +0 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/transform.d.ts.map +0 -1
- package/dist/typescript/module/src/compiler/attributes.test.d.ts +0 -2
- package/dist/typescript/module/src/compiler/attributes.test.d.ts.map +0 -1
- package/dist/typescript/module/src/doctor/index.d.ts +0 -2
- package/dist/typescript/module/src/doctor/index.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/injection.d.ts +0 -16
- package/dist/typescript/module/src/runtime/native/injection.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts +0 -9
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/border.d.ts +0 -2
- package/dist/typescript/module/src/runtime/native/styles/border.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts +0 -3
- package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/calc.d.ts +0 -3
- package/dist/typescript/module/src/runtime/native/styles/calc.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/filters.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/platform-functions.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts +0 -2
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/transform.d.ts.map +0 -1
- package/src/compiler/attributes.test.ts +0 -28
- package/src/doctor/index.ts +0 -1
- package/src/runtime/native/injection.ts +0 -131
- package/src/runtime/native/styles/box-shadow.ts +0 -54
- package/src/runtime/native/styles/calc.ts +0 -97
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
containerLayoutFamily,
|
|
7
7
|
focusFamily,
|
|
8
8
|
hoverFamily,
|
|
9
|
-
type
|
|
9
|
+
type Getter as WeakKey,
|
|
10
10
|
} from "../reactivity";
|
|
11
11
|
|
|
12
12
|
const mainCache = new WeakMap<
|
|
13
|
-
|
|
13
|
+
WeakKey,
|
|
14
14
|
WeakMap<Function, (event: any) => void>
|
|
15
15
|
>();
|
|
16
16
|
|
|
@@ -38,14 +38,14 @@ const defaultHandlers: Record<InteractionType, Handler> = {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
export function getInteractionHandler(
|
|
41
|
-
|
|
41
|
+
weakKey: WeakKey,
|
|
42
42
|
type: InteractionType,
|
|
43
43
|
handler = defaultHandlers[type],
|
|
44
44
|
) {
|
|
45
|
-
let cache = mainCache.get(
|
|
45
|
+
let cache = mainCache.get(weakKey);
|
|
46
46
|
if (!cache) {
|
|
47
47
|
cache = new WeakMap();
|
|
48
|
-
mainCache.set(
|
|
48
|
+
mainCache.set(weakKey, cache);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
let cached = cache.get(handler);
|
|
@@ -57,29 +57,29 @@ export function getInteractionHandler(
|
|
|
57
57
|
|
|
58
58
|
switch (type) {
|
|
59
59
|
case "onLayout":
|
|
60
|
-
containerLayoutFamily(
|
|
60
|
+
containerLayoutFamily(weakKey).set(
|
|
61
61
|
(event as LayoutChangeEvent).nativeEvent.layout,
|
|
62
62
|
);
|
|
63
63
|
break;
|
|
64
64
|
case "onHoverIn":
|
|
65
|
-
hoverFamily(
|
|
65
|
+
hoverFamily(weakKey).set(true);
|
|
66
66
|
break;
|
|
67
67
|
case "onHoverOut":
|
|
68
|
-
hoverFamily(
|
|
68
|
+
hoverFamily(weakKey).set(false);
|
|
69
69
|
break;
|
|
70
70
|
case "onPress":
|
|
71
71
|
break;
|
|
72
72
|
case "onPressIn":
|
|
73
|
-
activeFamily(
|
|
73
|
+
activeFamily(weakKey).set(true);
|
|
74
74
|
break;
|
|
75
75
|
case "onPressOut":
|
|
76
|
-
activeFamily(
|
|
76
|
+
activeFamily(weakKey).set(false);
|
|
77
77
|
break;
|
|
78
78
|
case "onFocus":
|
|
79
|
-
focusFamily(
|
|
79
|
+
focusFamily(weakKey).set(true);
|
|
80
80
|
break;
|
|
81
81
|
case "onBlur":
|
|
82
|
-
focusFamily(
|
|
82
|
+
focusFamily(weakKey).set(false);
|
|
83
83
|
break;
|
|
84
84
|
}
|
|
85
85
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
+
import { StyleCollection } from "react-native-css/style-collection";
|
|
3
|
+
|
|
2
4
|
import type { InlineVariable, StyleRule } from "../../../compiler";
|
|
3
5
|
import { getDeepPath } from "../../utils";
|
|
4
6
|
import { testRule } from "../conditions";
|
|
5
7
|
import { DEFAULT_CONTAINER_NAME } from "../conditions/container-query";
|
|
6
8
|
import type { RenderGuard } from "../conditions/guards";
|
|
7
|
-
import { StyleCollection } from "../injection";
|
|
8
9
|
import {
|
|
9
10
|
activeFamily,
|
|
10
11
|
containerLayoutFamily,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
hoverFamily,
|
|
13
14
|
VAR_SYMBOL,
|
|
14
15
|
weakFamily,
|
|
16
|
+
type ContainerContextValue,
|
|
15
17
|
type VariableContextValue,
|
|
16
18
|
} from "../reactivity";
|
|
17
19
|
import { stylesFamily } from "../styles";
|
|
@@ -36,11 +38,12 @@ export function updateRules(
|
|
|
36
38
|
|
|
37
39
|
let usesVariables = false;
|
|
38
40
|
|
|
39
|
-
let variables
|
|
40
|
-
let containers
|
|
41
|
+
let variables: VariableContextValue | undefined;
|
|
42
|
+
let containers: ContainerContextValue | undefined;
|
|
41
43
|
const inlineVariables = new Set<InlineVariable>();
|
|
42
44
|
|
|
43
45
|
let animated = false;
|
|
46
|
+
let pressable = false;
|
|
44
47
|
|
|
45
48
|
for (const config of state.configs) {
|
|
46
49
|
const source = currentProps?.[config.source];
|
|
@@ -68,6 +71,11 @@ export function updateRules(
|
|
|
68
71
|
if (target) {
|
|
69
72
|
if (Array.isArray(target)) {
|
|
70
73
|
for (const item of target) {
|
|
74
|
+
// undefined or falsy is allowed in the style array
|
|
75
|
+
if (!item) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
|
|
71
79
|
if (VAR_SYMBOL in item) {
|
|
72
80
|
inlineVariables.add(item);
|
|
73
81
|
} else if (
|
|
@@ -93,18 +101,25 @@ export function updateRules(
|
|
|
93
101
|
}
|
|
94
102
|
|
|
95
103
|
for (let rule of styleRuleSet) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if
|
|
99
|
-
|
|
104
|
+
usesVariables ||= Boolean(rule.dv);
|
|
105
|
+
|
|
106
|
+
// We do this even if the rule doesn't match so we can maintain a consistent render tree
|
|
107
|
+
// We we need to inject React context
|
|
100
108
|
if (rule.a) animated = true;
|
|
101
109
|
|
|
102
|
-
|
|
110
|
+
if (rule.v) {
|
|
111
|
+
variables ??= inheritedVariables;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (rule.c) {
|
|
115
|
+
containers ??= inheritedContainers;
|
|
116
|
+
activeFamily(state.ruleEffectGetter);
|
|
117
|
+
}
|
|
103
118
|
|
|
104
119
|
if (
|
|
105
120
|
!testRule(
|
|
106
121
|
rule,
|
|
107
|
-
state.
|
|
122
|
+
state.ruleEffectGetter,
|
|
108
123
|
currentProps,
|
|
109
124
|
guards,
|
|
110
125
|
inheritedContainers,
|
|
@@ -114,11 +129,8 @@ export function updateRules(
|
|
|
114
129
|
}
|
|
115
130
|
|
|
116
131
|
if (rule.v) {
|
|
117
|
-
// We're going to set a value, so we need to create a new object
|
|
118
132
|
if (variables === inheritedVariables) {
|
|
119
133
|
variables = { ...inheritedVariables };
|
|
120
|
-
} else {
|
|
121
|
-
variables ??= { ...inheritedVariables };
|
|
122
134
|
}
|
|
123
135
|
|
|
124
136
|
for (const v of rule.v) {
|
|
@@ -132,20 +144,20 @@ export function updateRules(
|
|
|
132
144
|
containers = {
|
|
133
145
|
...inheritedContainers,
|
|
134
146
|
// This container becomes the default container
|
|
135
|
-
[DEFAULT_CONTAINER_NAME]: state.
|
|
147
|
+
[DEFAULT_CONTAINER_NAME]: state.ruleEffectGetter,
|
|
136
148
|
};
|
|
137
149
|
}
|
|
138
150
|
|
|
139
151
|
// This this component as the named container
|
|
140
152
|
for (const name of rule.c) {
|
|
141
|
-
containers![name] = state.
|
|
153
|
+
containers![name] = state.ruleEffectGetter;
|
|
142
154
|
}
|
|
143
155
|
|
|
144
156
|
// Enable hover/active/focus/layout handlers
|
|
145
|
-
hoverFamily(state.
|
|
146
|
-
activeFamily(state.
|
|
147
|
-
focusFamily(state.
|
|
148
|
-
containerLayoutFamily(state.
|
|
157
|
+
hoverFamily(state.ruleEffectGetter);
|
|
158
|
+
activeFamily(state.ruleEffectGetter);
|
|
159
|
+
focusFamily(state.ruleEffectGetter);
|
|
160
|
+
containerLayoutFamily(state.ruleEffectGetter);
|
|
149
161
|
}
|
|
150
162
|
|
|
151
163
|
if (rule.a) {
|
|
@@ -163,7 +175,7 @@ export function updateRules(
|
|
|
163
175
|
|
|
164
176
|
if (process.env.NODE_ENV !== "production") {
|
|
165
177
|
if (isRerender) {
|
|
166
|
-
|
|
178
|
+
const pressable = activeFamily.has(state.ruleEffectGetter);
|
|
167
179
|
|
|
168
180
|
if (Boolean(variables) !== Boolean(state.variables)) {
|
|
169
181
|
console.log(
|
|
@@ -186,11 +198,7 @@ export function updateRules(
|
|
|
186
198
|
}
|
|
187
199
|
}
|
|
188
200
|
|
|
189
|
-
|
|
190
|
-
let pressable =
|
|
191
|
-
process.env.NODE_ENV === "production"
|
|
192
|
-
? undefined
|
|
193
|
-
: activeFamily.has(state.ruleEffect);
|
|
201
|
+
pressable = activeFamily.has(state.ruleEffectGetter);
|
|
194
202
|
|
|
195
203
|
if (!rules.size && !state.stylesObs && !inlineVariables.size) {
|
|
196
204
|
return {
|
|
@@ -199,6 +207,8 @@ export function updateRules(
|
|
|
199
207
|
guards,
|
|
200
208
|
animated,
|
|
201
209
|
pressable,
|
|
210
|
+
variables,
|
|
211
|
+
containers,
|
|
202
212
|
};
|
|
203
213
|
}
|
|
204
214
|
|
|
@@ -17,10 +17,11 @@ import {
|
|
|
17
17
|
VariableContext,
|
|
18
18
|
type ContainerContextValue,
|
|
19
19
|
type Effect,
|
|
20
|
+
type Getter,
|
|
20
21
|
type VariableContextValue,
|
|
21
22
|
} from "../reactivity";
|
|
23
|
+
import { animatedComponentFamily } from "../reanimated";
|
|
22
24
|
import { getStyledProps, stylesFamily } from "../styles";
|
|
23
|
-
import { animatedComponentFamily } from "../styles/animation";
|
|
24
25
|
import { updateRules } from "./rules";
|
|
25
26
|
|
|
26
27
|
export type Config = {
|
|
@@ -35,6 +36,7 @@ export type ComponentState = {
|
|
|
35
36
|
|
|
36
37
|
/** Reactive tracking */
|
|
37
38
|
ruleEffect: Effect;
|
|
39
|
+
ruleEffectGetter: Getter;
|
|
38
40
|
styleEffect: Effect;
|
|
39
41
|
|
|
40
42
|
/** The components props */
|
|
@@ -94,6 +96,7 @@ export function useNativeCss(
|
|
|
94
96
|
return updateRules(
|
|
95
97
|
{
|
|
96
98
|
ruleEffect,
|
|
99
|
+
ruleEffectGetter: (observable) => observable.get(ruleEffect),
|
|
97
100
|
styleEffect,
|
|
98
101
|
configs,
|
|
99
102
|
inheritedContainers,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type LayoutRectangle,
|
|
8
8
|
} from "react-native";
|
|
9
9
|
|
|
10
|
-
import type {
|
|
10
|
+
import type { StyleDescriptor } from "../../compiler";
|
|
11
11
|
|
|
12
12
|
export type Effect = {
|
|
13
13
|
observers: Set<Effect>;
|
|
@@ -189,25 +189,6 @@ export const VariableContext = createContext<VariableContextValue>({
|
|
|
189
189
|
[VAR_SYMBOL]: true,
|
|
190
190
|
});
|
|
191
191
|
|
|
192
|
-
const lightDarkFamily = () => {
|
|
193
|
-
return family<string, Observable<StyleDescriptor, LightDarkVariable>>(() => {
|
|
194
|
-
const obs = observable<StyleDescriptor, LightDarkVariable>(
|
|
195
|
-
(read, lightDark = [undefined, undefined]) => {
|
|
196
|
-
const colorSchemeName =
|
|
197
|
-
read(colorScheme) ?? Appearance.getColorScheme() ?? "light";
|
|
198
|
-
|
|
199
|
-
return colorSchemeName === "dark"
|
|
200
|
-
? (lightDark[1] ?? lightDark[0])
|
|
201
|
-
: lightDark[0];
|
|
202
|
-
},
|
|
203
|
-
);
|
|
204
|
-
|
|
205
|
-
return obs;
|
|
206
|
-
});
|
|
207
|
-
};
|
|
208
|
-
export const rootVariables = lightDarkFamily();
|
|
209
|
-
export const universalVariables = lightDarkFamily();
|
|
210
|
-
|
|
211
192
|
/** Units *********************************************************************/
|
|
212
193
|
|
|
213
194
|
export const rem = observable(14);
|
|
@@ -228,6 +209,18 @@ export const vh = observable<number>(
|
|
|
228
209
|
(read, value) => value ?? read(dimensions)?.height,
|
|
229
210
|
);
|
|
230
211
|
|
|
212
|
+
Dimensions.addEventListener("change", ({ window }) => {
|
|
213
|
+
observableBatch.current = new Set();
|
|
214
|
+
vw.set(window.width);
|
|
215
|
+
vh.set(window.height);
|
|
216
|
+
|
|
217
|
+
for (const effect of observableBatch.current) {
|
|
218
|
+
effect.run();
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
observableBatch.current = undefined;
|
|
222
|
+
});
|
|
223
|
+
|
|
231
224
|
/** Color Scheme **************************************************************/
|
|
232
225
|
|
|
233
226
|
export const colorScheme = observable<ColorSchemeName>(
|
|
@@ -237,7 +230,7 @@ Appearance.addChangeListener((event) => colorScheme.set(event.colorScheme));
|
|
|
237
230
|
|
|
238
231
|
/** Containers ****************************************************************/
|
|
239
232
|
|
|
240
|
-
export type ContainerContextValue = Record<string,
|
|
233
|
+
export type ContainerContextValue = Record<string, WeakKey>;
|
|
241
234
|
export const ContainerContext = createContext<ContainerContextValue>({});
|
|
242
235
|
|
|
243
236
|
export const containerLayoutFamily = weakFamily(() => {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
|
|
3
|
+
import { weakFamily } from "./reactivity";
|
|
4
|
+
|
|
5
|
+
export const animatedComponentFamily = weakFamily(
|
|
6
|
+
(component: ComponentType) => {
|
|
7
|
+
if (
|
|
8
|
+
"displayName" in component &&
|
|
9
|
+
component.displayName?.startsWith("Animated.")
|
|
10
|
+
) {
|
|
11
|
+
return component;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const createAnimatedComponent =
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-member-access
|
|
16
|
+
require("react-native-reanimated").createAnimatedComponent as (
|
|
17
|
+
component: ComponentType,
|
|
18
|
+
) => ComponentType;
|
|
19
|
+
|
|
20
|
+
return createAnimatedComponent(component);
|
|
21
|
+
},
|
|
22
|
+
);
|
|
@@ -4,13 +4,14 @@ import type {
|
|
|
4
4
|
StyleDeclaration,
|
|
5
5
|
StyleRule,
|
|
6
6
|
} from "../../../compiler";
|
|
7
|
-
import { applyValue, Specificity as S } from "../../utils";
|
|
7
|
+
import { applyValue, getDeepPath, Specificity as S } from "../../utils";
|
|
8
8
|
import type { RenderGuard } from "../conditions/guards";
|
|
9
9
|
import {
|
|
10
10
|
VAR_SYMBOL,
|
|
11
11
|
type Getter,
|
|
12
12
|
type VariableContextValue,
|
|
13
13
|
} from "../reactivity";
|
|
14
|
+
import { transformKeys } from "./defaults";
|
|
14
15
|
import { resolveValue } from "./resolve";
|
|
15
16
|
|
|
16
17
|
export function calculateProps(
|
|
@@ -28,6 +29,7 @@ export function calculateProps(
|
|
|
28
29
|
let important: Record<string, any> | undefined;
|
|
29
30
|
|
|
30
31
|
const delayedStyles: (() => void)[] = [];
|
|
32
|
+
const transformStyles: (() => void)[] = [];
|
|
31
33
|
|
|
32
34
|
for (const rule of rules) {
|
|
33
35
|
if (VAR_SYMBOL in rule) {
|
|
@@ -67,6 +69,7 @@ export function calculateProps(
|
|
|
67
69
|
inlineVariables,
|
|
68
70
|
inheritedVariables,
|
|
69
71
|
delayedStyles,
|
|
72
|
+
transformStyles,
|
|
70
73
|
guards,
|
|
71
74
|
target,
|
|
72
75
|
topLevelTarget,
|
|
@@ -78,6 +81,10 @@ export function calculateProps(
|
|
|
78
81
|
delayedStyle();
|
|
79
82
|
}
|
|
80
83
|
|
|
84
|
+
for (const transformStyle of transformStyles) {
|
|
85
|
+
transformStyle();
|
|
86
|
+
}
|
|
87
|
+
|
|
81
88
|
return {
|
|
82
89
|
normal,
|
|
83
90
|
guards,
|
|
@@ -91,6 +98,7 @@ export function applyDeclarations(
|
|
|
91
98
|
inlineVariables: InlineVariable,
|
|
92
99
|
inheritedVariables: VariableContextValue,
|
|
93
100
|
delayedStyles: (() => void)[] = [],
|
|
101
|
+
transformStyles: (() => void)[] = [],
|
|
94
102
|
guards: RenderGuard[] = [],
|
|
95
103
|
target: Record<string, any> = {},
|
|
96
104
|
topLevelTarget = target,
|
|
@@ -103,42 +111,66 @@ export function applyDeclarations(
|
|
|
103
111
|
// Dynamic styles
|
|
104
112
|
let value: any = declaration[0];
|
|
105
113
|
let propPath = declaration[1];
|
|
106
|
-
let prop
|
|
114
|
+
let prop: string;
|
|
115
|
+
|
|
116
|
+
if (Array.isArray(propPath)) {
|
|
117
|
+
const [first, ...rest] = propPath;
|
|
107
118
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
propPath = propPath.slice(1);
|
|
111
|
-
target = topLevelTarget[propPath] ??= {};
|
|
119
|
+
if (!first) {
|
|
120
|
+
continue;
|
|
112
121
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
122
|
+
|
|
123
|
+
const final = rest.pop();
|
|
124
|
+
|
|
125
|
+
if (final) {
|
|
126
|
+
if (first !== "*") {
|
|
127
|
+
topLevelTarget[first] ??= {};
|
|
128
|
+
target = topLevelTarget[first];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
for (prop of rest) {
|
|
132
|
+
target[prop] ??= {};
|
|
133
|
+
target = target[prop];
|
|
121
134
|
}
|
|
135
|
+
|
|
136
|
+
prop = final;
|
|
137
|
+
} else {
|
|
138
|
+
target = topLevelTarget;
|
|
139
|
+
prop = first;
|
|
122
140
|
}
|
|
141
|
+
} else {
|
|
142
|
+
prop = propPath;
|
|
123
143
|
}
|
|
124
144
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
145
|
+
const shouldDelay = declaration[2];
|
|
146
|
+
|
|
147
|
+
if (shouldDelay || transformKeys.has(prop)) {
|
|
148
|
+
/**
|
|
149
|
+
* We need to delay the resolution of this value until after all
|
|
150
|
+
* styles have been calculated. But another style might override
|
|
151
|
+
* this value. So we set a placeholder value and only override
|
|
152
|
+
* if the placeholder is preserved
|
|
153
|
+
*
|
|
154
|
+
* This also ensures the props exist, so setValue will properly
|
|
155
|
+
* mutate the props object and not create a new one
|
|
156
|
+
*/
|
|
157
|
+
const originalValue = value;
|
|
158
|
+
// This needs to be a object with the [prop] so we can discover in transform arrays
|
|
159
|
+
value = { [prop]: true };
|
|
160
|
+
|
|
161
|
+
if (transformKeys.has(prop)) {
|
|
162
|
+
transformStyles.push(() => {
|
|
163
|
+
value = resolveValue(originalValue, get, {
|
|
164
|
+
inlineVariables,
|
|
165
|
+
inheritedVariables,
|
|
166
|
+
renderGuards: guards,
|
|
167
|
+
calculateProps,
|
|
168
|
+
});
|
|
169
|
+
applyValue(target, prop, value);
|
|
170
|
+
});
|
|
171
|
+
} else {
|
|
140
172
|
delayedStyles.push(() => {
|
|
141
|
-
if (target
|
|
173
|
+
if (getDeepPath(target, prop) === value) {
|
|
142
174
|
delete target[prop];
|
|
143
175
|
value = resolveValue(originalValue, get, {
|
|
144
176
|
inlineVariables,
|
|
@@ -149,17 +181,17 @@ export function applyDeclarations(
|
|
|
149
181
|
applyValue(target, prop, value);
|
|
150
182
|
}
|
|
151
183
|
});
|
|
152
|
-
} else {
|
|
153
|
-
value = resolveValue(value, get, {
|
|
154
|
-
inlineVariables,
|
|
155
|
-
inheritedVariables,
|
|
156
|
-
renderGuards: guards,
|
|
157
|
-
calculateProps,
|
|
158
|
-
});
|
|
159
184
|
}
|
|
160
|
-
|
|
161
|
-
|
|
185
|
+
} else {
|
|
186
|
+
value = resolveValue(value, get, {
|
|
187
|
+
inlineVariables,
|
|
188
|
+
inheritedVariables,
|
|
189
|
+
renderGuards: guards,
|
|
190
|
+
calculateProps,
|
|
191
|
+
});
|
|
162
192
|
}
|
|
193
|
+
|
|
194
|
+
applyValue(target, prop, value);
|
|
163
195
|
}
|
|
164
196
|
}
|
|
165
197
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
4
|
+
const advancedTimingFunctions: Record<
|
|
5
|
+
string,
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
() => (...args: any[]) => unknown
|
|
8
|
+
> = {
|
|
9
|
+
cubicBezier: () => {
|
|
10
|
+
return (
|
|
11
|
+
require("react-native-reanimated") as typeof import("react-native-reanimated")
|
|
12
|
+
).cubicBezier;
|
|
13
|
+
},
|
|
14
|
+
steps: () => {
|
|
15
|
+
return (
|
|
16
|
+
require("react-native-reanimated") as typeof import("react-native-reanimated")
|
|
17
|
+
).steps;
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const timingFunctionResolver: StyleFunctionResolver = (resolveValue, value) => {
|
|
22
|
+
const name = value[1];
|
|
23
|
+
const resolver = advancedTimingFunctions[name];
|
|
24
|
+
|
|
25
|
+
if (!resolver) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const args = resolveValue(value[2]);
|
|
30
|
+
|
|
31
|
+
if (!Array.isArray(args)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const fn = resolver();
|
|
36
|
+
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
38
|
+
const result = fn(...args);
|
|
39
|
+
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const cubicBezier = timingFunctionResolver;
|
|
44
|
+
export const steps = timingFunctionResolver;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
2
|
+
|
|
3
|
+
interface Value {
|
|
4
|
+
value: number;
|
|
5
|
+
isPercent: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const precedence: Record<string, number> = { "+": 1, "-": 1, "*": 2, "/": 2 };
|
|
9
|
+
|
|
10
|
+
export const calc: StyleFunctionResolver = (resolveValue, func) => {
|
|
11
|
+
const tokens = resolveValue(func[2]);
|
|
12
|
+
|
|
13
|
+
if (!Array.isArray(tokens)) {
|
|
14
|
+
return tokens;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// --- Step 1: Convert to RPN (Shunting-Yard) ---
|
|
18
|
+
const output: (string | Value)[] = [];
|
|
19
|
+
const ops: string[] = [];
|
|
20
|
+
|
|
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 === "/") {
|
|
30
|
+
while (
|
|
31
|
+
ops.length &&
|
|
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)
|
|
38
|
+
) {
|
|
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
|
+
}
|
|
50
|
+
if (ops.pop() !== "(") return undefined; // mismatched parens
|
|
51
|
+
} else {
|
|
52
|
+
return undefined; // invalid token
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
while (ops.length) {
|
|
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);
|
|
63
|
+
}
|
|
64
|
+
|
|
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;
|
|
74
|
+
|
|
75
|
+
const res: Value = { value: 0, isPercent: false };
|
|
76
|
+
|
|
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
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (stack.length !== 1) return undefined;
|
|
110
|
+
|
|
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}%`;
|
|
115
|
+
}
|
|
116
|
+
return final.value;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
function round(number: number) {
|
|
120
|
+
return Math.round((number + Number.EPSILON) * 10000) / 10000;
|
|
121
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isStyleDescriptorArray } from "
|
|
2
|
-
import type { StyleFunctionResolver } from "
|
|
3
|
-
import { shorthandHandler } from "
|
|
1
|
+
import { isStyleDescriptorArray } from "../../../utils";
|
|
2
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
3
|
+
import { shorthandHandler } from "../shorthands/_handler";
|
|
4
4
|
|
|
5
5
|
export const blur: StyleFunctionResolver = (resolveValue, value) => {
|
|
6
6
|
const args = resolveValue(value[2]);
|