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,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { memo, useId, useLayoutEffect } from "react";
|
|
4
|
+
import { I18nManager, StyleSheet, useWindowDimensions, View } from "react-native";
|
|
5
|
+
import Animated, { useAnimatedReaction, useAnimatedStyle } from "react-native-reanimated";
|
|
6
|
+
import { NO_STYLES } from "../../../../constants";
|
|
7
|
+
import { useBuilderStore } from "../../../../providers/screen/builder";
|
|
8
|
+
import { composeSlotStyleWithLocalTransform } from "../../../../providers/screen/orchestrator/styles/helpers/compose-slot-style";
|
|
9
|
+
import { resolvePortalOffsetStyle } from "../helpers/offset-style";
|
|
10
|
+
import { useHostMeasurement } from "../hooks/use-host-measurement";
|
|
11
|
+
import { registerHost, unregisterHost } from "../stores/host-registry.store";
|
|
12
|
+
import { useActivePortalBoundaryHosts } from "../stores/portal-boundary-host.store";
|
|
13
|
+
import { PORTAL_POINTER_EVENTS } from "../teleport";
|
|
14
|
+
import { PortalHost } from "./portal-host";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
/**
|
|
17
|
+
* A screen-sized overlay containing the receivers for escaped boundary frames.
|
|
18
|
+
*
|
|
19
|
+
* Registers this overlay as an available placement, measures its origin, and
|
|
20
|
+
* renders one positioned PortalHost per boundary assigned to it. An overlay can
|
|
21
|
+
* contain many hosts; each host receives one named portal.
|
|
22
|
+
*
|
|
23
|
+
* Boundary.Host uses this directly; screens render it with `fallback` for
|
|
24
|
+
* their automatic overlay. Explicit overlays take priority over the fallback.
|
|
25
|
+
* Handoff between screens uses receivers inside boundaries, so it does not
|
|
26
|
+
* need this overlay unless escapeClipping is also enabled.
|
|
27
|
+
*/
|
|
28
|
+
export const PortalOverlay = /*#__PURE__*/memo(function PortalOverlay({
|
|
29
|
+
fallback = false,
|
|
30
|
+
style
|
|
31
|
+
}) {
|
|
32
|
+
const screenKey = useBuilderStore(s => s.derivations.currentScreenKey);
|
|
33
|
+
const id = useId();
|
|
34
|
+
const hostKey = fallback ? screenKey : `${screenKey}-host-${id}`;
|
|
35
|
+
const activeBoundaryHosts = useActivePortalBoundaryHosts(hostKey);
|
|
36
|
+
const {
|
|
37
|
+
height: viewportHeight,
|
|
38
|
+
width: viewportWidth
|
|
39
|
+
} = useWindowDimensions();
|
|
40
|
+
const measurementKey = activeBoundaryHosts.length ? activeBoundaryHosts.map(host => host.portalHostName).join("|") : null;
|
|
41
|
+
const measurement = useHostMeasurement({
|
|
42
|
+
measurementKey,
|
|
43
|
+
boundaryMeasurements: activeBoundaryHosts.map(host => host.localMeasurement)
|
|
44
|
+
});
|
|
45
|
+
const boundaryHosts = activeBoundaryHosts.map(host => /*#__PURE__*/_jsx(View, {
|
|
46
|
+
pointerEvents: PORTAL_POINTER_EVENTS,
|
|
47
|
+
style: [styles.boundaryHostViewport, {
|
|
48
|
+
width: viewportWidth,
|
|
49
|
+
height: viewportHeight
|
|
50
|
+
}],
|
|
51
|
+
children: /*#__PURE__*/_jsx(BoundaryPortalPlacement, {
|
|
52
|
+
host: host,
|
|
53
|
+
hostBounds: measurement.hostBounds
|
|
54
|
+
})
|
|
55
|
+
}, host.portalHostName));
|
|
56
|
+
useLayoutEffect(() => {
|
|
57
|
+
registerHost({
|
|
58
|
+
fallback,
|
|
59
|
+
hostKey,
|
|
60
|
+
screenKey
|
|
61
|
+
});
|
|
62
|
+
return () => {
|
|
63
|
+
unregisterHost(screenKey, hostKey);
|
|
64
|
+
};
|
|
65
|
+
}, [fallback, hostKey, screenKey]);
|
|
66
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
67
|
+
ref: measurement.hostRef,
|
|
68
|
+
pointerEvents: PORTAL_POINTER_EVENTS,
|
|
69
|
+
style: [styles.host, {
|
|
70
|
+
width: viewportWidth,
|
|
71
|
+
height: viewportHeight
|
|
72
|
+
}, style],
|
|
73
|
+
collapsable: false,
|
|
74
|
+
children: boundaryHosts
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
const getCurrentBoundaryBounds = host => {
|
|
78
|
+
"worklet";
|
|
79
|
+
|
|
80
|
+
return host.localMeasurement.get()?.bounds ?? null;
|
|
81
|
+
};
|
|
82
|
+
/** Positions one receiver using captured boundary and overlay measurements. */
|
|
83
|
+
const BoundaryPortalPlacement = /*#__PURE__*/memo(function BoundaryPortalPlacement({
|
|
84
|
+
host,
|
|
85
|
+
hostBounds
|
|
86
|
+
}) {
|
|
87
|
+
useAnimatedReaction(() => {
|
|
88
|
+
"worklet";
|
|
89
|
+
|
|
90
|
+
return getCurrentBoundaryBounds(host) !== null && hostBounds.get() !== null;
|
|
91
|
+
}, ready => {
|
|
92
|
+
"worklet";
|
|
93
|
+
|
|
94
|
+
host.portalHostReady.set(ready);
|
|
95
|
+
});
|
|
96
|
+
const hostStyle = useAnimatedStyle(() => {
|
|
97
|
+
"worklet";
|
|
98
|
+
|
|
99
|
+
const boundaryBounds = getCurrentBoundaryBounds(host);
|
|
100
|
+
if (!boundaryBounds) {
|
|
101
|
+
return NO_STYLES;
|
|
102
|
+
}
|
|
103
|
+
return resolvePortalOffsetStyle({
|
|
104
|
+
bounds: boundaryBounds,
|
|
105
|
+
hostBounds: hostBounds.get()
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
const contentFrameStyle = useAnimatedStyle(() => {
|
|
109
|
+
"worklet";
|
|
110
|
+
|
|
111
|
+
const boundaryBounds = getCurrentBoundaryBounds(host);
|
|
112
|
+
if (!boundaryBounds) {
|
|
113
|
+
return NO_STYLES;
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
height: boundaryBounds.height,
|
|
117
|
+
width: boundaryBounds.width
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
const slotStyle = useAnimatedStyle(() => {
|
|
121
|
+
"worklet";
|
|
122
|
+
|
|
123
|
+
const slot = host.slotsMap.get()[host.boundaryId];
|
|
124
|
+
return composeSlotStyleWithLocalTransform(slot?.style ?? NO_STYLES, undefined, slot?.boundsLocalTransform);
|
|
125
|
+
});
|
|
126
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
127
|
+
pointerEvents: PORTAL_POINTER_EVENTS,
|
|
128
|
+
style: [StyleSheet.absoluteFill, hostStyle],
|
|
129
|
+
collapsable: false,
|
|
130
|
+
children: /*#__PURE__*/_jsx(PortalHost, {
|
|
131
|
+
name: host.portalHostName,
|
|
132
|
+
style: [styles.content, contentFrameStyle, slotStyle]
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
const styles = StyleSheet.create({
|
|
137
|
+
// The teleport offset is a physical page delta measured from the screen's
|
|
138
|
+
// left edge, so the content box must anchor there too. Under native RTL,
|
|
139
|
+
// `left: 0` swaps to a right-edge anchor; `end: 0` is the physical left edge
|
|
140
|
+
// in RTL regardless of the swap setting.
|
|
141
|
+
content: I18nManager.isRTL ? {
|
|
142
|
+
end: 0,
|
|
143
|
+
position: "absolute",
|
|
144
|
+
top: 0
|
|
145
|
+
} : {
|
|
146
|
+
left: 0,
|
|
147
|
+
position: "absolute",
|
|
148
|
+
top: 0
|
|
149
|
+
},
|
|
150
|
+
host: {
|
|
151
|
+
elevation: 999999,
|
|
152
|
+
left: 0,
|
|
153
|
+
overflow: "visible",
|
|
154
|
+
position: "absolute",
|
|
155
|
+
top: 0,
|
|
156
|
+
zIndex: 999999
|
|
157
|
+
},
|
|
158
|
+
boundaryHostViewport: {
|
|
159
|
+
left: 0,
|
|
160
|
+
overflow: "visible",
|
|
161
|
+
position: "absolute",
|
|
162
|
+
top: 0
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
//# sourceMappingURL=portal-overlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["memo","useId","useLayoutEffect","I18nManager","StyleSheet","useWindowDimensions","View","Animated","useAnimatedReaction","useAnimatedStyle","NO_STYLES","useBuilderStore","composeSlotStyleWithLocalTransform","resolvePortalOffsetStyle","useHostMeasurement","registerHost","unregisterHost","useActivePortalBoundaryHosts","PORTAL_POINTER_EVENTS","PortalHost","jsx","_jsx","PortalOverlay","fallback","style","screenKey","s","derivations","currentScreenKey","id","hostKey","activeBoundaryHosts","height","viewportHeight","width","viewportWidth","measurementKey","length","map","host","portalHostName","join","measurement","boundaryMeasurements","localMeasurement","boundaryHosts","pointerEvents","styles","boundaryHostViewport","children","BoundaryPortalPlacement","hostBounds","ref","hostRef","collapsable","getCurrentBoundaryBounds","get","bounds","ready","portalHostReady","set","hostStyle","boundaryBounds","contentFrameStyle","slotStyle","slot","slotsMap","boundaryId","undefined","boundsLocalTransform","absoluteFill","name","content","create","isRTL","end","position","top","left","elevation","overflow","zIndex"],"sourceRoot":"../../../../../../src","sources":["components/boundary/portal/components/portal-overlay.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,KAAK,EAAEC,eAAe,QAAQ,OAAO;AACpD,SACCC,WAAW,EAEXC,UAAU,EACVC,mBAAmB,EACnBC,IAAI,QAEE,cAAc;AACrB,OAAOC,QAAQ,IAGdC,mBAAmB,EACnBC,gBAAgB,QACV,yBAAyB;AAChC,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,eAAe,QAAQ,sCAAsC;AACtE,SAASC,kCAAkC,QAAQ,6EAA6E;AAChI,SAASC,wBAAwB,QAAQ,yBAAyB;AAClE,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,YAAY,EAAEC,cAAc,QAAQ,+BAA+B;AAC5E,SAECC,4BAA4B,QACtB,sCAAsC;AAC7C,S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C;AAElB,CAAC,CAAC;AAEF,MAAMjB,MAAM,GAAG3C,UAAU,CAACqE,MAAM,CAAC;EAChC;EACA;EACA;EACA;EACAD,OAAO,EAAErE,WAAW,CAACuE,KAAK,GACvB;IACAC,GAAG,EAAE,CAAC;IACNC,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE;EACN,CAAC,GACA;IACAC,IAAI,EAAE,CAAC;IACPF,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE;EACN,CAAC;EAEHtC,IAAI,EAAE;IACLwC,SAAS,EAAE,MAAM;IACjBD,IAAI,EAAE,CAAC;IACPE,QAAQ,EAAE,SAAS;IACnBJ,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNI,MAAM,EAAE;EACT,CAAC;EACDjC,oBAAoB,EAAE;IACrB8B,IAAI,EAAE,CAAC;IACPE,QAAQ,EAAE,SAAS;IACnBJ,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE;EACN;AACD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { memo } from "react";
|
|
4
|
+
import { StyleSheet } from "react-native";
|
|
5
|
+
import Animated from "react-native-reanimated";
|
|
6
|
+
import { scheduleOnUI } from "react-native-worklets";
|
|
7
|
+
import { logger } from "../../../../utils/logger";
|
|
8
|
+
import { usePlaceholderStyles } from "../hooks/use-placeholder-styles";
|
|
9
|
+
import { usePortalDestination } from "../hooks/use-portal-destination";
|
|
10
|
+
import { isTeleportAvailable, NativePortal, PORTAL_POINTER_EVENTS } from "../teleport";
|
|
11
|
+
import { PortalHost } from "./portal-host";
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const AnimatedNativePortal = NativePortal ? Animated.createAnimatedComponent(NativePortal) : null;
|
|
14
|
+
const EnabledNativePortal = AnimatedNativePortal;
|
|
15
|
+
/**
|
|
16
|
+
* Sends its children to a named PortalHost chosen on the UI thread.
|
|
17
|
+
*
|
|
18
|
+
* `handoff` moves the boundary's content between screens and creates a local
|
|
19
|
+
* receiver inside this boundary. `escapeClipping` moves the whole boundary
|
|
20
|
+
* frame into a PortalOverlay, leaving a sized placeholder at its original spot.
|
|
21
|
+
* When both are enabled, the handoff portal lives inside the escaped frame.
|
|
22
|
+
* Disabled portals, or apps without Teleport, render their children inline.
|
|
23
|
+
*/
|
|
24
|
+
export const Portal = /*#__PURE__*/memo(function Portal(props) {
|
|
25
|
+
if (!props.enabled || props.boundaryId === undefined || !isTeleportAvailable || !AnimatedNativePortal) {
|
|
26
|
+
return props.children;
|
|
27
|
+
}
|
|
28
|
+
return /*#__PURE__*/_jsx(EnabledPortal, {
|
|
29
|
+
...props,
|
|
30
|
+
boundaryId: props.boundaryId
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
function EnabledPortal({
|
|
34
|
+
boundaryId,
|
|
35
|
+
children,
|
|
36
|
+
mode,
|
|
37
|
+
placeholderRef
|
|
38
|
+
}) {
|
|
39
|
+
if (__DEV__ && mode === "escapeClipping" && !boundaryId) {
|
|
40
|
+
logger.warnOnce("portal:missing-id", "A boundary portal was rendered without an id; rendering inline.");
|
|
41
|
+
}
|
|
42
|
+
const {
|
|
43
|
+
teleportProps,
|
|
44
|
+
localHostName
|
|
45
|
+
} = usePortalDestination(boundaryId, mode);
|
|
46
|
+
const content = /*#__PURE__*/_jsx(EnabledNativePortal, {
|
|
47
|
+
animatedProps: teleportProps,
|
|
48
|
+
name: boundaryId,
|
|
49
|
+
pointerEvents: PORTAL_POINTER_EVENTS,
|
|
50
|
+
style: mode === "handoff" ? StyleSheet.absoluteFill : undefined,
|
|
51
|
+
children: children
|
|
52
|
+
});
|
|
53
|
+
return mode === "handoff" ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
54
|
+
children: [content, /*#__PURE__*/_jsx(PortalHost, {
|
|
55
|
+
name: localHostName
|
|
56
|
+
})]
|
|
57
|
+
}) : /*#__PURE__*/_jsx(PortalPlaceholder, {
|
|
58
|
+
placeholderRef: placeholderRef,
|
|
59
|
+
children: content
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function PortalPlaceholder({
|
|
63
|
+
children,
|
|
64
|
+
placeholderRef
|
|
65
|
+
}) {
|
|
66
|
+
const {
|
|
67
|
+
handleOnLayout,
|
|
68
|
+
placeholderStyle
|
|
69
|
+
} = usePlaceholderStyles();
|
|
70
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
71
|
+
ref: placeholderRef,
|
|
72
|
+
onLayout: ({
|
|
73
|
+
nativeEvent: {
|
|
74
|
+
layout
|
|
75
|
+
}
|
|
76
|
+
}) => scheduleOnUI(handleOnLayout, layout),
|
|
77
|
+
style: placeholderStyle,
|
|
78
|
+
pointerEvents: PORTAL_POINTER_EVENTS,
|
|
79
|
+
collapsable: false,
|
|
80
|
+
children: children
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=portal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["memo","StyleSheet","Animated","scheduleOnUI","logger","usePlaceholderStyles","usePortalDestination","isTeleportAvailable","NativePortal","PORTAL_POINTER_EVENTS","PortalHost","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","AnimatedNativePortal","createAnimatedComponent","EnabledNativePortal","Portal","props","enabled","boundaryId","undefined","children","EnabledPortal","mode","placeholderRef","__DEV__","warnOnce","teleportProps","localHostName","content","animatedProps","name","pointerEvents","style","absoluteFill","PortalPlaceholder","handleOnLayout","placeholderStyle","View","ref","onLayout","nativeEvent","layout","collapsable"],"sourceRoot":"../../../../../../src","sources":["components/boundary/portal/components/portal.tsx"],"mappings":";;AAAA,SAGCA,IAAI,QAEE,OAAO;AACd,SAASC,UAAU,QAAmB,cAAc;AACpD,OAAOC,QAAQ,MAA4B,yBAAyB;AACpE,SAASC,YAAY,QAAQ,uBAAuB;AACpD,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jBa,aAAa,EAAE3B,qBAAsB;IACrC4B,KAAK,EAAEV,IAAI,KAAK,SAAS,GAAG1B,UAAU,CAACqC,YAAY,GAAGd,SAAU;IAAAC,QAAA,EAE/DA;EAAQ,CACW,CACrB;EAED,OAAOE,IAAI,KAAK,SAAS,gBACxBX,KAAA,CAAAF,SAAA;IAAAW,QAAA,GACEQ,OAAO,eACRrB,IAAA,CAACF,UAAU;MAACyB,IAAI,EAAEH;IAAc,CAAE,CAAC;EAAA,CAClC,CAAC,gBAEHpB,IAAA,CAAC2B,iBAAiB;IAACX,cAAc,EAAEA,cAAe;IAAAH,QAAA,EAChDQ;EAAO,CACU,CACnB;AACF;AAEA,SAASM,iBAAiBA,CAAC;EAC1Bd,QAAQ;EACRG;AACiD,CAAC,EAAE;EACpD,MAAM;IAAEY,cAAc;IAAEC;EAAiB,CAAC,GAAGpC,oBAAoB,CAAC,CAAC;EACnE,oBACCO,IAAA,CAACV,QAAQ,CAACwC,IAAI;IACbC,GAAG,EAAEf,cAAe;IACpBgB,QAAQ,EAAEA,CAAC;MAAEC,WAAW,EAAE;QAAEC;MAAO;IAAE,CAAC,KACrC3C,YAAY,CAACqC,cAAc,EAAEM,MAAM,CACnC;IACDT,KAAK,EAAEI,gBAAiB;IACxBL,aAAa,EAAE3B,qBAAsB;IACrCsC,WAAW,EAAE,KAAM;IAAAtB,QAAA,EAElBA;EAAQ,CACK,CAAC;AAElB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["resolvePortalOffsetStyle","bounds","hostBounds","hostPageX","pageX","hostPageY","pageY","transform","translateY","translateX"],"sourceRoot":"../../../../../../src","sources":["components/boundary/portal/helpers/offset-style.ts"],"mappings":";;AAOA,OAAO,MAAMA,wBAAwB,GAAGA,CAAC;EACxCC,MAAM;EACNC;AAC+B,CAAC,KAAiB;EACjD,SAAS;;EACT;EACA;EACA;EACA,MAAMC,SAAS,GAAGD,UAAU,EAAEE,KAAK,IAAI,CAAC;EACxC,MAAMC,SAAS,GAAGH,UAAU,EAAEI,KAAK,IAAI,CAAC;EAExC,OAAO;IACNC,SAAS,EAAE,CACV;MAAEC,UAAU,EAAEP,MAAM,CAACK,KAAK,GAAGD;IAAU,CAAC,EACxC;MAAEI,UAAU,EAAER,MAAM,CAACG,KAAK,GAAGD;IAAU,CAAC;EAE1C,CAAC;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useLayoutEffect } from "react";
|
|
4
|
+
import { mountPortalBoundaryHost, unmountPortalBoundaryHostByName } from "../stores/portal-boundary-host.store";
|
|
5
|
+
import { createBoundaryPortalHostName } from "../utils/naming";
|
|
6
|
+
|
|
7
|
+
// Hosts belong to mounted boundaries, not animation phases. React prepares
|
|
8
|
+
// them once; attachment and release are entirely UI-thread decisions.
|
|
9
|
+
export const useActivePortalBoundaryHost = ({
|
|
10
|
+
boundaryId,
|
|
11
|
+
escapeHostKey,
|
|
12
|
+
localMeasurement,
|
|
13
|
+
portalHostReady,
|
|
14
|
+
slotsMap
|
|
15
|
+
}) => {
|
|
16
|
+
const portalHostName = escapeHostKey ? createBoundaryPortalHostName(escapeHostKey, boundaryId) : null;
|
|
17
|
+
useLayoutEffect(() => {
|
|
18
|
+
if (!escapeHostKey || !portalHostName) return;
|
|
19
|
+
mountPortalBoundaryHost({
|
|
20
|
+
boundaryId,
|
|
21
|
+
hostKey: escapeHostKey,
|
|
22
|
+
localMeasurement,
|
|
23
|
+
portalHostName,
|
|
24
|
+
portalHostReady,
|
|
25
|
+
slotsMap
|
|
26
|
+
});
|
|
27
|
+
return () => unmountPortalBoundaryHostByName(portalHostName);
|
|
28
|
+
}, [boundaryId, escapeHostKey, localMeasurement, portalHostName, portalHostReady, slotsMap]);
|
|
29
|
+
return portalHostName;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=use-active-portal-boundary-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useLayoutEffect","mountPortalBoundaryHost","unmountPortalBoundaryHostByName","createBoundaryPortalHostName","useActivePortalBoundaryHost","boundaryId","escapeHostKey","localMeasurement","portalHostReady","slotsMap","portalHostName","hostKey"],"sourceRoot":"../../../../../../src","sources":["components/boundary/portal/hooks/use-active-portal-boundary-host.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,OAAO;AAIvC,SACCC,uBAAuB,EACvBC,+BAA+B,QACzB,sCAAsC;AAC7C,SAASC,4BAA4B,QAAQ,iBAAiB;;AAE9D;AACA;AACA,OAAO,MAAMC,2BAA2B,GAAGA,CAAC;EAC3CC,UAAU;EACVC,aAAa;EACbC,gBAAgB;EAChBC,eAAe;EACfC;AAOD,CAAC,KAAK;EACL,MAAMC,cAAc,GAAGJ,aAAa,GACjCH,4BAA4B,CAACG,aAAa,EAAED,UAAU,CAAC,GACvD,IAAI;EAEPL,eAAe,CAAC,MAAM;IACrB,IAAI,CAACM,aAAa,IAAI,CAACI,cAAc,EAAE;IAEvCT,uBAAuB,CAAC;MACvBI,UAAU;MACVM,OAAO,EAAEL,aAAa;MACtBC,gBAAgB;MAChBG,cAAc;MACdF,eAAe;MACfC;IACD,CAAC,CAAC;IAEF,OAAO,MAAMP,+BAA+B,CAACQ,cAAc,CAAC;EAC7D,CAAC,EAAE,CACFL,UAAU,EACVC,aAAa,EACbC,gBAAgB,EAChBG,cAAc,EACdF,eAAe,EACfC,QAAQ,CACR,CAAC;EACF,OAAOC,cAAc;AACtB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { cancelAnimation, measure, useAnimatedReaction, useAnimatedRef, useDerivedValue, useSharedValue, withDelay, withTiming } from "react-native-reanimated";
|
|
4
|
+
const HOST_MEASUREMENT_RETRY_DELAY_MS = 16;
|
|
5
|
+
const MAX_HOST_MEASUREMENT_ATTEMPTS = 20;
|
|
6
|
+
export const useHostMeasurement = ({
|
|
7
|
+
measurementKey,
|
|
8
|
+
boundaryMeasurements
|
|
9
|
+
}) => {
|
|
10
|
+
const hostRef = useAnimatedRef();
|
|
11
|
+
const measurement = useSharedValue(null);
|
|
12
|
+
const hostBounds = useDerivedValue(() => {
|
|
13
|
+
const captured = measurement.get();
|
|
14
|
+
return captured?.key === measurementKey ? captured.bounds : null;
|
|
15
|
+
});
|
|
16
|
+
const retryToken = useSharedValue(0);
|
|
17
|
+
const attempts = useSharedValue({
|
|
18
|
+
key: measurementKey,
|
|
19
|
+
count: 0
|
|
20
|
+
});
|
|
21
|
+
useAnimatedReaction(() => {
|
|
22
|
+
"worklet";
|
|
23
|
+
|
|
24
|
+
if (!measurementKey) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Hosts mount before their screen is visible. Wait for source capture
|
|
29
|
+
// rather than caching the screen's initial offscreen position.
|
|
30
|
+
let hasSource = false;
|
|
31
|
+
for (const measurement of boundaryMeasurements) {
|
|
32
|
+
if (measurement.get()) {
|
|
33
|
+
hasSource = true;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (!hasSource) return null;
|
|
38
|
+
return [measurementKey, measurement.get()?.key ?? null, retryToken.get()];
|
|
39
|
+
}, state => {
|
|
40
|
+
"worklet";
|
|
41
|
+
|
|
42
|
+
if (!state) {
|
|
43
|
+
cancelAnimation(retryToken);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const [requestedKey, completedKey] = state;
|
|
47
|
+
if (requestedKey === completedKey) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
cancelAnimation(retryToken);
|
|
51
|
+
const count = attempts.get().key === requestedKey ? attempts.get().count : 0;
|
|
52
|
+
if (count >= MAX_HOST_MEASUREMENT_ATTEMPTS) return;
|
|
53
|
+
attempts.set({
|
|
54
|
+
key: requestedKey,
|
|
55
|
+
count: count + 1
|
|
56
|
+
});
|
|
57
|
+
const measured = measure(hostRef);
|
|
58
|
+
if (!measured || measured.width <= 0 || measured.height <= 0) {
|
|
59
|
+
if (count + 1 < MAX_HOST_MEASUREMENT_ATTEMPTS) {
|
|
60
|
+
retryToken.set(withDelay(HOST_MEASUREMENT_RETRY_DELAY_MS, withTiming(retryToken.get() + 1, {
|
|
61
|
+
duration: 0
|
|
62
|
+
})));
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
measurement.set({
|
|
67
|
+
key: requestedKey,
|
|
68
|
+
bounds: {
|
|
69
|
+
...measured
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
hostBounds,
|
|
75
|
+
hostRef
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=use-host-measurement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["cancelAnimation","measure","useAnimatedReaction","useAnimatedRef","useDerivedValue","useSharedValue","withDelay","withTiming","HOST_MEASUREMENT_RETRY_DELAY_MS","MAX_HOST_MEASUREMENT_ATTEMPTS","useHostMeasurement","measurementKey","boundaryMeasurements","hostRef","measurement","hostBounds","captured","get","key","bounds","retryToken","attempts","count","hasSource","state","requestedKey","completedKey","set","measured","width","height","duration"],"sourceRoot":"../../../../../../src","sources":["components/boundary/portal/hooks/use-host-measurement.ts"],"mappings":";;AACA,SACCA,eAAe,EAEfC,OAAO,EACPC,mBAAmB,EACnBC,cAAc,EACdC,eAAe,EACfC,cAAc,EACdC,SAAS,EACTC,UAAU,QACJ,yBAAyB;AAIhC,MAAMC,+BAA+B,GAAG,EAAE;AAC1C,MAAMC,6BAA6B,GAAG,EAAE;AAOxC,OAAO,MAAMC,kBAAkB,GAAGA,CAAC;EAClCC,cAAc;EACdC;AACyB,CAAC,KAAK;EAC/B,MAAMC,OAAO,GAAGV,cAAc,CAAO,CAAC;EACtC,MAAMW,WAAW,GAAGT,cAAc,CAGxB,I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IA,KAAK,IAAIb,6BAA6B,EAAE;IAC5CY,QAAQ,CAACM,GAAG,CAAC;MAAET,GAAG,EAAEO,YAAY;MAAEH,KAAK,EAAEA,KAAK,GAAG;IAAE,CAAC,CAAC;IAErD,MAAMM,QAAQ,GAAG3B,OAAO,CAACY,OAAO,CAAC;IACjC,IAAI,CAACe,QAAQ,IAAIA,QAAQ,CAACC,KAAK,IAAI,CAAC,IAAID,QAAQ,CAACE,MAAM,IAAI,CAAC,EAAE;MAC7D,IAAIR,KAAK,GAAG,CAAC,GAAGb,6BAA6B,EAAE;QAC9CW,UAAU,CAACO,GAAG,CACbrB,SAAS,CACRE,+BAA+B,EAC/BD,UAAU,CAACa,UAAU,CAACH,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE;UAAEc,QAAQ,EAAE;QAAE,CAAC,CACjD,CACD,CAAC;MACF;MACA;IACD;IAEAjB,WAAW,CAACa,GAAG,CAAC;MAAET,GAAG,EAAEO,YAAY;MAAEN,MAAM,EAAE;QAAE,GAAGS;MAAS;IAAE,CAAC,CAAC;EAChE,CACD,CAAC;EACD,OAAO;IACNb,UAAU;IACVF;EACD,CAAC;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useAnimatedStyle","useSharedValue","usePlaceholderStyles","placeholderWidth","placeholderHeight","placeholderStyle","width","get","height","handleOnLayout","layout","hasValidDimensions","set"],"sourceRoot":"../../../../../../src","sources":["components/boundary/portal/hooks/use-placeholder-styles.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,OAAO;AAEnC,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,yBAAyB;AAE1E,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACzC,MAAMC,gBAAgB,GAAGF,cAAc,CAAC,CAAC,CAAC;EAC1C,MAAMG,iBAAiB,GAAGH,cAAc,CAAC,CAAC,CAAC;EAC3C;EACA;EACA;EACA;EACA,MAAMI,gBAAgB,GAAGL,gBAAgB,CAAC,MAAM;IAC/C,SAAS;;IACT,MAAMM,KAAK,GAAGH,gBAAgB,CAACI,GAAG,CAAC,CAAC;IACpC,MAAMC,MAAM,GAAGJ,iBAAiB,CAACG,GAAG,CAAC,CAAC;IAEtC,IAAID,KAAK,KAAK,CAAC,EAAE;MAChB,OAAO;QAAEA,KAAK,EAAE,MAAM;QAAEE,MAAM,EAAE;MAAO,CAAC;IACzC;IAEA,OAAO;MAAEF,KAAK;MAAEE;IAAO,CAAC;EACzB,CAAC,CAAC;EAEF,MAAMC,cAAc,GAAGV,WAAW,CAChCW,MAAuB,IAAK;IAC5B,SAAS;;IACT,MAAM;MAAEJ,KAAK;MAAEE;IAAO,CAAC,GAAGE,MAAM;IAChC,IAAIJ,KAAK,KAAK,CAAC,IAAIE,MAAM,KAAK,CAAC,EAAE;MAChC;IACD;IAEA,MAAMG,kBAAkB,GACvBP,iBAAiB,CAACG,GAAG,CAAC,CAAC,KAAK,CAAC,IAAIJ,gBAAgB,CAACI,GAAG,CAAC,CAAC,KAAK,CAAC;IAE9D,IAAI,CAACI,kBAAkB,EAAE;MACxBR,gBAAgB,CAACS,GAAG,CAACN,KAAK,CAAC;MAC3BF,iBAAiB,CAACQ,GAAG,CAACJ,MAAM,CAAC;IAC9B;EACD,CAAC,EACD,CAACJ,iBAAiB,EAAED,gBAAgB,CACrC,CAAC;EAED,OAAO;IAAEE,gBAAgB;IAAEI;EAAe,CAAC;AAC5C,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useAnimatedProps, useSharedValue } from "react-native-reanimated";
|
|
4
|
+
import { useBoundaryRootStore } from "../../providers/boundary-root.provider";
|
|
5
|
+
import { useActiveHostKey } from "../stores/host-registry.store";
|
|
6
|
+
import { createHandoffHostName, PORTAL_HOST_NAME_RESET_VALUE } from "../utils/naming";
|
|
7
|
+
import { useActivePortalBoundaryHost } from "./use-active-portal-boundary-host";
|
|
8
|
+
export function usePortalDestination(boundaryId, mode) {
|
|
9
|
+
const {
|
|
10
|
+
currentScreenKey,
|
|
11
|
+
localMeasurement,
|
|
12
|
+
slotsMap,
|
|
13
|
+
boundaryPresentation
|
|
14
|
+
} = useBoundaryRootStore(s => s);
|
|
15
|
+
const portalHostReady = useSharedValue(false);
|
|
16
|
+
const escapeHostKey = useActiveHostKey(mode === "escapeClipping" ? currentScreenKey : null);
|
|
17
|
+
const portalHostName = useActivePortalBoundaryHost({
|
|
18
|
+
boundaryId,
|
|
19
|
+
escapeHostKey,
|
|
20
|
+
localMeasurement,
|
|
21
|
+
portalHostReady,
|
|
22
|
+
slotsMap
|
|
23
|
+
});
|
|
24
|
+
const teleportProps = useAnimatedProps(() => {
|
|
25
|
+
"worklet";
|
|
26
|
+
|
|
27
|
+
const {
|
|
28
|
+
owner,
|
|
29
|
+
receiver,
|
|
30
|
+
slots
|
|
31
|
+
} = boundaryPresentation.get();
|
|
32
|
+
const slot = slots[boundaryId];
|
|
33
|
+
const {
|
|
34
|
+
pointerEvents: _pointerEvents,
|
|
35
|
+
handoffTarget: _handoffTarget,
|
|
36
|
+
...props
|
|
37
|
+
} = slot?.props ?? {};
|
|
38
|
+
let hostName = PORTAL_HOST_NAME_RESET_VALUE;
|
|
39
|
+
if (mode === "handoff") {
|
|
40
|
+
hostName = createHandoffHostName(receiver, boundaryId);
|
|
41
|
+
} else if (owner?.ready && localMeasurement.get()?.pairKey === owner.pairKey && slot !== undefined && portalHostReady.get()) {
|
|
42
|
+
hostName = portalHostName;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
...props,
|
|
46
|
+
hostName
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
teleportProps,
|
|
51
|
+
localHostName: createHandoffHostName(currentScreenKey, boundaryId)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=use-portal-destination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useAnimatedProps","useSharedValue","useBoundaryRootStore","useActiveHostKey","createHandoffHostName","PORTAL_HOST_NAME_RESET_VALUE","useActivePortalBoundaryHost","usePortalDestination","boundaryId","mode","currentScreenKey","localMeasurement","slotsMap","boundaryPresentation","s","portalHostReady","escapeHostKey","portalHostName","teleportProps","owner","receiver","slots","get","slot","pointerEvents","_pointerEvents","handoffTarget","_handoffTarget","props","hostName","ready","pairKey","undefined","localHostName"],"sourceRoot":"../../../../../../src","sources":["components/boundary/portal/hooks/use-portal-destination.ts"],"mappings":";;AAAA,SAASA,gBAAgB,EAAEC,cAAc,QAAQ,yBAAyB;AAC1E,SAASC,oBAAoB,QAAQ,wCAAwC;AAC7E,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SACCC,qBAAqB,EACrBC,4BAA4B,QACtB,iBAAiB;AACxB,SAASC,2BAA2B,QAAQ,mCAAmC;AAI/E,OAAO,SAASC,oBAAoBA,CAACC,UAAkB,EAAEC,IAAgB,EAAE;EAC1E,MAAM;IAAEC,gBAAgB;IAAEC,gBAAgB;IAAEC,QAAQ;IAAEC;EAAqB,CAAC,GAC3EX,oBAAoB,CAAEY,CAAC,IAAKA,CAAC,CAAC;EAC/B,MAAMC,eAAe,GAAGd,cAAc,CAAC,KAAK,CAAC;EAC7C,MAAMe,aAAa,GAAGb,gBAAgB,CACrCM,IAAI,KAAK,gBAAgB,GAAGC,gBAAgB,GAAG,IAChD,CAAC;EACD,MAAMO,cAAc,GAAGX,2BAA2B,CAAC;IAClDE,UAAU;IACVQ,aAAa;IACbL,gBAAgB;IAChBI,eAAe;IACfH;EACD,CAAC,CAAC;EACF,MAAMM,aAAa,GAAGlB,gBAAgB,CAAC,MAAM;IAC5C,SAAS;;IACT,MAAM;MAAEmB,KAAK;MAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAGR,oBAAoB,CAACS,GAAG,CAAC,CAAC;IAC7D,MAAMC,IAAI,GAAGF,KAAK,CAACb,UAAU,CAAC;IAC9B,MAAM;MACLgB,aAAa,EAAEC,cAAc;MAC7BC,aAAa,EAAEC,cAAc;MAC7B,GAAGC;IACJ,CAAC,GAAGL,IAAI,EAAEK,KAAK,IAAI,CAAC,CAAC;IACrB,IAAIC,QAAuB,GAAGxB,4BAA4B;IAC1D,IAAII,IAAI,KAAK,SAAS,EAAE;MACvBoB,QAAQ,GAAGzB,qBAAqB,CAACgB,QAAQ,EAAEZ,UAAU,CAAC;IACvD,CAAC,MAAM,IACNW,KAAK,EAAEW,KAAK,IACZnB,gBAAgB,CAACW,GAAG,CAAC,CAAC,EAAES,OAAO,KAAKZ,KAAK,CAACY,OAAO,IACjDR,IAAI,KAAKS,SAAS,IAClBjB,eAAe,CAACO,GAAG,CAAC,CAAC,EACpB;MACDO,QAAQ,GAAGZ,cAAc;IAC1B;IAEA,OAAO;MAAE,GAAGW,KAAK;MAAEC;IAAS,CAAC;EAC9B,CAAC,CAAC;EACF,OAAO;IACNX,aAAa;IACbe,aAAa,EAAE7B,qBAAqB,CAACM,gBAAgB,EAAEF,UAAU;EAClE,CAAC;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["PortalProvider"],"sourceRoot":"../../../../../src","sources":["components/boundary/portal/index.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,8BAA8B","ignoreList":[]}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useSyncExternalStore } from "react";
|
|
4
|
-
const EMPTY_SNAPSHOT = {};
|
|
5
4
|
const listeners = new Set();
|
|
6
5
|
const hostStacks = new Map();
|
|
7
|
-
let snapshot = EMPTY_SNAPSHOT;
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* The active host for a screen. Stack ordering is the load-bearing invariant:
|
|
@@ -24,15 +22,7 @@ const getActiveHostFromStack = (screenKey, stack) => {
|
|
|
24
22
|
}
|
|
25
23
|
return stack[0]?.hostKey ?? screenKey;
|
|
26
24
|
};
|
|
27
|
-
const buildSnapshot = () => {
|
|
28
|
-
const nextSnapshot = {};
|
|
29
|
-
for (const [screenKey, stack] of hostStacks) {
|
|
30
|
-
nextSnapshot[screenKey] = getActiveHostFromStack(screenKey, stack);
|
|
31
|
-
}
|
|
32
|
-
return nextSnapshot;
|
|
33
|
-
};
|
|
34
25
|
const emit = () => {
|
|
35
|
-
snapshot = buildSnapshot();
|
|
36
26
|
for (const listener of listeners) {
|
|
37
27
|
listener();
|
|
38
28
|
}
|
|
@@ -76,14 +66,13 @@ export const unregisterHost = (screenKey, hostKey) => {
|
|
|
76
66
|
emit();
|
|
77
67
|
};
|
|
78
68
|
export const getActiveHostKey = screenKey => {
|
|
79
|
-
return
|
|
69
|
+
return getActiveHostFromStack(screenKey, hostStacks.get(screenKey));
|
|
80
70
|
};
|
|
81
71
|
export const useActiveHostKey = screenKey => {
|
|
82
72
|
return useSyncExternalStore(subscribe, () => screenKey ? getActiveHostKey(screenKey) : undefined, () => undefined);
|
|
83
73
|
};
|
|
84
74
|
export const resetHostRegistry = () => {
|
|
85
75
|
hostStacks.clear();
|
|
86
|
-
snapshot = EMPTY_SNAPSHOT;
|
|
87
76
|
emit();
|
|
88
77
|
};
|
|
89
78
|
//# sourceMappingURL=host-registry.store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSyncExternalStore","listeners","Set","hostStacks","Map","getActiveHostFromStack","screenKey","stack","length","index","host","fallback","hostKey","emit","listener","subscribe","add","delete","registerHost","registration","get","previousActiveHostKey","nextStack","filter","unshift","push","set","unregisterHost","getActiveHostKey","useActiveHostKey","undefined","resetHostRegistry","clear"],"sourceRoot":"../../../../../../src","sources":["components/boundary/portal/stores/host-registry.store.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,OAAO;AAQ5C,MAAMC,SAAS,GAAG,IAAIC,GAAG,CAAa,CAAC;AACvC,MAAMC,UAA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AAGwB,SAAU,EAC3D,MAAMA,SACP,CAAC;AACF,CAAC;AAED,OAAO,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;EACtC5B,UAAU,CAAC6B,KAAK,CAAC,CAAC;EAClBnB,IAAI,CAAC,CAAC;AACP,CAAC","ignoreList":[]}
|
|
@@ -7,25 +7,23 @@ const activeBoundaryHosts = new Map();
|
|
|
7
7
|
let snapshot = {
|
|
8
8
|
hostsByScope: {}
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
|
|
11
|
+
// Preserve other overlays' snapshots so a registration only rerenders its owners.
|
|
12
|
+
const emit = (...hostKeys) => {
|
|
13
|
+
const hostsByScope = {
|
|
14
|
+
...snapshot.hostsByScope
|
|
15
|
+
};
|
|
16
|
+
for (const hostKey of new Set(hostKeys)) {
|
|
17
|
+
hostsByScope[hostKey] = Array.from(activeBoundaryHosts.values()).filter(host => host.hostKey === hostKey);
|
|
18
|
+
if (!hostsByScope[hostKey].length) delete hostsByScope[hostKey];
|
|
16
19
|
}
|
|
17
|
-
|
|
20
|
+
snapshot = {
|
|
18
21
|
hostsByScope
|
|
19
22
|
};
|
|
20
|
-
|
|
21
|
-
const emit = () => {
|
|
22
|
-
snapshot = buildSnapshot();
|
|
23
|
-
for (const listener of listeners) {
|
|
24
|
-
listener();
|
|
25
|
-
}
|
|
23
|
+
for (const listener of listeners) listener();
|
|
26
24
|
};
|
|
27
25
|
const isSameHost = (a, b) => {
|
|
28
|
-
return a.boundaryId === b.boundaryId && a.hostKey === b.hostKey && a.localMeasurement === b.localMeasurement && a.
|
|
26
|
+
return a.boundaryId === b.boundaryId && a.hostKey === b.hostKey && a.localMeasurement === b.localMeasurement && a.portalHostName === b.portalHostName && a.portalHostReady === b.portalHostReady && a.slotsMap === b.slotsMap;
|
|
29
27
|
};
|
|
30
28
|
export const mountPortalBoundaryHost = host => {
|
|
31
29
|
const previous = activeBoundaryHosts.get(host.portalHostName);
|
|
@@ -33,13 +31,15 @@ export const mountPortalBoundaryHost = host => {
|
|
|
33
31
|
return;
|
|
34
32
|
}
|
|
35
33
|
activeBoundaryHosts.set(host.portalHostName, host);
|
|
36
|
-
emit();
|
|
34
|
+
emit(host.hostKey, previous?.hostKey ?? host.hostKey);
|
|
37
35
|
};
|
|
38
36
|
export const unmountPortalBoundaryHostByName = portalHostName => {
|
|
39
|
-
|
|
37
|
+
const host = portalHostName ? activeBoundaryHosts.get(portalHostName) : undefined;
|
|
38
|
+
if (!host) {
|
|
40
39
|
return;
|
|
41
40
|
}
|
|
42
|
-
|
|
41
|
+
activeBoundaryHosts.delete(host.portalHostName);
|
|
42
|
+
emit(host.hostKey);
|
|
43
43
|
};
|
|
44
44
|
const subscribe = listener => {
|
|
45
45
|
listeners.add(listener);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSyncExternalStore","EMPTY_HOSTS","listeners","Set","activeBoundaryHosts","Map","snapshot","hostsByScope","emit","hostKeys","hostKey","Array","from","values","filter","host","length","listener","isSameHost","a","b","boundaryId","localMeasurement","portalHostName","portalHostReady","slotsMap","mountPortalBoundaryHost","previous","get","set","unmountPortalBoundaryHostByName","undefined","delete","subscribe","add","useActivePortalBoundaryHosts"],"sourceRoot":"../../../../../../src","sources":["components/boundary/portal/stores/portal-boundary-host.store.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,OAAO;AAkB5C,MAAMC,WAAuC,GAAG,EAAE;AAElD,MAAMC,SAAS,GAAG,IAAIC,GAAG,CAAa,CAAC;AACvC,MAAMC,mBAAmB,GAAG,IAAIC,GAAG,CAAmC,CAAC;AAEvE,IAAIC,QAAwB,GAAG;EAC9BC,YAAY,EAAE,CAAC;AAChB,CAAC;;AAED;AACA,MAAMC,IAAI,GAAGA,CAAC,GAAGC,QAAkB,KAAK;EACvC,MAAMF,YAAY,GAAG;IAAE,GAAGD,QAAQ,CAACC;EAAa,CAAC;EAC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AC;AACtD,CAAC;AAED,OAAO,MAAMoB,+BAA+B,GAC3CP,cAAyC,IACrC;EACJ,MAAMR,IAAI,GAAGQ,cAAc,GACxBnB,mBAAmB,CAACwB,GAAG,CAACL,cAAc,CAAC,GACvCQ,SAAS;EACZ,IAAI,CAAChB,IAAI,EAAE;IACV;EACD;EAEAX,mBAAmB,CAAC4B,MAAM,CAACjB,IAAI,CAACQ,cAAc,CAAC;EAC/Cf,IAAI,CAACO,IAAI,CAACL,OAAO,CAAC;AACnB,CAAC;AAED,MAAMuB,SAAS,GAAIhB,QAAoB,IAAK;EAC3Cf,SAAS,CAACgC,GAAG,CAACjB,QAAQ,CAAC;EAEvB,OAAO,MAAM;IACZf,SAAS,CAAC8B,MAAM,CAACf,QAAQ,CAAC;EAC3B,CAAC;AACF,CAAC;AAED,OAAO,MAAMkB,4BAA4B,GAAIzB,OAAe,IAAK;EAChE,OAAOV,oBAAoB,CAC1BiC,SAAS,EACT,MAAM3B,QAAQ,CAACC,YAAY,CAACG,OAAO,CAAC,IAAIT,WAAW,EACnD,MAAMA,WACP,CAAC;AACF,CAAC","ignoreList":[]}
|
|
@@ -7,4 +7,10 @@ export const createBoundaryPortalHostName = (hostKey, boundaryId, pairKey) => {
|
|
|
7
7
|
return `${hostKey}-${pairKey ? `${pairKey}-` : ""}${boundaryId}${BOUNDARY_PORTAL_HOST_NAME_SUFFIX}`;
|
|
8
8
|
};
|
|
9
9
|
export const PORTAL_HOST_NAME_RESET_VALUE = null;
|
|
10
|
+
const BOUNDARY_CONTENT_PORTAL_HOST_NAME_SUFFIX = "-content-portal-host";
|
|
11
|
+
export const createHandoffHostName = (screenKey, boundaryId) => {
|
|
12
|
+
"worklet";
|
|
13
|
+
|
|
14
|
+
return `${screenKey}-${boundaryId}${BOUNDARY_CONTENT_PORTAL_HOST_NAME_SUFFIX}`;
|
|
15
|
+
};
|
|
10
16
|
//# sourceMappingURL=naming.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BOUNDARY_PORTAL_HOST_NAME_SUFFIX","createBoundaryPortalHostName","hostKey","boundaryId","pairKey","PORTAL_HOST_NAME_RESET_VALUE"],"sourceRoot":"../../../../../../src","sources":["components/boundary/portal/utils/naming.ts"],"mappings":";;AAAA,MAAMA,gCAAgC,GAAG,cAAc;AAEvD,OAAO,MAAMC,4BAA4B,GAAGA,CAC3CC,OAAe,EACfC,UAAkB,EAClBC,OAAuB,KACnB;EACJ,SAAS;;EACT,OAAO,GAAGF,OAAO,IAAIE,OAAO,GAAG,GAAGA,OAAO,GAAG,GAAG,EAAE,GAAGD,UAAU,GAAGH,gCAAgC,EAAE;AACpG,CAAC;AAED,OAAO,MAAMK,4BAA4B,GAAG,IAAI","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["BOUNDARY_PORTAL_HOST_NAME_SUFFIX","createBoundaryPortalHostName","hostKey","boundaryId","pairKey","PORTAL_HOST_NAME_RESET_VALUE","BOUNDARY_CONTENT_PORTAL_HOST_NAME_SUFFIX","createHandoffHostName","screenKey"],"sourceRoot":"../../../../../../src","sources":["components/boundary/portal/utils/naming.ts"],"mappings":";;AAAA,MAAMA,gCAAgC,GAAG,cAAc;AAEvD,OAAO,MAAMC,4BAA4B,GAAGA,CAC3CC,OAAe,EACfC,UAAkB,EAClBC,OAAuB,KACnB;EACJ,SAAS;;EACT,OAAO,GAAGF,OAAO,IAAIE,OAAO,GAAG,GAAGA,OAAO,GAAG,GAAG,EAAE,GAAGD,UAAU,GAAGH,gCAAgC,EAAE;AACpG,CAAC;AAED,OAAO,MAAMK,4BAA4B,GAAG,IAAI;AAEhD,MAAMC,wCAAwC,GAAG,sBAAsB;AAEvE,OAAO,MAAMC,qBAAqB,GAAGA,CACpCC,SAAiB,EACjBL,UAAkB,KACd;EACJ,SAAS;;EACT,OAAO,GAAGK,SAAS,IAAIL,UAAU,GAAGG,wCAAwC,EAAE;AAC/E,CAAC","ignoreList":[]}
|