react-native-screen-transitions 4.1.0-beta.0 → 4.1.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/components/boundary/components/boundary-lifecycle.js +40 -8
- package/lib/commonjs/components/boundary/components/boundary-lifecycle.js.map +1 -1
- package/lib/commonjs/components/boundary/components/boundary-target.js +10 -17
- package/lib/commonjs/components/boundary/components/boundary-target.js.map +1 -1
- package/lib/commonjs/components/boundary/create-boundary-component.js +13 -16
- package/lib/commonjs/components/boundary/create-boundary-component.js.map +1 -1
- package/lib/commonjs/components/boundary/helpers/presentation.js +56 -0
- package/lib/commonjs/components/boundary/helpers/presentation.js.map +1 -0
- package/lib/commonjs/components/boundary/hooks/use-boundary-presentation.js +65 -0
- package/lib/commonjs/components/boundary/hooks/use-boundary-presentation.js.map +1 -0
- package/lib/commonjs/components/boundary/hooks/use-composed-boundary-style.js +43 -0
- package/lib/commonjs/components/boundary/hooks/use-composed-boundary-style.js.map +1 -0
- package/lib/commonjs/components/boundary/index.js +2 -3
- package/lib/commonjs/components/boundary/index.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/components/portal-host.js +39 -0
- package/lib/commonjs/components/boundary/portal/components/portal-host.js.map +1 -0
- package/lib/commonjs/components/boundary/portal/components/portal-overlay.js +170 -0
- package/lib/commonjs/components/boundary/portal/components/portal-overlay.js.map +1 -0
- package/lib/commonjs/components/boundary/portal/components/portal.js +88 -0
- package/lib/commonjs/components/boundary/portal/components/portal.js.map +1 -0
- package/lib/commonjs/components/boundary/portal/helpers/offset-style.js.map +1 -0
- package/lib/commonjs/components/boundary/portal/hooks/use-active-portal-boundary-host.js +35 -0
- package/lib/commonjs/components/boundary/portal/hooks/use-active-portal-boundary-host.js.map +1 -0
- package/lib/commonjs/components/boundary/portal/hooks/use-host-measurement.js +83 -0
- package/lib/commonjs/components/boundary/portal/hooks/use-host-measurement.js.map +1 -0
- package/lib/commonjs/components/boundary/portal/hooks/use-placeholder-styles.js.map +1 -0
- package/lib/commonjs/components/boundary/portal/hooks/use-portal-destination.js +58 -0
- package/lib/commonjs/components/boundary/portal/hooks/use-portal-destination.js.map +1 -0
- package/lib/commonjs/components/boundary/portal/index.js +0 -7
- package/lib/commonjs/components/boundary/portal/index.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/{components/boundary-portal/stores → stores}/host-registry.store.js +1 -12
- package/lib/commonjs/components/boundary/portal/stores/host-registry.store.js.map +1 -0
- package/lib/commonjs/components/boundary/portal/{components/boundary-portal/stores → stores}/portal-boundary-host.store.js +17 -17
- package/lib/commonjs/components/boundary/portal/stores/portal-boundary-host.store.js.map +1 -0
- package/lib/commonjs/components/boundary/portal/utils/naming.js +8 -1
- package/lib/commonjs/components/boundary/portal/utils/naming.js.map +1 -1
- package/lib/commonjs/components/boundary/portal/utils/resolve-portal.js +7 -27
- package/lib/commonjs/components/boundary/portal/utils/resolve-portal.js.map +1 -1
- package/lib/commonjs/components/boundary/providers/boundary-root.provider.js +13 -7
- package/lib/commonjs/components/boundary/providers/boundary-root.provider.js.map +1 -1
- package/lib/commonjs/components/screen/container/helpers/layer-component.js +39 -0
- package/lib/commonjs/components/screen/container/helpers/layer-component.js.map +1 -0
- package/lib/commonjs/components/screen/container/{layers/render-component.js → helpers/uses-layer-render-props.js} +1 -1
- package/lib/commonjs/components/screen/container/helpers/uses-layer-render-props.js.map +1 -0
- package/lib/commonjs/components/screen/container/layers/backdrop.js +4 -13
- package/lib/commonjs/components/screen/container/layers/backdrop.js.map +1 -1
- package/lib/commonjs/components/screen/container/layers/clip.js +117 -0
- package/lib/commonjs/components/screen/container/layers/clip.js.map +1 -0
- package/lib/commonjs/components/screen/container/layers/content.js +17 -33
- package/lib/commonjs/components/screen/container/layers/content.js.map +1 -1
- package/lib/commonjs/components/screen/container/layers/surface.js +3 -15
- package/lib/commonjs/components/screen/container/layers/surface.js.map +1 -1
- package/lib/commonjs/components/screen/lifecycle/hooks/use-open-transition-intent.js +15 -0
- package/lib/commonjs/components/screen/lifecycle/hooks/use-open-transition-intent.js.map +1 -1
- package/lib/commonjs/constants.js +3 -1
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/hooks/navigation/use-navigation-helpers.js +16 -4
- package/lib/commonjs/hooks/navigation/use-navigation-helpers.js.map +1 -1
- package/lib/commonjs/providers/screen/motion/animation/helpers/build-screen-transition-options.js +0 -1
- package/lib/commonjs/providers/screen/motion/animation/helpers/build-screen-transition-options.js.map +1 -1
- package/lib/commonjs/providers/screen/motion/animation/helpers/hydrate-transition-state/index.js +3 -2
- package/lib/commonjs/providers/screen/motion/animation/helpers/hydrate-transition-state/index.js.map +1 -1
- package/lib/commonjs/providers/screen/motion/options/helpers.js +1 -3
- package/lib/commonjs/providers/screen/motion/options/helpers.js.map +1 -1
- package/lib/commonjs/providers/screen/orchestrator/helpers/use-interpolator-state.js +4 -2
- package/lib/commonjs/providers/screen/orchestrator/helpers/use-interpolator-state.js.map +1 -1
- package/lib/commonjs/providers/screen/orchestrator/helpers/use-pair-presentation.js +79 -0
- package/lib/commonjs/providers/screen/orchestrator/helpers/use-pair-presentation.js.map +1 -0
- package/lib/commonjs/providers/screen/orchestrator/orchestrator.provider.js +3 -0
- package/lib/commonjs/providers/screen/orchestrator/orchestrator.provider.js.map +1 -1
- package/lib/commonjs/providers/screen/orchestrator/styles/constants.js +1 -0
- package/lib/commonjs/providers/screen/orchestrator/styles/constants.js.map +1 -1
- package/lib/commonjs/providers/screen/orchestrator/styles/hooks/slot-resolvers.js +5 -8
- package/lib/commonjs/providers/screen/orchestrator/styles/hooks/slot-resolvers.js.map +1 -1
- package/lib/commonjs/utils/bounds/navigation/reveal/build.js +28 -61
- package/lib/commonjs/utils/bounds/navigation/reveal/build.js.map +1 -1
- package/lib/commonjs/utils/bounds/navigation/reveal/config.js +3 -4
- package/lib/commonjs/utils/bounds/navigation/reveal/config.js.map +1 -1
- package/lib/commonjs/utils/bounds/navigation/reveal/math.js +8 -8
- package/lib/commonjs/utils/bounds/navigation/reveal/math.js.map +1 -1
- package/lib/commonjs/utils/bounds/navigation/reveal/types.js +3 -1
- package/lib/commonjs/utils/bounds/navigation/reveal/types.js.map +1 -1
- package/lib/commonjs/utils/bounds/navigation/zoom/build.js +4 -6
- package/lib/commonjs/utils/bounds/navigation/zoom/build.js.map +1 -1
- package/lib/commonjs/utils/bounds/navigation/zoom/clip.js +64 -0
- package/lib/commonjs/utils/bounds/navigation/zoom/clip.js.map +1 -0
- package/lib/commonjs/utils/bounds/navigation/zoom/drag.js +1 -1
- package/lib/commonjs/utils/bounds/navigation/zoom/drag.js.map +1 -1
- package/lib/commonjs/utils/bounds/navigation/zoom/types.js +3 -1
- package/lib/commonjs/utils/bounds/navigation/zoom/types.js.map +1 -1
- package/lib/module/components/boundary/components/boundary-lifecycle.js +41 -9
- package/lib/module/components/boundary/components/boundary-lifecycle.js.map +1 -1
- package/lib/module/components/boundary/components/boundary-target.js +10 -17
- package/lib/module/components/boundary/components/boundary-target.js.map +1 -1
- package/lib/module/components/boundary/create-boundary-component.js +13 -16
- package/lib/module/components/boundary/create-boundary-component.js.map +1 -1
- package/lib/module/components/boundary/helpers/presentation.js +50 -0
- package/lib/module/components/boundary/helpers/presentation.js.map +1 -0
- package/lib/module/components/boundary/hooks/use-boundary-presentation.js +62 -0
- package/lib/module/components/boundary/hooks/use-boundary-presentation.js.map +1 -0
- package/lib/module/components/boundary/hooks/use-composed-boundary-style.js +39 -0
- package/lib/module/components/boundary/hooks/use-composed-boundary-style.js.map +1 -0
- package/lib/module/components/boundary/index.js +2 -3
- package/lib/module/components/boundary/index.js.map +1 -1
- package/lib/module/components/boundary/portal/components/portal-host.js +34 -0
- package/lib/module/components/boundary/portal/components/portal-host.js.map +1 -0
- package/lib/module/components/boundary/portal/components/portal-overlay.js +165 -0
- package/lib/module/components/boundary/portal/components/portal-overlay.js.map +1 -0
- package/lib/module/components/boundary/portal/components/portal.js +83 -0
- package/lib/module/components/boundary/portal/components/portal.js.map +1 -0
- package/lib/module/components/boundary/portal/helpers/offset-style.js.map +1 -0
- package/lib/module/components/boundary/portal/hooks/use-active-portal-boundary-host.js +31 -0
- package/lib/module/components/boundary/portal/hooks/use-active-portal-boundary-host.js.map +1 -0
- package/lib/module/components/boundary/portal/hooks/use-host-measurement.js +78 -0
- package/lib/module/components/boundary/portal/hooks/use-host-measurement.js.map +1 -0
- package/lib/module/components/boundary/portal/hooks/use-placeholder-styles.js.map +1 -0
- package/lib/module/components/boundary/portal/hooks/use-portal-destination.js +54 -0
- package/lib/module/components/boundary/portal/hooks/use-portal-destination.js.map +1 -0
- package/lib/module/components/boundary/portal/index.js +0 -1
- package/lib/module/components/boundary/portal/index.js.map +1 -1
- package/lib/module/components/boundary/portal/{components/boundary-portal/stores → stores}/host-registry.store.js +1 -12
- package/lib/module/components/boundary/portal/stores/host-registry.store.js.map +1 -0
- package/lib/module/components/boundary/portal/{components/boundary-portal/stores → stores}/portal-boundary-host.store.js +17 -17
- package/lib/module/components/boundary/portal/stores/portal-boundary-host.store.js.map +1 -0
- package/lib/module/components/boundary/portal/utils/naming.js +6 -0
- package/lib/module/components/boundary/portal/utils/naming.js.map +1 -1
- package/lib/module/components/boundary/portal/utils/resolve-portal.js +7 -27
- package/lib/module/components/boundary/portal/utils/resolve-portal.js.map +1 -1
- package/lib/module/components/boundary/providers/boundary-root.provider.js +13 -7
- package/lib/module/components/boundary/providers/boundary-root.provider.js.map +1 -1
- package/lib/module/components/screen/container/helpers/layer-component.js +35 -0
- package/lib/module/components/screen/container/helpers/layer-component.js.map +1 -0
- package/lib/module/components/screen/container/{layers/render-component.js → helpers/uses-layer-render-props.js} +1 -1
- package/lib/module/components/screen/container/helpers/uses-layer-render-props.js.map +1 -0
- package/lib/module/components/screen/container/layers/backdrop.js +5 -13
- package/lib/module/components/screen/container/layers/backdrop.js.map +1 -1
- package/lib/module/components/screen/container/layers/clip.js +112 -0
- package/lib/module/components/screen/container/layers/clip.js.map +1 -0
- package/lib/module/components/screen/container/layers/content.js +18 -33
- package/lib/module/components/screen/container/layers/content.js.map +1 -1
- package/lib/module/components/screen/container/layers/surface.js +4 -15
- package/lib/module/components/screen/container/layers/surface.js.map +1 -1
- package/lib/module/components/screen/lifecycle/hooks/use-open-transition-intent.js +17 -2
- package/lib/module/components/screen/lifecycle/hooks/use-open-transition-intent.js.map +1 -1
- package/lib/module/constants.js +3 -1
- package/lib/module/constants.js.map +1 -1
- package/lib/module/hooks/navigation/use-navigation-helpers.js +16 -4
- package/lib/module/hooks/navigation/use-navigation-helpers.js.map +1 -1
- package/lib/module/providers/screen/motion/animation/helpers/build-screen-transition-options.js +0 -1
- package/lib/module/providers/screen/motion/animation/helpers/build-screen-transition-options.js.map +1 -1
- package/lib/module/providers/screen/motion/animation/helpers/hydrate-transition-state/index.js +3 -2
- package/lib/module/providers/screen/motion/animation/helpers/hydrate-transition-state/index.js.map +1 -1
- package/lib/module/providers/screen/motion/options/helpers.js +1 -3
- package/lib/module/providers/screen/motion/options/helpers.js.map +1 -1
- package/lib/module/providers/screen/orchestrator/helpers/use-interpolator-state.js +6 -4
- package/lib/module/providers/screen/orchestrator/helpers/use-interpolator-state.js.map +1 -1
- package/lib/module/providers/screen/orchestrator/helpers/use-pair-presentation.js +73 -0
- package/lib/module/providers/screen/orchestrator/helpers/use-pair-presentation.js.map +1 -0
- package/lib/module/providers/screen/orchestrator/orchestrator.provider.js +3 -0
- package/lib/module/providers/screen/orchestrator/orchestrator.provider.js.map +1 -1
- package/lib/module/providers/screen/orchestrator/styles/constants.js +1 -0
- package/lib/module/providers/screen/orchestrator/styles/constants.js.map +1 -1
- package/lib/module/providers/screen/orchestrator/styles/hooks/slot-resolvers.js +5 -8
- package/lib/module/providers/screen/orchestrator/styles/hooks/slot-resolvers.js.map +1 -1
- package/lib/module/types/animation.types.js +3 -1
- package/lib/module/types/animation.types.js.map +1 -1
- package/lib/module/utils/bounds/navigation/reveal/build.js +30 -63
- package/lib/module/utils/bounds/navigation/reveal/build.js.map +1 -1
- package/lib/module/utils/bounds/navigation/reveal/config.js +2 -3
- package/lib/module/utils/bounds/navigation/reveal/config.js.map +1 -1
- package/lib/module/utils/bounds/navigation/reveal/math.js +7 -7
- package/lib/module/utils/bounds/navigation/reveal/math.js.map +1 -1
- package/lib/module/utils/bounds/navigation/reveal/types.js +1 -1
- package/lib/module/utils/bounds/navigation/reveal/types.js.map +1 -1
- package/lib/module/utils/bounds/navigation/zoom/build.js +5 -7
- package/lib/module/utils/bounds/navigation/zoom/build.js.map +1 -1
- package/lib/module/utils/bounds/navigation/zoom/clip.js +59 -0
- package/lib/module/utils/bounds/navigation/zoom/clip.js.map +1 -0
- package/lib/module/utils/bounds/navigation/zoom/drag.js +1 -1
- package/lib/module/utils/bounds/navigation/zoom/drag.js.map +1 -1
- package/lib/module/utils/bounds/navigation/zoom/types.js +1 -1
- package/lib/module/utils/bounds/navigation/zoom/types.js.map +1 -1
- package/lib/typescript/components/boundary/components/boundary-lifecycle.d.ts.map +1 -1
- package/lib/typescript/components/boundary/components/boundary-target.d.ts.map +1 -1
- package/lib/typescript/components/boundary/create-boundary-component.d.ts.map +1 -1
- package/lib/typescript/components/boundary/helpers/presentation.d.ts +14 -0
- package/lib/typescript/components/boundary/helpers/presentation.d.ts.map +1 -0
- package/lib/typescript/components/boundary/hooks/use-boundary-presentation.d.ts +9 -0
- package/lib/typescript/components/boundary/hooks/use-boundary-presentation.d.ts.map +1 -0
- package/lib/typescript/components/boundary/hooks/use-composed-boundary-style.d.ts +4 -0
- package/lib/typescript/components/boundary/hooks/use-composed-boundary-style.d.ts.map +1 -0
- package/lib/typescript/components/boundary/index.d.ts +3 -2
- package/lib/typescript/components/boundary/index.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/components/portal-host.d.ts +15 -0
- package/lib/typescript/components/boundary/portal/components/portal-host.d.ts.map +1 -0
- package/lib/typescript/components/boundary/portal/components/portal-overlay.d.ts +20 -0
- package/lib/typescript/components/boundary/portal/components/portal-overlay.d.ts.map +1 -0
- package/lib/typescript/components/boundary/portal/components/portal.d.ts +23 -0
- package/lib/typescript/components/boundary/portal/components/portal.d.ts.map +1 -0
- package/lib/typescript/components/boundary/portal/helpers/offset-style.d.ts.map +1 -0
- package/lib/typescript/components/boundary/portal/hooks/use-active-portal-boundary-host.d.ts +11 -0
- package/lib/typescript/components/boundary/portal/hooks/use-active-portal-boundary-host.d.ts.map +1 -0
- package/lib/typescript/components/boundary/portal/hooks/use-host-measurement.d.ts +13 -0
- package/lib/typescript/components/boundary/portal/hooks/use-host-measurement.d.ts.map +1 -0
- package/lib/typescript/components/boundary/portal/hooks/use-placeholder-styles.d.ts.map +1 -0
- package/lib/typescript/components/boundary/portal/hooks/use-portal-destination.d.ts +8 -0
- package/lib/typescript/components/boundary/portal/hooks/use-portal-destination.d.ts.map +1 -0
- package/lib/typescript/components/boundary/portal/index.d.ts +0 -1
- package/lib/typescript/components/boundary/portal/index.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/stores/host-registry.store.d.ts.map +1 -0
- package/lib/typescript/components/boundary/portal/{components/boundary-portal/stores → stores}/portal-boundary-host.store.d.ts +2 -3
- package/lib/typescript/components/boundary/portal/stores/portal-boundary-host.store.d.ts.map +1 -0
- package/lib/typescript/components/boundary/portal/utils/naming.d.ts +1 -0
- package/lib/typescript/components/boundary/portal/utils/naming.d.ts.map +1 -1
- package/lib/typescript/components/boundary/portal/utils/resolve-portal.d.ts +2 -7
- package/lib/typescript/components/boundary/portal/utils/resolve-portal.d.ts.map +1 -1
- package/lib/typescript/components/boundary/providers/boundary-root.provider.d.ts +5 -2
- package/lib/typescript/components/boundary/providers/boundary-root.provider.d.ts.map +1 -1
- package/lib/typescript/components/screen/container/helpers/layer-component.d.ts +10 -0
- package/lib/typescript/components/screen/container/helpers/layer-component.d.ts.map +1 -0
- package/lib/typescript/components/screen/container/{layers/render-component.d.ts → helpers/uses-layer-render-props.d.ts} +1 -1
- package/lib/typescript/components/screen/container/helpers/uses-layer-render-props.d.ts.map +1 -0
- package/lib/typescript/components/screen/container/layers/backdrop.d.ts.map +1 -1
- package/lib/typescript/components/screen/container/layers/clip.d.ts +7 -0
- package/lib/typescript/components/screen/container/layers/clip.d.ts.map +1 -0
- package/lib/typescript/components/screen/container/layers/content.d.ts.map +1 -1
- package/lib/typescript/components/screen/container/layers/surface.d.ts.map +1 -1
- package/lib/typescript/components/screen/lifecycle/hooks/use-open-transition-intent.d.ts.map +1 -1
- package/lib/typescript/constants.d.ts +3 -1
- package/lib/typescript/constants.d.ts.map +1 -1
- package/lib/typescript/hooks/navigation/use-navigation-helpers.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/providers/screen/motion/animation/helpers/build-screen-transition-options.d.ts.map +1 -1
- package/lib/typescript/providers/screen/motion/animation/helpers/hydrate-transition-state/index.d.ts.map +1 -1
- package/lib/typescript/providers/screen/motion/options/helpers.d.ts.map +1 -1
- package/lib/typescript/providers/screen/motion/options/types.d.ts +0 -1
- package/lib/typescript/providers/screen/motion/options/types.d.ts.map +1 -1
- package/lib/typescript/providers/screen/orchestrator/helpers/use-interpolator-state.d.ts.map +1 -1
- package/lib/typescript/providers/screen/orchestrator/helpers/use-pair-presentation.d.ts +21 -0
- package/lib/typescript/providers/screen/orchestrator/helpers/use-pair-presentation.d.ts.map +1 -0
- package/lib/typescript/providers/screen/orchestrator/orchestrator.provider.d.ts +2 -0
- package/lib/typescript/providers/screen/orchestrator/orchestrator.provider.d.ts.map +1 -1
- package/lib/typescript/providers/screen/orchestrator/styles/constants.d.ts.map +1 -1
- package/lib/typescript/providers/screen/orchestrator/styles/hooks/slot-resolvers.d.ts +1 -1
- package/lib/typescript/providers/screen/orchestrator/styles/hooks/slot-resolvers.d.ts.map +1 -1
- package/lib/typescript/providers/screen/orchestrator/styles/types.d.ts +1 -1
- package/lib/typescript/providers/screen/orchestrator/styles/types.d.ts.map +1 -1
- package/lib/typescript/types/animation.types.d.ts +16 -4
- package/lib/typescript/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/types/bounds.types.d.ts +7 -15
- package/lib/typescript/types/bounds.types.d.ts.map +1 -1
- package/lib/typescript/types/index.d.ts +1 -1
- package/lib/typescript/types/index.d.ts.map +1 -1
- package/lib/typescript/types/screen.types.d.ts +1 -8
- package/lib/typescript/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/navigation/reveal/build.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/navigation/reveal/config.d.ts +2 -3
- package/lib/typescript/utils/bounds/navigation/reveal/config.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/navigation/reveal/math.d.ts +3 -3
- package/lib/typescript/utils/bounds/navigation/reveal/types.d.ts +1 -5
- package/lib/typescript/utils/bounds/navigation/reveal/types.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/navigation/zoom/build.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/navigation/zoom/{mask.d.ts → clip.d.ts} +5 -5
- package/lib/typescript/utils/bounds/navigation/zoom/clip.d.ts.map +1 -0
- package/lib/typescript/utils/bounds/navigation/zoom/drag.d.ts +1 -1
- package/lib/typescript/utils/bounds/navigation/zoom/types.d.ts +1 -5
- package/lib/typescript/utils/bounds/navigation/zoom/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/boundary/components/boundary-lifecycle.tsx +44 -8
- package/src/components/boundary/components/boundary-target.tsx +14 -36
- package/src/components/boundary/create-boundary-component.tsx +16 -17
- package/src/components/boundary/helpers/presentation.ts +88 -0
- package/src/components/boundary/hooks/use-boundary-presentation.ts +82 -0
- package/src/components/boundary/hooks/use-composed-boundary-style.ts +58 -0
- package/src/components/boundary/index.tsx +10 -5
- package/src/components/boundary/portal/components/portal-host.tsx +36 -0
- package/src/components/boundary/portal/components/portal-overlay.tsx +223 -0
- package/src/components/boundary/portal/components/portal.tsx +124 -0
- package/src/components/boundary/portal/hooks/use-active-portal-boundary-host.ts +52 -0
- package/src/components/boundary/portal/hooks/use-host-measurement.ts +101 -0
- package/src/components/boundary/portal/hooks/use-portal-destination.ts +53 -0
- package/src/components/boundary/portal/index.ts +0 -1
- package/src/components/boundary/portal/{components/boundary-portal/stores → stores}/host-registry.store.ts +1 -20
- package/src/components/boundary/portal/{components/boundary-portal/stores → stores}/portal-boundary-host.store.ts +19 -26
- package/src/components/boundary/portal/utils/naming.ts +10 -0
- package/src/components/boundary/portal/utils/resolve-portal.ts +9 -48
- package/src/components/boundary/providers/boundary-root.provider.tsx +34 -22
- package/src/components/screen/container/helpers/layer-component.tsx +38 -0
- package/src/components/screen/container/layers/backdrop.tsx +8 -31
- package/src/components/screen/container/layers/clip.tsx +124 -0
- package/src/components/screen/container/layers/content.tsx +21 -62
- package/src/components/screen/container/layers/surface.tsx +5 -23
- package/src/components/screen/lifecycle/hooks/use-open-transition-intent.ts +26 -2
- package/src/constants.ts +3 -1
- package/src/hooks/navigation/use-navigation-helpers.ts +13 -7
- package/src/index.ts +1 -0
- package/src/providers/screen/motion/animation/helpers/build-screen-transition-options.ts +0 -1
- package/src/providers/screen/motion/animation/helpers/hydrate-transition-state/index.ts +3 -2
- package/src/providers/screen/motion/options/helpers.ts +0 -6
- package/src/providers/screen/motion/options/types.ts +0 -1
- package/src/providers/screen/orchestrator/helpers/use-interpolator-state.ts +13 -8
- package/src/providers/screen/orchestrator/helpers/use-pair-presentation.ts +103 -0
- package/src/providers/screen/orchestrator/orchestrator.provider.tsx +4 -0
- package/src/providers/screen/orchestrator/styles/constants.ts +1 -0
- package/src/providers/screen/orchestrator/styles/hooks/slot-resolvers.tsx +8 -11
- package/src/providers/screen/orchestrator/styles/types.ts +1 -0
- package/src/types/animation.types.ts +35 -4
- package/src/types/bounds.types.ts +7 -15
- package/src/types/index.ts +1 -0
- package/src/types/screen.types.ts +1 -8
- package/src/utils/bounds/navigation/reveal/build.ts +46 -80
- package/src/utils/bounds/navigation/reveal/config.ts +2 -4
- package/src/utils/bounds/navigation/reveal/math.ts +9 -9
- package/src/utils/bounds/navigation/reveal/types.ts +1 -8
- package/src/utils/bounds/navigation/zoom/build.ts +16 -26
- package/src/utils/bounds/navigation/zoom/{mask.ts → clip.ts} +42 -48
- package/src/utils/bounds/navigation/zoom/drag.ts +2 -2
- package/src/utils/bounds/navigation/zoom/types.ts +1 -8
- package/lib/commonjs/components/boundary/hooks/use-boundary-measurement.js +0 -83
- package/lib/commonjs/components/boundary/hooks/use-boundary-measurement.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/components/host.js +0 -45
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/components/host.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js +0 -119
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/helpers/handoff-visibility.js +0 -20
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/helpers/handoff-visibility.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/helpers/host-name.js +0 -14
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/helpers/host-name.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +0 -136
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/index.js +0 -53
- package/lib/commonjs/components/boundary/portal/components/boundary-content-portal/index.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/components/host.js +0 -99
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/components/host.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +0 -104
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/local-measurement.js +0 -13
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/local-measurement.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/helpers/offset-style.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js +0 -82
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +0 -58
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js +0 -67
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/hooks/use-placeholder-styles.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/index.js +0 -68
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/index.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/stores/host-registry.store.js.map +0 -1
- package/lib/commonjs/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +0 -1
- package/lib/commonjs/components/screen/container/layers/maybe-masked-navigation-container.js +0 -83
- package/lib/commonjs/components/screen/container/layers/maybe-masked-navigation-container.js.map +0 -1
- package/lib/commonjs/components/screen/container/layers/render-component.js.map +0 -1
- package/lib/commonjs/utils/bounds/navigation/zoom/mask.js +0 -73
- package/lib/commonjs/utils/bounds/navigation/zoom/mask.js.map +0 -1
- package/lib/module/components/boundary/hooks/use-boundary-measurement.js +0 -78
- package/lib/module/components/boundary/hooks/use-boundary-measurement.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-content-portal/components/host.js +0 -40
- package/lib/module/components/boundary/portal/components/boundary-content-portal/components/host.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js +0 -110
- package/lib/module/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-content-portal/helpers/handoff-visibility.js +0 -16
- package/lib/module/components/boundary/portal/components/boundary-content-portal/helpers/handoff-visibility.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-content-portal/helpers/host-name.js +0 -9
- package/lib/module/components/boundary/portal/components/boundary-content-portal/helpers/host-name.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +0 -131
- package/lib/module/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-content-portal/index.js +0 -42
- package/lib/module/components/boundary/portal/components/boundary-content-portal/index.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/components/host.js +0 -94
- package/lib/module/components/boundary/portal/components/boundary-portal/components/host.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +0 -99
- package/lib/module/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/helpers/local-measurement.js +0 -8
- package/lib/module/components/boundary/portal/components/boundary-portal/helpers/local-measurement.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/helpers/offset-style.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js +0 -76
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +0 -53
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js +0 -62
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/hooks/use-placeholder-styles.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/index.js +0 -63
- package/lib/module/components/boundary/portal/components/boundary-portal/index.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/stores/host-registry.store.js.map +0 -1
- package/lib/module/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +0 -1
- package/lib/module/components/screen/container/layers/maybe-masked-navigation-container.js +0 -78
- package/lib/module/components/screen/container/layers/maybe-masked-navigation-container.js.map +0 -1
- package/lib/module/components/screen/container/layers/render-component.js.map +0 -1
- package/lib/module/utils/bounds/navigation/zoom/mask.js +0 -68
- package/lib/module/utils/bounds/navigation/zoom/mask.js.map +0 -1
- package/lib/typescript/components/boundary/hooks/use-boundary-measurement.d.ts +0 -28
- package/lib/typescript/components/boundary/hooks/use-boundary-measurement.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/components/host.d.ts +0 -10
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/components/host.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.d.ts +0 -45
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/helpers/handoff-visibility.d.ts +0 -8
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/helpers/handoff-visibility.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/helpers/host-name.d.ts +0 -2
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/helpers/host-name.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.d.ts +0 -10
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/index.d.ts +0 -9
- package/lib/typescript/components/boundary/portal/components/boundary-content-portal/index.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/components/host.d.ts +0 -7
- package/lib/typescript/components/boundary/portal/components/boundary-portal/components/host.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.d.ts +0 -13
- package/lib/typescript/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/local-measurement.d.ts +0 -4
- package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/local-measurement.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/helpers/offset-style.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.d.ts +0 -21
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts +0 -10
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.d.ts +0 -12
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/hooks/use-placeholder-styles.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/index.d.ts +0 -12
- package/lib/typescript/components/boundary/portal/components/boundary-portal/index.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/stores/host-registry.store.d.ts.map +0 -1
- package/lib/typescript/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts.map +0 -1
- package/lib/typescript/components/screen/container/layers/maybe-masked-navigation-container.d.ts +0 -9
- package/lib/typescript/components/screen/container/layers/maybe-masked-navigation-container.d.ts.map +0 -1
- package/lib/typescript/components/screen/container/layers/render-component.d.ts.map +0 -1
- package/lib/typescript/utils/bounds/navigation/zoom/mask.d.ts.map +0 -1
- package/src/components/boundary/hooks/use-boundary-measurement.ts +0 -98
- package/src/components/boundary/portal/components/boundary-content-portal/components/host.tsx +0 -56
- package/src/components/boundary/portal/components/boundary-content-portal/helpers/active-handoff-receiver.ts +0 -192
- package/src/components/boundary/portal/components/boundary-content-portal/helpers/handoff-visibility.ts +0 -23
- package/src/components/boundary/portal/components/boundary-content-portal/helpers/host-name.ts +0 -9
- package/src/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.ts +0 -252
- package/src/components/boundary/portal/components/boundary-content-portal/index.tsx +0 -81
- package/src/components/boundary/portal/components/boundary-portal/components/host.tsx +0 -119
- package/src/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.tsx +0 -139
- package/src/components/boundary/portal/components/boundary-portal/helpers/local-measurement.ts +0 -10
- package/src/components/boundary/portal/components/boundary-portal/hooks/use-active-portal-boundary-host.ts +0 -118
- package/src/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.ts +0 -64
- package/src/components/boundary/portal/components/boundary-portal/hooks/use-host-measurement.ts +0 -90
- package/src/components/boundary/portal/components/boundary-portal/index.tsx +0 -97
- package/src/components/screen/container/layers/maybe-masked-navigation-container.tsx +0 -113
- /package/lib/commonjs/components/boundary/portal/{components/boundary-portal/helpers → helpers}/offset-style.js +0 -0
- /package/lib/commonjs/components/boundary/portal/{components/boundary-portal/hooks → hooks}/use-placeholder-styles.js +0 -0
- /package/lib/module/components/boundary/portal/{components/boundary-portal/helpers → helpers}/offset-style.js +0 -0
- /package/lib/module/components/boundary/portal/{components/boundary-portal/hooks → hooks}/use-placeholder-styles.js +0 -0
- /package/lib/typescript/components/boundary/portal/{components/boundary-portal/helpers → helpers}/offset-style.d.ts +0 -0
- /package/lib/typescript/components/boundary/portal/{components/boundary-portal/hooks → hooks}/use-placeholder-styles.d.ts +0 -0
- /package/lib/typescript/components/boundary/portal/{components/boundary-portal/stores → stores}/host-registry.store.d.ts +0 -0
- /package/src/components/boundary/portal/{components/boundary-portal/helpers → helpers}/offset-style.ts +0 -0
- /package/src/components/boundary/portal/{components/boundary-portal/hooks → hooks}/use-placeholder-styles.ts +0 -0
- /package/src/components/screen/container/{layers/render-component.ts → helpers/uses-layer-render-props.ts} +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { DerivedValue } from "react-native-reanimated";
|
|
2
|
+
import { getLinkKeyFromTag } from "../../../stores/bounds/helpers/link-pairs.helpers";
|
|
3
|
+
import type {
|
|
4
|
+
boundaryRegistry,
|
|
5
|
+
pairs,
|
|
6
|
+
} from "../../../stores/bounds/internals/state";
|
|
7
|
+
import type { BoundaryHandoffTarget } from "../../../types/animation.types";
|
|
8
|
+
|
|
9
|
+
export type { BoundaryPairPresentation } from "../../../providers/screen/orchestrator/helpers/use-pair-presentation";
|
|
10
|
+
|
|
11
|
+
import type { BoundaryPairPresentation } from "../../../providers/screen/orchestrator/helpers/use-pair-presentation";
|
|
12
|
+
|
|
13
|
+
export type BoundaryPresentationState = {
|
|
14
|
+
presentations: readonly (
|
|
15
|
+
| DerivedValue<BoundaryPairPresentation | undefined>
|
|
16
|
+
| null
|
|
17
|
+
| undefined
|
|
18
|
+
)[];
|
|
19
|
+
pairs: ReturnType<typeof pairs.get>;
|
|
20
|
+
entries: ReturnType<typeof boundaryRegistry.get>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export function resolveBoundaryPresentation(
|
|
24
|
+
screenKey: string,
|
|
25
|
+
boundaryId: string,
|
|
26
|
+
state: BoundaryPresentationState,
|
|
27
|
+
) {
|
|
28
|
+
"worklet";
|
|
29
|
+
const linkKey = getLinkKeyFromTag(boundaryId);
|
|
30
|
+
let result: BoundaryPairPresentation | undefined;
|
|
31
|
+
for (const value of state.presentations) {
|
|
32
|
+
const presentation = value?.get();
|
|
33
|
+
if (!presentation) continue;
|
|
34
|
+
const pair = state.pairs[presentation.pairKey];
|
|
35
|
+
const link = pair?.links[linkKey];
|
|
36
|
+
if (!link || (link.group && pair.groups[link.group]?.activeId !== linkKey))
|
|
37
|
+
continue;
|
|
38
|
+
const sourceKey = link.source?.screenKey ?? presentation.sourceKey;
|
|
39
|
+
const destinationKey =
|
|
40
|
+
link.destination?.screenKey ?? presentation.destinationKey;
|
|
41
|
+
if (sourceKey !== screenKey && destinationKey !== screenKey) continue;
|
|
42
|
+
// A preparing or completed pair cannot displace a live presentation.
|
|
43
|
+
if (result && !presentation.ready) continue;
|
|
44
|
+
result = { ...presentation, sourceKey, destinationKey };
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function resolveBoundaryReceiver(
|
|
50
|
+
presentation: BoundaryPairPresentation | undefined,
|
|
51
|
+
target: BoundaryHandoffTarget | undefined,
|
|
52
|
+
screenKey: string,
|
|
53
|
+
) {
|
|
54
|
+
"worklet";
|
|
55
|
+
if (!presentation) return screenKey;
|
|
56
|
+
return presentation.ready && target !== "source"
|
|
57
|
+
? presentation.destinationKey
|
|
58
|
+
: presentation.sourceKey;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function resolveBoundaryHandoff(
|
|
62
|
+
screenKey: string,
|
|
63
|
+
boundaryId: string,
|
|
64
|
+
state: BoundaryPresentationState,
|
|
65
|
+
) {
|
|
66
|
+
"worklet";
|
|
67
|
+
let receiver = screenKey;
|
|
68
|
+
const visited: Record<string, true> = {};
|
|
69
|
+
while (!visited[receiver]) {
|
|
70
|
+
visited[receiver] = true;
|
|
71
|
+
const p = resolveBoundaryPresentation(receiver, boundaryId, state);
|
|
72
|
+
if (!p) break;
|
|
73
|
+
const slot = (p.sourceKey === receiver ? p.source : p.destination)[
|
|
74
|
+
boundaryId
|
|
75
|
+
];
|
|
76
|
+
const next = resolveBoundaryReceiver(
|
|
77
|
+
p,
|
|
78
|
+
slot?.props?.handoffTarget ??
|
|
79
|
+
p.destination[boundaryId]?.props?.handoffTarget ??
|
|
80
|
+
p.source[boundaryId]?.props?.handoffTarget,
|
|
81
|
+
receiver,
|
|
82
|
+
);
|
|
83
|
+
if (next === receiver || !state.entries[boundaryId]?.screens[next]?.handoff)
|
|
84
|
+
break;
|
|
85
|
+
receiver = next;
|
|
86
|
+
}
|
|
87
|
+
return receiver;
|
|
88
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useDerivedValue, useSharedValue } from "react-native-reanimated";
|
|
3
|
+
import { NO_PROPS, NO_STYLES } from "../../../constants";
|
|
4
|
+
import { useBuilderStore } from "../../../providers/screen/builder";
|
|
5
|
+
import { useScreenRelationships } from "../../../providers/screen/builder/topology";
|
|
6
|
+
import {
|
|
7
|
+
useOptionalOrchestratorStore,
|
|
8
|
+
useOrchestratorStore,
|
|
9
|
+
} from "../../../providers/screen/orchestrator";
|
|
10
|
+
import {
|
|
11
|
+
areResettableStatesBySlotEqual,
|
|
12
|
+
type ResettableStyleStatesBySlot,
|
|
13
|
+
resolveSlotStyles,
|
|
14
|
+
} from "../../../providers/screen/orchestrator/styles/helpers/resolve-slot-styles";
|
|
15
|
+
import { useOptionalBlankStackStore } from "../../../providers/stack/blank-stack.provider";
|
|
16
|
+
import {
|
|
17
|
+
boundaryRegistry,
|
|
18
|
+
pairs,
|
|
19
|
+
} from "../../../stores/bounds/internals/state";
|
|
20
|
+
import {
|
|
21
|
+
type BoundaryPresentationState,
|
|
22
|
+
resolveBoundaryHandoff,
|
|
23
|
+
resolveBoundaryPresentation,
|
|
24
|
+
} from "../helpers/presentation";
|
|
25
|
+
|
|
26
|
+
// Screens are discovered through existing providers. React only wires subscriptions;
|
|
27
|
+
// their live UI values decide ownership, including retained closing screens.
|
|
28
|
+
export function useBoundaryPresentation(boundaryId: string, enabled = true) {
|
|
29
|
+
const screenKey = useBuilderStore((s) => s.derivations.currentScreenKey);
|
|
30
|
+
const scenes = useOptionalBlankStackStore((s) => s?.scenes);
|
|
31
|
+
const keys = useMemo(
|
|
32
|
+
() => (enabled ? (scenes?.map((s) => s.route.key) ?? [screenKey]) : []),
|
|
33
|
+
[scenes, screenKey, enabled],
|
|
34
|
+
);
|
|
35
|
+
const pairPresentations = useOptionalOrchestratorStore(
|
|
36
|
+
keys,
|
|
37
|
+
(s) => s.pairPresentation,
|
|
38
|
+
);
|
|
39
|
+
const localSlots = useOrchestratorStore((s) => s.slotsMap);
|
|
40
|
+
const { parentScreenKey } = useScreenRelationships();
|
|
41
|
+
const ancestorSlots = useOptionalOrchestratorStore(
|
|
42
|
+
parentScreenKey,
|
|
43
|
+
(s) => s.slotsMap,
|
|
44
|
+
);
|
|
45
|
+
const previous = useSharedValue<ResettableStyleStatesBySlot>(NO_PROPS);
|
|
46
|
+
|
|
47
|
+
const presentation = useDerivedValue(() => {
|
|
48
|
+
const state: BoundaryPresentationState = {
|
|
49
|
+
presentations: pairPresentations,
|
|
50
|
+
pairs: pairs.get(),
|
|
51
|
+
entries: boundaryRegistry.get(),
|
|
52
|
+
};
|
|
53
|
+
const owner = resolveBoundaryPresentation(screenKey, boundaryId, state);
|
|
54
|
+
const receiver = resolveBoundaryHandoff(screenKey, boundaryId, state);
|
|
55
|
+
const ownedSlot = owner?.ready
|
|
56
|
+
? (owner.sourceKey === screenKey ? owner.source : owner.destination)[
|
|
57
|
+
boundaryId
|
|
58
|
+
]
|
|
59
|
+
: undefined;
|
|
60
|
+
|
|
61
|
+
const fallback = localSlots.get()[boundaryId];
|
|
62
|
+
const { resolvedStylesMap, nextPreviousStyleStatesBySlot } =
|
|
63
|
+
resolveSlotStyles({
|
|
64
|
+
localStylesMaps: [{ [boundaryId]: ownedSlot ?? fallback ?? {} }],
|
|
65
|
+
ancestorStylesMap: ownedSlot
|
|
66
|
+
? (ancestorSlots?.get() ?? NO_STYLES)
|
|
67
|
+
: NO_STYLES,
|
|
68
|
+
previousStyleStatesBySlot: previous.get(),
|
|
69
|
+
});
|
|
70
|
+
if (
|
|
71
|
+
!areResettableStatesBySlotEqual(
|
|
72
|
+
previous.get(),
|
|
73
|
+
nextPreviousStyleStatesBySlot,
|
|
74
|
+
)
|
|
75
|
+
) {
|
|
76
|
+
previous.set(nextPreviousStyleStatesBySlot);
|
|
77
|
+
}
|
|
78
|
+
return { owner, receiver, slots: resolvedStylesMap };
|
|
79
|
+
});
|
|
80
|
+
const slotsMap = useDerivedValue(() => presentation.get().slots);
|
|
81
|
+
return { presentation, slotsMap };
|
|
82
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import {
|
|
3
|
+
type SharedValue,
|
|
4
|
+
type StyleProps,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
} from "react-native-reanimated";
|
|
7
|
+
import { NO_STYLES } from "../../../constants";
|
|
8
|
+
import {
|
|
9
|
+
composeSlotStyleWithLocalTransform,
|
|
10
|
+
getLocalTransformForSlotComposition,
|
|
11
|
+
} from "../../../providers/screen/orchestrator/styles/helpers/compose-slot-style";
|
|
12
|
+
import type { NormalizedTransitionInterpolatedStyle } from "../../../types/animation.types";
|
|
13
|
+
|
|
14
|
+
export function useComposedBoundaryStyle(
|
|
15
|
+
slots: SharedValue<NormalizedTransitionInterpolatedStyle> | undefined,
|
|
16
|
+
id: string | undefined,
|
|
17
|
+
style?: unknown,
|
|
18
|
+
kind: "full" | "stacking" | "layout" = "full",
|
|
19
|
+
) {
|
|
20
|
+
const local = useMemo(
|
|
21
|
+
() => getLocalTransformForSlotComposition(style),
|
|
22
|
+
[style],
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return useAnimatedStyle(() => {
|
|
26
|
+
const slot = id ? slots?.get()[id] : undefined;
|
|
27
|
+
const value: StyleProps = slot?.style ?? NO_STYLES;
|
|
28
|
+
if (kind === "stacking")
|
|
29
|
+
return { zIndex: value.zIndex ?? 0, elevation: value.elevation ?? 0 };
|
|
30
|
+
|
|
31
|
+
if (kind === "layout") {
|
|
32
|
+
const {
|
|
33
|
+
width,
|
|
34
|
+
height,
|
|
35
|
+
minWidth,
|
|
36
|
+
minHeight,
|
|
37
|
+
maxWidth,
|
|
38
|
+
maxHeight,
|
|
39
|
+
aspectRatio,
|
|
40
|
+
} = value;
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
width,
|
|
44
|
+
height,
|
|
45
|
+
minWidth,
|
|
46
|
+
minHeight,
|
|
47
|
+
maxWidth,
|
|
48
|
+
maxHeight,
|
|
49
|
+
aspectRatio,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return composeSlotStyleWithLocalTransform(
|
|
53
|
+
value,
|
|
54
|
+
local,
|
|
55
|
+
slot?.boundsLocalTransform,
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type ComponentProps,
|
|
3
|
+
forwardRef,
|
|
4
|
+
type NamedExoticComponent,
|
|
5
|
+
} from "react";
|
|
2
6
|
import { View, type ViewProps } from "react-native";
|
|
3
7
|
import { Pressable, type PressableProps } from "react-native-gesture-handler";
|
|
4
8
|
import { BoundaryTarget } from "./components/boundary-target";
|
|
5
9
|
import { createBoundaryComponent } from "./create-boundary-component";
|
|
6
|
-
import {
|
|
10
|
+
import { PortalOverlay } from "./portal/components/portal-overlay";
|
|
7
11
|
import type { BoundaryComponentProps } from "./types";
|
|
8
12
|
|
|
9
13
|
export { createBoundaryComponent };
|
|
@@ -26,7 +30,6 @@ BoundaryPrimitive.displayName = "Transition.Boundary.Primitive";
|
|
|
26
30
|
const BoundaryRoot = createBoundaryComponent(BoundaryPrimitive);
|
|
27
31
|
BoundaryRoot.displayName = "Transition.Boundary";
|
|
28
32
|
BoundaryTarget.displayName = "Transition.Boundary.Target";
|
|
29
|
-
Host.displayName = "Transition.Boundary.Host";
|
|
30
33
|
|
|
31
34
|
type BoundaryRootComponent = typeof BoundaryRoot;
|
|
32
35
|
|
|
@@ -55,12 +58,14 @@ export interface BoundaryComponent extends BoundaryRootComponent {
|
|
|
55
58
|
/**
|
|
56
59
|
* Explicit host for clipping-escape placement.
|
|
57
60
|
*/
|
|
58
|
-
Host:
|
|
61
|
+
Host: NamedExoticComponent<
|
|
62
|
+
Omit<ComponentProps<typeof PortalOverlay>, "fallback">
|
|
63
|
+
>;
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
export type BoundaryProps = BoundaryComponentProps<BoundaryPrimitiveProps>;
|
|
62
67
|
|
|
63
68
|
export const Boundary = Object.assign(BoundaryRoot, {
|
|
64
69
|
Target: BoundaryTarget,
|
|
65
|
-
Host,
|
|
70
|
+
Host: PortalOverlay,
|
|
66
71
|
}) as BoundaryComponent;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ComponentProps, memo } from "react";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
import Animated from "react-native-reanimated";
|
|
4
|
+
import { NativePortalHost, PORTAL_POINTER_EVENTS } from "../teleport";
|
|
5
|
+
|
|
6
|
+
const AnimatedHost = NativePortalHost
|
|
7
|
+
? Animated.createAnimatedComponent(NativePortalHost)
|
|
8
|
+
: null;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The native receiving point for a Portal whose destination matches `name`.
|
|
12
|
+
*
|
|
13
|
+
* Handoff places this inside a boundary, filling its local frame. Escape-clipping
|
|
14
|
+
* places it inside a PortalOverlay, which supplies
|
|
15
|
+
* the boundary's size, offset, and animated styles. This component only renders
|
|
16
|
+
* the receiver; destination selection and measurement belong to its callers.
|
|
17
|
+
*/
|
|
18
|
+
export const PortalHost = memo(function PortalHost({
|
|
19
|
+
name,
|
|
20
|
+
style = styles.inline,
|
|
21
|
+
}: {
|
|
22
|
+
name: string;
|
|
23
|
+
style?: ComponentProps<typeof Animated.View>["style"];
|
|
24
|
+
}) {
|
|
25
|
+
return AnimatedHost ? (
|
|
26
|
+
<AnimatedHost
|
|
27
|
+
name={name}
|
|
28
|
+
pointerEvents={PORTAL_POINTER_EVENTS}
|
|
29
|
+
style={style}
|
|
30
|
+
/>
|
|
31
|
+
) : null;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const styles = StyleSheet.create({
|
|
35
|
+
inline: { ...StyleSheet.absoluteFill, overflow: "visible" },
|
|
36
|
+
});
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { memo, useId, useLayoutEffect } from "react";
|
|
2
|
+
import {
|
|
3
|
+
I18nManager,
|
|
4
|
+
type StyleProp,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
useWindowDimensions,
|
|
7
|
+
View,
|
|
8
|
+
type ViewStyle,
|
|
9
|
+
} from "react-native";
|
|
10
|
+
import Animated, {
|
|
11
|
+
type MeasuredDimensions,
|
|
12
|
+
type SharedValue,
|
|
13
|
+
useAnimatedReaction,
|
|
14
|
+
useAnimatedStyle,
|
|
15
|
+
} from "react-native-reanimated";
|
|
16
|
+
import { NO_STYLES } from "../../../../constants";
|
|
17
|
+
import { useBuilderStore } from "../../../../providers/screen/builder";
|
|
18
|
+
import { composeSlotStyleWithLocalTransform } from "../../../../providers/screen/orchestrator/styles/helpers/compose-slot-style";
|
|
19
|
+
import { resolvePortalOffsetStyle } from "../helpers/offset-style";
|
|
20
|
+
import { useHostMeasurement } from "../hooks/use-host-measurement";
|
|
21
|
+
import { registerHost, unregisterHost } from "../stores/host-registry.store";
|
|
22
|
+
import {
|
|
23
|
+
type ActivePortalBoundaryHost,
|
|
24
|
+
useActivePortalBoundaryHosts,
|
|
25
|
+
} from "../stores/portal-boundary-host.store";
|
|
26
|
+
import { PORTAL_POINTER_EVENTS } from "../teleport";
|
|
27
|
+
import { PortalHost } from "./portal-host";
|
|
28
|
+
|
|
29
|
+
type PortalOverlayProps = {
|
|
30
|
+
style?: StyleProp<ViewStyle>;
|
|
31
|
+
fallback?: boolean;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A screen-sized overlay containing the receivers for escaped boundary frames.
|
|
36
|
+
*
|
|
37
|
+
* Registers this overlay as an available placement, measures its origin, and
|
|
38
|
+
* renders one positioned PortalHost per boundary assigned to it. An overlay can
|
|
39
|
+
* contain many hosts; each host receives one named portal.
|
|
40
|
+
*
|
|
41
|
+
* Boundary.Host uses this directly; screens render it with `fallback` for
|
|
42
|
+
* their automatic overlay. Explicit overlays take priority over the fallback.
|
|
43
|
+
* Handoff between screens uses receivers inside boundaries, so it does not
|
|
44
|
+
* need this overlay unless escapeClipping is also enabled.
|
|
45
|
+
*/
|
|
46
|
+
export const PortalOverlay = memo(function PortalOverlay({
|
|
47
|
+
fallback = false,
|
|
48
|
+
style,
|
|
49
|
+
}: PortalOverlayProps) {
|
|
50
|
+
const screenKey = useBuilderStore((s) => s.derivations.currentScreenKey);
|
|
51
|
+
const id = useId();
|
|
52
|
+
const hostKey = fallback ? screenKey : `${screenKey}-host-${id}`;
|
|
53
|
+
const activeBoundaryHosts = useActivePortalBoundaryHosts(hostKey);
|
|
54
|
+
|
|
55
|
+
const { height: viewportHeight, width: viewportWidth } =
|
|
56
|
+
useWindowDimensions();
|
|
57
|
+
|
|
58
|
+
const measurementKey = activeBoundaryHosts.length
|
|
59
|
+
? activeBoundaryHosts.map((host) => host.portalHostName).join("|")
|
|
60
|
+
: null;
|
|
61
|
+
|
|
62
|
+
const measurement = useHostMeasurement({
|
|
63
|
+
measurementKey,
|
|
64
|
+
boundaryMeasurements: activeBoundaryHosts.map(
|
|
65
|
+
(host) => host.localMeasurement,
|
|
66
|
+
),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const boundaryHosts = activeBoundaryHosts.map((host) => (
|
|
70
|
+
<View
|
|
71
|
+
key={host.portalHostName}
|
|
72
|
+
pointerEvents={PORTAL_POINTER_EVENTS}
|
|
73
|
+
style={[
|
|
74
|
+
styles.boundaryHostViewport,
|
|
75
|
+
{ width: viewportWidth, height: viewportHeight },
|
|
76
|
+
]}
|
|
77
|
+
>
|
|
78
|
+
<BoundaryPortalPlacement
|
|
79
|
+
host={host}
|
|
80
|
+
hostBounds={measurement.hostBounds}
|
|
81
|
+
/>
|
|
82
|
+
</View>
|
|
83
|
+
));
|
|
84
|
+
|
|
85
|
+
useLayoutEffect(() => {
|
|
86
|
+
registerHost({
|
|
87
|
+
fallback,
|
|
88
|
+
hostKey,
|
|
89
|
+
screenKey,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
return () => {
|
|
93
|
+
unregisterHost(screenKey, hostKey);
|
|
94
|
+
};
|
|
95
|
+
}, [fallback, hostKey, screenKey]);
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<Animated.View
|
|
99
|
+
ref={measurement.hostRef}
|
|
100
|
+
pointerEvents={PORTAL_POINTER_EVENTS}
|
|
101
|
+
style={[
|
|
102
|
+
styles.host,
|
|
103
|
+
{ width: viewportWidth, height: viewportHeight },
|
|
104
|
+
style,
|
|
105
|
+
]}
|
|
106
|
+
collapsable={false}
|
|
107
|
+
>
|
|
108
|
+
{boundaryHosts}
|
|
109
|
+
</Animated.View>
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const getCurrentBoundaryBounds = (host: ActivePortalBoundaryHost) => {
|
|
114
|
+
"worklet";
|
|
115
|
+
return host.localMeasurement.get()?.bounds ?? null;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
type BoundaryPortalPlacementProps = {
|
|
119
|
+
host: ActivePortalBoundaryHost;
|
|
120
|
+
hostBounds: SharedValue<MeasuredDimensions | null>;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/** Positions one receiver using captured boundary and overlay measurements. */
|
|
124
|
+
const BoundaryPortalPlacement = memo(function BoundaryPortalPlacement({
|
|
125
|
+
host,
|
|
126
|
+
hostBounds,
|
|
127
|
+
}: BoundaryPortalPlacementProps) {
|
|
128
|
+
useAnimatedReaction(
|
|
129
|
+
() => {
|
|
130
|
+
"worklet";
|
|
131
|
+
return (
|
|
132
|
+
getCurrentBoundaryBounds(host) !== null && hostBounds.get() !== null
|
|
133
|
+
);
|
|
134
|
+
},
|
|
135
|
+
(ready) => {
|
|
136
|
+
"worklet";
|
|
137
|
+
host.portalHostReady.set(ready);
|
|
138
|
+
},
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
const hostStyle = useAnimatedStyle(() => {
|
|
142
|
+
"worklet";
|
|
143
|
+
const boundaryBounds = getCurrentBoundaryBounds(host);
|
|
144
|
+
if (!boundaryBounds) {
|
|
145
|
+
return NO_STYLES;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return resolvePortalOffsetStyle({
|
|
149
|
+
bounds: boundaryBounds,
|
|
150
|
+
hostBounds: hostBounds.get(),
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const contentFrameStyle = useAnimatedStyle(() => {
|
|
155
|
+
"worklet";
|
|
156
|
+
const boundaryBounds = getCurrentBoundaryBounds(host);
|
|
157
|
+
if (!boundaryBounds) {
|
|
158
|
+
return NO_STYLES;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
height: boundaryBounds.height,
|
|
163
|
+
width: boundaryBounds.width,
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const slotStyle = useAnimatedStyle(() => {
|
|
168
|
+
"worklet";
|
|
169
|
+
const slot = host.slotsMap.get()[host.boundaryId];
|
|
170
|
+
|
|
171
|
+
return composeSlotStyleWithLocalTransform(
|
|
172
|
+
slot?.style ?? NO_STYLES,
|
|
173
|
+
undefined,
|
|
174
|
+
slot?.boundsLocalTransform,
|
|
175
|
+
);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<Animated.View
|
|
180
|
+
pointerEvents={PORTAL_POINTER_EVENTS}
|
|
181
|
+
style={[StyleSheet.absoluteFill, hostStyle]}
|
|
182
|
+
collapsable={false}
|
|
183
|
+
>
|
|
184
|
+
<PortalHost
|
|
185
|
+
name={host.portalHostName}
|
|
186
|
+
style={[styles.content, contentFrameStyle, slotStyle]}
|
|
187
|
+
/>
|
|
188
|
+
</Animated.View>
|
|
189
|
+
);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
const styles = StyleSheet.create({
|
|
193
|
+
// The teleport offset is a physical page delta measured from the screen's
|
|
194
|
+
// left edge, so the content box must anchor there too. Under native RTL,
|
|
195
|
+
// `left: 0` swaps to a right-edge anchor; `end: 0` is the physical left edge
|
|
196
|
+
// in RTL regardless of the swap setting.
|
|
197
|
+
content: I18nManager.isRTL
|
|
198
|
+
? {
|
|
199
|
+
end: 0,
|
|
200
|
+
position: "absolute",
|
|
201
|
+
top: 0,
|
|
202
|
+
}
|
|
203
|
+
: {
|
|
204
|
+
left: 0,
|
|
205
|
+
position: "absolute",
|
|
206
|
+
top: 0,
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
host: {
|
|
210
|
+
elevation: 999999,
|
|
211
|
+
left: 0,
|
|
212
|
+
overflow: "visible",
|
|
213
|
+
position: "absolute",
|
|
214
|
+
top: 0,
|
|
215
|
+
zIndex: 999999,
|
|
216
|
+
},
|
|
217
|
+
boundaryHostViewport: {
|
|
218
|
+
left: 0,
|
|
219
|
+
overflow: "visible",
|
|
220
|
+
position: "absolute",
|
|
221
|
+
top: 0,
|
|
222
|
+
},
|
|
223
|
+
});
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ComponentProps,
|
|
3
|
+
type ComponentType,
|
|
4
|
+
memo,
|
|
5
|
+
type ReactNode,
|
|
6
|
+
} from "react";
|
|
7
|
+
import { StyleSheet, type View } from "react-native";
|
|
8
|
+
import Animated, { type AnimatedRef } from "react-native-reanimated";
|
|
9
|
+
import { scheduleOnUI } from "react-native-worklets";
|
|
10
|
+
import { logger } from "../../../../utils/logger";
|
|
11
|
+
import { usePlaceholderStyles } from "../hooks/use-placeholder-styles";
|
|
12
|
+
import {
|
|
13
|
+
type PortalMode,
|
|
14
|
+
usePortalDestination,
|
|
15
|
+
} from "../hooks/use-portal-destination";
|
|
16
|
+
import {
|
|
17
|
+
isTeleportAvailable,
|
|
18
|
+
NativePortal,
|
|
19
|
+
PORTAL_POINTER_EVENTS,
|
|
20
|
+
} from "../teleport";
|
|
21
|
+
import { PortalHost } from "./portal-host";
|
|
22
|
+
|
|
23
|
+
type NullableHostNamePortalProps = Omit<
|
|
24
|
+
ComponentProps<NonNullable<typeof NativePortal>>,
|
|
25
|
+
"hostName"
|
|
26
|
+
> & { hostName?: string | null };
|
|
27
|
+
const AnimatedNativePortal = NativePortal
|
|
28
|
+
? Animated.createAnimatedComponent(
|
|
29
|
+
NativePortal as ComponentType<NullableHostNamePortalProps>,
|
|
30
|
+
)
|
|
31
|
+
: null;
|
|
32
|
+
const EnabledNativePortal = AnimatedNativePortal as NonNullable<
|
|
33
|
+
typeof AnimatedNativePortal
|
|
34
|
+
>;
|
|
35
|
+
|
|
36
|
+
type PortalProps = {
|
|
37
|
+
boundaryId?: string;
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
enabled: boolean;
|
|
40
|
+
mode: PortalMode;
|
|
41
|
+
placeholderRef?: AnimatedRef<View>;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Sends its children to a named PortalHost chosen on the UI thread.
|
|
46
|
+
*
|
|
47
|
+
* `handoff` moves the boundary's content between screens and creates a local
|
|
48
|
+
* receiver inside this boundary. `escapeClipping` moves the whole boundary
|
|
49
|
+
* frame into a PortalOverlay, leaving a sized placeholder at its original spot.
|
|
50
|
+
* When both are enabled, the handoff portal lives inside the escaped frame.
|
|
51
|
+
* Disabled portals, or apps without Teleport, render their children inline.
|
|
52
|
+
*/
|
|
53
|
+
export const Portal = memo(function Portal(props: PortalProps) {
|
|
54
|
+
if (
|
|
55
|
+
!props.enabled ||
|
|
56
|
+
props.boundaryId === undefined ||
|
|
57
|
+
!isTeleportAvailable ||
|
|
58
|
+
!AnimatedNativePortal
|
|
59
|
+
) {
|
|
60
|
+
return props.children;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return <EnabledPortal {...props} boundaryId={props.boundaryId} />;
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
function EnabledPortal({
|
|
67
|
+
boundaryId,
|
|
68
|
+
children,
|
|
69
|
+
mode,
|
|
70
|
+
placeholderRef,
|
|
71
|
+
}: PortalProps & { boundaryId: string }) {
|
|
72
|
+
if (__DEV__ && mode === "escapeClipping" && !boundaryId) {
|
|
73
|
+
logger.warnOnce(
|
|
74
|
+
"portal:missing-id",
|
|
75
|
+
"A boundary portal was rendered without an id; rendering inline.",
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
const { teleportProps, localHostName } = usePortalDestination(
|
|
79
|
+
boundaryId,
|
|
80
|
+
mode,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const content = (
|
|
84
|
+
<EnabledNativePortal
|
|
85
|
+
animatedProps={teleportProps}
|
|
86
|
+
name={boundaryId}
|
|
87
|
+
pointerEvents={PORTAL_POINTER_EVENTS}
|
|
88
|
+
style={mode === "handoff" ? StyleSheet.absoluteFill : undefined}
|
|
89
|
+
>
|
|
90
|
+
{children}
|
|
91
|
+
</EnabledNativePortal>
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
return mode === "handoff" ? (
|
|
95
|
+
<>
|
|
96
|
+
{content}
|
|
97
|
+
<PortalHost name={localHostName} />
|
|
98
|
+
</>
|
|
99
|
+
) : (
|
|
100
|
+
<PortalPlaceholder placeholderRef={placeholderRef}>
|
|
101
|
+
{content}
|
|
102
|
+
</PortalPlaceholder>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function PortalPlaceholder({
|
|
107
|
+
children,
|
|
108
|
+
placeholderRef,
|
|
109
|
+
}: Pick<PortalProps, "children" | "placeholderRef">) {
|
|
110
|
+
const { handleOnLayout, placeholderStyle } = usePlaceholderStyles();
|
|
111
|
+
return (
|
|
112
|
+
<Animated.View
|
|
113
|
+
ref={placeholderRef}
|
|
114
|
+
onLayout={({ nativeEvent: { layout } }) =>
|
|
115
|
+
scheduleOnUI(handleOnLayout, layout)
|
|
116
|
+
}
|
|
117
|
+
style={placeholderStyle}
|
|
118
|
+
pointerEvents={PORTAL_POINTER_EVENTS}
|
|
119
|
+
collapsable={false}
|
|
120
|
+
>
|
|
121
|
+
{children}
|
|
122
|
+
</Animated.View>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useLayoutEffect } from "react";
|
|
2
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
3
|
+
import type { NormalizedTransitionInterpolatedStyle } from "../../../../types/animation.types";
|
|
4
|
+
import type { BoundaryLocalMeasurementValue } from "../../types";
|
|
5
|
+
import {
|
|
6
|
+
mountPortalBoundaryHost,
|
|
7
|
+
unmountPortalBoundaryHostByName,
|
|
8
|
+
} from "../stores/portal-boundary-host.store";
|
|
9
|
+
import { createBoundaryPortalHostName } from "../utils/naming";
|
|
10
|
+
|
|
11
|
+
// Hosts belong to mounted boundaries, not animation phases. React prepares
|
|
12
|
+
// them once; attachment and release are entirely UI-thread decisions.
|
|
13
|
+
export const useActivePortalBoundaryHost = ({
|
|
14
|
+
boundaryId,
|
|
15
|
+
escapeHostKey,
|
|
16
|
+
localMeasurement,
|
|
17
|
+
portalHostReady,
|
|
18
|
+
slotsMap,
|
|
19
|
+
}: {
|
|
20
|
+
boundaryId: string;
|
|
21
|
+
escapeHostKey?: string;
|
|
22
|
+
localMeasurement: BoundaryLocalMeasurementValue;
|
|
23
|
+
portalHostReady: SharedValue<boolean>;
|
|
24
|
+
slotsMap: SharedValue<NormalizedTransitionInterpolatedStyle>;
|
|
25
|
+
}) => {
|
|
26
|
+
const portalHostName = escapeHostKey
|
|
27
|
+
? createBoundaryPortalHostName(escapeHostKey, boundaryId)
|
|
28
|
+
: null;
|
|
29
|
+
|
|
30
|
+
useLayoutEffect(() => {
|
|
31
|
+
if (!escapeHostKey || !portalHostName) return;
|
|
32
|
+
|
|
33
|
+
mountPortalBoundaryHost({
|
|
34
|
+
boundaryId,
|
|
35
|
+
hostKey: escapeHostKey,
|
|
36
|
+
localMeasurement,
|
|
37
|
+
portalHostName,
|
|
38
|
+
portalHostReady,
|
|
39
|
+
slotsMap,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return () => unmountPortalBoundaryHostByName(portalHostName);
|
|
43
|
+
}, [
|
|
44
|
+
boundaryId,
|
|
45
|
+
escapeHostKey,
|
|
46
|
+
localMeasurement,
|
|
47
|
+
portalHostName,
|
|
48
|
+
portalHostReady,
|
|
49
|
+
slotsMap,
|
|
50
|
+
]);
|
|
51
|
+
return portalHostName;
|
|
52
|
+
};
|