react-native-screen-transitions 2.0.6 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +100 -77
- package/lib/commonjs/components/{bounds-activator.js → bound-capture.js} +4 -4
- package/lib/commonjs/components/bound-capture.js.map +1 -0
- package/lib/commonjs/components/controllers/screen-lifecycle.js +18 -4
- package/lib/commonjs/components/controllers/screen-lifecycle.js.map +1 -1
- package/lib/commonjs/components/create-transition-aware-component.js +14 -12
- package/lib/commonjs/components/create-transition-aware-component.js.map +1 -1
- package/lib/commonjs/components/integrations/masked-view.js +52 -0
- package/lib/commonjs/components/integrations/masked-view.js.map +1 -0
- package/lib/commonjs/components/root-transition-aware.js +6 -15
- package/lib/commonjs/components/root-transition-aware.js.map +1 -1
- package/lib/commonjs/configs/index.js +4 -1
- package/lib/commonjs/configs/index.js.map +1 -1
- package/lib/commonjs/configs/presets.js +378 -7
- package/lib/commonjs/configs/presets.js.map +1 -1
- package/lib/commonjs/configs/specs.js +2 -1
- package/lib/commonjs/configs/specs.js.map +1 -1
- package/lib/commonjs/hooks/animation/use-associated-style.js +7 -10
- package/lib/commonjs/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/commonjs/hooks/animation/use-screen-animation.js +37 -37
- package/lib/commonjs/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/commonjs/hooks/bounds/use-bound-registry.js +73 -0
- package/lib/commonjs/hooks/bounds/use-bound-registry.js.map +1 -0
- package/lib/commonjs/hooks/gestures/use-build-gestures.js +156 -152
- package/lib/commonjs/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/commonjs/hooks/gestures/use-parent-gesture-registry.js +28 -0
- package/lib/commonjs/hooks/gestures/use-parent-gesture-registry.js.map +1 -0
- package/lib/commonjs/hooks/gestures/use-scroll-registry.js +146 -0
- package/lib/commonjs/hooks/gestures/use-scroll-registry.js.map +1 -0
- package/lib/commonjs/index.js +3 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js +7 -4
- package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/commonjs/providers/gestures.js +16 -16
- package/lib/commonjs/providers/gestures.js.map +1 -1
- package/lib/commonjs/providers/transition-styles.js +44 -0
- package/lib/commonjs/providers/transition-styles.js.map +1 -0
- package/lib/commonjs/stores/bounds.js +142 -1
- package/lib/commonjs/stores/bounds.js.map +1 -1
- package/lib/commonjs/stores/utils/reset-stores-for-screen.js +4 -2
- package/lib/commonjs/stores/utils/reset-stores-for-screen.js.map +1 -1
- package/lib/commonjs/types/gesture.js +11 -0
- package/lib/commonjs/types/gesture.js.map +1 -1
- package/lib/commonjs/utils/animation/derivations.js +39 -0
- package/lib/commonjs/utils/animation/derivations.js.map +1 -0
- package/lib/commonjs/utils/animation/run-transition.js +6 -2
- package/lib/commonjs/utils/animation/run-transition.js.map +1 -1
- package/lib/commonjs/utils/bounds/_utils/flatten-styles.js.map +1 -0
- package/lib/commonjs/utils/bounds/_utils/geometry.js +179 -0
- package/lib/commonjs/utils/bounds/_utils/geometry.js.map +1 -0
- package/lib/commonjs/utils/bounds/{get-bounds.js → _utils/get-bounds.js} +7 -9
- package/lib/commonjs/utils/bounds/_utils/get-bounds.js.map +1 -0
- package/lib/commonjs/utils/bounds/_utils/is-bounds-equal.js +19 -0
- package/lib/commonjs/utils/bounds/_utils/is-bounds-equal.js.map +1 -0
- package/lib/commonjs/utils/bounds/_utils/style-composers.js +201 -0
- package/lib/commonjs/utils/bounds/_utils/style-composers.js.map +1 -0
- package/lib/commonjs/utils/bounds/constants.js +14 -3
- package/lib/commonjs/utils/bounds/constants.js.map +1 -1
- package/lib/commonjs/utils/bounds/index.js +210 -17
- package/lib/commonjs/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/utils/gesture/apply-offset-rules.js +233 -0
- package/lib/commonjs/utils/gesture/apply-offset-rules.js.map +1 -0
- package/lib/commonjs/utils/gesture/check-gesture-activation.js +231 -0
- package/lib/commonjs/utils/gesture/check-gesture-activation.js.map +1 -0
- package/lib/commonjs/utils/gesture/determine-dismissal.js +98 -0
- package/lib/commonjs/utils/gesture/determine-dismissal.js.map +1 -0
- package/lib/module/components/{bounds-activator.js → bound-capture.js} +2 -2
- package/lib/module/components/bound-capture.js.map +1 -0
- package/lib/module/components/controllers/screen-lifecycle.js +18 -4
- package/lib/module/components/controllers/screen-lifecycle.js.map +1 -1
- package/lib/module/components/create-transition-aware-component.js +14 -12
- package/lib/module/components/create-transition-aware-component.js.map +1 -1
- package/lib/module/components/integrations/masked-view.js +48 -0
- package/lib/module/components/integrations/masked-view.js.map +1 -0
- package/lib/module/components/root-transition-aware.js +7 -16
- package/lib/module/components/root-transition-aware.js.map +1 -1
- package/lib/module/configs/index.js +6 -3
- package/lib/module/configs/index.js.map +1 -1
- package/lib/module/configs/presets.js +374 -6
- package/lib/module/configs/presets.js.map +1 -1
- package/lib/module/configs/specs.js +2 -1
- package/lib/module/configs/specs.js.map +1 -1
- package/lib/module/hooks/animation/use-associated-style.js +6 -10
- package/lib/module/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/module/hooks/animation/use-screen-animation.js +37 -37
- package/lib/module/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/module/hooks/bounds/use-bound-registry.js +68 -0
- package/lib/module/hooks/bounds/use-bound-registry.js.map +1 -0
- package/lib/module/hooks/gestures/use-build-gestures.js +156 -153
- package/lib/module/hooks/gestures/use-build-gestures.js.map +1 -1
- package/lib/module/hooks/gestures/use-parent-gesture-registry.js +23 -0
- package/lib/module/hooks/gestures/use-parent-gesture-registry.js.map +1 -0
- package/lib/module/hooks/gestures/use-scroll-registry.js +140 -0
- package/lib/module/hooks/gestures/use-scroll-registry.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/integrations/native-stack/views/NativeStackView.native.js +7 -4
- package/lib/module/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/module/providers/gestures.js +16 -16
- package/lib/module/providers/gestures.js.map +1 -1
- package/lib/module/providers/transition-styles.js +39 -0
- package/lib/module/providers/transition-styles.js.map +1 -0
- package/lib/module/stores/bounds.js +142 -1
- package/lib/module/stores/bounds.js.map +1 -1
- package/lib/module/stores/utils/reset-stores-for-screen.js +4 -2
- package/lib/module/stores/utils/reset-stores-for-screen.js.map +1 -1
- package/lib/module/types/gesture.js +7 -0
- package/lib/module/types/gesture.js.map +1 -1
- package/lib/module/utils/animation/derivations.js +34 -0
- package/lib/module/utils/animation/derivations.js.map +1 -0
- package/lib/module/utils/animation/run-transition.js +6 -2
- package/lib/module/utils/animation/run-transition.js.map +1 -1
- package/lib/module/utils/bounds/_utils/flatten-styles.js.map +1 -0
- package/lib/module/utils/bounds/_utils/geometry.js +174 -0
- package/lib/module/utils/bounds/_utils/geometry.js.map +1 -0
- package/lib/module/utils/bounds/{get-bounds.js → _utils/get-bounds.js} +7 -9
- package/lib/module/utils/bounds/_utils/get-bounds.js.map +1 -0
- package/lib/module/utils/bounds/_utils/is-bounds-equal.js +14 -0
- package/lib/module/utils/bounds/_utils/is-bounds-equal.js.map +1 -0
- package/lib/module/utils/bounds/_utils/style-composers.js +194 -0
- package/lib/module/utils/bounds/_utils/style-composers.js.map +1 -0
- package/lib/module/utils/bounds/constants.js +14 -3
- package/lib/module/utils/bounds/constants.js.map +1 -1
- package/lib/module/utils/bounds/index.js +208 -15
- package/lib/module/utils/bounds/index.js.map +1 -1
- package/lib/module/utils/gesture/apply-offset-rules.js +228 -0
- package/lib/module/utils/gesture/apply-offset-rules.js.map +1 -0
- package/lib/module/utils/gesture/check-gesture-activation.js +226 -0
- package/lib/module/utils/gesture/check-gesture-activation.js.map +1 -0
- package/lib/module/utils/gesture/determine-dismissal.js +93 -0
- package/lib/module/utils/gesture/determine-dismissal.js.map +1 -0
- package/lib/typescript/components/bound-capture.d.ts +8 -0
- package/lib/typescript/components/bound-capture.d.ts.map +1 -0
- package/lib/typescript/components/controllers/screen-lifecycle.d.ts.map +1 -1
- package/lib/typescript/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/components/integrations/masked-view.d.ts +6 -0
- package/lib/typescript/components/integrations/masked-view.d.ts.map +1 -0
- package/lib/typescript/components/root-transition-aware.d.ts +3 -3
- package/lib/typescript/components/root-transition-aware.d.ts.map +1 -1
- package/lib/typescript/configs/index.d.ts +3 -0
- package/lib/typescript/configs/index.d.ts.map +1 -1
- package/lib/typescript/configs/presets.d.ts +3 -0
- package/lib/typescript/configs/presets.d.ts.map +1 -1
- package/lib/typescript/configs/specs.d.ts.map +1 -1
- package/lib/typescript/hooks/animation/use-associated-style.d.ts +6 -4
- package/lib/typescript/hooks/animation/use-associated-style.d.ts.map +1 -1
- package/lib/typescript/hooks/animation/use-screen-animation.d.ts.map +1 -1
- package/lib/typescript/hooks/bounds/{use-bound-measurer.d.ts → use-bound-registry.d.ts} +5 -4
- package/lib/typescript/hooks/bounds/{use-bound-measurer.d.ts.map → use-bound-registry.d.ts.map} +1 -1
- package/lib/typescript/hooks/gestures/use-build-gestures.d.ts +6 -5
- package/lib/typescript/hooks/gestures/use-build-gestures.d.ts.map +1 -1
- package/lib/typescript/hooks/gestures/use-parent-gesture-registry.d.ts +6 -0
- package/lib/typescript/hooks/gestures/use-parent-gesture-registry.d.ts.map +1 -0
- package/lib/typescript/hooks/gestures/{use-scroll-progress.d.ts → use-scroll-registry.d.ts} +2 -2
- package/lib/typescript/hooks/gestures/use-scroll-registry.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +13 -8
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts.map +1 -1
- package/lib/typescript/providers/gestures.d.ts +4 -2
- package/lib/typescript/providers/gestures.d.ts.map +1 -1
- package/lib/typescript/providers/transition-styles.d.ts +8 -0
- package/lib/typescript/providers/transition-styles.d.ts.map +1 -0
- package/lib/typescript/stores/bounds.d.ts +11 -0
- package/lib/typescript/stores/bounds.d.ts.map +1 -1
- package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts +3 -1
- package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts.map +1 -1
- package/lib/typescript/types/bounds.d.ts +5 -1
- package/lib/typescript/types/bounds.d.ts.map +1 -1
- package/lib/typescript/types/gesture.d.ts +14 -0
- package/lib/typescript/types/gesture.d.ts.map +1 -1
- package/lib/typescript/types/navigator.d.ts +5 -1
- package/lib/typescript/types/navigator.d.ts.map +1 -1
- package/lib/typescript/utils/animation/derivations.d.ts +19 -0
- package/lib/typescript/utils/animation/derivations.d.ts.map +1 -0
- package/lib/typescript/utils/animation/run-transition.d.ts +2 -1
- package/lib/typescript/utils/animation/run-transition.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/_types/builder.d.ts +96 -14
- package/lib/typescript/utils/bounds/_types/builder.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/_types/geometry.d.ts +0 -1
- package/lib/typescript/utils/bounds/_types/geometry.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/_utils/flatten-styles.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/{geometry.d.ts → _utils/geometry.d.ts} +8 -5
- package/lib/typescript/utils/bounds/_utils/geometry.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/_utils/get-bounds.d.ts +4 -0
- package/lib/typescript/utils/bounds/_utils/get-bounds.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/_utils/is-bounds-equal.d.ts +7 -0
- package/lib/typescript/utils/bounds/_utils/is-bounds-equal.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/{style-composers.d.ts → _utils/style-composers.d.ts} +7 -10
- package/lib/typescript/utils/bounds/_utils/style-composers.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/constants.d.ts +5 -5
- package/lib/typescript/utils/bounds/constants.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/index.d.ts +2 -4
- package/lib/typescript/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/utils/gesture/apply-offset-rules.d.ts +38 -0
- package/lib/typescript/utils/gesture/apply-offset-rules.d.ts.map +1 -0
- package/lib/typescript/utils/gesture/check-gesture-activation.d.ts +38 -0
- package/lib/typescript/utils/gesture/check-gesture-activation.d.ts.map +1 -0
- package/lib/typescript/utils/gesture/determine-dismissal.d.ts +25 -0
- package/lib/typescript/utils/gesture/determine-dismissal.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/__tests__/geometry.test.ts +15 -12
- package/src/components/{bounds-activator.tsx → bound-capture.tsx} +1 -1
- package/src/components/controllers/screen-lifecycle.tsx +13 -5
- package/src/components/create-transition-aware-component.tsx +17 -11
- package/src/components/integrations/masked-view.tsx +56 -0
- package/src/components/root-transition-aware.tsx +31 -39
- package/src/configs/index.ts +20 -8
- package/src/configs/presets.ts +401 -6
- package/src/configs/specs.ts +1 -0
- package/src/hooks/animation/use-associated-style.tsx +12 -11
- package/src/hooks/animation/use-screen-animation.tsx +48 -49
- package/src/hooks/bounds/{use-bound-measurer.tsx → use-bound-registry.tsx} +32 -20
- package/src/hooks/gestures/use-build-gestures.tsx +193 -228
- package/src/hooks/gestures/use-parent-gesture-registry.tsx +18 -0
- package/src/hooks/gestures/use-scroll-registry.tsx +145 -0
- package/src/index.ts +2 -0
- package/src/integrations/native-stack/views/NativeStackView.native.tsx +8 -5
- package/src/providers/gestures.tsx +19 -22
- package/src/providers/transition-styles.tsx +52 -0
- package/src/stores/bounds.ts +156 -0
- package/src/stores/utils/reset-stores-for-screen.ts +7 -2
- package/src/types/bounds.ts +8 -1
- package/src/types/gesture.ts +19 -0
- package/src/types/navigator.ts +5 -1
- package/src/utils/animation/derivations.ts +38 -0
- package/src/utils/animation/run-transition.ts +4 -1
- package/src/utils/bounds/_types/builder.ts +127 -11
- package/src/utils/bounds/_types/geometry.ts +0 -1
- package/src/utils/bounds/_utils/geometry.ts +166 -0
- package/src/utils/bounds/_utils/get-bounds.ts +54 -0
- package/src/utils/bounds/_utils/is-bounds-equal.ts +24 -0
- package/src/utils/bounds/_utils/style-composers.ts +216 -0
- package/src/utils/bounds/constants.ts +37 -22
- package/src/utils/bounds/index.ts +269 -19
- package/src/utils/gesture/apply-offset-rules.ts +314 -0
- package/src/utils/gesture/check-gesture-activation.ts +310 -0
- package/src/utils/gesture/determine-dismissal.ts +131 -0
- package/lib/commonjs/components/bounds-activator.js.map +0 -1
- package/lib/commonjs/hooks/bounds/use-bound-measurer.js +0 -52
- package/lib/commonjs/hooks/bounds/use-bound-measurer.js.map +0 -1
- package/lib/commonjs/hooks/gestures/use-scroll-progress.js +0 -57
- package/lib/commonjs/hooks/gestures/use-scroll-progress.js.map +0 -1
- package/lib/commonjs/utils/bounds/build-bound-styles.js +0 -145
- package/lib/commonjs/utils/bounds/build-bound-styles.js.map +0 -1
- package/lib/commonjs/utils/bounds/flatten-styles.js.map +0 -1
- package/lib/commonjs/utils/bounds/geometry.js +0 -94
- package/lib/commonjs/utils/bounds/geometry.js.map +0 -1
- package/lib/commonjs/utils/bounds/get-bounds.js.map +0 -1
- package/lib/commonjs/utils/bounds/style-composers.js +0 -199
- package/lib/commonjs/utils/bounds/style-composers.js.map +0 -1
- package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js +0 -81
- package/lib/commonjs/utils/gesture/apply-gesture-activation-criteria.js.map +0 -1
- package/lib/commonjs/utils/gesture/normalize-gesture-translation.js +0 -21
- package/lib/commonjs/utils/gesture/normalize-gesture-translation.js.map +0 -1
- package/lib/module/components/bounds-activator.js.map +0 -1
- package/lib/module/hooks/bounds/use-bound-measurer.js +0 -47
- package/lib/module/hooks/bounds/use-bound-measurer.js.map +0 -1
- package/lib/module/hooks/gestures/use-scroll-progress.js +0 -52
- package/lib/module/hooks/gestures/use-scroll-progress.js.map +0 -1
- package/lib/module/utils/bounds/build-bound-styles.js +0 -141
- package/lib/module/utils/bounds/build-bound-styles.js.map +0 -1
- package/lib/module/utils/bounds/flatten-styles.js.map +0 -1
- package/lib/module/utils/bounds/geometry.js +0 -89
- package/lib/module/utils/bounds/geometry.js.map +0 -1
- package/lib/module/utils/bounds/get-bounds.js.map +0 -1
- package/lib/module/utils/bounds/style-composers.js +0 -191
- package/lib/module/utils/bounds/style-composers.js.map +0 -1
- package/lib/module/utils/gesture/apply-gesture-activation-criteria.js +0 -76
- package/lib/module/utils/gesture/apply-gesture-activation-criteria.js.map +0 -1
- package/lib/module/utils/gesture/normalize-gesture-translation.js +0 -16
- package/lib/module/utils/gesture/normalize-gesture-translation.js.map +0 -1
- package/lib/typescript/components/bounds-activator.d.ts +0 -8
- package/lib/typescript/components/bounds-activator.d.ts.map +0 -1
- package/lib/typescript/hooks/gestures/use-scroll-progress.d.ts.map +0 -1
- package/lib/typescript/utils/bounds/build-bound-styles.d.ts +0 -4
- package/lib/typescript/utils/bounds/build-bound-styles.d.ts.map +0 -1
- package/lib/typescript/utils/bounds/flatten-styles.d.ts.map +0 -1
- package/lib/typescript/utils/bounds/geometry.d.ts.map +0 -1
- package/lib/typescript/utils/bounds/get-bounds.d.ts +0 -4
- package/lib/typescript/utils/bounds/get-bounds.d.ts.map +0 -1
- package/lib/typescript/utils/bounds/style-composers.d.ts.map +0 -1
- package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts +0 -17
- package/lib/typescript/utils/gesture/apply-gesture-activation-criteria.d.ts.map +0 -1
- package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts +0 -6
- package/lib/typescript/utils/gesture/normalize-gesture-translation.d.ts.map +0 -1
- package/src/hooks/gestures/use-scroll-progress.tsx +0 -60
- package/src/utils/bounds/build-bound-styles.ts +0 -184
- package/src/utils/bounds/geometry.ts +0 -113
- package/src/utils/bounds/get-bounds.ts +0 -56
- package/src/utils/bounds/style-composers.ts +0 -172
- package/src/utils/gesture/apply-gesture-activation-criteria.ts +0 -109
- package/src/utils/gesture/normalize-gesture-translation.ts +0 -20
- /package/lib/commonjs/utils/bounds/{flatten-styles.js → _utils/flatten-styles.js} +0 -0
- /package/lib/module/utils/bounds/{flatten-styles.js → _utils/flatten-styles.js} +0 -0
- /package/lib/typescript/utils/bounds/{flatten-styles.d.ts → _utils/flatten-styles.d.ts} +0 -0
- /package/src/utils/bounds/{flatten-styles.ts → _utils/flatten-styles.ts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-bounds.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/get-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAc3D,eAAO,MAAM,SAAS,GAAI,OAAO,eAAe,KAAG,UAuClD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"style-composers.d.ts","sourceRoot":"","sources":["../../../../src/utils/bounds/style-composers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EACX,wBAAwB,EACxB,gBAAgB,EAChB,MAAM,mBAAmB,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,kBAAkB,CAAC;IACxB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,oBAAoB,CAAC;CACrC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,kBAAkB,CAAC;IACxB,QAAQ,EAAE,wBAAwB,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,oBAAoB,CAAC;CACrC,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CAuB5E;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CAuB5E;AAED,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,oBAAoB,GAC1B,UAAU,CAuBZ;AAED,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,oBAAoB,GAC1B,UAAU,CA2BZ;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU,CAsB5E"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { PanGesture } from "react-native-gesture-handler";
|
|
2
|
-
import type { ScreenTransitionConfig } from "../../types/navigator";
|
|
3
|
-
interface GestureActivationOptions {
|
|
4
|
-
gestureDirection: ScreenTransitionConfig["gestureDirection"] | Array<ScreenTransitionConfig["gestureDirection"]>;
|
|
5
|
-
gestureResponseDistance: number;
|
|
6
|
-
panGesture: PanGesture;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* rngh requires this type instead a number[]. We're returning a num[] which is still correct, this is just to remove the type error.
|
|
10
|
-
*/
|
|
11
|
-
type OffsetErrorTypeBugFix = [start: number, end: number];
|
|
12
|
-
export declare const applyGestureActivationCriteria: ({ gestureDirection, gestureResponseDistance, panGesture, }: GestureActivationOptions) => import("react-native-gesture-handler/lib/typescript/handlers/gestures/panGesture").PanGesture | {
|
|
13
|
-
activeOffsetX: OffsetErrorTypeBugFix;
|
|
14
|
-
activeOffsetY: OffsetErrorTypeBugFix;
|
|
15
|
-
};
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=apply-gesture-activation-criteria.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apply-gesture-activation-criteria.d.ts","sourceRoot":"","sources":["../../../../src/utils/gesture/apply-gesture-activation-criteria.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEpE,UAAU,wBAAwB;IACjC,gBAAgB,EACb,sBAAsB,CAAC,kBAAkB,CAAC,GAC1C,KAAK,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACrD,uBAAuB,EAAE,MAAM,CAAC;IAChC,UAAU,EAAE,UAAU,CAAC;CACvB;AAED;;GAEG;AACH,KAAK,qBAAqB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AAE1D,eAAO,MAAM,8BAA8B,GAAI,4DAI5C,wBAAwB;mBAUnB,qBAAqB;mBAIrB,qBAAqB;CA0E5B,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { GestureDirection } from "../../types/gesture";
|
|
2
|
-
/**
|
|
3
|
-
* Utility function to normalize gesture translation based on direction.
|
|
4
|
-
*/
|
|
5
|
-
export declare const normalizeGestureTranslation: (translation: number, gestureDirection: GestureDirection) => number;
|
|
6
|
-
//# sourceMappingURL=normalize-gesture-translation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-gesture-translation.d.ts","sourceRoot":"","sources":["../../../../src/utils/gesture/normalize-gesture-translation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,2BAA2B,GACvC,aAAa,MAAM,EACnB,kBAAkB,gBAAgB,WAYlC,CAAC"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import type { LayoutChangeEvent } from "react-native";
|
|
3
|
-
import { useAnimatedScrollHandler } from "react-native-reanimated";
|
|
4
|
-
import type { ReanimatedScrollEvent } from "react-native-reanimated/lib/typescript/hook/commonTypes";
|
|
5
|
-
import { useGestureContext } from "../../providers/gestures";
|
|
6
|
-
|
|
7
|
-
interface ScrollProgressHookProps {
|
|
8
|
-
onScroll?: (event: ReanimatedScrollEvent) => void;
|
|
9
|
-
onContentSizeChange?: (width: number, height: number) => void;
|
|
10
|
-
onLayout?: (event: LayoutChangeEvent) => void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const useScrollProgress = (props: ScrollProgressHookProps) => {
|
|
14
|
-
const { scrollProgress } = useGestureContext();
|
|
15
|
-
const scrollHandler = useAnimatedScrollHandler({
|
|
16
|
-
onScroll: (event) => {
|
|
17
|
-
props.onScroll?.(event);
|
|
18
|
-
scrollProgress.modify((v) => {
|
|
19
|
-
"worklet";
|
|
20
|
-
v.x = event.contentOffset.x;
|
|
21
|
-
v.y = event.contentOffset.y;
|
|
22
|
-
return v;
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const onContentSizeChange = useCallback(
|
|
28
|
-
(width: number, height: number) => {
|
|
29
|
-
props.onContentSizeChange?.(width, height);
|
|
30
|
-
|
|
31
|
-
scrollProgress.modify((v) => {
|
|
32
|
-
"worklet";
|
|
33
|
-
v.contentWidth = width;
|
|
34
|
-
v.contentHeight = height;
|
|
35
|
-
return v;
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
[scrollProgress, props.onContentSizeChange],
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const onLayout = useCallback(
|
|
42
|
-
(event: LayoutChangeEvent) => {
|
|
43
|
-
props.onLayout?.(event);
|
|
44
|
-
const { width, height } = event.nativeEvent.layout;
|
|
45
|
-
scrollProgress.modify((v) => {
|
|
46
|
-
"worklet";
|
|
47
|
-
v.layoutHeight = height;
|
|
48
|
-
v.layoutWidth = width;
|
|
49
|
-
return v;
|
|
50
|
-
});
|
|
51
|
-
},
|
|
52
|
-
[scrollProgress, props.onLayout],
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
scrollHandler,
|
|
57
|
-
onContentSizeChange,
|
|
58
|
-
onLayout,
|
|
59
|
-
};
|
|
60
|
-
};
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import type { ScaledSize } from "react-native";
|
|
2
|
-
import { interpolate, type MeasuredDimensions } from "react-native-reanimated";
|
|
3
|
-
import type { ScreenTransitionState } from "../../types/animation";
|
|
4
|
-
import type { BoundsBuilder } from "../../types/bounds";
|
|
5
|
-
import type { ScreenPhase } from "../../types/core";
|
|
6
|
-
import type {
|
|
7
|
-
BoundsBuilderInitParams,
|
|
8
|
-
BoundsBuilderOptions,
|
|
9
|
-
} from "./_types/builder";
|
|
10
|
-
import { DEFAULT_BUILDER_OPTIONS, FULLSCREEN_DIMENSIONS } from "./constants";
|
|
11
|
-
import {
|
|
12
|
-
computeContentTransformGeometry,
|
|
13
|
-
computeRelativeGeometry,
|
|
14
|
-
} from "./geometry";
|
|
15
|
-
import {
|
|
16
|
-
composeContentStyle,
|
|
17
|
-
composeSizeAbsolute,
|
|
18
|
-
composeSizeRelative,
|
|
19
|
-
composeTransformAbsolute,
|
|
20
|
-
composeTransformRelative,
|
|
21
|
-
type ElementComposeParams,
|
|
22
|
-
} from "./style-composers";
|
|
23
|
-
|
|
24
|
-
function resolveBounds(props: {
|
|
25
|
-
id: string;
|
|
26
|
-
previous?: ScreenTransitionState;
|
|
27
|
-
current?: ScreenTransitionState;
|
|
28
|
-
next?: ScreenTransitionState;
|
|
29
|
-
toRect?: Partial<MeasuredDimensions>;
|
|
30
|
-
dimensions: ScaledSize;
|
|
31
|
-
computeOptions: BoundsBuilderOptions;
|
|
32
|
-
}) {
|
|
33
|
-
"worklet";
|
|
34
|
-
const entering = !props.next;
|
|
35
|
-
|
|
36
|
-
const fullscreen = FULLSCREEN_DIMENSIONS(props.dimensions);
|
|
37
|
-
|
|
38
|
-
const startPhase: ScreenPhase = entering ? "previous" : "current";
|
|
39
|
-
const endPhase: ScreenPhase = entering ? "current" : "next";
|
|
40
|
-
|
|
41
|
-
const resolve = (phase?: ScreenPhase) => {
|
|
42
|
-
"worklet";
|
|
43
|
-
if (phase === "previous") return props.previous?.bounds?.[props.id]?.bounds;
|
|
44
|
-
if (phase === "current") return props.current?.bounds?.[props.id]?.bounds;
|
|
45
|
-
if (phase === "next") return props.next?.bounds?.[props.id]?.bounds;
|
|
46
|
-
return null;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const start = resolve(startPhase);
|
|
50
|
-
let end = resolve(endPhase);
|
|
51
|
-
|
|
52
|
-
if (props.computeOptions.toFullscreen) {
|
|
53
|
-
end = fullscreen;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
start,
|
|
58
|
-
end,
|
|
59
|
-
entering,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const computeBoundStyles = (
|
|
64
|
-
{
|
|
65
|
-
id,
|
|
66
|
-
previous,
|
|
67
|
-
current,
|
|
68
|
-
next,
|
|
69
|
-
progress,
|
|
70
|
-
dimensions,
|
|
71
|
-
}: BoundsBuilderInitParams,
|
|
72
|
-
computeOptions: BoundsBuilderOptions = {},
|
|
73
|
-
) => {
|
|
74
|
-
"worklet";
|
|
75
|
-
if (!id) return {};
|
|
76
|
-
|
|
77
|
-
const { start, end, entering } = resolveBounds({
|
|
78
|
-
id,
|
|
79
|
-
previous,
|
|
80
|
-
current,
|
|
81
|
-
next,
|
|
82
|
-
computeOptions: computeOptions,
|
|
83
|
-
dimensions,
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
if (!start || !end) return {};
|
|
87
|
-
|
|
88
|
-
const relativeGeometry = computeRelativeGeometry({ start, end, entering });
|
|
89
|
-
|
|
90
|
-
const interp = (a: number, b: number) =>
|
|
91
|
-
interpolate(progress, relativeGeometry.ranges, [a, b]);
|
|
92
|
-
|
|
93
|
-
const common: ElementComposeParams = {
|
|
94
|
-
start,
|
|
95
|
-
end,
|
|
96
|
-
interp,
|
|
97
|
-
geometry: relativeGeometry,
|
|
98
|
-
computeOptions,
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const isSize = computeOptions.method === "size";
|
|
102
|
-
const isAbs = !!computeOptions.absolute;
|
|
103
|
-
|
|
104
|
-
if (computeOptions.method === "content") {
|
|
105
|
-
const contentGeometry = computeContentTransformGeometry({
|
|
106
|
-
start,
|
|
107
|
-
end,
|
|
108
|
-
entering,
|
|
109
|
-
dimensions,
|
|
110
|
-
contentScaleMode: computeOptions.contentScaleMode ?? "auto",
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
return composeContentStyle({
|
|
114
|
-
...common,
|
|
115
|
-
geometry: contentGeometry,
|
|
116
|
-
computeOptions,
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return isSize
|
|
121
|
-
? isAbs
|
|
122
|
-
? composeSizeAbsolute(common)
|
|
123
|
-
: composeSizeRelative(common)
|
|
124
|
-
: isAbs
|
|
125
|
-
? composeTransformAbsolute(common)
|
|
126
|
-
: composeTransformRelative(common);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
export function buildBoundStyles(
|
|
130
|
-
params: BoundsBuilderInitParams,
|
|
131
|
-
): BoundsBuilder {
|
|
132
|
-
"worklet";
|
|
133
|
-
|
|
134
|
-
const cfg: { options: BoundsBuilderOptions } = {
|
|
135
|
-
options: { ...DEFAULT_BUILDER_OPTIONS },
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const builder = (): BoundsBuilder => ({
|
|
139
|
-
gestures: (options) => {
|
|
140
|
-
cfg.options.gestures = options;
|
|
141
|
-
return builder();
|
|
142
|
-
},
|
|
143
|
-
toFullscreen: () => {
|
|
144
|
-
cfg.options.toFullscreen = true;
|
|
145
|
-
return builder();
|
|
146
|
-
},
|
|
147
|
-
absolute: () => {
|
|
148
|
-
cfg.options.absolute = true;
|
|
149
|
-
cfg.options.relative = false;
|
|
150
|
-
return builder();
|
|
151
|
-
},
|
|
152
|
-
relative: () => {
|
|
153
|
-
cfg.options.relative = true;
|
|
154
|
-
cfg.options.absolute = false;
|
|
155
|
-
return builder();
|
|
156
|
-
},
|
|
157
|
-
transform: () => {
|
|
158
|
-
cfg.options.method = "transform";
|
|
159
|
-
return builder();
|
|
160
|
-
},
|
|
161
|
-
size: () => {
|
|
162
|
-
cfg.options.method = "size";
|
|
163
|
-
return builder();
|
|
164
|
-
},
|
|
165
|
-
content: () => {
|
|
166
|
-
cfg.options.method = "content";
|
|
167
|
-
return builder();
|
|
168
|
-
},
|
|
169
|
-
contentFill: () => {
|
|
170
|
-
cfg.options.contentScaleMode = "aspectFill";
|
|
171
|
-
return builder();
|
|
172
|
-
},
|
|
173
|
-
contentFit: () => {
|
|
174
|
-
cfg.options.contentScaleMode = "aspectFit";
|
|
175
|
-
return builder();
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
build: () => {
|
|
179
|
-
return computeBoundStyles(params, cfg.options);
|
|
180
|
-
},
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
return builder();
|
|
184
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import type { ScaledSize } from "react-native";
|
|
2
|
-
import type { MeasuredDimensions } from "react-native-reanimated";
|
|
3
|
-
import type { BoundsBuilderOptions } from "./_types/builder";
|
|
4
|
-
import type {
|
|
5
|
-
ContentTransformGeometry,
|
|
6
|
-
RelativeGeometry,
|
|
7
|
-
} from "./_types/geometry";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Relative geometry between start/end bounds.
|
|
11
|
-
*/
|
|
12
|
-
export function computeRelativeGeometry({
|
|
13
|
-
start,
|
|
14
|
-
end,
|
|
15
|
-
entering,
|
|
16
|
-
}: {
|
|
17
|
-
start: MeasuredDimensions;
|
|
18
|
-
end: MeasuredDimensions;
|
|
19
|
-
entering: boolean;
|
|
20
|
-
}): RelativeGeometry {
|
|
21
|
-
"worklet";
|
|
22
|
-
const startCenterX = start.pageX + start.width / 2;
|
|
23
|
-
const startCenterY = start.pageY + start.height / 2;
|
|
24
|
-
const endCenterX = end.pageX + end.width / 2;
|
|
25
|
-
const endCenterY = end.pageY + end.height / 2;
|
|
26
|
-
|
|
27
|
-
const dx = startCenterX - endCenterX;
|
|
28
|
-
const dy = startCenterY - endCenterY;
|
|
29
|
-
|
|
30
|
-
const scaleX = start.width / end.width;
|
|
31
|
-
const scaleY = start.height / end.height;
|
|
32
|
-
|
|
33
|
-
const ranges: readonly [number, number] = entering ? [0, 1] : [1, 2];
|
|
34
|
-
|
|
35
|
-
return { dx, dy, scaleX, scaleY, ranges, entering };
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Computes the transform to apply to the entire destination screen so that
|
|
39
|
-
* its bound (end) matches the source bound (start) at progress start.
|
|
40
|
-
*/
|
|
41
|
-
export function computeContentTransformGeometry({
|
|
42
|
-
start,
|
|
43
|
-
end,
|
|
44
|
-
entering,
|
|
45
|
-
dimensions,
|
|
46
|
-
contentScaleMode,
|
|
47
|
-
}: {
|
|
48
|
-
start: MeasuredDimensions;
|
|
49
|
-
end: MeasuredDimensions;
|
|
50
|
-
entering: boolean;
|
|
51
|
-
dimensions: ScaledSize;
|
|
52
|
-
contentScaleMode: BoundsBuilderOptions["contentScaleMode"];
|
|
53
|
-
}): ContentTransformGeometry {
|
|
54
|
-
"worklet";
|
|
55
|
-
|
|
56
|
-
const parent = {
|
|
57
|
-
x: 0,
|
|
58
|
-
y: 0,
|
|
59
|
-
width: dimensions.width,
|
|
60
|
-
height: dimensions.height,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const startCenterX = start.pageX + start.width / 2;
|
|
64
|
-
const startCenterY = start.pageY + start.height / 2;
|
|
65
|
-
|
|
66
|
-
const childCenterX = end.pageX + end.width / 2;
|
|
67
|
-
const childCenterY = end.pageY + end.height / 2;
|
|
68
|
-
|
|
69
|
-
const parentCenterX = parent.x + parent.width / 2;
|
|
70
|
-
const parentCenterY = parent.y + parent.height / 2;
|
|
71
|
-
|
|
72
|
-
const safe = (v: number) => (v === 0 ? 1e-6 : v);
|
|
73
|
-
|
|
74
|
-
const sx = safe(start.width) / safe(end.width);
|
|
75
|
-
const sy = safe(start.height) / safe(end.height);
|
|
76
|
-
|
|
77
|
-
let s: number;
|
|
78
|
-
|
|
79
|
-
if (contentScaleMode === "aspectFit") {
|
|
80
|
-
s = Math.min(sx, sy);
|
|
81
|
-
} else if (contentScaleMode === "aspectFill") {
|
|
82
|
-
s = Math.max(sx, sy);
|
|
83
|
-
} else {
|
|
84
|
-
const startAspect = start.width / start.height;
|
|
85
|
-
const endAspect = end.width / end.height;
|
|
86
|
-
const aspectDifference = Math.abs(startAspect - endAspect);
|
|
87
|
-
|
|
88
|
-
if (aspectDifference < 0.1) {
|
|
89
|
-
s = Math.max(sx, sy);
|
|
90
|
-
} else {
|
|
91
|
-
s = Math.min(sx, sy);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const offsetX = startCenterX - parentCenterX;
|
|
96
|
-
const offsetY = startCenterY - parentCenterY;
|
|
97
|
-
|
|
98
|
-
const centerOffsetX = (parentCenterX - childCenterX) * s;
|
|
99
|
-
const centerOffsetY = (parentCenterY - childCenterY) * s;
|
|
100
|
-
|
|
101
|
-
const tx = offsetX + centerOffsetX;
|
|
102
|
-
const ty = offsetY + centerOffsetY;
|
|
103
|
-
|
|
104
|
-
const ranges: readonly [number, number] = entering ? [0, 1] : [1, 2];
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
tx,
|
|
108
|
-
ty,
|
|
109
|
-
s,
|
|
110
|
-
ranges,
|
|
111
|
-
entering,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { BoundEntry } from '../../types/bounds';
|
|
2
|
-
|
|
3
|
-
import type { GetBoundsParams } from './_types/get-bounds';
|
|
4
|
-
|
|
5
|
-
const fallbackBounds = {
|
|
6
|
-
bounds: {
|
|
7
|
-
width: 0,
|
|
8
|
-
height: 0,
|
|
9
|
-
x: 0,
|
|
10
|
-
y: 0,
|
|
11
|
-
pageX: 0,
|
|
12
|
-
pageY: 0,
|
|
13
|
-
},
|
|
14
|
-
styles: {},
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const getBounds = (props: GetBoundsParams): BoundEntry => {
|
|
18
|
-
'worklet';
|
|
19
|
-
const boundId = props.id;
|
|
20
|
-
const phase = props.phase;
|
|
21
|
-
|
|
22
|
-
if (phase && boundId) {
|
|
23
|
-
let phaseBounds = null;
|
|
24
|
-
|
|
25
|
-
if (phase === 'current') {
|
|
26
|
-
phaseBounds = props.current?.bounds[boundId];
|
|
27
|
-
} else if (phase === 'next') {
|
|
28
|
-
phaseBounds = props.next?.bounds[boundId];
|
|
29
|
-
} else {
|
|
30
|
-
phaseBounds = props.previous?.bounds[boundId];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (!phaseBounds) {
|
|
34
|
-
return fallbackBounds;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
bounds: phaseBounds.bounds,
|
|
39
|
-
styles: phaseBounds?.styles,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (!props.next && boundId) {
|
|
44
|
-
const previousBounds = props.previous?.bounds[boundId];
|
|
45
|
-
|
|
46
|
-
return previousBounds || fallbackBounds;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (boundId) {
|
|
50
|
-
const nextBounds = props.next?.bounds[boundId];
|
|
51
|
-
|
|
52
|
-
return nextBounds || fallbackBounds;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return fallbackBounds;
|
|
56
|
-
};
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import type { MeasuredDimensions, StyleProps } from "react-native-reanimated";
|
|
2
|
-
import type { BoundsBuilderOptions } from "./_types/builder";
|
|
3
|
-
import type {
|
|
4
|
-
ContentTransformGeometry,
|
|
5
|
-
RelativeGeometry,
|
|
6
|
-
} from "./_types/geometry";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Common interpolation helper signature used by composers.
|
|
10
|
-
* It maps from a -> b over the already-determined progress range.
|
|
11
|
-
*/
|
|
12
|
-
export type Interp = (a: number, b: number) => number;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Element-level (relative) params shared by size/transform composers.
|
|
16
|
-
* - start/end: absolute window bounds of the element in previous/next phases
|
|
17
|
-
* - geometry: relative deltas and scales between start/end (dx, dy, scaleX, scaleY, ...)
|
|
18
|
-
* - interp: function to interpolate between numbers using the correct progress range
|
|
19
|
-
*/
|
|
20
|
-
export type ElementComposeParams = {
|
|
21
|
-
start: MeasuredDimensions;
|
|
22
|
-
end: MeasuredDimensions;
|
|
23
|
-
geometry: RelativeGeometry;
|
|
24
|
-
interp: Interp;
|
|
25
|
-
computeOptions: BoundsBuilderOptions;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Screen-level content transform params (for aligning destination bound to source).
|
|
30
|
-
* - start/end: absolute window bounds for the shared id (source/destination)
|
|
31
|
-
* - geometry: precomputed screen-level tx/ty/sx/sy plus ranges/entering
|
|
32
|
-
* - interp: function to interpolate between numbers using the correct progress range
|
|
33
|
-
*/
|
|
34
|
-
export type ContentComposeParams = {
|
|
35
|
-
start: MeasuredDimensions;
|
|
36
|
-
end: MeasuredDimensions;
|
|
37
|
-
geometry: ContentTransformGeometry;
|
|
38
|
-
interp: Interp;
|
|
39
|
-
computeOptions: BoundsBuilderOptions;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export function composeSizeAbsolute(params: ElementComposeParams): StyleProps {
|
|
43
|
-
"worklet";
|
|
44
|
-
const { start, end, geometry, interp } = params;
|
|
45
|
-
|
|
46
|
-
if (geometry.entering) {
|
|
47
|
-
return {
|
|
48
|
-
width: interp(start.width, end.width),
|
|
49
|
-
height: interp(start.height, end.height),
|
|
50
|
-
transform: [
|
|
51
|
-
{ translateX: interp(start.pageX, end.pageX) },
|
|
52
|
-
{ translateY: interp(start.pageY, end.pageY) },
|
|
53
|
-
],
|
|
54
|
-
} satisfies StyleProps;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return {
|
|
58
|
-
width: interp(end.width, start.width),
|
|
59
|
-
height: interp(end.height, start.height),
|
|
60
|
-
transform: [
|
|
61
|
-
{ translateX: interp(end.pageX, start.pageX) },
|
|
62
|
-
{ translateY: interp(end.pageY, start.pageY) },
|
|
63
|
-
],
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function composeSizeRelative(params: ElementComposeParams): StyleProps {
|
|
68
|
-
"worklet";
|
|
69
|
-
const { start, end, geometry, interp } = params;
|
|
70
|
-
|
|
71
|
-
if (geometry.entering) {
|
|
72
|
-
return {
|
|
73
|
-
transform: [
|
|
74
|
-
{ translateX: interp(geometry.dx, 0) },
|
|
75
|
-
{ translateY: interp(geometry.dy, 0) },
|
|
76
|
-
],
|
|
77
|
-
width: interp(start.width, end.width),
|
|
78
|
-
height: interp(start.height, end.height),
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
transform: [
|
|
84
|
-
{ translateX: interp(0, -geometry.dx) },
|
|
85
|
-
{ translateY: interp(0, -geometry.dy) },
|
|
86
|
-
],
|
|
87
|
-
width: interp(end.width, start.width),
|
|
88
|
-
height: interp(end.height, start.height),
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function composeTransformAbsolute(
|
|
93
|
-
params: ElementComposeParams,
|
|
94
|
-
): StyleProps {
|
|
95
|
-
"worklet";
|
|
96
|
-
const { start, end, geometry, interp } = params;
|
|
97
|
-
|
|
98
|
-
if (geometry.entering) {
|
|
99
|
-
return {
|
|
100
|
-
transform: [
|
|
101
|
-
{ translateX: interp(start.pageX, end.pageX) },
|
|
102
|
-
{ translateY: interp(start.pageY, end.pageY) },
|
|
103
|
-
{ scaleX: interp(geometry.scaleX, 1) },
|
|
104
|
-
{ scaleY: interp(geometry.scaleY, 1) },
|
|
105
|
-
],
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return {
|
|
110
|
-
transform: [
|
|
111
|
-
{ translateX: interp(end.pageX, start.pageX) },
|
|
112
|
-
{ translateY: interp(end.pageY, start.pageY) },
|
|
113
|
-
{ scaleX: interp(1, 1 / geometry.scaleX) },
|
|
114
|
-
{ scaleY: interp(1, 1 / geometry.scaleY) },
|
|
115
|
-
],
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export function composeTransformRelative(
|
|
120
|
-
params: ElementComposeParams,
|
|
121
|
-
): StyleProps {
|
|
122
|
-
"worklet";
|
|
123
|
-
const { geometry, computeOptions, interp } = params;
|
|
124
|
-
|
|
125
|
-
if (geometry.entering) {
|
|
126
|
-
return {
|
|
127
|
-
transform: [
|
|
128
|
-
{ translateX: computeOptions.gestures?.x ?? 0 },
|
|
129
|
-
{ translateY: computeOptions.gestures?.y ?? 0 },
|
|
130
|
-
{ translateX: interp(geometry.dx, 0) },
|
|
131
|
-
{ translateY: interp(geometry.dy, 0) },
|
|
132
|
-
{ scaleX: interp(geometry.scaleX, 1) },
|
|
133
|
-
{ scaleY: interp(geometry.scaleY, 1) },
|
|
134
|
-
],
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return {
|
|
139
|
-
transform: [
|
|
140
|
-
{ translateX: computeOptions.gestures?.x ?? 0 },
|
|
141
|
-
{ translateY: computeOptions.gestures?.y ?? 0 },
|
|
142
|
-
{ translateX: interp(0, -geometry.dx) },
|
|
143
|
-
{ translateY: interp(0, -geometry.dy) },
|
|
144
|
-
{ scaleX: interp(1, 1 / geometry.scaleX) },
|
|
145
|
-
{ scaleY: interp(1, 1 / geometry.scaleY) },
|
|
146
|
-
],
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export function composeContentStyle(params: ContentComposeParams): StyleProps {
|
|
151
|
-
"worklet";
|
|
152
|
-
const { geometry, interp } = params;
|
|
153
|
-
const { s, tx, ty, entering } = geometry;
|
|
154
|
-
|
|
155
|
-
if (entering) {
|
|
156
|
-
return {
|
|
157
|
-
transform: [
|
|
158
|
-
{ translateX: interp(tx, 0) },
|
|
159
|
-
{ translateY: interp(ty, 0) },
|
|
160
|
-
{ scale: interp(s, 1) },
|
|
161
|
-
],
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return {
|
|
166
|
-
transform: [
|
|
167
|
-
{ translateX: interp(0, tx) },
|
|
168
|
-
{ translateY: interp(0, ty) },
|
|
169
|
-
{ scale: interp(1, s) },
|
|
170
|
-
],
|
|
171
|
-
};
|
|
172
|
-
}
|