react-native-screen-transitions 3.4.0-alpha.7 → 3.4.0-beta.1
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/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js +6 -4
- package/lib/commonjs/shared/components/create-boundary-component/components/boundary-target.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js +22 -60
- package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +56 -41
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +4 -23
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +111 -2
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js +69 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js.map +1 -0
- package/lib/commonjs/shared/components/create-boundary-component/index.js +10 -5
- package/lib/commonjs/shared/components/create-boundary-component/index.js.map +1 -1
- package/lib/commonjs/shared/components/create-transition-aware-component.js +8 -32
- package/lib/commonjs/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js +11 -9
- package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +7 -5
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/commonjs/shared/components/screen-lifecycle/index.js +3 -1
- package/lib/commonjs/shared/components/screen-lifecycle/index.js.map +1 -1
- package/lib/commonjs/shared/constants.js +17 -3
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/reanimated/use-animated-debounce.js +43 -0
- package/lib/commonjs/shared/hooks/reanimated/use-animated-debounce.js.map +1 -0
- package/lib/commonjs/shared/index.js +6 -0
- package/lib/commonjs/shared/index.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js +7 -0
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/commonjs/shared/providers/register-bounds.provider.js +9 -1
- package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js +23 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +3 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/styles.provider.js +1 -11
- package/lib/commonjs/shared/providers/screen/styles/styles.provider.js.map +1 -1
- package/lib/commonjs/shared/stores/animation.store.js +9 -3
- package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/clear.js +23 -167
- package/lib/commonjs/shared/stores/bounds/internals/clear.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/presence.js +0 -3
- package/lib/commonjs/shared/stores/bounds/internals/presence.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/registry.js +18 -7
- package/lib/commonjs/shared/stores/bounds/internals/registry.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js +7 -51
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/state.js +1 -83
- package/lib/commonjs/shared/stores/bounds/internals/state.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js +10 -0
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/constants.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{resolve-bound-tag.js → create-bound-tag.js} +5 -5
- package/lib/commonjs/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{interpolators.js → create-interpolators.js} +6 -6
- package/lib/commonjs/shared/utils/bounds/helpers/create-interpolators.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{link-accessor.js → create-link-accessor.js} +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js +70 -0
- package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{style-composers.js → styles/composers.js} +22 -22
- package/lib/commonjs/shared/utils/bounds/helpers/styles/composers.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{compute-bounds-styles.js → styles/compute.js} +14 -20
- package/lib/commonjs/shared/utils/bounds/helpers/styles/compute.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{interpolate-style.js → styles/interpolate-link-style.js} +4 -4
- package/lib/commonjs/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/styles/styles.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/index.js +16 -44
- package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/build.js +234 -50
- package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/config.js +10 -1
- package/lib/commonjs/shared/utils/bounds/zoom/config.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/math.js +34 -1
- package/lib/commonjs/shared/utils/bounds/zoom/math.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/components/boundary-target.js +6 -4
- package/lib/module/shared/components/create-boundary-component/components/boundary-target.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/create-boundary-component.js +23 -61
- package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js +1 -1
- package/lib/module/shared/components/create-boundary-component/helpers/resolve-pending-source-key.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +54 -39
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js +7 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-auto-source-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js +4 -23
- package/lib/module/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +114 -4
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js +64 -0
- package/lib/module/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js.map +1 -0
- package/lib/module/shared/components/create-boundary-component/index.js +10 -5
- package/lib/module/shared/components/create-boundary-component/index.js.map +1 -1
- package/lib/module/shared/components/create-transition-aware-component.js +10 -34
- package/lib/module/shared/components/create-transition-aware-component.js.map +1 -1
- package/lib/module/shared/components/screen-container/hooks/use-content-layout.js +11 -9
- package/lib/module/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/backdrop.js +7 -5
- package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/module/shared/components/screen-lifecycle/index.js +3 -1
- package/lib/module/shared/components/screen-lifecycle/index.js.map +1 -1
- package/lib/module/shared/constants.js +16 -2
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/reanimated/use-animated-debounce.js +39 -0
- package/lib/module/shared/hooks/reanimated/use-animated-debounce.js.map +1 -0
- package/lib/module/shared/index.js +1 -1
- package/lib/module/shared/index.js.map +1 -1
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js +7 -0
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/module/shared/providers/register-bounds.provider.js +9 -1
- package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js +23 -1
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +3 -0
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/styles.provider.js +1 -11
- package/lib/module/shared/providers/screen/styles/styles.provider.js.map +1 -1
- package/lib/module/shared/stores/animation.store.js +9 -3
- package/lib/module/shared/stores/animation.store.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/clear.js +24 -168
- package/lib/module/shared/stores/bounds/internals/clear.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/presence.js +1 -4
- package/lib/module/shared/stores/bounds/internals/presence.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/registry.js +19 -8
- package/lib/module/shared/stores/bounds/internals/registry.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/resolver.js +8 -52
- package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/state.js +0 -78
- package/lib/module/shared/stores/bounds/internals/state.js.map +1 -1
- package/lib/module/shared/utils/animation/animate-to-progress.js +10 -0
- package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/module/shared/utils/bounds/constants.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{resolve-bound-tag.js → create-bound-tag.js} +3 -3
- package/lib/module/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{interpolators.js → create-interpolators.js} +5 -5
- package/lib/module/shared/utils/bounds/helpers/create-interpolators.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{link-accessor.js → create-link-accessor.js} +1 -1
- package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js +64 -0
- package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{style-composers.js → styles/composers.js} +22 -22
- package/lib/module/shared/utils/bounds/helpers/styles/composers.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{compute-bounds-styles.js → styles/compute.js} +12 -18
- package/lib/module/shared/utils/bounds/helpers/styles/compute.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{interpolate-style.js → styles/interpolate-link-style.js} +4 -4
- package/lib/module/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/styles/styles.js.map +1 -0
- package/lib/module/shared/utils/bounds/index.js +14 -42
- package/lib/module/shared/utils/bounds/index.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/build.js +238 -54
- package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/config.js +9 -0
- package/lib/module/shared/utils/bounds/zoom/config.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/math.js +31 -0
- package/lib/module/shared/utils/bounds/zoom/math.js.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/components/boundary-target.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/helpers/resolve-pending-source-key.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts +17 -11
- package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts +3 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-auto-source-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts +1 -2
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts +20 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.d.ts +12 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.d.ts.map +1 -0
- package/lib/typescript/shared/components/create-boundary-component/index.d.ts +10 -4
- package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/types.d.ts +1 -1
- package/lib/typescript/shared/components/create-boundary-component/types.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-transition-aware-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-lifecycle/index.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts +33 -1
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/reanimated/use-animated-debounce.d.ts +13 -0
- package/lib/typescript/shared/hooks/reanimated/use-animated-debounce.d.ts.map +1 -0
- package/lib/typescript/shared/index.d.ts +3 -3
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures/handlers/use-handlers.d.ts.map +1 -1
- package/lib/typescript/shared/providers/register-bounds.provider.d.ts +7 -0
- package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts +3 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts +3 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/styles.provider.d.ts.map +1 -1
- package/lib/typescript/shared/stores/animation.store.d.ts +5 -2
- package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/clear.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/presence.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/registry.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/state.d.ts +0 -3
- package/lib/typescript/shared/stores/bounds/internals/state.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/types.d.ts +0 -2
- package/lib/typescript/shared/stores/bounds/types.d.ts.map +1 -1
- package/lib/typescript/shared/types/animation.types.d.ts +11 -0
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/bounds.types.d.ts +106 -1
- package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +1 -1
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts +2 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/constants.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts +7 -0
- package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{interpolators.d.ts → create-interpolators.d.ts} +3 -3
- package/lib/typescript/shared/utils/bounds/helpers/create-interpolators.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{link-accessor.d.ts → create-link-accessor.d.ts} +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/create-link-accessor.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts +20 -0
- package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{style-composers.d.ts → styles/composers.d.ts} +4 -4
- package/lib/typescript/shared/utils/bounds/helpers/styles/composers.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{compute-bounds-styles.d.ts → styles/compute.d.ts} +3 -3
- package/lib/typescript/shared/utils/bounds/helpers/styles/compute.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{interpolate-style.d.ts → styles/interpolate-link-style.d.ts} +2 -2
- package/lib/typescript/shared/utils/bounds/helpers/styles/interpolate-link-style.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/styles/styles.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/types/options.d.ts +3 -2
- package/lib/typescript/shared/utils/bounds/types/options.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/config.d.ts +9 -0
- package/lib/typescript/shared/utils/bounds/zoom/config.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/math.d.ts +17 -0
- package/lib/typescript/shared/utils/bounds/zoom/math.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/shared/components/create-boundary-component/components/boundary-target.tsx +6 -4
- package/src/shared/components/create-boundary-component/create-boundary-component.tsx +28 -60
- package/src/shared/components/create-boundary-component/helpers/resolve-pending-source-key.ts +5 -1
- package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +72 -53
- package/src/shared/components/create-boundary-component/hooks/use-auto-source-measurement.ts +19 -3
- package/src/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.ts +5 -34
- package/src/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.ts +180 -6
- package/src/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.ts +110 -0
- package/src/shared/components/create-boundary-component/index.tsx +10 -5
- package/src/shared/components/create-boundary-component/types.ts +1 -2
- package/src/shared/components/create-transition-aware-component.tsx +10 -47
- package/src/shared/components/screen-container/hooks/use-content-layout.ts +10 -17
- package/src/shared/components/screen-container/layers/backdrop.tsx +6 -9
- package/src/shared/components/screen-lifecycle/index.tsx +1 -4
- package/src/shared/constants.ts +11 -1
- package/src/shared/hooks/reanimated/use-animated-debounce.ts +56 -0
- package/src/shared/index.ts +3 -0
- package/src/shared/providers/gestures/handlers/use-handlers.ts +9 -0
- package/src/shared/providers/register-bounds.provider.tsx +8 -1
- package/src/shared/providers/screen/animation/helpers/hydrate-transition-state.ts +27 -1
- package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +6 -0
- package/src/shared/providers/screen/styles/styles.provider.tsx +1 -12
- package/src/shared/stores/animation.store.ts +11 -2
- package/src/shared/stores/bounds/internals/clear.ts +47 -220
- package/src/shared/stores/bounds/internals/presence.ts +1 -4
- package/src/shared/stores/bounds/internals/registry.ts +25 -14
- package/src/shared/stores/bounds/internals/resolver.ts +7 -84
- package/src/shared/stores/bounds/internals/state.ts +0 -98
- package/src/shared/stores/bounds/types.ts +0 -2
- package/src/shared/types/animation.types.ts +13 -0
- package/src/shared/types/bounds.types.ts +108 -1
- package/src/shared/types/index.ts +2 -0
- package/src/shared/utils/animation/animate-to-progress.ts +11 -1
- package/src/shared/utils/bounds/{helpers/constants.ts → constants.ts} +1 -1
- package/src/shared/utils/bounds/helpers/{resolve-bound-tag.ts → create-bound-tag.ts} +2 -2
- package/src/shared/utils/bounds/helpers/{interpolators.ts → create-interpolators.ts} +19 -12
- package/src/shared/utils/bounds/helpers/prepare-bound-styles.ts +100 -0
- package/src/shared/utils/bounds/helpers/{style-composers.ts → styles/composers.ts} +119 -53
- package/src/shared/utils/bounds/helpers/{compute-bounds-styles.ts → styles/compute.ts} +10 -20
- package/src/shared/utils/bounds/helpers/{interpolate-style.ts → styles/interpolate-link-style.ts} +9 -4
- package/src/shared/utils/bounds/index.ts +13 -53
- package/src/shared/utils/bounds/types/options.ts +3 -2
- package/src/shared/utils/bounds/zoom/build.ts +316 -95
- package/src/shared/utils/bounds/zoom/config.ts +11 -0
- package/src/shared/utils/bounds/zoom/math.ts +57 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +0 -54
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +0 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +0 -122
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +0 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +0 -72
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +0 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +0 -66
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +0 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +0 -58
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +0 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +0 -53
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/build-bounds-options.js +0 -41
- package/lib/commonjs/shared/utils/bounds/helpers/build-bounds-options.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/constants.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/interpolate-style.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/interpolate.js +0 -20
- package/lib/commonjs/shared/utils/bounds/helpers/interpolate.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/interpolators.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/link-accessor.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/styles.js.map +0 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js +0 -49
- package/lib/module/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.js.map +0 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +0 -118
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +0 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js +0 -67
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.js.map +0 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +0 -61
- package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +0 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js +0 -53
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.js.map +0 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js +0 -48
- package/lib/module/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/build-bounds-options.js +0 -36
- package/lib/module/shared/utils/bounds/helpers/build-bounds-options.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/constants.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/interpolate-style.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/interpolate.js +0 -16
- package/lib/module/shared/utils/bounds/helpers/interpolate.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/interpolators.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/link-accessor.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/style-composers.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/styles.js.map +0 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts +0 -11
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.d.ts.map +0 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts +0 -17
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts.map +0 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts +0 -11
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.d.ts.map +0 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts +0 -10
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts.map +0 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts +0 -11
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.d.ts.map +0 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts +0 -10
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts +0 -14
- package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/constants.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/interpolate-style.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/interpolate.d.ts +0 -2
- package/lib/typescript/shared/utils/bounds/helpers/interpolate.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/interpolators.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/link-accessor.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts +0 -7
- package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/styles.d.ts.map +0 -1
- package/src/shared/components/create-boundary-component/hooks/use-deferred-measurement-trigger.ts +0 -58
- package/src/shared/components/create-boundary-component/hooks/use-group-active-measurement.ts +0 -162
- package/src/shared/components/create-boundary-component/hooks/use-group-active-source-measurement.ts +0 -82
- package/src/shared/components/create-boundary-component/hooks/use-initial-layout-handler.ts +0 -92
- package/src/shared/components/create-boundary-component/hooks/use-pending-destination-retry-measurement.ts +0 -87
- package/src/shared/components/create-boundary-component/hooks/use-scroll-settled-measurement.ts +0 -49
- package/src/shared/utils/bounds/helpers/build-bounds-options.ts +0 -48
- package/src/shared/utils/bounds/helpers/interpolate.ts +0 -19
- /package/lib/commonjs/shared/utils/bounds/{helpers/constants.js → constants.js} +0 -0
- /package/lib/commonjs/shared/utils/bounds/helpers/{styles.js → styles/styles.js} +0 -0
- /package/lib/module/shared/utils/bounds/{helpers/constants.js → constants.js} +0 -0
- /package/lib/module/shared/utils/bounds/helpers/{styles.js → styles/styles.js} +0 -0
- /package/lib/typescript/shared/utils/bounds/{helpers/constants.d.ts → constants.d.ts} +0 -0
- /package/lib/typescript/shared/utils/bounds/helpers/{styles.d.ts → styles/styles.d.ts} +0 -0
- /package/src/shared/utils/bounds/helpers/{link-accessor.ts → create-link-accessor.ts} +0 -0
- /package/src/shared/utils/bounds/helpers/{styles.ts → styles/styles.ts} +0 -0
|
@@ -10,7 +10,6 @@ export type MeasurementIntentFlags = {
|
|
|
10
10
|
completeDestination: boolean;
|
|
11
11
|
refreshSource: boolean;
|
|
12
12
|
refreshDestination: boolean;
|
|
13
|
-
snapshotOnly: boolean;
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
export type MeasurementWritePlan = {
|
|
@@ -18,7 +17,6 @@ export type MeasurementWritePlan = {
|
|
|
18
17
|
completeDestination: boolean;
|
|
19
18
|
refreshSource: boolean;
|
|
20
19
|
refreshDestination: boolean;
|
|
21
|
-
registerSnapshot: boolean;
|
|
22
20
|
writesAny: boolean;
|
|
23
21
|
wantsDestinationWrite: boolean;
|
|
24
22
|
};
|
|
@@ -37,7 +35,6 @@ export const getMeasurementIntentFlags = (
|
|
|
37
35
|
completeDestination: false,
|
|
38
36
|
refreshSource: false,
|
|
39
37
|
refreshDestination: false,
|
|
40
|
-
snapshotOnly: false,
|
|
41
38
|
};
|
|
42
39
|
|
|
43
40
|
if (!intent) {
|
|
@@ -60,9 +57,6 @@ export const getMeasurementIntentFlags = (
|
|
|
60
57
|
case "refresh-destination":
|
|
61
58
|
flags.refreshDestination = true;
|
|
62
59
|
break;
|
|
63
|
-
case "snapshot-only":
|
|
64
|
-
flags.snapshotOnly = true;
|
|
65
|
-
break;
|
|
66
60
|
}
|
|
67
61
|
}
|
|
68
62
|
|
|
@@ -74,68 +68,99 @@ export const resolveMeasurementWritePlan = (params: {
|
|
|
74
68
|
hasPendingLink: boolean;
|
|
75
69
|
hasSourceLink: boolean;
|
|
76
70
|
hasDestinationLink: boolean;
|
|
71
|
+
hasAttachableSourceLink: boolean;
|
|
77
72
|
}): MeasurementWritePlan => {
|
|
78
73
|
"worklet";
|
|
79
|
-
const {
|
|
74
|
+
const {
|
|
75
|
+
intents,
|
|
76
|
+
hasPendingLink,
|
|
77
|
+
hasSourceLink,
|
|
78
|
+
hasDestinationLink,
|
|
79
|
+
hasAttachableSourceLink,
|
|
80
|
+
} = params;
|
|
80
81
|
|
|
81
82
|
const captureSource = intents.captureSource;
|
|
82
|
-
const completeDestination =
|
|
83
|
+
const completeDestination =
|
|
84
|
+
intents.completeDestination && (hasPendingLink || hasAttachableSourceLink);
|
|
83
85
|
const refreshSource = intents.refreshSource && hasSourceLink;
|
|
84
86
|
const refreshDestination =
|
|
85
|
-
intents.refreshDestination &&
|
|
86
|
-
|
|
87
|
+
intents.refreshDestination &&
|
|
88
|
+
(hasDestinationLink || hasPendingLink || hasAttachableSourceLink);
|
|
87
89
|
const writesAny =
|
|
88
|
-
|
|
89
|
-
captureSource ||
|
|
90
|
-
completeDestination ||
|
|
91
|
-
refreshSource ||
|
|
92
|
-
refreshDestination;
|
|
90
|
+
captureSource || completeDestination || refreshSource || refreshDestination;
|
|
93
91
|
|
|
94
92
|
return {
|
|
95
93
|
captureSource,
|
|
96
94
|
completeDestination,
|
|
97
95
|
refreshSource,
|
|
98
96
|
refreshDestination,
|
|
99
|
-
registerSnapshot,
|
|
100
97
|
writesAny,
|
|
101
98
|
wantsDestinationWrite: completeDestination || refreshDestination,
|
|
102
99
|
};
|
|
103
100
|
};
|
|
104
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Temporarily removed destination-match gating for auto source capture.
|
|
104
|
+
*
|
|
105
|
+
* For now, any enabled boundary on a source screen will eagerly capture when a
|
|
106
|
+
* next screen exists, even if no matching destination boundary has registered
|
|
107
|
+
* presence yet. The previous behavior waited for an explicit destination match
|
|
108
|
+
* before allowing source capture.
|
|
109
|
+
*/
|
|
105
110
|
export const resolveAutoSourceCaptureSignal = (params: {
|
|
106
111
|
enabled: boolean;
|
|
107
112
|
nextScreenKey?: string;
|
|
108
113
|
tagPresence?: Record<string, PresenceLikeEntry>;
|
|
109
114
|
}): string | 0 => {
|
|
110
115
|
"worklet";
|
|
111
|
-
const { enabled, nextScreenKey
|
|
116
|
+
const { enabled, nextScreenKey } = params;
|
|
112
117
|
if (!enabled) return 0;
|
|
113
118
|
if (!nextScreenKey) return 0;
|
|
114
|
-
if (!tagPresence) return 0;
|
|
115
119
|
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Temporarily removed destination-match gating for auto source capture.
|
|
122
|
+
*
|
|
123
|
+
* For now, any enabled boundary on a source screen will eagerly capture when
|
|
124
|
+
* a next screen exists, even if no matching destination boundary has
|
|
125
|
+
* registered presence yet. The previous behavior waited for an explicit
|
|
126
|
+
* destination match before allowing source capture.
|
|
127
|
+
*/
|
|
128
|
+
// const tagPresence = params.tagPresence;
|
|
129
|
+
// if (!tagPresence) return 0;
|
|
130
|
+
//
|
|
131
|
+
// const direct = tagPresence[nextScreenKey];
|
|
132
|
+
// if (direct && direct.count > 0) return nextScreenKey;
|
|
133
|
+
//
|
|
134
|
+
// for (const screenKey in tagPresence) {
|
|
135
|
+
// const entry = tagPresence[screenKey];
|
|
136
|
+
// if (entry.ancestorKeys?.includes(nextScreenKey)) {
|
|
137
|
+
// return nextScreenKey;
|
|
138
|
+
// }
|
|
139
|
+
// }
|
|
140
|
+
//
|
|
141
|
+
// return 0;
|
|
118
142
|
|
|
119
|
-
|
|
120
|
-
const entry = tagPresence[screenKey];
|
|
121
|
-
if (entry.ancestorKeys?.includes(nextScreenKey)) {
|
|
122
|
-
return nextScreenKey;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return 0;
|
|
143
|
+
return nextScreenKey;
|
|
127
144
|
};
|
|
128
145
|
|
|
129
146
|
export const resolvePendingDestinationCaptureSignal = (params: {
|
|
130
147
|
enabled: boolean;
|
|
131
148
|
resolvedSourceKey?: string | null;
|
|
132
|
-
|
|
149
|
+
hasAttachableSourceLink: boolean;
|
|
150
|
+
hasDestinationLink: boolean;
|
|
133
151
|
}): string | 0 => {
|
|
134
152
|
"worklet";
|
|
135
|
-
const {
|
|
153
|
+
const {
|
|
154
|
+
enabled,
|
|
155
|
+
resolvedSourceKey,
|
|
156
|
+
hasAttachableSourceLink,
|
|
157
|
+
hasDestinationLink,
|
|
158
|
+
} = params;
|
|
136
159
|
if (!enabled) return 0;
|
|
137
160
|
if (!resolvedSourceKey) return 0;
|
|
138
|
-
|
|
161
|
+
if (!hasAttachableSourceLink) return 0;
|
|
162
|
+
if (hasDestinationLink) return 0;
|
|
163
|
+
return resolvedSourceKey;
|
|
139
164
|
};
|
|
140
165
|
|
|
141
166
|
export const resolvePendingDestinationRetrySignal = (params: {
|
|
@@ -148,7 +173,7 @@ export const resolvePendingDestinationRetrySignal = (params: {
|
|
|
148
173
|
retryProgressMax: number;
|
|
149
174
|
retryProgressBuckets: number;
|
|
150
175
|
resolvedSourceKey?: string | null;
|
|
151
|
-
|
|
176
|
+
hasAttachableSourceLink: boolean;
|
|
152
177
|
}): number => {
|
|
153
178
|
"worklet";
|
|
154
179
|
const {
|
|
@@ -161,7 +186,7 @@ export const resolvePendingDestinationRetrySignal = (params: {
|
|
|
161
186
|
retryProgressMax,
|
|
162
187
|
retryProgressBuckets,
|
|
163
188
|
resolvedSourceKey,
|
|
164
|
-
|
|
189
|
+
hasAttachableSourceLink,
|
|
165
190
|
} = params;
|
|
166
191
|
|
|
167
192
|
if (!enabled) return 0;
|
|
@@ -170,34 +195,28 @@ export const resolvePendingDestinationRetrySignal = (params: {
|
|
|
170
195
|
if (hasDestinationLink) return 0;
|
|
171
196
|
if (progress <= 0 || progress >= retryProgressMax) return 0;
|
|
172
197
|
if (!resolvedSourceKey) return 0;
|
|
173
|
-
if (!
|
|
198
|
+
if (!hasAttachableSourceLink) return 0;
|
|
174
199
|
|
|
175
200
|
return Math.floor(progress * retryProgressBuckets) + 1;
|
|
176
201
|
};
|
|
177
202
|
|
|
178
|
-
export const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
isAnyAnimating: boolean;
|
|
183
|
-
hasPendingLinkFromSource: boolean;
|
|
184
|
-
}): MeasurementIntent | readonly MeasurementIntent[] | null => {
|
|
203
|
+
export const resolvePrepareSourceMeasurementIntent = (params: {
|
|
204
|
+
hasSourceLink: boolean;
|
|
205
|
+
shouldRefreshExistingSource: boolean;
|
|
206
|
+
}): MeasurementIntent | null => {
|
|
185
207
|
"worklet";
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
hasMeasuredOnLayout,
|
|
190
|
-
isAnyAnimating,
|
|
191
|
-
hasPendingLinkFromSource,
|
|
192
|
-
} = params;
|
|
193
|
-
|
|
194
|
-
if (!enabled) return null;
|
|
195
|
-
if (!hasSharedBoundTag || hasMeasuredOnLayout) return null;
|
|
196
|
-
if (!isAnyAnimating) return null;
|
|
208
|
+
if (!params.hasSourceLink) {
|
|
209
|
+
return "capture-source";
|
|
210
|
+
}
|
|
197
211
|
|
|
198
|
-
return
|
|
212
|
+
return params.shouldRefreshExistingSource ? "refresh-source" : null;
|
|
199
213
|
};
|
|
200
214
|
|
|
215
|
+
export const PREPARE_DESTINATION_MEASUREMENT_INTENT = [
|
|
216
|
+
"complete-destination",
|
|
217
|
+
"refresh-destination",
|
|
218
|
+
] as const satisfies readonly MeasurementIntent[];
|
|
219
|
+
|
|
201
220
|
export const resolveGroupActiveMeasurementAction = (params: {
|
|
202
221
|
enabled: boolean;
|
|
203
222
|
isEligible: boolean;
|
package/src/shared/components/create-boundary-component/hooks/use-auto-source-measurement.ts
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import { useAnimatedReaction } from "react-native-reanimated";
|
|
2
2
|
import { BoundStore } from "../../../stores/bounds";
|
|
3
|
-
import type { MaybeMeasureAndStoreParams } from "../types";
|
|
3
|
+
import type { BoundaryId, MaybeMeasureAndStoreParams } from "../types";
|
|
4
4
|
import { resolveAutoSourceCaptureSignal } from "./helpers/measurement-rules";
|
|
5
5
|
|
|
6
6
|
export const useAutoSourceMeasurement = (params: {
|
|
7
7
|
enabled: boolean;
|
|
8
8
|
sharedBoundTag: string;
|
|
9
|
+
id: BoundaryId;
|
|
10
|
+
group?: string;
|
|
9
11
|
nextScreenKey?: string;
|
|
10
12
|
maybeMeasureAndStore: (options: MaybeMeasureAndStoreParams) => void;
|
|
11
13
|
}) => {
|
|
12
|
-
const {
|
|
13
|
-
|
|
14
|
+
const {
|
|
15
|
+
enabled,
|
|
16
|
+
sharedBoundTag,
|
|
17
|
+
id,
|
|
18
|
+
group,
|
|
19
|
+
nextScreenKey,
|
|
20
|
+
maybeMeasureAndStore,
|
|
21
|
+
} = params;
|
|
14
22
|
const boundaryPresence = BoundStore.getBoundaryPresence();
|
|
15
23
|
|
|
16
24
|
useAnimatedReaction(
|
|
@@ -27,10 +35,18 @@ export const useAutoSourceMeasurement = (params: {
|
|
|
27
35
|
if (!enabled) return;
|
|
28
36
|
if (!nextScreenKey) return;
|
|
29
37
|
if (!captureSignal || captureSignal === previousCaptureSignal) return;
|
|
38
|
+
const currentGroupActiveId = group
|
|
39
|
+
? BoundStore.getGroupActiveId(group)
|
|
40
|
+
: null;
|
|
41
|
+
if (group && currentGroupActiveId !== String(id)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
30
44
|
maybeMeasureAndStore({ intent: "capture-source" });
|
|
31
45
|
},
|
|
32
46
|
[
|
|
33
47
|
enabled,
|
|
48
|
+
id,
|
|
49
|
+
group,
|
|
34
50
|
nextScreenKey,
|
|
35
51
|
sharedBoundTag,
|
|
36
52
|
boundaryPresence,
|
package/src/shared/components/create-boundary-component/hooks/use-boundary-measure-and-store.ts
CHANGED
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
type AnimatedRef,
|
|
4
4
|
type MeasuredDimensions,
|
|
5
5
|
measure,
|
|
6
|
-
type SharedValue,
|
|
7
6
|
type StyleProps,
|
|
8
7
|
} from "react-native-reanimated";
|
|
9
8
|
import useStableCallbackValue from "../../../hooks/use-stable-callback-value";
|
|
@@ -43,7 +42,6 @@ export const useBoundaryMeasureAndStore = (params: {
|
|
|
43
42
|
ancestorKeys: string[];
|
|
44
43
|
navigatorKey?: string;
|
|
45
44
|
ancestorNavigatorKeys?: string[];
|
|
46
|
-
isAnimating: SharedValue<number>;
|
|
47
45
|
preparedStyles: StyleProps;
|
|
48
46
|
measuredAnimatedRef: AnimatedRef<View>;
|
|
49
47
|
}) => {
|
|
@@ -55,7 +53,6 @@ export const useBoundaryMeasureAndStore = (params: {
|
|
|
55
53
|
ancestorKeys,
|
|
56
54
|
navigatorKey,
|
|
57
55
|
ancestorNavigatorKeys,
|
|
58
|
-
isAnimating,
|
|
59
56
|
preparedStyles,
|
|
60
57
|
measuredAnimatedRef,
|
|
61
58
|
} = params;
|
|
@@ -73,36 +70,15 @@ export const useBoundaryMeasureAndStore = (params: {
|
|
|
73
70
|
resolvePendingSourceKey(sharedBoundTag, preferredSourceScreenKey) ||
|
|
74
71
|
undefined;
|
|
75
72
|
|
|
76
|
-
if (intents.captureSource && isAnimating.get()) {
|
|
77
|
-
const existing = BoundStore.getSnapshot(
|
|
78
|
-
sharedBoundTag,
|
|
79
|
-
currentScreenKey,
|
|
80
|
-
);
|
|
81
|
-
if (existing) {
|
|
82
|
-
applyMeasuredBoundsWrites({
|
|
83
|
-
sharedBoundTag,
|
|
84
|
-
ancestorKeys,
|
|
85
|
-
navigatorKey,
|
|
86
|
-
ancestorNavigatorKeys,
|
|
87
|
-
currentScreenKey,
|
|
88
|
-
measured: existing.bounds,
|
|
89
|
-
preparedStyles,
|
|
90
|
-
shouldSetSource: true,
|
|
91
|
-
});
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// No cached snapshot while animating.
|
|
96
|
-
// Fall through to a live measurement so rapid retargeting still
|
|
97
|
-
// captures a valid source link.
|
|
98
|
-
}
|
|
99
|
-
|
|
100
73
|
const hasPendingLink = expectedSourceScreenKey
|
|
101
74
|
? BoundStore.hasPendingLinkFromSource(
|
|
102
75
|
sharedBoundTag,
|
|
103
76
|
expectedSourceScreenKey,
|
|
104
77
|
)
|
|
105
78
|
: BoundStore.hasPendingLink(sharedBoundTag);
|
|
79
|
+
const hasAttachableSourceLink = expectedSourceScreenKey
|
|
80
|
+
? BoundStore.hasSourceLink(sharedBoundTag, expectedSourceScreenKey)
|
|
81
|
+
: false;
|
|
106
82
|
const hasSourceLink = BoundStore.hasSourceLink(
|
|
107
83
|
sharedBoundTag,
|
|
108
84
|
currentScreenKey,
|
|
@@ -117,6 +93,7 @@ export const useBoundaryMeasureAndStore = (params: {
|
|
|
117
93
|
hasPendingLink,
|
|
118
94
|
hasSourceLink,
|
|
119
95
|
hasDestinationLink,
|
|
96
|
+
hasAttachableSourceLink,
|
|
120
97
|
});
|
|
121
98
|
|
|
122
99
|
if (!writePlan.writesAny) {
|
|
@@ -151,13 +128,7 @@ export const useBoundaryMeasureAndStore = (params: {
|
|
|
151
128
|
const hasSnapshotChanged =
|
|
152
129
|
!existingSnapshot ||
|
|
153
130
|
!areMeasurementsEqual(existingSnapshot.bounds, correctedMeasured);
|
|
154
|
-
const shouldWriteSnapshot =
|
|
155
|
-
hasSnapshotChanged &&
|
|
156
|
-
(writePlan.registerSnapshot ||
|
|
157
|
-
writePlan.captureSource ||
|
|
158
|
-
writePlan.completeDestination ||
|
|
159
|
-
writePlan.refreshSource ||
|
|
160
|
-
writePlan.refreshDestination);
|
|
131
|
+
const shouldWriteSnapshot = hasSnapshotChanged;
|
|
161
132
|
|
|
162
133
|
applyMeasuredBoundsWrites({
|
|
163
134
|
sharedBoundTag,
|
package/src/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.ts
CHANGED
|
@@ -1,25 +1,127 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useLayoutEffect } from "react";
|
|
2
|
+
import {
|
|
3
|
+
runOnUI,
|
|
4
|
+
type SharedValue,
|
|
5
|
+
useAnimatedReaction,
|
|
6
|
+
useSharedValue,
|
|
7
|
+
} from "react-native-reanimated";
|
|
8
|
+
import { AnimationStore } from "../../../stores/animation.store";
|
|
2
9
|
import { BoundStore } from "../../../stores/bounds";
|
|
3
10
|
import { resolvePendingSourceKey } from "../helpers/resolve-pending-source-key";
|
|
4
|
-
import type { MaybeMeasureAndStoreParams } from "../types";
|
|
5
|
-
import {
|
|
11
|
+
import type { BoundaryId, MaybeMeasureAndStoreParams } from "../types";
|
|
12
|
+
import {
|
|
13
|
+
resolvePendingDestinationCaptureSignal,
|
|
14
|
+
resolvePendingDestinationRetrySignal,
|
|
15
|
+
} from "./helpers/measurement-rules";
|
|
6
16
|
|
|
17
|
+
/**
|
|
18
|
+
* The current v3.4 behavior intentionally favors correctness over efficiency:
|
|
19
|
+
* when destination layout races transition start, this hook may re-measure
|
|
20
|
+
* multiple times to recover a usable pair for `navigation.zoom()`.
|
|
21
|
+
*
|
|
22
|
+
* This works well enough for now, but it is not the ideal architecture. A more
|
|
23
|
+
* complete v4 solution should allow open-animation deferral and broader
|
|
24
|
+
* readiness coordination so we can avoid repeated measurement work while still
|
|
25
|
+
* handling multiple transition scenarios correctly. Until that system exists,
|
|
26
|
+
* `navigation.zoom()` remains fast in practice, just not as performant as it
|
|
27
|
+
* could be.
|
|
28
|
+
*
|
|
29
|
+
* For now, you may notice a slight stutter towards the end of the animation.
|
|
30
|
+
*/
|
|
7
31
|
export const usePendingDestinationMeasurement = (params: {
|
|
8
32
|
sharedBoundTag: string;
|
|
9
33
|
enabled: boolean;
|
|
34
|
+
id: BoundaryId;
|
|
35
|
+
group?: string;
|
|
36
|
+
currentScreenKey: string;
|
|
10
37
|
expectedSourceScreenKey?: string;
|
|
38
|
+
animating: SharedValue<number>;
|
|
11
39
|
maybeMeasureAndStore: (options: MaybeMeasureAndStoreParams) => void;
|
|
12
40
|
}) => {
|
|
13
41
|
const {
|
|
14
42
|
sharedBoundTag,
|
|
15
43
|
enabled,
|
|
44
|
+
id,
|
|
45
|
+
group,
|
|
46
|
+
currentScreenKey,
|
|
16
47
|
expectedSourceScreenKey,
|
|
48
|
+
animating,
|
|
17
49
|
maybeMeasureAndStore,
|
|
18
50
|
} = params;
|
|
19
51
|
|
|
52
|
+
const progress = AnimationStore.getValue(currentScreenKey, "progress");
|
|
53
|
+
const closing = AnimationStore.getValue(currentScreenKey, "closing");
|
|
54
|
+
|
|
55
|
+
const retryCount = useSharedValue(0);
|
|
56
|
+
const MAX_RETRIES = 4;
|
|
57
|
+
const RETRY_PROGRESS_BUCKETS = 8;
|
|
58
|
+
const RETRY_PROGRESS_MAX = 1.05;
|
|
59
|
+
|
|
60
|
+
useLayoutEffect(() => {
|
|
61
|
+
if (!enabled) return;
|
|
62
|
+
|
|
63
|
+
runOnUI(() => {
|
|
64
|
+
"worklet";
|
|
65
|
+
if (closing.get()) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const currentGroupActiveId = group
|
|
70
|
+
? BoundStore.getGroupActiveId(group)
|
|
71
|
+
: null;
|
|
72
|
+
if (group && currentGroupActiveId !== String(id)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const resolvedSourceKey = resolvePendingSourceKey(
|
|
77
|
+
sharedBoundTag,
|
|
78
|
+
expectedSourceScreenKey,
|
|
79
|
+
);
|
|
80
|
+
const hasAttachableSourceLink = resolvedSourceKey
|
|
81
|
+
? BoundStore.hasPendingLinkFromSource(
|
|
82
|
+
sharedBoundTag,
|
|
83
|
+
resolvedSourceKey,
|
|
84
|
+
) || BoundStore.hasSourceLink(sharedBoundTag, resolvedSourceKey)
|
|
85
|
+
: false;
|
|
86
|
+
|
|
87
|
+
if (!hasAttachableSourceLink) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (BoundStore.hasDestinationLink(sharedBoundTag, currentScreenKey)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
maybeMeasureAndStore({ intent: "complete-destination" });
|
|
96
|
+
})();
|
|
97
|
+
}, [
|
|
98
|
+
enabled,
|
|
99
|
+
id,
|
|
100
|
+
group,
|
|
101
|
+
sharedBoundTag,
|
|
102
|
+
currentScreenKey,
|
|
103
|
+
expectedSourceScreenKey,
|
|
104
|
+
closing,
|
|
105
|
+
maybeMeasureAndStore,
|
|
106
|
+
]);
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* This exessive retry for groups with {target:"bound"} will have to change in v4.
|
|
110
|
+
* .navigation.zoom() is stable and works great for non groups and groups that are non {target: "bound"}.
|
|
111
|
+
*
|
|
112
|
+
* The retry logic is needed for dst screen when we do an initialScrollIndex, the system is competing with the (i assume) useLayoutEffect
|
|
113
|
+
* in the scrollable, causing a race here and giving us wrong measurements. I believe, in simialr fashion to how
|
|
114
|
+
* system.store defers the screen from animating, we could possibly do the same here. Registering it up, once we get valid measurements, we can
|
|
115
|
+
* un defer? Is that the word? Undefer the screen, removing this block compeltely, avoiding any potential flickers ( which currently happens.)
|
|
116
|
+
*
|
|
117
|
+
* You can replicate this bug by dismissing dst, as dst reaches its ending tail (0.01->0.10), if we tap again, we notice a flicker.
|
|
118
|
+
*/
|
|
20
119
|
useAnimatedReaction(
|
|
21
120
|
() => {
|
|
22
121
|
"worklet";
|
|
122
|
+
if (closing.get()) {
|
|
123
|
+
return 0;
|
|
124
|
+
}
|
|
23
125
|
const resolvedSourceKey = resolvePendingSourceKey(
|
|
24
126
|
sharedBoundTag,
|
|
25
127
|
expectedSourceScreenKey,
|
|
@@ -27,12 +129,16 @@ export const usePendingDestinationMeasurement = (params: {
|
|
|
27
129
|
return resolvePendingDestinationCaptureSignal({
|
|
28
130
|
enabled,
|
|
29
131
|
resolvedSourceKey,
|
|
30
|
-
|
|
132
|
+
hasAttachableSourceLink: resolvedSourceKey
|
|
31
133
|
? BoundStore.hasPendingLinkFromSource(
|
|
32
134
|
sharedBoundTag,
|
|
33
135
|
resolvedSourceKey,
|
|
34
|
-
)
|
|
136
|
+
) || BoundStore.hasSourceLink(sharedBoundTag, resolvedSourceKey)
|
|
35
137
|
: false,
|
|
138
|
+
hasDestinationLink: BoundStore.hasDestinationLink(
|
|
139
|
+
sharedBoundTag,
|
|
140
|
+
currentScreenKey,
|
|
141
|
+
),
|
|
36
142
|
});
|
|
37
143
|
},
|
|
38
144
|
(captureSignal, previousCaptureSignal) => {
|
|
@@ -42,8 +148,76 @@ export const usePendingDestinationMeasurement = (params: {
|
|
|
42
148
|
return;
|
|
43
149
|
}
|
|
44
150
|
|
|
151
|
+
const currentGroupActiveId = group
|
|
152
|
+
? BoundStore.getGroupActiveId(group)
|
|
153
|
+
: null;
|
|
154
|
+
|
|
155
|
+
if (group && currentGroupActiveId !== String(id)) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
maybeMeasureAndStore({ intent: "complete-destination" });
|
|
160
|
+
},
|
|
161
|
+
[
|
|
162
|
+
enabled,
|
|
163
|
+
id,
|
|
164
|
+
group,
|
|
165
|
+
sharedBoundTag,
|
|
166
|
+
expectedSourceScreenKey,
|
|
167
|
+
closing,
|
|
168
|
+
maybeMeasureAndStore,
|
|
169
|
+
],
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
useAnimatedReaction(
|
|
173
|
+
() => {
|
|
174
|
+
"worklet";
|
|
175
|
+
if (closing.get()) {
|
|
176
|
+
return 0;
|
|
177
|
+
}
|
|
178
|
+
const resolvedSourceKey = resolvePendingSourceKey(
|
|
179
|
+
sharedBoundTag,
|
|
180
|
+
expectedSourceScreenKey,
|
|
181
|
+
);
|
|
182
|
+
return resolvePendingDestinationRetrySignal({
|
|
183
|
+
enabled,
|
|
184
|
+
retryCount: retryCount.get(),
|
|
185
|
+
maxRetries: MAX_RETRIES,
|
|
186
|
+
isAnimating: !!animating.get(),
|
|
187
|
+
hasDestinationLink: BoundStore.hasDestinationLink(
|
|
188
|
+
sharedBoundTag,
|
|
189
|
+
currentScreenKey,
|
|
190
|
+
),
|
|
191
|
+
progress: progress.get(),
|
|
192
|
+
retryProgressMax: RETRY_PROGRESS_MAX,
|
|
193
|
+
retryProgressBuckets: RETRY_PROGRESS_BUCKETS,
|
|
194
|
+
resolvedSourceKey,
|
|
195
|
+
hasAttachableSourceLink: resolvedSourceKey
|
|
196
|
+
? BoundStore.hasPendingLinkFromSource(
|
|
197
|
+
sharedBoundTag,
|
|
198
|
+
resolvedSourceKey,
|
|
199
|
+
) || BoundStore.hasSourceLink(sharedBoundTag, resolvedSourceKey)
|
|
200
|
+
: false,
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
(captureSignal) => {
|
|
204
|
+
"worklet";
|
|
205
|
+
// if (!group) return;
|
|
206
|
+
if (!enabled) return;
|
|
207
|
+
if (!captureSignal) {
|
|
208
|
+
retryCount.set(0);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const currentGroupActiveId = group
|
|
212
|
+
? BoundStore.getGroupActiveId(group)
|
|
213
|
+
: null;
|
|
214
|
+
if (group && currentGroupActiveId !== String(id)) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (retryCount.get() >= MAX_RETRIES) return;
|
|
219
|
+
retryCount.set(retryCount.get() + 1);
|
|
45
220
|
maybeMeasureAndStore({ intent: "complete-destination" });
|
|
46
221
|
},
|
|
47
|
-
[enabled, sharedBoundTag, expectedSourceScreenKey, maybeMeasureAndStore],
|
|
48
222
|
);
|
|
49
223
|
};
|
package/src/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { useAnimatedReaction } from "react-native-reanimated";
|
|
2
|
+
import { AnimationStore } from "../../../stores/animation.store";
|
|
3
|
+
import { BoundStore } from "../../../stores/bounds";
|
|
4
|
+
import { GestureStore } from "../../../stores/gesture.store";
|
|
5
|
+
import type { BoundaryId, MaybeMeasureAndStoreParams } from "../types";
|
|
6
|
+
import {
|
|
7
|
+
PREPARE_DESTINATION_MEASUREMENT_INTENT,
|
|
8
|
+
resolvePrepareSourceMeasurementIntent,
|
|
9
|
+
} from "./helpers/measurement-rules";
|
|
10
|
+
|
|
11
|
+
export const usePreTransitionMeasurement = (params: {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
sharedBoundTag: string;
|
|
14
|
+
id: BoundaryId;
|
|
15
|
+
group?: string;
|
|
16
|
+
currentScreenKey: string;
|
|
17
|
+
nextScreenKey?: string;
|
|
18
|
+
hasNextScreen: boolean;
|
|
19
|
+
maybeMeasureAndStore: (options: MaybeMeasureAndStoreParams) => void;
|
|
20
|
+
}) => {
|
|
21
|
+
const {
|
|
22
|
+
enabled,
|
|
23
|
+
sharedBoundTag,
|
|
24
|
+
id,
|
|
25
|
+
group,
|
|
26
|
+
currentScreenKey,
|
|
27
|
+
nextScreenKey,
|
|
28
|
+
hasNextScreen,
|
|
29
|
+
maybeMeasureAndStore,
|
|
30
|
+
} = params;
|
|
31
|
+
|
|
32
|
+
const currentWillAnimate = AnimationStore.getValue(
|
|
33
|
+
currentScreenKey,
|
|
34
|
+
"willAnimate",
|
|
35
|
+
);
|
|
36
|
+
const currentAnimating = AnimationStore.getValue(
|
|
37
|
+
currentScreenKey,
|
|
38
|
+
"animating",
|
|
39
|
+
);
|
|
40
|
+
const currentDragging = GestureStore.getValue(currentScreenKey, "dragging");
|
|
41
|
+
const nextWillAnimate = nextScreenKey
|
|
42
|
+
? AnimationStore.getValue(nextScreenKey, "willAnimate")
|
|
43
|
+
: null;
|
|
44
|
+
const nextAnimating = nextScreenKey
|
|
45
|
+
? AnimationStore.getValue(nextScreenKey, "animating")
|
|
46
|
+
: null;
|
|
47
|
+
const nextDragging = nextScreenKey
|
|
48
|
+
? GestureStore.getValue(nextScreenKey, "dragging")
|
|
49
|
+
: null;
|
|
50
|
+
|
|
51
|
+
useAnimatedReaction(
|
|
52
|
+
() => (hasNextScreen ? (nextWillAnimate?.get() ?? 0) : 0),
|
|
53
|
+
(nextValue, previousValue) => {
|
|
54
|
+
"worklet";
|
|
55
|
+
if (!enabled || !hasNextScreen) return;
|
|
56
|
+
if (nextValue === 0 || nextValue === previousValue) return;
|
|
57
|
+
|
|
58
|
+
const currentGroupActiveId = group
|
|
59
|
+
? BoundStore.getGroupActiveId(group)
|
|
60
|
+
: null;
|
|
61
|
+
|
|
62
|
+
if (group && currentGroupActiveId !== String(id)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const shouldCancelMeasurement =
|
|
67
|
+
!!nextAnimating?.get() && !!nextDragging?.get();
|
|
68
|
+
if (shouldCancelMeasurement) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const hasSourceLink = BoundStore.hasSourceLink(
|
|
73
|
+
sharedBoundTag,
|
|
74
|
+
currentScreenKey,
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const intent = resolvePrepareSourceMeasurementIntent({
|
|
78
|
+
hasSourceLink,
|
|
79
|
+
shouldRefreshExistingSource: !!group,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
if (!intent) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
maybeMeasureAndStore({ intent });
|
|
87
|
+
},
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
useAnimatedReaction(
|
|
91
|
+
() => (!hasNextScreen ? currentWillAnimate.get() : 0),
|
|
92
|
+
(nextValue, previousValue) => {
|
|
93
|
+
"worklet";
|
|
94
|
+
if (!enabled || hasNextScreen) return;
|
|
95
|
+
if (nextValue === 0 || nextValue === previousValue) return;
|
|
96
|
+
const currentGroupActiveId = group
|
|
97
|
+
? BoundStore.getGroupActiveId(group)
|
|
98
|
+
: null;
|
|
99
|
+
if (group && currentGroupActiveId !== String(id)) return;
|
|
100
|
+
|
|
101
|
+
const shouldCancelMeasurement =
|
|
102
|
+
!!currentAnimating.get() && !!currentDragging.get();
|
|
103
|
+
if (shouldCancelMeasurement) return;
|
|
104
|
+
|
|
105
|
+
maybeMeasureAndStore({
|
|
106
|
+
intent: PREPARE_DESTINATION_MEASUREMENT_INTENT,
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
);
|
|
110
|
+
};
|