@userflow-tech/react-native 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -77
- package/app.plugin.js +11 -3
- package/babel-plugin/index.d.ts.map +1 -1
- package/babel-plugin/index.js +53 -6
- package/babel-plugin/index.js.map +1 -1
- package/babel-plugin.js +11 -3
- package/docs/deep-linking.md +70 -33
- package/docs/isolation.md +75 -0
- package/docs/troubleshooting.md +40 -17
- package/docs/webview-custom-banner-poc.md +64 -0
- package/expo-plugin/withUserflow.d.ts +3 -2
- package/expo-plugin/withUserflow.d.ts.map +1 -1
- package/expo-plugin/withUserflow.js +14 -8
- package/expo-plugin/withUserflow.js.map +1 -1
- package/lib/commonjs/anchors/AutoAnchorRegistry.js +37 -11
- package/lib/commonjs/anchors/AutoAnchorRegistry.js.map +1 -1
- package/lib/commonjs/anchors/fiber/fiberPath.js +122 -0
- package/lib/commonjs/anchors/fiber/fiberPath.js.map +1 -0
- package/lib/commonjs/anchors/fiber/findAnchorFiber.js +60 -50
- package/lib/commonjs/anchors/fiber/findAnchorFiber.js.map +1 -1
- package/lib/commonjs/anchors/fiber/resolveFiberPath.js +220 -0
- package/lib/commonjs/anchors/fiber/resolveFiberPath.js.map +1 -0
- package/lib/commonjs/anchors/fiber/visibleRect.js +147 -0
- package/lib/commonjs/anchors/fiber/visibleRect.js.map +1 -0
- package/lib/commonjs/anchors/fiber/visibleScreens.js +73 -36
- package/lib/commonjs/anchors/fiber/visibleScreens.js.map +1 -1
- package/lib/commonjs/anchors/fiber/walkVisibleFibers.js +66 -0
- package/lib/commonjs/anchors/fiber/walkVisibleFibers.js.map +1 -0
- package/lib/commonjs/anchors/isInstanceOnVisibleScreen.js +51 -0
- package/lib/commonjs/anchors/isInstanceOnVisibleScreen.js.map +1 -0
- package/lib/commonjs/anchors/resolveAutoAnchorHost.js +22 -15
- package/lib/commonjs/anchors/resolveAutoAnchorHost.js.map +1 -1
- package/lib/commonjs/anchors/semanticMatcher.js +26 -8
- package/lib/commonjs/anchors/semanticMatcher.js.map +1 -1
- package/lib/commonjs/anonymousId.js +4 -1
- package/lib/commonjs/anonymousId.js.map +1 -1
- package/lib/commonjs/authoring/ElementPickerOverlay.js +126 -50
- package/lib/commonjs/authoring/ElementPickerOverlay.js.map +1 -1
- package/lib/commonjs/authoring/chrome/ChromeBottomSheet.js +32 -10
- package/lib/commonjs/authoring/chrome/ChromeBottomSheet.js.map +1 -1
- package/lib/commonjs/authoring/chrome/ChromeButton.js +8 -3
- package/lib/commonjs/authoring/chrome/ChromeButton.js.map +1 -1
- package/lib/commonjs/authoring/chrome/ChromeIcon.js +4 -0
- package/lib/commonjs/authoring/chrome/ChromeIcon.js.map +1 -1
- package/lib/commonjs/authoring/chrome/ChromeTopBar.js +23 -10
- package/lib/commonjs/authoring/chrome/ChromeTopBar.js.map +1 -1
- package/lib/commonjs/authoring/chrome/DoubleTapBridge.js +19 -12
- package/lib/commonjs/authoring/chrome/DoubleTapBridge.js.map +1 -1
- package/lib/commonjs/authoring/chrome/doubleTapMonitor.js +10 -0
- package/lib/commonjs/authoring/chrome/doubleTapMonitor.js.map +1 -1
- package/lib/commonjs/authoring/chrome/icons/circle-exclamation.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/circle-exclamation@2x.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/circle-exclamation@3x.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/triangle-exclamation.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/triangle-exclamation@2x.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/triangle-exclamation@3x.png +0 -0
- package/lib/commonjs/authoring/chrome/tokens.js +7 -6
- package/lib/commonjs/authoring/chrome/tokens.js.map +1 -1
- package/lib/commonjs/authoring/elementPickerController.js.map +1 -1
- package/lib/commonjs/authoring/fingerprintFromInstance.js +204 -4
- package/lib/commonjs/authoring/fingerprintFromInstance.js.map +1 -1
- package/lib/commonjs/authoring/hitTest.js +264 -16
- package/lib/commonjs/authoring/hitTest.js.map +1 -1
- package/lib/commonjs/authoring/hostAtPoint.js +204 -0
- package/lib/commonjs/authoring/hostAtPoint.js.map +1 -0
- package/lib/commonjs/content/BannerStepButton.js +68 -0
- package/lib/commonjs/content/BannerStepButton.js.map +1 -0
- package/lib/commonjs/content/buttonAppearance.js +16 -0
- package/lib/commonjs/content/buttonAppearance.js.map +1 -1
- package/lib/commonjs/content/resolveBannerButtonChrome.js +44 -0
- package/lib/commonjs/content/resolveBannerButtonChrome.js.map +1 -0
- package/lib/commonjs/content/themeColor.js +15 -0
- package/lib/commonjs/content/themeColor.js.map +1 -1
- package/lib/commonjs/deepLinking.js +4 -4
- package/lib/commonjs/evalJs/EvalJsHost.js +244 -0
- package/lib/commonjs/evalJs/EvalJsHost.js.map +1 -0
- package/lib/commonjs/evalJs/bootstrap.js +84 -0
- package/lib/commonjs/evalJs/bootstrap.js.map +1 -0
- package/lib/commonjs/evalJs/bridgeMessages.js +143 -0
- package/lib/commonjs/evalJs/bridgeMessages.js.map +1 -0
- package/lib/commonjs/evalJs/evalJsBridge.js +31 -0
- package/lib/commonjs/evalJs/evalJsBridge.js.map +1 -0
- package/lib/commonjs/evalJs/evalJsController.js +124 -0
- package/lib/commonjs/evalJs/evalJsController.js.map +1 -0
- package/lib/commonjs/evalJs/getWebView.js +81 -0
- package/lib/commonjs/evalJs/getWebView.js.map +1 -0
- package/lib/commonjs/evalJs/injectEvalPending.js +19 -0
- package/lib/commonjs/evalJs/injectEvalPending.js.map +1 -0
- package/lib/commonjs/evalJs/types.js +2 -0
- package/lib/commonjs/evalJs/types.js.map +1 -0
- package/lib/commonjs/evalJs/useEvalJsWebViewInjection.js +40 -0
- package/lib/commonjs/evalJs/useEvalJsWebViewInjection.js.map +1 -0
- package/lib/commonjs/expo-router/index.js +19 -0
- package/lib/commonjs/expo-router/index.js.map +1 -1
- package/lib/commonjs/expo-router/redirectSystemPath.js +75 -0
- package/lib/commonjs/expo-router/redirectSystemPath.js.map +1 -0
- package/lib/commonjs/expo-router/useUserflowExpoRouter.js +2 -2
- package/lib/commonjs/index.js +118 -43
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/lifecycle.js.map +1 -1
- package/lib/commonjs/navigation/WithUserflowReactNavigation.js +14 -11
- package/lib/commonjs/navigation/WithUserflowReactNavigation.js.map +1 -1
- package/lib/commonjs/navigation/openFlowNavigateUrl.js +12 -5
- package/lib/commonjs/navigation/openFlowNavigateUrl.js.map +1 -1
- package/lib/commonjs/pairing/PairingController.js +245 -27
- package/lib/commonjs/pairing/PairingController.js.map +1 -1
- package/lib/commonjs/pairing/PreviewModeBanner.js +55 -16
- package/lib/commonjs/pairing/PreviewModeBanner.js.map +1 -1
- package/lib/commonjs/pairing/deepLink.js +22 -5
- package/lib/commonjs/pairing/deepLink.js.map +1 -1
- package/lib/commonjs/pairing/deviceId.js +47 -0
- package/lib/commonjs/pairing/deviceId.js.map +1 -0
- package/lib/commonjs/pairing/diagnostics.js +5 -4
- package/lib/commonjs/pairing/diagnostics.js.map +1 -1
- package/lib/commonjs/pairing/tokenStorage.js +47 -7
- package/lib/commonjs/pairing/tokenStorage.js.map +1 -1
- package/lib/commonjs/pairing/usePairingState.js +3 -1
- package/lib/commonjs/pairing/usePairingState.js.map +1 -1
- package/lib/commonjs/pairing/usePreviewBarHold.js +139 -0
- package/lib/commonjs/pairing/usePreviewBarHold.js.map +1 -0
- package/lib/commonjs/runtime/BannerHost.js +96 -0
- package/lib/commonjs/runtime/BannerHost.js.map +1 -0
- package/lib/commonjs/runtime/EmbedBannerPlaceholder.js +99 -0
- package/lib/commonjs/runtime/EmbedBannerPlaceholder.js.map +1 -0
- package/lib/commonjs/runtime/SdkErrorBoundary.js +61 -0
- package/lib/commonjs/runtime/SdkErrorBoundary.js.map +1 -0
- package/lib/commonjs/runtime/TargetPressBridge.js +19 -12
- package/lib/commonjs/runtime/TargetPressBridge.js.map +1 -1
- package/lib/commonjs/runtime/UserflowOverlay.js +97 -0
- package/lib/commonjs/runtime/UserflowOverlay.js.map +1 -0
- package/lib/commonjs/runtime/UserflowProvider.js +135 -65
- package/lib/commonjs/runtime/UserflowProvider.js.map +1 -1
- package/lib/commonjs/runtime/bannerEngine.js +63 -0
- package/lib/commonjs/runtime/bannerEngine.js.map +1 -0
- package/lib/commonjs/runtime/bannerEngineContext.js +11 -0
- package/lib/commonjs/runtime/bannerEngineContext.js.map +1 -0
- package/lib/commonjs/runtime/bannerPlacement.js +37 -0
- package/lib/commonjs/runtime/bannerPlacement.js.map +1 -0
- package/lib/commonjs/runtime/embedBannerRegistry.js +30 -0
- package/lib/commonjs/runtime/embedBannerRegistry.js.map +1 -0
- package/lib/commonjs/runtime/flowEngine.js +75 -3
- package/lib/commonjs/runtime/flowEngine.js.map +1 -1
- package/lib/commonjs/runtime/isolateCall.js +48 -0
- package/lib/commonjs/runtime/isolateCall.js.map +1 -0
- package/lib/commonjs/runtime/reportSdkError.js +19 -0
- package/lib/commonjs/runtime/reportSdkError.js.map +1 -0
- package/lib/commonjs/runtime/useBannerSession.js +37 -0
- package/lib/commonjs/runtime/useBannerSession.js.map +1 -0
- package/lib/commonjs/screenTracker.js +34 -9
- package/lib/commonjs/screenTracker.js.map +1 -1
- package/lib/commonjs/surfaces/BannerBar.js +160 -0
- package/lib/commonjs/surfaces/BannerBar.js.map +1 -0
- package/lib/commonjs/surfaces/BannerSurface.js +78 -0
- package/lib/commonjs/surfaces/BannerSurface.js.map +1 -0
- package/lib/commonjs/surfaces/MadeWithUserflow.js +12 -8
- package/lib/commonjs/surfaces/MadeWithUserflow.js.map +1 -1
- package/lib/commonjs/surfaces/ModalSurface.js +1 -1
- package/lib/commonjs/surfaces/ModalSurface.js.map +1 -1
- package/lib/commonjs/surfaces/TooltipSurface.js +17 -1
- package/lib/commonjs/surfaces/TooltipSurface.js.map +1 -1
- package/lib/commonjs/surfaces/bannerBarLayout.js +88 -0
- package/lib/commonjs/surfaces/bannerBarLayout.js.map +1 -0
- package/lib/commonjs/surfaces/bannerBarTokens.js +42 -0
- package/lib/commonjs/surfaces/bannerBarTokens.js.map +1 -0
- package/lib/commonjs/surfaces/bannerWebView/BannerWebViewBar.js +277 -0
- package/lib/commonjs/surfaces/bannerWebView/BannerWebViewBar.js.map +1 -0
- package/lib/commonjs/surfaces/bannerWebView/bannerAutoRunEvalJs.js +46 -0
- package/lib/commonjs/surfaces/bannerWebView/bannerAutoRunEvalJs.js.map +1 -0
- package/lib/commonjs/surfaces/bannerWebView/bannerAutoRunSession.js +26 -0
- package/lib/commonjs/surfaces/bannerWebView/bannerAutoRunSession.js.map +1 -0
- package/lib/commonjs/surfaces/bannerWebView/bannerNeedsWebView.js +41 -0
- package/lib/commonjs/surfaces/bannerWebView/bannerNeedsWebView.js.map +1 -0
- package/lib/commonjs/surfaces/bannerWebView/bannerThemeStyles.js +74 -0
- package/lib/commonjs/surfaces/bannerWebView/bannerThemeStyles.js.map +1 -0
- package/lib/commonjs/surfaces/bannerWebView/bannerWebFrameCss.js +152 -0
- package/lib/commonjs/surfaces/bannerWebView/bannerWebFrameCss.js.map +1 -0
- package/lib/commonjs/surfaces/bannerWebView/buildCustomBannerHtml.js +148 -0
- package/lib/commonjs/surfaces/bannerWebView/buildCustomBannerHtml.js.map +1 -0
- package/lib/commonjs/surfaces/bannerWebView/buttonClassName.js +13 -0
- package/lib/commonjs/surfaces/bannerWebView/buttonClassName.js.map +1 -0
- package/lib/commonjs/surfaces/bannerWebView/resolveCdnHost.js +49 -0
- package/lib/commonjs/surfaces/bannerWebView/resolveCdnHost.js.map +1 -0
- package/lib/commonjs/surfaces/bannerWebView/richContentDocToHtml.js +83 -0
- package/lib/commonjs/surfaces/bannerWebView/richContentDocToHtml.js.map +1 -0
- package/lib/commonjs/surfaces/resolveBannerTheme.js +22 -0
- package/lib/commonjs/surfaces/resolveBannerTheme.js.map +1 -0
- package/lib/commonjs/surfaces/safeArea.js +23 -0
- package/lib/commonjs/surfaces/safeArea.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/anchors/AutoAnchorRegistry.js +37 -11
- package/lib/module/anchors/AutoAnchorRegistry.js.map +1 -1
- package/lib/module/anchors/fiber/fiberPath.js +118 -0
- package/lib/module/anchors/fiber/fiberPath.js.map +1 -0
- package/lib/module/anchors/fiber/findAnchorFiber.js +60 -50
- package/lib/module/anchors/fiber/findAnchorFiber.js.map +1 -1
- package/lib/module/anchors/fiber/resolveFiberPath.js +215 -0
- package/lib/module/anchors/fiber/resolveFiberPath.js.map +1 -0
- package/lib/module/anchors/fiber/visibleRect.js +139 -0
- package/lib/module/anchors/fiber/visibleRect.js.map +1 -0
- package/lib/module/anchors/fiber/visibleScreens.js +73 -37
- package/lib/module/anchors/fiber/visibleScreens.js.map +1 -1
- package/lib/module/anchors/fiber/walkVisibleFibers.js +61 -0
- package/lib/module/anchors/fiber/walkVisibleFibers.js.map +1 -0
- package/lib/module/anchors/isInstanceOnVisibleScreen.js +46 -0
- package/lib/module/anchors/isInstanceOnVisibleScreen.js.map +1 -0
- package/lib/module/anchors/resolveAutoAnchorHost.js +22 -15
- package/lib/module/anchors/resolveAutoAnchorHost.js.map +1 -1
- package/lib/module/anchors/semanticMatcher.js +26 -9
- package/lib/module/anchors/semanticMatcher.js.map +1 -1
- package/lib/module/anonymousId.js +4 -2
- package/lib/module/anonymousId.js.map +1 -1
- package/lib/module/authoring/ElementPickerOverlay.js +128 -52
- package/lib/module/authoring/ElementPickerOverlay.js.map +1 -1
- package/lib/module/authoring/chrome/ChromeBottomSheet.js +32 -10
- package/lib/module/authoring/chrome/ChromeBottomSheet.js.map +1 -1
- package/lib/module/authoring/chrome/ChromeButton.js +8 -3
- package/lib/module/authoring/chrome/ChromeButton.js.map +1 -1
- package/lib/module/authoring/chrome/ChromeIcon.js +4 -0
- package/lib/module/authoring/chrome/ChromeIcon.js.map +1 -1
- package/lib/module/authoring/chrome/ChromeTopBar.js +23 -10
- package/lib/module/authoring/chrome/ChromeTopBar.js.map +1 -1
- package/lib/module/authoring/chrome/DoubleTapBridge.js +19 -12
- package/lib/module/authoring/chrome/DoubleTapBridge.js.map +1 -1
- package/lib/module/authoring/chrome/doubleTapMonitor.js +10 -0
- package/lib/module/authoring/chrome/doubleTapMonitor.js.map +1 -1
- package/lib/module/authoring/chrome/icons/circle-exclamation.png +0 -0
- package/lib/module/authoring/chrome/icons/circle-exclamation@2x.png +0 -0
- package/lib/module/authoring/chrome/icons/circle-exclamation@3x.png +0 -0
- package/lib/module/authoring/chrome/icons/triangle-exclamation.png +0 -0
- package/lib/module/authoring/chrome/icons/triangle-exclamation@2x.png +0 -0
- package/lib/module/authoring/chrome/icons/triangle-exclamation@3x.png +0 -0
- package/lib/module/authoring/chrome/tokens.js +7 -6
- package/lib/module/authoring/chrome/tokens.js.map +1 -1
- package/lib/module/authoring/elementPickerController.js.map +1 -1
- package/lib/module/authoring/fingerprintFromInstance.js +198 -4
- package/lib/module/authoring/fingerprintFromInstance.js.map +1 -1
- package/lib/module/authoring/hitTest.js +264 -18
- package/lib/module/authoring/hitTest.js.map +1 -1
- package/lib/module/authoring/hostAtPoint.js +199 -0
- package/lib/module/authoring/hostAtPoint.js.map +1 -0
- package/lib/module/content/BannerStepButton.js +63 -0
- package/lib/module/content/BannerStepButton.js.map +1 -0
- package/lib/module/content/buttonAppearance.js +14 -0
- package/lib/module/content/buttonAppearance.js.map +1 -1
- package/lib/module/content/resolveBannerButtonChrome.js +41 -0
- package/lib/module/content/resolveBannerButtonChrome.js.map +1 -0
- package/lib/module/content/themeColor.js +14 -0
- package/lib/module/content/themeColor.js.map +1 -1
- package/lib/module/deepLinking.js +4 -4
- package/lib/module/evalJs/EvalJsHost.js +239 -0
- package/lib/module/evalJs/EvalJsHost.js.map +1 -0
- package/lib/module/evalJs/bootstrap.js +76 -0
- package/lib/module/evalJs/bootstrap.js.map +1 -0
- package/lib/module/evalJs/bridgeMessages.js +139 -0
- package/lib/module/evalJs/bridgeMessages.js.map +1 -0
- package/lib/module/evalJs/evalJsBridge.js +25 -0
- package/lib/module/evalJs/evalJsBridge.js.map +1 -0
- package/lib/module/evalJs/evalJsController.js +119 -0
- package/lib/module/evalJs/evalJsController.js.map +1 -0
- package/lib/module/evalJs/getWebView.js +76 -0
- package/lib/module/evalJs/getWebView.js.map +1 -0
- package/lib/module/evalJs/injectEvalPending.js +15 -0
- package/lib/module/evalJs/injectEvalPending.js.map +1 -0
- package/lib/module/evalJs/types.js +2 -0
- package/lib/module/evalJs/types.js.map +1 -0
- package/lib/module/evalJs/useEvalJsWebViewInjection.js +35 -0
- package/lib/module/evalJs/useEvalJsWebViewInjection.js.map +1 -0
- package/lib/module/expo-router/index.js +1 -0
- package/lib/module/expo-router/index.js.map +1 -1
- package/lib/module/expo-router/redirectSystemPath.js +70 -0
- package/lib/module/expo-router/redirectSystemPath.js.map +1 -0
- package/lib/module/expo-router/useUserflowExpoRouter.js +2 -2
- package/lib/module/index.js +114 -45
- package/lib/module/index.js.map +1 -1
- package/lib/module/lifecycle.js.map +1 -1
- package/lib/module/navigation/WithUserflowReactNavigation.js +14 -11
- package/lib/module/navigation/WithUserflowReactNavigation.js.map +1 -1
- package/lib/module/navigation/openFlowNavigateUrl.js +12 -5
- package/lib/module/navigation/openFlowNavigateUrl.js.map +1 -1
- package/lib/module/pairing/PairingController.js +245 -27
- package/lib/module/pairing/PairingController.js.map +1 -1
- package/lib/module/pairing/PreviewModeBanner.js +54 -16
- package/lib/module/pairing/PreviewModeBanner.js.map +1 -1
- package/lib/module/pairing/deepLink.js +21 -5
- package/lib/module/pairing/deepLink.js.map +1 -1
- package/lib/module/pairing/deviceId.js +41 -0
- package/lib/module/pairing/deviceId.js.map +1 -0
- package/lib/module/pairing/diagnostics.js +5 -4
- package/lib/module/pairing/diagnostics.js.map +1 -1
- package/lib/module/pairing/tokenStorage.js +47 -7
- package/lib/module/pairing/tokenStorage.js.map +1 -1
- package/lib/module/pairing/usePairingState.js +3 -1
- package/lib/module/pairing/usePairingState.js.map +1 -1
- package/lib/module/pairing/usePreviewBarHold.js +134 -0
- package/lib/module/pairing/usePreviewBarHold.js.map +1 -0
- package/lib/module/runtime/BannerHost.js +92 -0
- package/lib/module/runtime/BannerHost.js.map +1 -0
- package/lib/module/runtime/EmbedBannerPlaceholder.js +94 -0
- package/lib/module/runtime/EmbedBannerPlaceholder.js.map +1 -0
- package/lib/module/runtime/SdkErrorBoundary.js +55 -0
- package/lib/module/runtime/SdkErrorBoundary.js.map +1 -0
- package/lib/module/runtime/TargetPressBridge.js +19 -12
- package/lib/module/runtime/TargetPressBridge.js.map +1 -1
- package/lib/module/runtime/UserflowOverlay.js +92 -0
- package/lib/module/runtime/UserflowOverlay.js.map +1 -0
- package/lib/module/runtime/UserflowProvider.js +136 -66
- package/lib/module/runtime/UserflowProvider.js.map +1 -1
- package/lib/module/runtime/bannerEngine.js +55 -0
- package/lib/module/runtime/bannerEngine.js.map +1 -0
- package/lib/module/runtime/bannerEngineContext.js +7 -0
- package/lib/module/runtime/bannerEngineContext.js.map +1 -0
- package/lib/module/runtime/bannerPlacement.js +30 -0
- package/lib/module/runtime/bannerPlacement.js.map +1 -0
- package/lib/module/runtime/embedBannerRegistry.js +24 -0
- package/lib/module/runtime/embedBannerRegistry.js.map +1 -0
- package/lib/module/runtime/flowEngine.js +72 -3
- package/lib/module/runtime/flowEngine.js.map +1 -1
- package/lib/module/runtime/isolateCall.js +43 -0
- package/lib/module/runtime/isolateCall.js.map +1 -0
- package/lib/module/runtime/reportSdkError.js +15 -0
- package/lib/module/runtime/reportSdkError.js.map +1 -0
- package/lib/module/runtime/useBannerSession.js +33 -0
- package/lib/module/runtime/useBannerSession.js.map +1 -0
- package/lib/module/screenTracker.js +33 -9
- package/lib/module/screenTracker.js.map +1 -1
- package/lib/module/surfaces/BannerBar.js +155 -0
- package/lib/module/surfaces/BannerBar.js.map +1 -0
- package/lib/module/surfaces/BannerSurface.js +72 -0
- package/lib/module/surfaces/BannerSurface.js.map +1 -0
- package/lib/module/surfaces/MadeWithUserflow.js +11 -7
- package/lib/module/surfaces/MadeWithUserflow.js.map +1 -1
- package/lib/module/surfaces/ModalSurface.js +1 -1
- package/lib/module/surfaces/ModalSurface.js.map +1 -1
- package/lib/module/surfaces/TooltipSurface.js +17 -1
- package/lib/module/surfaces/TooltipSurface.js.map +1 -1
- package/lib/module/surfaces/bannerBarLayout.js +69 -0
- package/lib/module/surfaces/bannerBarLayout.js.map +1 -0
- package/lib/module/surfaces/bannerBarTokens.js +37 -0
- package/lib/module/surfaces/bannerBarTokens.js.map +1 -0
- package/lib/module/surfaces/bannerWebView/BannerWebViewBar.js +272 -0
- package/lib/module/surfaces/bannerWebView/BannerWebViewBar.js.map +1 -0
- package/lib/module/surfaces/bannerWebView/bannerAutoRunEvalJs.js +42 -0
- package/lib/module/surfaces/bannerWebView/bannerAutoRunEvalJs.js.map +1 -0
- package/lib/module/surfaces/bannerWebView/bannerAutoRunSession.js +19 -0
- package/lib/module/surfaces/bannerWebView/bannerAutoRunSession.js.map +1 -0
- package/lib/module/surfaces/bannerWebView/bannerNeedsWebView.js +35 -0
- package/lib/module/surfaces/bannerWebView/bannerNeedsWebView.js.map +1 -0
- package/lib/module/surfaces/bannerWebView/bannerThemeStyles.js +69 -0
- package/lib/module/surfaces/bannerWebView/bannerThemeStyles.js.map +1 -0
- package/lib/module/surfaces/bannerWebView/bannerWebFrameCss.js +148 -0
- package/lib/module/surfaces/bannerWebView/bannerWebFrameCss.js.map +1 -0
- package/lib/module/surfaces/bannerWebView/buildCustomBannerHtml.js +143 -0
- package/lib/module/surfaces/bannerWebView/buildCustomBannerHtml.js.map +1 -0
- package/lib/module/surfaces/bannerWebView/buttonClassName.js +9 -0
- package/lib/module/surfaces/bannerWebView/buttonClassName.js.map +1 -0
- package/lib/module/surfaces/bannerWebView/resolveCdnHost.js +42 -0
- package/lib/module/surfaces/bannerWebView/resolveCdnHost.js.map +1 -0
- package/lib/module/surfaces/bannerWebView/richContentDocToHtml.js +79 -0
- package/lib/module/surfaces/bannerWebView/richContentDocToHtml.js.map +1 -0
- package/lib/module/surfaces/resolveBannerTheme.js +16 -0
- package/lib/module/surfaces/resolveBannerTheme.js.map +1 -0
- package/lib/module/surfaces/safeArea.js +22 -0
- package/lib/module/surfaces/safeArea.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/src/anchors/AutoAnchorRegistry.d.ts +14 -0
- package/lib/typescript/commonjs/src/anchors/AutoAnchorRegistry.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/fiber/fiberPath.d.ts +12 -0
- package/lib/typescript/commonjs/src/anchors/fiber/fiberPath.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/fiber/findAnchorFiber.d.ts +5 -4
- package/lib/typescript/commonjs/src/anchors/fiber/findAnchorFiber.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/fiber/resolveFiberPath.d.ts +24 -0
- package/lib/typescript/commonjs/src/anchors/fiber/resolveFiberPath.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/fiber/visibleRect.d.ts +32 -0
- package/lib/typescript/commonjs/src/anchors/fiber/visibleRect.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/fiber/visibleScreens.d.ts +6 -1
- package/lib/typescript/commonjs/src/anchors/fiber/visibleScreens.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/fiber/walkVisibleFibers.d.ts +20 -0
- package/lib/typescript/commonjs/src/anchors/fiber/walkVisibleFibers.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/isInstanceOnVisibleScreen.d.ts +19 -0
- package/lib/typescript/commonjs/src/anchors/isInstanceOnVisibleScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/resolveAutoAnchorHost.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/semanticMatcher.d.ts +6 -4
- package/lib/typescript/commonjs/src/anchors/semanticMatcher.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anonymousId.d.ts +1 -0
- package/lib/typescript/commonjs/src/anonymousId.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/authoring/ElementPickerOverlay.d.ts +1 -0
- package/lib/typescript/commonjs/src/authoring/ElementPickerOverlay.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeBottomSheet.d.ts +14 -3
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeBottomSheet.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeIcon.d.ts +1 -1
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeIcon.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeTopBar.d.ts +12 -4
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeTopBar.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/authoring/chrome/DoubleTapBridge.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/authoring/chrome/doubleTapMonitor.d.ts +5 -0
- package/lib/typescript/commonjs/src/authoring/chrome/doubleTapMonitor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/authoring/chrome/tokens.d.ts +7 -6
- package/lib/typescript/commonjs/src/authoring/chrome/tokens.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/authoring/elementPickerController.d.ts +2 -3
- package/lib/typescript/commonjs/src/authoring/elementPickerController.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/authoring/fingerprintFromInstance.d.ts +57 -2
- package/lib/typescript/commonjs/src/authoring/fingerprintFromInstance.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/authoring/hitTest.d.ts +47 -3
- package/lib/typescript/commonjs/src/authoring/hitTest.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/authoring/hostAtPoint.d.ts +7 -0
- package/lib/typescript/commonjs/src/authoring/hostAtPoint.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/content/BannerStepButton.d.ts +14 -0
- package/lib/typescript/commonjs/src/content/BannerStepButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/content/buttonAppearance.d.ts +4 -0
- package/lib/typescript/commonjs/src/content/buttonAppearance.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/content/resolveBannerButtonChrome.d.ts +8 -0
- package/lib/typescript/commonjs/src/content/resolveBannerButtonChrome.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/content/themeColor.d.ts +2 -0
- package/lib/typescript/commonjs/src/content/themeColor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/content/types.d.ts +1 -0
- package/lib/typescript/commonjs/src/content/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/deepLinking.d.ts +4 -4
- package/lib/typescript/commonjs/src/evalJs/EvalJsHost.d.ts +14 -0
- package/lib/typescript/commonjs/src/evalJs/EvalJsHost.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/evalJs/bootstrap.d.ts +18 -0
- package/lib/typescript/commonjs/src/evalJs/bootstrap.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/evalJs/bridgeMessages.d.ts +37 -0
- package/lib/typescript/commonjs/src/evalJs/bridgeMessages.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/evalJs/evalJsBridge.d.ts +16 -0
- package/lib/typescript/commonjs/src/evalJs/evalJsBridge.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/evalJs/evalJsController.d.ts +24 -0
- package/lib/typescript/commonjs/src/evalJs/evalJsController.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/evalJs/getWebView.d.ts +64 -0
- package/lib/typescript/commonjs/src/evalJs/getWebView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/evalJs/injectEvalPending.d.ts +4 -0
- package/lib/typescript/commonjs/src/evalJs/injectEvalPending.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/evalJs/types.d.ts +53 -0
- package/lib/typescript/commonjs/src/evalJs/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/evalJs/useEvalJsWebViewInjection.d.ts +12 -0
- package/lib/typescript/commonjs/src/evalJs/useEvalJsWebViewInjection.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-router/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/expo-router/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/expo-router/redirectSystemPath.d.ts +50 -0
- package/lib/typescript/commonjs/src/expo-router/redirectSystemPath.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-router/useUserflowExpoRouter.d.ts +2 -2
- package/lib/typescript/commonjs/src/index.d.ts +16 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/lifecycle.d.ts +4 -1
- package/lib/typescript/commonjs/src/lifecycle.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/navigation/WithUserflowReactNavigation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/navigation/openFlowNavigateUrl.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/pairing/PairingController.d.ts +71 -4
- package/lib/typescript/commonjs/src/pairing/PairingController.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/pairing/PreviewModeBanner.d.ts +9 -1
- package/lib/typescript/commonjs/src/pairing/PreviewModeBanner.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/pairing/deepLink.d.ts +6 -2
- package/lib/typescript/commonjs/src/pairing/deepLink.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/pairing/deviceId.d.ts +12 -0
- package/lib/typescript/commonjs/src/pairing/deviceId.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/pairing/diagnostics.d.ts +3 -2
- package/lib/typescript/commonjs/src/pairing/diagnostics.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/pairing/tokenStorage.d.ts +14 -2
- package/lib/typescript/commonjs/src/pairing/tokenStorage.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/pairing/usePairingState.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/pairing/usePreviewBarHold.d.ts +19 -0
- package/lib/typescript/commonjs/src/pairing/usePreviewBarHold.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/BannerHost.d.ts +16 -0
- package/lib/typescript/commonjs/src/runtime/BannerHost.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/EmbedBannerPlaceholder.d.ts +18 -0
- package/lib/typescript/commonjs/src/runtime/EmbedBannerPlaceholder.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/SdkErrorBoundary.d.ts +34 -0
- package/lib/typescript/commonjs/src/runtime/SdkErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/TargetPressBridge.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/UserflowOverlay.d.ts +15 -0
- package/lib/typescript/commonjs/src/runtime/UserflowOverlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/UserflowProvider.d.ts +9 -3
- package/lib/typescript/commonjs/src/runtime/UserflowProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/bannerEngine.d.ts +12 -0
- package/lib/typescript/commonjs/src/runtime/bannerEngine.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/bannerEngineContext.d.ts +5 -0
- package/lib/typescript/commonjs/src/runtime/bannerEngineContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/bannerPlacement.d.ts +12 -0
- package/lib/typescript/commonjs/src/runtime/bannerPlacement.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/embedBannerRegistry.d.ts +5 -0
- package/lib/typescript/commonjs/src/runtime/embedBannerRegistry.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/flowEngine.d.ts +25 -1
- package/lib/typescript/commonjs/src/runtime/flowEngine.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/isolateCall.d.ts +20 -0
- package/lib/typescript/commonjs/src/runtime/isolateCall.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/reportSdkError.d.ts +10 -0
- package/lib/typescript/commonjs/src/runtime/reportSdkError.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/useBannerSession.d.ts +5 -0
- package/lib/typescript/commonjs/src/runtime/useBannerSession.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/screenTracker.d.ts +7 -3
- package/lib/typescript/commonjs/src/screenTracker.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/BannerBar.d.ts +14 -0
- package/lib/typescript/commonjs/src/surfaces/BannerBar.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/BannerSurface.d.ts +15 -0
- package/lib/typescript/commonjs/src/surfaces/BannerSurface.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/MadeWithUserflow.d.ts +10 -6
- package/lib/typescript/commonjs/src/surfaces/MadeWithUserflow.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/TooltipSurface.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/bannerBarLayout.d.ts +15 -0
- package/lib/typescript/commonjs/src/surfaces/bannerBarLayout.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/bannerBarTokens.d.ts +20 -0
- package/lib/typescript/commonjs/src/surfaces/bannerBarTokens.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/BannerWebViewBar.d.ts +10 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/BannerWebViewBar.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerAutoRunEvalJs.d.ts +7 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerAutoRunEvalJs.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerAutoRunSession.d.ts +6 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerAutoRunSession.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerNeedsWebView.d.ts +13 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerNeedsWebView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerThemeStyles.d.ts +5 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerThemeStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerWebFrameCss.d.ts +6 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerWebFrameCss.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/buildCustomBannerHtml.d.ts +9 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/buildCustomBannerHtml.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/buttonClassName.d.ts +3 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/buttonClassName.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/resolveCdnHost.d.ts +10 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/resolveCdnHost.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/richContentDocToHtml.d.ts +3 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/richContentDocToHtml.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/resolveBannerTheme.d.ts +7 -0
- package/lib/typescript/commonjs/src/surfaces/resolveBannerTheme.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/safeArea.d.ts +6 -0
- package/lib/typescript/commonjs/src/surfaces/safeArea.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/version.d.ts +1 -1
- package/lib/typescript/module/src/anchors/AutoAnchorRegistry.d.ts +14 -0
- package/lib/typescript/module/src/anchors/AutoAnchorRegistry.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/fiber/fiberPath.d.ts +12 -0
- package/lib/typescript/module/src/anchors/fiber/fiberPath.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/fiber/findAnchorFiber.d.ts +5 -4
- package/lib/typescript/module/src/anchors/fiber/findAnchorFiber.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/fiber/resolveFiberPath.d.ts +24 -0
- package/lib/typescript/module/src/anchors/fiber/resolveFiberPath.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/fiber/visibleRect.d.ts +32 -0
- package/lib/typescript/module/src/anchors/fiber/visibleRect.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/fiber/visibleScreens.d.ts +6 -1
- package/lib/typescript/module/src/anchors/fiber/visibleScreens.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/fiber/walkVisibleFibers.d.ts +20 -0
- package/lib/typescript/module/src/anchors/fiber/walkVisibleFibers.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/isInstanceOnVisibleScreen.d.ts +19 -0
- package/lib/typescript/module/src/anchors/isInstanceOnVisibleScreen.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/resolveAutoAnchorHost.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/semanticMatcher.d.ts +6 -4
- package/lib/typescript/module/src/anchors/semanticMatcher.d.ts.map +1 -1
- package/lib/typescript/module/src/anonymousId.d.ts +1 -0
- package/lib/typescript/module/src/anonymousId.d.ts.map +1 -1
- package/lib/typescript/module/src/authoring/ElementPickerOverlay.d.ts +1 -0
- package/lib/typescript/module/src/authoring/ElementPickerOverlay.d.ts.map +1 -1
- package/lib/typescript/module/src/authoring/chrome/ChromeBottomSheet.d.ts +14 -3
- package/lib/typescript/module/src/authoring/chrome/ChromeBottomSheet.d.ts.map +1 -1
- package/lib/typescript/module/src/authoring/chrome/ChromeButton.d.ts.map +1 -1
- package/lib/typescript/module/src/authoring/chrome/ChromeIcon.d.ts +1 -1
- package/lib/typescript/module/src/authoring/chrome/ChromeIcon.d.ts.map +1 -1
- package/lib/typescript/module/src/authoring/chrome/ChromeTopBar.d.ts +12 -4
- package/lib/typescript/module/src/authoring/chrome/ChromeTopBar.d.ts.map +1 -1
- package/lib/typescript/module/src/authoring/chrome/DoubleTapBridge.d.ts.map +1 -1
- package/lib/typescript/module/src/authoring/chrome/doubleTapMonitor.d.ts +5 -0
- package/lib/typescript/module/src/authoring/chrome/doubleTapMonitor.d.ts.map +1 -1
- package/lib/typescript/module/src/authoring/chrome/tokens.d.ts +7 -6
- package/lib/typescript/module/src/authoring/chrome/tokens.d.ts.map +1 -1
- package/lib/typescript/module/src/authoring/elementPickerController.d.ts +2 -3
- package/lib/typescript/module/src/authoring/elementPickerController.d.ts.map +1 -1
- package/lib/typescript/module/src/authoring/fingerprintFromInstance.d.ts +57 -2
- package/lib/typescript/module/src/authoring/fingerprintFromInstance.d.ts.map +1 -1
- package/lib/typescript/module/src/authoring/hitTest.d.ts +47 -3
- package/lib/typescript/module/src/authoring/hitTest.d.ts.map +1 -1
- package/lib/typescript/module/src/authoring/hostAtPoint.d.ts +7 -0
- package/lib/typescript/module/src/authoring/hostAtPoint.d.ts.map +1 -0
- package/lib/typescript/module/src/content/BannerStepButton.d.ts +14 -0
- package/lib/typescript/module/src/content/BannerStepButton.d.ts.map +1 -0
- package/lib/typescript/module/src/content/buttonAppearance.d.ts +4 -0
- package/lib/typescript/module/src/content/buttonAppearance.d.ts.map +1 -1
- package/lib/typescript/module/src/content/resolveBannerButtonChrome.d.ts +8 -0
- package/lib/typescript/module/src/content/resolveBannerButtonChrome.d.ts.map +1 -0
- package/lib/typescript/module/src/content/themeColor.d.ts +2 -0
- package/lib/typescript/module/src/content/themeColor.d.ts.map +1 -1
- package/lib/typescript/module/src/content/types.d.ts +1 -0
- package/lib/typescript/module/src/content/types.d.ts.map +1 -1
- package/lib/typescript/module/src/deepLinking.d.ts +4 -4
- package/lib/typescript/module/src/evalJs/EvalJsHost.d.ts +14 -0
- package/lib/typescript/module/src/evalJs/EvalJsHost.d.ts.map +1 -0
- package/lib/typescript/module/src/evalJs/bootstrap.d.ts +18 -0
- package/lib/typescript/module/src/evalJs/bootstrap.d.ts.map +1 -0
- package/lib/typescript/module/src/evalJs/bridgeMessages.d.ts +37 -0
- package/lib/typescript/module/src/evalJs/bridgeMessages.d.ts.map +1 -0
- package/lib/typescript/module/src/evalJs/evalJsBridge.d.ts +16 -0
- package/lib/typescript/module/src/evalJs/evalJsBridge.d.ts.map +1 -0
- package/lib/typescript/module/src/evalJs/evalJsController.d.ts +24 -0
- package/lib/typescript/module/src/evalJs/evalJsController.d.ts.map +1 -0
- package/lib/typescript/module/src/evalJs/getWebView.d.ts +64 -0
- package/lib/typescript/module/src/evalJs/getWebView.d.ts.map +1 -0
- package/lib/typescript/module/src/evalJs/injectEvalPending.d.ts +4 -0
- package/lib/typescript/module/src/evalJs/injectEvalPending.d.ts.map +1 -0
- package/lib/typescript/module/src/evalJs/types.d.ts +53 -0
- package/lib/typescript/module/src/evalJs/types.d.ts.map +1 -0
- package/lib/typescript/module/src/evalJs/useEvalJsWebViewInjection.d.ts +12 -0
- package/lib/typescript/module/src/evalJs/useEvalJsWebViewInjection.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-router/index.d.ts +1 -0
- package/lib/typescript/module/src/expo-router/index.d.ts.map +1 -1
- package/lib/typescript/module/src/expo-router/redirectSystemPath.d.ts +50 -0
- package/lib/typescript/module/src/expo-router/redirectSystemPath.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-router/useUserflowExpoRouter.d.ts +2 -2
- package/lib/typescript/module/src/index.d.ts +16 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/lifecycle.d.ts +4 -1
- package/lib/typescript/module/src/lifecycle.d.ts.map +1 -1
- package/lib/typescript/module/src/navigation/WithUserflowReactNavigation.d.ts.map +1 -1
- package/lib/typescript/module/src/navigation/openFlowNavigateUrl.d.ts.map +1 -1
- package/lib/typescript/module/src/pairing/PairingController.d.ts +71 -4
- package/lib/typescript/module/src/pairing/PairingController.d.ts.map +1 -1
- package/lib/typescript/module/src/pairing/PreviewModeBanner.d.ts +9 -1
- package/lib/typescript/module/src/pairing/PreviewModeBanner.d.ts.map +1 -1
- package/lib/typescript/module/src/pairing/deepLink.d.ts +6 -2
- package/lib/typescript/module/src/pairing/deepLink.d.ts.map +1 -1
- package/lib/typescript/module/src/pairing/deviceId.d.ts +12 -0
- package/lib/typescript/module/src/pairing/deviceId.d.ts.map +1 -0
- package/lib/typescript/module/src/pairing/diagnostics.d.ts +3 -2
- package/lib/typescript/module/src/pairing/diagnostics.d.ts.map +1 -1
- package/lib/typescript/module/src/pairing/tokenStorage.d.ts +14 -2
- package/lib/typescript/module/src/pairing/tokenStorage.d.ts.map +1 -1
- package/lib/typescript/module/src/pairing/usePairingState.d.ts.map +1 -1
- package/lib/typescript/module/src/pairing/usePreviewBarHold.d.ts +19 -0
- package/lib/typescript/module/src/pairing/usePreviewBarHold.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/BannerHost.d.ts +16 -0
- package/lib/typescript/module/src/runtime/BannerHost.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/EmbedBannerPlaceholder.d.ts +18 -0
- package/lib/typescript/module/src/runtime/EmbedBannerPlaceholder.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/SdkErrorBoundary.d.ts +34 -0
- package/lib/typescript/module/src/runtime/SdkErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/TargetPressBridge.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/UserflowOverlay.d.ts +15 -0
- package/lib/typescript/module/src/runtime/UserflowOverlay.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/UserflowProvider.d.ts +9 -3
- package/lib/typescript/module/src/runtime/UserflowProvider.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/bannerEngine.d.ts +12 -0
- package/lib/typescript/module/src/runtime/bannerEngine.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/bannerEngineContext.d.ts +5 -0
- package/lib/typescript/module/src/runtime/bannerEngineContext.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/bannerPlacement.d.ts +12 -0
- package/lib/typescript/module/src/runtime/bannerPlacement.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/embedBannerRegistry.d.ts +5 -0
- package/lib/typescript/module/src/runtime/embedBannerRegistry.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/flowEngine.d.ts +25 -1
- package/lib/typescript/module/src/runtime/flowEngine.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/isolateCall.d.ts +20 -0
- package/lib/typescript/module/src/runtime/isolateCall.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/reportSdkError.d.ts +10 -0
- package/lib/typescript/module/src/runtime/reportSdkError.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/useBannerSession.d.ts +5 -0
- package/lib/typescript/module/src/runtime/useBannerSession.d.ts.map +1 -0
- package/lib/typescript/module/src/screenTracker.d.ts +7 -3
- package/lib/typescript/module/src/screenTracker.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/BannerBar.d.ts +14 -0
- package/lib/typescript/module/src/surfaces/BannerBar.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/BannerSurface.d.ts +15 -0
- package/lib/typescript/module/src/surfaces/BannerSurface.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/MadeWithUserflow.d.ts +10 -6
- package/lib/typescript/module/src/surfaces/MadeWithUserflow.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/TooltipSurface.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/bannerBarLayout.d.ts +15 -0
- package/lib/typescript/module/src/surfaces/bannerBarLayout.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/bannerBarTokens.d.ts +20 -0
- package/lib/typescript/module/src/surfaces/bannerBarTokens.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/BannerWebViewBar.d.ts +10 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/BannerWebViewBar.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerAutoRunEvalJs.d.ts +7 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerAutoRunEvalJs.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerAutoRunSession.d.ts +6 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerAutoRunSession.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerNeedsWebView.d.ts +13 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerNeedsWebView.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerThemeStyles.d.ts +5 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerThemeStyles.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerWebFrameCss.d.ts +6 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerWebFrameCss.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/buildCustomBannerHtml.d.ts +9 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/buildCustomBannerHtml.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/buttonClassName.d.ts +3 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/buttonClassName.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/resolveCdnHost.d.ts +10 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/resolveCdnHost.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/richContentDocToHtml.d.ts +3 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/richContentDocToHtml.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/resolveBannerTheme.d.ts +7 -0
- package/lib/typescript/module/src/surfaces/resolveBannerTheme.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/safeArea.d.ts +6 -0
- package/lib/typescript/module/src/surfaces/safeArea.d.ts.map +1 -1
- package/lib/typescript/module/src/version.d.ts +1 -1
- package/package.json +4 -3
- package/src/anchors/AutoAnchorRegistry.ts +41 -11
- package/src/anchors/fiber/fiberPath.ts +117 -0
- package/src/anchors/fiber/findAnchorFiber.ts +57 -47
- package/src/anchors/fiber/resolveFiberPath.ts +215 -0
- package/src/anchors/fiber/visibleRect.ts +153 -0
- package/src/anchors/fiber/visibleScreens.ts +74 -36
- package/src/anchors/fiber/walkVisibleFibers.ts +65 -0
- package/src/anchors/isInstanceOnVisibleScreen.ts +55 -0
- package/src/anchors/resolveAutoAnchorHost.ts +17 -15
- package/src/anchors/semanticMatcher.ts +38 -14
- package/src/anonymousId.ts +2 -1
- package/src/authoring/ElementPickerOverlay.tsx +168 -59
- package/src/authoring/chrome/ChromeBottomSheet.tsx +49 -8
- package/src/authoring/chrome/ChromeButton.tsx +9 -4
- package/src/authoring/chrome/ChromeIcon.tsx +10 -1
- package/src/authoring/chrome/ChromeTopBar.tsx +39 -15
- package/src/authoring/chrome/DoubleTapBridge.tsx +19 -12
- package/src/authoring/chrome/doubleTapMonitor.ts +10 -0
- package/src/authoring/chrome/icons/circle-exclamation.png +0 -0
- package/src/authoring/chrome/icons/circle-exclamation@2x.png +0 -0
- package/src/authoring/chrome/icons/circle-exclamation@3x.png +0 -0
- package/src/authoring/chrome/icons/triangle-exclamation.png +0 -0
- package/src/authoring/chrome/icons/triangle-exclamation@2x.png +0 -0
- package/src/authoring/chrome/icons/triangle-exclamation@3x.png +0 -0
- package/src/authoring/chrome/tokens.ts +7 -2
- package/src/authoring/elementPickerController.ts +2 -4
- package/src/authoring/fingerprintFromInstance.ts +170 -4
- package/src/authoring/hitTest.ts +324 -16
- package/src/authoring/hostAtPoint.ts +247 -0
- package/src/content/BannerStepButton.tsx +91 -0
- package/src/content/buttonAppearance.ts +16 -0
- package/src/content/resolveBannerButtonChrome.ts +49 -0
- package/src/content/themeColor.ts +15 -0
- package/src/content/types.ts +1 -0
- package/src/deepLinking.ts +4 -4
- package/src/evalJs/EvalJsHost.tsx +255 -0
- package/src/evalJs/bootstrap.ts +83 -0
- package/src/evalJs/bridgeMessages.ts +134 -0
- package/src/evalJs/evalJsBridge.ts +42 -0
- package/src/evalJs/evalJsController.ts +127 -0
- package/src/evalJs/getWebView.ts +124 -0
- package/src/evalJs/injectEvalPending.ts +14 -0
- package/src/evalJs/types.ts +56 -0
- package/src/evalJs/useEvalJsWebViewInjection.ts +37 -0
- package/src/expo-router/index.ts +8 -0
- package/src/expo-router/redirectSystemPath.ts +86 -0
- package/src/expo-router/useUserflowExpoRouter.ts +2 -2
- package/src/index.ts +129 -45
- package/src/lifecycle.ts +4 -1
- package/src/navigation/WithUserflowReactNavigation.tsx +13 -10
- package/src/navigation/openFlowNavigateUrl.ts +12 -5
- package/src/pairing/PairingController.ts +283 -29
- package/src/pairing/PreviewModeBanner.tsx +71 -14
- package/src/pairing/deepLink.ts +23 -5
- package/src/pairing/deviceId.ts +43 -0
- package/src/pairing/diagnostics.ts +6 -4
- package/src/pairing/tokenStorage.ts +60 -7
- package/src/pairing/usePairingState.ts +2 -0
- package/src/pairing/usePreviewBarHold.ts +160 -0
- package/src/runtime/BannerHost.tsx +102 -0
- package/src/runtime/EmbedBannerPlaceholder.tsx +115 -0
- package/src/runtime/SdkErrorBoundary.tsx +77 -0
- package/src/runtime/TargetPressBridge.tsx +19 -12
- package/src/runtime/UserflowOverlay.tsx +118 -0
- package/src/runtime/UserflowProvider.tsx +139 -64
- package/src/runtime/bannerEngine.ts +55 -0
- package/src/runtime/bannerEngineContext.ts +5 -0
- package/src/runtime/bannerPlacement.ts +36 -0
- package/src/runtime/embedBannerRegistry.ts +28 -0
- package/src/runtime/flowEngine.ts +76 -3
- package/src/runtime/isolateCall.ts +53 -0
- package/src/runtime/reportSdkError.ts +12 -0
- package/src/runtime/useBannerSession.ts +35 -0
- package/src/screenTracker.ts +34 -8
- package/src/surfaces/BannerBar.tsx +176 -0
- package/src/surfaces/BannerSurface.tsx +82 -0
- package/src/surfaces/MadeWithUserflow.tsx +15 -10
- package/src/surfaces/ModalSurface.tsx +1 -1
- package/src/surfaces/TooltipSurface.tsx +17 -1
- package/src/surfaces/bannerBarLayout.ts +74 -0
- package/src/surfaces/bannerBarTokens.ts +34 -0
- package/src/surfaces/bannerWebView/BannerWebViewBar.tsx +312 -0
- package/src/surfaces/bannerWebView/bannerAutoRunEvalJs.ts +44 -0
- package/src/surfaces/bannerWebView/bannerAutoRunSession.ts +19 -0
- package/src/surfaces/bannerWebView/bannerNeedsWebView.ts +38 -0
- package/src/surfaces/bannerWebView/bannerThemeStyles.ts +91 -0
- package/src/surfaces/bannerWebView/bannerWebFrameCss.ts +145 -0
- package/src/surfaces/bannerWebView/buildCustomBannerHtml.ts +178 -0
- package/src/surfaces/bannerWebView/buttonClassName.ts +15 -0
- package/src/surfaces/bannerWebView/resolveCdnHost.ts +47 -0
- package/src/surfaces/bannerWebView/richContentDocToHtml.ts +99 -0
- package/src/surfaces/resolveBannerTheme.ts +18 -0
- package/src/surfaces/safeArea.ts +29 -0
- package/src/version.ts +1 -1
- package/vendor/core/dist/attributes.d.ts.map +1 -1
- package/vendor/core/dist/attributes.js +4 -4
- package/vendor/core/dist/attributes.js.map +1 -1
- package/vendor/core/dist/engine/BannerSessionEngine.d.ts +73 -0
- package/vendor/core/dist/engine/BannerSessionEngine.d.ts.map +1 -0
- package/vendor/core/dist/engine/BannerSessionEngine.js +236 -0
- package/vendor/core/dist/engine/BannerSessionEngine.js.map +1 -0
- package/vendor/core/dist/engine/FlowSessionEngine.d.ts +41 -1
- package/vendor/core/dist/engine/FlowSessionEngine.d.ts.map +1 -1
- package/vendor/core/dist/engine/FlowSessionEngine.js +167 -28
- package/vendor/core/dist/engine/FlowSessionEngine.js.map +1 -1
- package/vendor/core/dist/engine/PairingEngine.d.ts +38 -2
- package/vendor/core/dist/engine/PairingEngine.d.ts.map +1 -1
- package/vendor/core/dist/engine/PairingEngine.js +19 -2
- package/vendor/core/dist/engine/PairingEngine.js.map +1 -1
- package/vendor/core/dist/engine/UserflowCore.d.ts +10 -1
- package/vendor/core/dist/engine/UserflowCore.d.ts.map +1 -1
- package/vendor/core/dist/engine/UserflowCore.js +47 -27
- package/vendor/core/dist/engine/UserflowCore.js.map +1 -1
- package/vendor/core/dist/engine/handleActions.d.ts +17 -3
- package/vendor/core/dist/engine/handleActions.d.ts.map +1 -1
- package/vendor/core/dist/engine/handleActions.js +17 -14
- package/vendor/core/dist/engine/handleActions.js.map +1 -1
- package/vendor/core/dist/engine/trackCondition.d.ts +2 -0
- package/vendor/core/dist/engine/trackCondition.d.ts.map +1 -1
- package/vendor/core/dist/engine/trackCondition.js +4 -2
- package/vendor/core/dist/engine/trackCondition.js.map +1 -1
- package/vendor/core/dist/engine/trackStepTriggers.d.ts +11 -1
- package/vendor/core/dist/engine/trackStepTriggers.d.ts.map +1 -1
- package/vendor/core/dist/engine/trackStepTriggers.js +42 -16
- package/vendor/core/dist/engine/trackStepTriggers.js.map +1 -1
- package/vendor/core/dist/errors.d.ts +11 -1
- package/vendor/core/dist/errors.d.ts.map +1 -1
- package/vendor/core/dist/errors.js +2 -1
- package/vendor/core/dist/errors.js.map +1 -1
- package/vendor/core/dist/eventAttributes.d.ts.map +1 -1
- package/vendor/core/dist/eventAttributes.js +4 -2
- package/vendor/core/dist/eventAttributes.js.map +1 -1
- package/vendor/core/dist/index.d.ts +4 -1
- package/vendor/core/dist/index.d.ts.map +1 -1
- package/vendor/core/dist/index.js +1 -0
- package/vendor/core/dist/index.js.map +1 -1
- package/vendor/core/dist/normalizeAttributes.js +9 -7
- package/vendor/core/dist/normalizeAttributes.js.map +1 -1
- package/vendor/core/dist/transport/pairing.d.ts +5 -0
- package/vendor/core/dist/transport/pairing.d.ts.map +1 -1
- package/vendor/core/dist/transport/pairing.js +69 -2
- package/vendor/core/dist/transport/pairing.js.map +1 -1
- package/vendor/core/dist/transport/phoenix.d.ts +8 -0
- package/vendor/core/dist/transport/phoenix.d.ts.map +1 -1
- package/vendor/core/dist/transport/phoenix.js +16 -2
- package/vendor/core/dist/transport/phoenix.js.map +1 -1
- package/vendor/core/dist/version.d.ts +1 -1
- package/vendor/core/dist/version.js +1 -1
- package/vendor/core/package.json +1 -1
- package/vendor/protocol/dist/autoData.d.ts +8 -15
- package/vendor/protocol/dist/autoData.d.ts.map +1 -1
- package/vendor/protocol/dist/autoData.js.map +1 -1
- package/vendor/protocol/dist/flows.d.ts +58 -2
- package/vendor/protocol/dist/flows.d.ts.map +1 -1
- package/vendor/protocol/dist/flows.js +20 -2
- package/vendor/protocol/dist/flows.js.map +1 -1
- package/vendor/protocol/dist/messages.d.ts +22 -12
- package/vendor/protocol/dist/messages.d.ts.map +1 -1
- package/vendor/protocol/dist/messages.js +5 -2
- package/vendor/protocol/dist/messages.js.map +1 -1
- package/vendor/protocol/package.json +1 -1
package/src/authoring/hitTest.ts
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { SemanticRole } from '@userflow-tech/protocol';
|
|
2
|
+
import { Dimensions } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
autoAnchorRegistry,
|
|
6
|
+
roleForKind,
|
|
7
|
+
type AutoAnchorInstance,
|
|
8
|
+
} from '../anchors/AutoAnchorRegistry';
|
|
9
|
+
import { fiberScanRoot } from '../anchors/fiber/FiberScanRoot';
|
|
10
|
+
import {
|
|
11
|
+
type AnyFiber,
|
|
12
|
+
MAX_ANCESTOR_WALK,
|
|
13
|
+
getAlternate,
|
|
14
|
+
getLiveHostProps,
|
|
15
|
+
getReturn,
|
|
16
|
+
isHostFiber,
|
|
17
|
+
} from '../anchors/fiber/fiberInternals';
|
|
18
|
+
import { createLazyHostFiberIndex, lookupHostFiber } from '../anchors/fiber/indexHostFibers';
|
|
3
19
|
import { measureHostFiber } from '../anchors/fiber/measureHostFiber';
|
|
20
|
+
import { readHostText } from '../anchors/fiber/readHostContent';
|
|
21
|
+
import {
|
|
22
|
+
clipToScrollViewports,
|
|
23
|
+
fiberIsUnder,
|
|
24
|
+
topmostVisibleModalHost,
|
|
25
|
+
type VisibleRect,
|
|
26
|
+
} from '../anchors/fiber/visibleRect';
|
|
4
27
|
import { isFiberOnVisibleScreen } from '../anchors/fiber/visibleScreens';
|
|
28
|
+
import { walkVisibleFibers } from '../anchors/fiber/walkVisibleFibers';
|
|
29
|
+
import { createVisibleInstanceFilter } from '../anchors/isInstanceOnVisibleScreen';
|
|
5
30
|
import { pointInRect } from '../anchors/targetPressMonitor';
|
|
6
31
|
|
|
32
|
+
import { hostAtPoint } from './hostAtPoint';
|
|
33
|
+
|
|
7
34
|
export interface HitRect {
|
|
8
35
|
x: number;
|
|
9
36
|
y: number;
|
|
@@ -11,17 +38,58 @@ export interface HitRect {
|
|
|
11
38
|
height: number;
|
|
12
39
|
}
|
|
13
40
|
|
|
41
|
+
/** What the picker knows about a host the Babel plugin never registered. */
|
|
42
|
+
export interface FiberTargetDescriptor {
|
|
43
|
+
kind: string;
|
|
44
|
+
role: SemanticRole;
|
|
45
|
+
isPressable: boolean;
|
|
46
|
+
testID?: string;
|
|
47
|
+
nativeID?: string;
|
|
48
|
+
accessibilityLabel?: string;
|
|
49
|
+
childText?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type PickTarget =
|
|
53
|
+
| { source: 'registry'; instance: AutoAnchorInstance }
|
|
54
|
+
| { source: 'fiber'; fiber: AnyFiber; descriptor: FiberTargetDescriptor };
|
|
55
|
+
|
|
14
56
|
export interface HitCandidate {
|
|
15
|
-
|
|
57
|
+
target: PickTarget;
|
|
16
58
|
rect: HitRect;
|
|
17
59
|
area: number;
|
|
18
60
|
}
|
|
19
61
|
|
|
20
62
|
export type MeasureInstance = (inst: AutoAnchorInstance) => Promise<HitRect | null>;
|
|
21
63
|
export type InstanceFilter = (inst: AutoAnchorInstance) => boolean;
|
|
64
|
+
export type HostAtPoint = (x: number, y: number) => Promise<AnyFiber | null>;
|
|
22
65
|
|
|
23
66
|
const MEASURE_TIMEOUT_MS = 400;
|
|
24
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Scroll hosts carry responder handlers (`onResponderRelease`, …) for drag
|
|
70
|
+
* tracking. They are containers, never the thing a tap means to pick.
|
|
71
|
+
*/
|
|
72
|
+
const SCROLL_HOST_TYPES = new Set([
|
|
73
|
+
'RCTScrollView',
|
|
74
|
+
'RCTScrollContentView',
|
|
75
|
+
'AndroidHorizontalScrollView',
|
|
76
|
+
'AndroidHorizontalScrollContentView',
|
|
77
|
+
]);
|
|
78
|
+
|
|
79
|
+
/** A pressable ancestor bigger than this share of the window is a container, not a control. */
|
|
80
|
+
const MAX_DEFAULT_PRESSABLE_WINDOW_SHARE = 0.5;
|
|
81
|
+
|
|
82
|
+
const INTERACTIVE_ROLES = new Set([
|
|
83
|
+
'button',
|
|
84
|
+
'tab',
|
|
85
|
+
'link',
|
|
86
|
+
'switch',
|
|
87
|
+
'checkbox',
|
|
88
|
+
'menuitem',
|
|
89
|
+
'radio',
|
|
90
|
+
'togglebutton',
|
|
91
|
+
]);
|
|
92
|
+
|
|
25
93
|
type MeasureInWindowCallback = (x: number, y: number, width: number, height: number) => void;
|
|
26
94
|
|
|
27
95
|
interface MeasurableNode {
|
|
@@ -40,10 +108,12 @@ function areaOf(rect: HitRect): number {
|
|
|
40
108
|
return rect.width * rect.height;
|
|
41
109
|
}
|
|
42
110
|
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
111
|
+
function fiberFromPublicInstanceSafe(node: unknown): AnyFiber | null {
|
|
112
|
+
try {
|
|
113
|
+
return lookupHostFiber(createLazyHostFiberIndex(), node);
|
|
114
|
+
} catch {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
47
117
|
}
|
|
48
118
|
|
|
49
119
|
function measureWithTimeout(
|
|
@@ -87,7 +157,7 @@ export function measureInstanceRect(inst: AutoAnchorInstance): Promise<HitRect |
|
|
|
87
157
|
node.measureInWindow(callback);
|
|
88
158
|
});
|
|
89
159
|
}
|
|
90
|
-
const fiber =
|
|
160
|
+
const fiber = fiberFromPublicInstanceSafe(node);
|
|
91
161
|
if (fiber) {
|
|
92
162
|
return measureWithTimeout((callback) => {
|
|
93
163
|
measureHostFiber(fiber, callback);
|
|
@@ -96,9 +166,193 @@ export function measureInstanceRect(inst: AutoAnchorInstance): Promise<HitRect |
|
|
|
96
166
|
return Promise.resolve(null);
|
|
97
167
|
}
|
|
98
168
|
|
|
169
|
+
function stringProp(value: unknown): string | undefined {
|
|
170
|
+
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function hostKind(fiber: AnyFiber): string {
|
|
174
|
+
const type = fiber?.type;
|
|
175
|
+
if (typeof type === 'string' && type.length > 0) return type;
|
|
176
|
+
return 'View';
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* A library-rendered host worth offering as a pick: it has a developer id, a
|
|
181
|
+
* label, an interactive role, or a press handler. Plain layout views are not.
|
|
182
|
+
*/
|
|
183
|
+
export function fiberTargetDescriptor(fiber: AnyFiber): FiberTargetDescriptor | null {
|
|
184
|
+
if (!isHostFiber(fiber)) return null;
|
|
185
|
+
let props: Record<string, unknown> | undefined;
|
|
186
|
+
try {
|
|
187
|
+
props = getLiveHostProps(fiber);
|
|
188
|
+
} catch {
|
|
189
|
+
props = undefined;
|
|
190
|
+
}
|
|
191
|
+
if (!props) return null;
|
|
192
|
+
|
|
193
|
+
const testID = stringProp(props.testID);
|
|
194
|
+
const nativeID = stringProp(props.nativeID);
|
|
195
|
+
const usableNativeID = nativeID && !nativeID.startsWith('uf_') ? nativeID : undefined;
|
|
196
|
+
const accessibilityLabel =
|
|
197
|
+
stringProp(props.accessibilityLabel) ?? stringProp(props['aria-label']);
|
|
198
|
+
const kind = hostKind(fiber);
|
|
199
|
+
const isScrollHost = SCROLL_HOST_TYPES.has(kind);
|
|
200
|
+
const a11yRole = stringProp(props.accessibilityRole) ?? stringProp(props.role);
|
|
201
|
+
const interactiveRole = a11yRole !== undefined && INTERACTIVE_ROLES.has(a11yRole.toLowerCase());
|
|
202
|
+
// Pressability puts `onClick` on the host for every Pressable / Touchable.
|
|
203
|
+
// Responder handlers alone are not a press signal: scroll views have them.
|
|
204
|
+
const hasPress =
|
|
205
|
+
!isScrollHost && (typeof props.onPress === 'function' || typeof props.onClick === 'function');
|
|
206
|
+
if (!testID && !usableNativeID && !accessibilityLabel && !interactiveRole && !hasPress) {
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const isPressable = !isScrollHost && (interactiveRole || hasPress);
|
|
211
|
+
let childText: string | undefined;
|
|
212
|
+
try {
|
|
213
|
+
childText = readHostText(fiber);
|
|
214
|
+
} catch {
|
|
215
|
+
childText = undefined;
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
kind,
|
|
219
|
+
role: isPressable ? 'Action' : roleForKind(kind),
|
|
220
|
+
isPressable,
|
|
221
|
+
...(testID ? { testID } : {}),
|
|
222
|
+
...(usableNativeID ? { nativeID: usableNativeID } : {}),
|
|
223
|
+
...(accessibilityLabel ? { accessibilityLabel } : {}),
|
|
224
|
+
...(childText ? { childText } : {}),
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function registryMap(instances: AutoAnchorInstance[]): Map<AnyFiber, AutoAnchorInstance> {
|
|
229
|
+
const map = new Map<AnyFiber, AutoAnchorInstance>();
|
|
230
|
+
const getIndex = createLazyHostFiberIndex();
|
|
231
|
+
for (const inst of instances) {
|
|
232
|
+
let fiber: AnyFiber | null = null;
|
|
233
|
+
try {
|
|
234
|
+
fiber = lookupHostFiber(getIndex, inst.ref.current);
|
|
235
|
+
} catch {
|
|
236
|
+
fiber = null;
|
|
237
|
+
}
|
|
238
|
+
if (!fiber) continue;
|
|
239
|
+
map.set(fiber, inst);
|
|
240
|
+
const alternate = getAlternate(fiber);
|
|
241
|
+
if (alternate) map.set(alternate, inst);
|
|
242
|
+
}
|
|
243
|
+
return map;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function targetForHost(
|
|
247
|
+
fiber: AnyFiber,
|
|
248
|
+
byFiber: Map<AnyFiber, AutoAnchorInstance>,
|
|
249
|
+
): PickTarget | null {
|
|
250
|
+
const registered = byFiber.get(fiber) ?? byFiber.get(getAlternate(fiber) as AnyFiber);
|
|
251
|
+
if (registered) return { source: 'registry', instance: registered };
|
|
252
|
+
const descriptor = fiberTargetDescriptor(fiber);
|
|
253
|
+
if (!descriptor) return null;
|
|
254
|
+
return { source: 'fiber', fiber, descriptor };
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Innermost host first, then each identifiable ancestor up to the
|
|
259
|
+
* {@link FiberScanRoot}. Hosts above it (the provider's own wrappers) are never
|
|
260
|
+
* resolvable at play time. Empty when `host` is on a covered screen: its
|
|
261
|
+
* ancestors above the navigator are not what was tapped.
|
|
262
|
+
*/
|
|
263
|
+
export function candidateChain(
|
|
264
|
+
host: AnyFiber,
|
|
265
|
+
byFiber: Map<AnyFiber, AutoAnchorInstance>,
|
|
266
|
+
): PickTarget[] {
|
|
267
|
+
const chain: PickTarget[] = [];
|
|
268
|
+
if (!isFiberOnVisibleScreen(host)) return chain;
|
|
269
|
+
const scanRoot = fiberScanRoot.getFiber();
|
|
270
|
+
const scanRootAlternate = scanRoot ? getAlternate(scanRoot) : null;
|
|
271
|
+
const seenInstances = new Set<string>();
|
|
272
|
+
const seenFibers = new Set<AnyFiber>();
|
|
273
|
+
let current: AnyFiber | null = host;
|
|
274
|
+
for (let depth = 0; current && depth < MAX_ANCESTOR_WALK; depth += 1) {
|
|
275
|
+
if (scanRoot && (current === scanRoot || current === scanRootAlternate)) break;
|
|
276
|
+
const target = isHostFiber(current) ? targetForHost(current, byFiber) : null;
|
|
277
|
+
if (target?.source === 'registry' && !seenInstances.has(target.instance.instanceId)) {
|
|
278
|
+
seenInstances.add(target.instance.instanceId);
|
|
279
|
+
chain.push(target);
|
|
280
|
+
} else if (target?.source === 'fiber' && !seenFibers.has(target.fiber)) {
|
|
281
|
+
seenFibers.add(target.fiber);
|
|
282
|
+
chain.push(target);
|
|
283
|
+
}
|
|
284
|
+
current = getReturn(current);
|
|
285
|
+
}
|
|
286
|
+
return chain;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function measureFiberRect(fiber: AnyFiber): Promise<HitRect | null> {
|
|
290
|
+
return measureWithTimeout((callback) => {
|
|
291
|
+
measureHostFiber(fiber, callback);
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
async function candidatesFromChain(
|
|
296
|
+
chain: PickTarget[],
|
|
297
|
+
measure: MeasureInstance,
|
|
298
|
+
): Promise<HitCandidate[]> {
|
|
299
|
+
const measured = await Promise.all(
|
|
300
|
+
chain.map(async (target) => {
|
|
301
|
+
const rect =
|
|
302
|
+
target.source === 'registry'
|
|
303
|
+
? await measure(target.instance)
|
|
304
|
+
: await measureFiberRect(target.fiber);
|
|
305
|
+
if (!rect) return null;
|
|
306
|
+
return { target, rect, area: areaOf(rect) };
|
|
307
|
+
}),
|
|
308
|
+
);
|
|
309
|
+
return measured.filter((c): c is HitCandidate => c != null);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function windowArea(): number {
|
|
313
|
+
try {
|
|
314
|
+
const { width, height } = Dimensions.get('window');
|
|
315
|
+
if (width > 0 && height > 0) return width * height;
|
|
316
|
+
} catch {
|
|
317
|
+
// Tests and odd hosts: no cap.
|
|
318
|
+
}
|
|
319
|
+
return Infinity;
|
|
320
|
+
}
|
|
321
|
+
|
|
99
322
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
323
|
+
* First control-sized pressable in an innermost-first list, else 0. A
|
|
324
|
+
* screen-sized pressable ancestor would select an invisible full-screen rect.
|
|
325
|
+
*/
|
|
326
|
+
export function defaultCandidateIndex(candidates: HitCandidate[]): number {
|
|
327
|
+
const cap = windowArea() * MAX_DEFAULT_PRESSABLE_WINDOW_SHARE;
|
|
328
|
+
const index = candidates.findIndex((candidate) => {
|
|
329
|
+
const pressable =
|
|
330
|
+
candidate.target.source === 'registry'
|
|
331
|
+
? candidate.target.instance.isPressable
|
|
332
|
+
: candidate.target.descriptor.isPressable;
|
|
333
|
+
return pressable && candidate.area <= cap;
|
|
334
|
+
});
|
|
335
|
+
return index >= 0 ? index : 0;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
async function clipCandidate(candidate: HitCandidate): Promise<HitCandidate | null> {
|
|
339
|
+
const fiber =
|
|
340
|
+
candidate.target.source === 'fiber'
|
|
341
|
+
? candidate.target.fiber
|
|
342
|
+
: fiberFromPublicInstanceSafe(candidate.target.instance.ref.current);
|
|
343
|
+
const clipped = await clipToScrollViewports(fiber, candidate.rect as VisibleRect);
|
|
344
|
+
if (!clipped) return null;
|
|
345
|
+
return { ...candidate, rect: clipped, area: areaOf(clipped) };
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Hit-test window coordinates.
|
|
350
|
+
*
|
|
351
|
+
* Prefers the native topmost host and walks out to identifiable ancestors.
|
|
352
|
+
* Falls back to clipped geometry when native hit-testing is unavailable or
|
|
353
|
+
* lands on a covered screen. A visible native hit with no identifiable
|
|
354
|
+
* ancestor returns no candidates: geometry ignores stacking order and would
|
|
355
|
+
* offer whatever lies underneath the tap.
|
|
102
356
|
*/
|
|
103
357
|
export async function hitTestAt(
|
|
104
358
|
x: number,
|
|
@@ -107,19 +361,73 @@ export async function hitTestAt(
|
|
|
107
361
|
instanceFilter?: InstanceFilter;
|
|
108
362
|
measure?: MeasureInstance;
|
|
109
363
|
instances?: AutoAnchorInstance[];
|
|
364
|
+
hostAtPoint?: HostAtPoint;
|
|
110
365
|
},
|
|
111
366
|
): Promise<HitCandidate[]> {
|
|
112
|
-
const filter = opts?.instanceFilter ??
|
|
367
|
+
const filter = opts?.instanceFilter ?? createVisibleInstanceFilter();
|
|
113
368
|
const measure = opts?.measure ?? measureInstanceRect;
|
|
114
369
|
const pool = (opts?.instances ?? autoAnchorRegistry.allInstances()).filter(filter);
|
|
115
370
|
autoAnchorRegistry.refreshLiveContent(pool);
|
|
116
371
|
|
|
372
|
+
const injected = opts?.hostAtPoint;
|
|
373
|
+
const locate = injected ?? (opts?.measure === undefined ? hostAtPoint : null);
|
|
374
|
+
if (locate) {
|
|
375
|
+
try {
|
|
376
|
+
const host = await locate(x, y);
|
|
377
|
+
if (host && isFiberOnVisibleScreen(host)) {
|
|
378
|
+
const chain = candidateChain(host, registryMap(pool));
|
|
379
|
+
return chain.length > 0 ? candidatesFromChain(chain, measure) : [];
|
|
380
|
+
}
|
|
381
|
+
} catch {
|
|
382
|
+
// Native hit-testing is optional; geometry still runs.
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
return geometryHits(x, y, pool, measure);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
async function geometryHits(
|
|
390
|
+
x: number,
|
|
391
|
+
y: number,
|
|
392
|
+
pool: AutoAnchorInstance[],
|
|
393
|
+
measure: MeasureInstance,
|
|
394
|
+
): Promise<HitCandidate[]> {
|
|
395
|
+
const root = fiberScanRoot.getFiber();
|
|
396
|
+
const modal = root ? topmostVisibleModalHost(root) : null;
|
|
397
|
+
const byFiber = registryMap(pool);
|
|
398
|
+
|
|
399
|
+
const scoped = modal
|
|
400
|
+
? pool.filter((inst) => {
|
|
401
|
+
const fiber = fiberFromPublicInstanceSafe(inst.ref.current);
|
|
402
|
+
if (!fiber) return true;
|
|
403
|
+
return fiberIsUnder(fiber, modal);
|
|
404
|
+
})
|
|
405
|
+
: pool;
|
|
406
|
+
|
|
407
|
+
const targets: PickTarget[] = scoped.map((instance) => ({ source: 'registry', instance }));
|
|
408
|
+
if (root) {
|
|
409
|
+
const scanRoot = modal ?? root;
|
|
410
|
+
walkVisibleFibers(scanRoot, (fiber) => {
|
|
411
|
+
if (!isHostFiber(fiber)) return;
|
|
412
|
+
if (byFiber.has(fiber)) return;
|
|
413
|
+
const descriptor = fiberTargetDescriptor(fiber);
|
|
414
|
+
if (!descriptor) return;
|
|
415
|
+
if (modal && !fiberIsUnder(fiber, modal)) return;
|
|
416
|
+
targets.push({ source: 'fiber', fiber, descriptor });
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
|
|
117
420
|
const measured = await Promise.all(
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
421
|
+
targets.map(async (target) => {
|
|
422
|
+
const raw =
|
|
423
|
+
target.source === 'registry'
|
|
424
|
+
? await measure(target.instance)
|
|
425
|
+
: await measureFiberRect(target.fiber);
|
|
426
|
+
if (!raw) return null;
|
|
427
|
+
const clipped = await clipCandidate({ target, rect: raw, area: areaOf(raw) });
|
|
428
|
+
if (!clipped) return null;
|
|
429
|
+
if (!pointInRect(x, y, clipped.rect)) return null;
|
|
430
|
+
return clipped;
|
|
123
431
|
}),
|
|
124
432
|
);
|
|
125
433
|
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Topmost host fiber under a window point.
|
|
3
|
+
*
|
|
4
|
+
* Spike (RN 0.86 source, not a device run):
|
|
5
|
+
* - `findNodeAtPoint` is registered unconditionally in `UIManagerBinding.cpp`,
|
|
6
|
+
* and `ReactFabric-prod.js` already calls `nativeFabricUIManager`. The DEV
|
|
7
|
+
* inspector is the only JS caller, but the native method is present in
|
|
8
|
+
* release builds. Call it directly and feature-detect.
|
|
9
|
+
* - `pointerEvents="none"` fails `canBeTouchTarget` and
|
|
10
|
+
* `canChildrenBeTouchTarget`, so a decorative backdrop is not returned
|
|
11
|
+
* (see `FindNodeAtPointTest.overlappingViewsWithParentPointerEventsNone`).
|
|
12
|
+
* - Scroll views subtract `contentOffset` in `getContentOriginOffset`, so
|
|
13
|
+
* content scrolled out of the viewport is not a hit.
|
|
14
|
+
* - Modal content lives under `ModalHostView` in the same shadow tree, but
|
|
15
|
+
* its frame is relative to the modal window. If the root hit misses the
|
|
16
|
+
* visible modal's subtree, retry rooted at that modal.
|
|
17
|
+
* - Screens a navigator covers stay laid out in the shadow tree, on top of the
|
|
18
|
+
* visible one, and react-native-screens clears their zIndex, so the
|
|
19
|
+
* last-mounted sibling wins. After visiting a later tab, a tap on an earlier
|
|
20
|
+
* one lands on the hidden tab. Retry rooted at the visible screen.
|
|
21
|
+
*/
|
|
22
|
+
import { UIManager } from 'react-native';
|
|
23
|
+
|
|
24
|
+
import { fiberScanRoot } from '../anchors/fiber/FiberScanRoot';
|
|
25
|
+
import {
|
|
26
|
+
type AnyFiber,
|
|
27
|
+
coerceToFiber,
|
|
28
|
+
getStateNode,
|
|
29
|
+
isReactFiber,
|
|
30
|
+
nativeTagFromHostFiber,
|
|
31
|
+
resolveCurrentFiber,
|
|
32
|
+
} from '../anchors/fiber/fiberInternals';
|
|
33
|
+
import { nearestHostDescendant } from '../anchors/fiber/findAnchorFiber';
|
|
34
|
+
import { createHostFiberIndex } from '../anchors/fiber/indexHostFibers';
|
|
35
|
+
import { measureHostFiber } from '../anchors/fiber/measureHostFiber';
|
|
36
|
+
import { fiberIsUnder, topmostVisibleModalHost } from '../anchors/fiber/visibleRect';
|
|
37
|
+
import { isFiberOnVisibleScreen, screensCoveringFiber } from '../anchors/fiber/visibleScreens';
|
|
38
|
+
|
|
39
|
+
const HIT_TIMEOUT_MS = 400;
|
|
40
|
+
|
|
41
|
+
/** Re-hits allowed while a hit keeps landing on a covered screen (one per nesting level). */
|
|
42
|
+
const MAX_COVERED_SCREEN_RETRIES = 4;
|
|
43
|
+
|
|
44
|
+
interface FabricHitManager {
|
|
45
|
+
findNodeAtPoint: (
|
|
46
|
+
node: unknown,
|
|
47
|
+
locationX: number,
|
|
48
|
+
locationY: number,
|
|
49
|
+
callback: (instanceHandle: unknown) => void,
|
|
50
|
+
) => void;
|
|
51
|
+
measure?: (
|
|
52
|
+
node: unknown,
|
|
53
|
+
callback: (
|
|
54
|
+
x: number,
|
|
55
|
+
y: number,
|
|
56
|
+
width: number,
|
|
57
|
+
height: number,
|
|
58
|
+
pageX: number,
|
|
59
|
+
pageY: number,
|
|
60
|
+
) => void,
|
|
61
|
+
) => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface PaperHitManager {
|
|
65
|
+
findSubviewIn: (
|
|
66
|
+
reactTag: number,
|
|
67
|
+
point: [number, number],
|
|
68
|
+
callback: (
|
|
69
|
+
nativeViewTag: number,
|
|
70
|
+
left: number,
|
|
71
|
+
top: number,
|
|
72
|
+
width: number,
|
|
73
|
+
height: number,
|
|
74
|
+
) => void,
|
|
75
|
+
) => void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function fabricManager(): FabricHitManager | null {
|
|
79
|
+
const manager = (globalThis as { nativeFabricUIManager?: FabricHitManager })
|
|
80
|
+
.nativeFabricUIManager;
|
|
81
|
+
if (!manager || typeof manager.findNodeAtPoint !== 'function') return null;
|
|
82
|
+
return manager;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function paperManager(): PaperHitManager | null {
|
|
86
|
+
const manager = UIManager as unknown as PaperHitManager;
|
|
87
|
+
if (!manager || typeof manager.findSubviewIn !== 'function') return null;
|
|
88
|
+
return manager;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function shadowNodeFromHost(fiber: AnyFiber): unknown {
|
|
92
|
+
const stateNode = getStateNode(fiber);
|
|
93
|
+
if (!stateNode || typeof stateNode !== 'object') return null;
|
|
94
|
+
const node = stateNode as { node?: unknown; canonical?: { node?: unknown } };
|
|
95
|
+
return node.node ?? node.canonical?.node ?? null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function fiberFromInstanceHandle(handle: unknown): AnyFiber | null {
|
|
99
|
+
if (isReactFiber(handle)) {
|
|
100
|
+
try {
|
|
101
|
+
return resolveCurrentFiber(handle);
|
|
102
|
+
} catch {
|
|
103
|
+
return handle;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const coerced = coerceToFiber(handle);
|
|
107
|
+
if (coerced) return coerced;
|
|
108
|
+
if (!handle || typeof handle !== 'object') return null;
|
|
109
|
+
const record = handle as {
|
|
110
|
+
stateNode?: { canonical?: { internalInstanceHandle?: unknown } };
|
|
111
|
+
};
|
|
112
|
+
const nested = record.stateNode?.canonical?.internalInstanceHandle;
|
|
113
|
+
if (isReactFiber(nested)) return resolveCurrentFiber(nested);
|
|
114
|
+
return coerceToFiber(nested);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function withTimeout<T>(run: (settle: (value: T) => void) => void, fallback: T): Promise<T> {
|
|
118
|
+
return new Promise((resolve) => {
|
|
119
|
+
let settled = false;
|
|
120
|
+
const timer = setTimeout(() => {
|
|
121
|
+
if (settled) return;
|
|
122
|
+
settled = true;
|
|
123
|
+
resolve(fallback);
|
|
124
|
+
}, HIT_TIMEOUT_MS);
|
|
125
|
+
const settle = (value: T) => {
|
|
126
|
+
if (settled) return;
|
|
127
|
+
settled = true;
|
|
128
|
+
clearTimeout(timer);
|
|
129
|
+
resolve(value);
|
|
130
|
+
};
|
|
131
|
+
try {
|
|
132
|
+
run(settle);
|
|
133
|
+
} catch {
|
|
134
|
+
settle(fallback);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function measureOrigin(fiber: AnyFiber): Promise<{ x: number; y: number } | null> {
|
|
140
|
+
return withTimeout<{ x: number; y: number } | null>((settle) => {
|
|
141
|
+
measureHostFiber(fiber, (x, y, width, height) => {
|
|
142
|
+
if (width <= 0 && height <= 0 && x === 0 && y === 0) {
|
|
143
|
+
settle(null);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
settle({ x, y });
|
|
147
|
+
});
|
|
148
|
+
}, null);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* `node`'s origin within its parent. `findNodeAtPoint` tests the point against
|
|
153
|
+
* `node`'s own frame, which is in parent coordinates. Zero when `measure` is
|
|
154
|
+
* unavailable, which is exact for a node at its parent's origin.
|
|
155
|
+
*/
|
|
156
|
+
function originInParent(
|
|
157
|
+
manager: FabricHitManager,
|
|
158
|
+
node: unknown,
|
|
159
|
+
): Promise<{ x: number; y: number }> {
|
|
160
|
+
const measure = manager.measure;
|
|
161
|
+
const none = { x: 0, y: 0 };
|
|
162
|
+
if (typeof measure !== 'function') return Promise.resolve(none);
|
|
163
|
+
return withTimeout<{ x: number; y: number }>((settle) => {
|
|
164
|
+
measure.call(manager, node, (x, y) => {
|
|
165
|
+
settle(Number.isFinite(x) && Number.isFinite(y) ? { x, y } : none);
|
|
166
|
+
});
|
|
167
|
+
}, none);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async function hitFabric(rootHost: AnyFiber, x: number, y: number): Promise<AnyFiber | null> {
|
|
171
|
+
const manager = fabricManager();
|
|
172
|
+
const node = shadowNodeFromHost(rootHost);
|
|
173
|
+
if (!manager || node == null) return null;
|
|
174
|
+
const origin = await measureOrigin(rootHost);
|
|
175
|
+
if (!origin) return null;
|
|
176
|
+
const inParent = await originInParent(manager, node);
|
|
177
|
+
const handle = await withTimeout<unknown>((settle) => {
|
|
178
|
+
manager.findNodeAtPoint(node, x - origin.x + inParent.x, y - origin.y + inParent.y, settle);
|
|
179
|
+
}, null);
|
|
180
|
+
if (!handle) return null;
|
|
181
|
+
return fiberFromInstanceHandle(handle);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
async function hitPaper(rootHost: AnyFiber, x: number, y: number): Promise<AnyFiber | null> {
|
|
185
|
+
const manager = paperManager();
|
|
186
|
+
const tag = nativeTagFromHostFiber(rootHost);
|
|
187
|
+
if (!manager || tag === undefined) return null;
|
|
188
|
+
// `findSubviewIn` hit-tests in the view's own coordinates (iOS `hitTest:`,
|
|
189
|
+
// Android `TouchTargetHelper`). The window root sits at the window origin; a
|
|
190
|
+
// nested screen does not. Unmeasurable falls back to the window point.
|
|
191
|
+
const origin = (await measureOrigin(rootHost)) ?? { x: 0, y: 0 };
|
|
192
|
+
const nativeTag = await withTimeout<number | null>((settle) => {
|
|
193
|
+
manager.findSubviewIn(tag, [x - origin.x, y - origin.y], (found) => {
|
|
194
|
+
settle(typeof found === 'number' ? found : null);
|
|
195
|
+
});
|
|
196
|
+
}, null);
|
|
197
|
+
if (nativeTag == null) return null;
|
|
198
|
+
const index = createHostFiberIndex(fiberScanRoot.getFiber());
|
|
199
|
+
return index.byNativeTag.get(nativeTag) ?? null;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
async function hitUnder(rootHost: AnyFiber, x: number, y: number): Promise<AnyFiber | null> {
|
|
203
|
+
const fabric = await hitFabric(rootHost, x, y);
|
|
204
|
+
if (fabric) return fabric;
|
|
205
|
+
return hitPaper(rootHost, x, y);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** {@link hitUnder}, re-hit from the visible screen while the hit lands on a covered one. */
|
|
209
|
+
async function hitOnVisibleScreen(
|
|
210
|
+
rootHost: AnyFiber,
|
|
211
|
+
x: number,
|
|
212
|
+
y: number,
|
|
213
|
+
): Promise<AnyFiber | null> {
|
|
214
|
+
let hit = await hitUnder(rootHost, x, y);
|
|
215
|
+
for (let attempt = 0; hit && attempt < MAX_COVERED_SCREEN_RETRIES; attempt += 1) {
|
|
216
|
+
const screens = screensCoveringFiber(hit);
|
|
217
|
+
if (screens.length === 0) return hit;
|
|
218
|
+
let next: AnyFiber | null = null;
|
|
219
|
+
for (const screen of screens) {
|
|
220
|
+
next = await hitUnder(screen, x, y);
|
|
221
|
+
if (next) break;
|
|
222
|
+
}
|
|
223
|
+
hit = next;
|
|
224
|
+
}
|
|
225
|
+
// Still on a covered screen: report no hit so the caller uses geometry.
|
|
226
|
+
return hit && isFiberOnVisibleScreen(hit) ? hit : null;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Host fiber drawn on top at window coordinates, or null when neither Fabric
|
|
231
|
+
* nor Paper hit-testing is available.
|
|
232
|
+
*/
|
|
233
|
+
export async function hostAtPoint(x: number, y: number): Promise<AnyFiber | null> {
|
|
234
|
+
const root = fiberScanRoot.getFiber();
|
|
235
|
+
if (!root) return null;
|
|
236
|
+
const rootHost = nearestHostDescendant(root);
|
|
237
|
+
if (!rootHost) return null;
|
|
238
|
+
|
|
239
|
+
let hit = await hitOnVisibleScreen(rootHost, x, y);
|
|
240
|
+
const modal = topmostVisibleModalHost(root);
|
|
241
|
+
const modalHost = modal ? nearestHostDescendant(modal) : null;
|
|
242
|
+
if (modalHost && (!hit || !fiberIsUnder(hit, modal))) {
|
|
243
|
+
const modalHit = await hitOnVisibleScreen(modalHost, x, y);
|
|
244
|
+
if (modalHit) hit = modalHit;
|
|
245
|
+
}
|
|
246
|
+
return hit;
|
|
247
|
+
}
|