@userflow-tech/react-native 0.1.0 → 0.2.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 +114 -68
- package/app.plugin.js +13 -0
- package/babel-plugin/index.d.ts +43 -0
- package/babel-plugin/index.d.ts.map +1 -0
- package/babel-plugin/index.js +862 -0
- package/babel-plugin/index.js.map +1 -0
- package/babel-plugin.js +13 -0
- package/docs/anchoring.md +141 -13
- package/docs/deep-linking.md +20 -17
- package/docs/theme-mapping.md +44 -15
- package/docs/troubleshooting.md +37 -30
- package/expo-plugin/withUserflow.d.ts +17 -0
- package/expo-plugin/withUserflow.d.ts.map +1 -0
- package/expo-plugin/withUserflow.js +99 -0
- package/expo-plugin/withUserflow.js.map +1 -0
- package/lib/commonjs/anchors/AutoAnchorRegistry.js +125 -3
- package/lib/commonjs/anchors/AutoAnchorRegistry.js.map +1 -1
- package/lib/commonjs/anchors/anchorChangeTicker.js +10 -0
- package/lib/commonjs/anchors/anchorChangeTicker.js.map +1 -1
- package/lib/commonjs/anchors/autoAnchor.js +1 -1
- package/lib/commonjs/anchors/elementConditionEvaluator.js +25 -12
- package/lib/commonjs/anchors/elementConditionEvaluator.js.map +1 -1
- package/lib/commonjs/anchors/fiber/FiberScanRoot.js +11 -47
- package/lib/commonjs/anchors/fiber/FiberScanRoot.js.map +1 -1
- package/lib/commonjs/anchors/fiber/FiberScanRootStore.js +50 -0
- package/lib/commonjs/anchors/fiber/FiberScanRootStore.js.map +1 -0
- package/lib/commonjs/anchors/fiber/fiberInternals.js +145 -3
- package/lib/commonjs/anchors/fiber/fiberInternals.js.map +1 -1
- package/lib/commonjs/anchors/fiber/indexHostFibers.js +129 -0
- package/lib/commonjs/anchors/fiber/indexHostFibers.js.map +1 -0
- package/lib/commonjs/anchors/fiber/readHostContent.js +131 -0
- package/lib/commonjs/anchors/fiber/readHostContent.js.map +1 -0
- package/lib/commonjs/anchors/fiberAnchorCache.js +50 -0
- package/lib/commonjs/anchors/fiberAnchorCache.js.map +1 -0
- package/lib/commonjs/anchors/hintsCodec.js +1 -1
- package/lib/commonjs/anchors/resolveAnchorHost.js +15 -21
- package/lib/commonjs/anchors/resolveAnchorHost.js.map +1 -1
- package/lib/commonjs/anchors/resolveAutoAnchorHost.js +171 -0
- package/lib/commonjs/anchors/resolveAutoAnchorHost.js.map +1 -0
- package/lib/commonjs/anchors/semanticMatcher.js +285 -0
- package/lib/commonjs/anchors/semanticMatcher.js.map +1 -0
- package/lib/commonjs/authoring/ElementPickerOverlay.js +490 -0
- package/lib/commonjs/authoring/ElementPickerOverlay.js.map +1 -0
- package/lib/commonjs/authoring/capturePickerScreenshot.js +73 -0
- package/lib/commonjs/authoring/capturePickerScreenshot.js.map +1 -0
- package/lib/commonjs/authoring/chrome/ChromeBarTransition.js +94 -0
- package/lib/commonjs/authoring/chrome/ChromeBarTransition.js.map +1 -0
- package/lib/commonjs/authoring/chrome/ChromeBottomSheet.js +64 -0
- package/lib/commonjs/authoring/chrome/ChromeBottomSheet.js.map +1 -0
- package/lib/commonjs/authoring/chrome/ChromeButton.js +94 -0
- package/lib/commonjs/authoring/chrome/ChromeButton.js.map +1 -0
- package/lib/commonjs/authoring/chrome/ChromeDialog.js +131 -0
- package/lib/commonjs/authoring/chrome/ChromeDialog.js.map +1 -0
- package/lib/commonjs/authoring/chrome/ChromeIcon.js +39 -0
- package/lib/commonjs/authoring/chrome/ChromeIcon.js.map +1 -0
- package/lib/commonjs/authoring/chrome/ChromeTooltip.js +88 -0
- package/lib/commonjs/authoring/chrome/ChromeTooltip.js.map +1 -0
- package/lib/commonjs/authoring/chrome/ChromeTopBar.js +110 -0
- package/lib/commonjs/authoring/chrome/ChromeTopBar.js.map +1 -0
- package/lib/commonjs/authoring/chrome/DoubleTapBridge.js +57 -0
- package/lib/commonjs/authoring/chrome/DoubleTapBridge.js.map +1 -0
- package/lib/commonjs/authoring/chrome/doubleTapMonitor.js +80 -0
- package/lib/commonjs/authoring/chrome/doubleTapMonitor.js.map +1 -0
- package/lib/commonjs/authoring/chrome/icons/arrow-left-from-bracket.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/arrow-left-from-bracket@2x.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/arrow-left-from-bracket@3x.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/arrow-rotate-left.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/arrow-rotate-left@2x.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/arrow-rotate-left@3x.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/userflow-logomark.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/userflow-logomark@2x.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/userflow-logomark@3x.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/xmark.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/xmark@2x.png +0 -0
- package/lib/commonjs/authoring/chrome/icons/xmark@3x.png +0 -0
- package/lib/commonjs/authoring/chrome/tokens.js +150 -0
- package/lib/commonjs/authoring/chrome/tokens.js.map +1 -0
- package/lib/commonjs/authoring/doubleTap.js +23 -0
- package/lib/commonjs/authoring/doubleTap.js.map +1 -0
- package/lib/commonjs/authoring/elementPickerController.js +102 -0
- package/lib/commonjs/authoring/elementPickerController.js.map +1 -0
- package/lib/commonjs/authoring/fingerprintFromInstance.js +195 -0
- package/lib/commonjs/authoring/fingerprintFromInstance.js.map +1 -0
- package/lib/commonjs/authoring/hitTest.js +106 -0
- package/lib/commonjs/authoring/hitTest.js.map +1 -0
- package/lib/commonjs/content/RichContentRenderer.js +12 -2
- package/lib/commonjs/content/RichContentRenderer.js.map +1 -1
- package/lib/commonjs/content/StepButton.js +19 -4
- package/lib/commonjs/content/StepButton.js.map +1 -1
- package/lib/commonjs/content/resolveStepButtonChrome.js +8 -6
- package/lib/commonjs/content/resolveStepButtonChrome.js.map +1 -1
- package/lib/commonjs/content/themeColor.js +11 -0
- package/lib/commonjs/content/themeColor.js.map +1 -1
- package/lib/commonjs/deviceContext.js +158 -0
- package/lib/commonjs/deviceContext.js.map +1 -0
- package/lib/commonjs/expo-router/useUserflowExpoRouter.js +40 -4
- package/lib/commonjs/expo-router/useUserflowExpoRouter.js.map +1 -1
- package/lib/commonjs/hostAppVersion.js +242 -0
- package/lib/commonjs/hostAppVersion.js.map +1 -0
- package/lib/commonjs/index.js +118 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/lifecycle.js +2 -0
- package/lib/commonjs/lifecycle.js.map +1 -1
- package/lib/commonjs/navigation/WithUserflowReactNavigation.js +17 -8
- package/lib/commonjs/navigation/WithUserflowReactNavigation.js.map +1 -1
- package/lib/commonjs/navigation/isOverlayPresentation.js +64 -0
- package/lib/commonjs/navigation/isOverlayPresentation.js.map +1 -0
- package/lib/commonjs/pairing/PairingController.js +29 -2
- package/lib/commonjs/pairing/PairingController.js.map +1 -1
- package/lib/commonjs/pairing/PreviewModeBanner.js +211 -84
- package/lib/commonjs/pairing/PreviewModeBanner.js.map +1 -1
- package/lib/commonjs/pairing/diagnostics.js +11 -2
- package/lib/commonjs/pairing/diagnostics.js.map +1 -1
- package/lib/commonjs/pairing/elementPickerRelay.js +91 -0
- package/lib/commonjs/pairing/elementPickerRelay.js.map +1 -0
- package/lib/commonjs/pairing/resolvePreviewChrome.js +52 -0
- package/lib/commonjs/pairing/resolvePreviewChrome.js.map +1 -0
- package/lib/commonjs/pairing/tokenStorage.js +25 -2
- 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/runtime/FlowRenderer.js +45 -21
- package/lib/commonjs/runtime/FlowRenderer.js.map +1 -1
- package/lib/commonjs/runtime/FlowSurfaceFade.js +47 -24
- package/lib/commonjs/runtime/FlowSurfaceFade.js.map +1 -1
- package/lib/commonjs/runtime/TargetPressBridge.js +13 -44
- package/lib/commonjs/runtime/TargetPressBridge.js.map +1 -1
- package/lib/commonjs/runtime/UserflowProvider.js +74 -20
- package/lib/commonjs/runtime/UserflowProvider.js.map +1 -1
- package/lib/commonjs/runtime/changedTouchPoints.js +48 -0
- package/lib/commonjs/runtime/changedTouchPoints.js.map +1 -0
- package/lib/commonjs/runtime/flowEngine.js +3 -1
- package/lib/commonjs/runtime/flowEngine.js.map +1 -1
- package/lib/commonjs/runtime/flowSessionViewState.js +32 -7
- package/lib/commonjs/runtime/flowSessionViewState.js.map +1 -1
- package/lib/commonjs/runtime/useFlowSessionState.js +2 -1
- package/lib/commonjs/runtime/useFlowSessionState.js.map +1 -1
- package/lib/commonjs/screenTracker.js +46 -4
- package/lib/commonjs/screenTracker.js.map +1 -1
- package/lib/commonjs/surfaces/CardFade.js +31 -0
- package/lib/commonjs/surfaces/CardFade.js.map +1 -0
- package/lib/commonjs/surfaces/CloseButton.js +11 -6
- package/lib/commonjs/surfaces/CloseButton.js.map +1 -1
- package/lib/commonjs/surfaces/ModalSurface.js +50 -34
- package/lib/commonjs/surfaces/ModalSurface.js.map +1 -1
- package/lib/commonjs/surfaces/TooltipSurface.js +366 -87
- package/lib/commonjs/surfaces/TooltipSurface.js.map +1 -1
- package/lib/commonjs/surfaces/cardTransition.js +70 -0
- package/lib/commonjs/surfaces/cardTransition.js.map +1 -0
- package/lib/commonjs/surfaces/resolveHighlightChrome.js +109 -0
- package/lib/commonjs/surfaces/resolveHighlightChrome.js.map +1 -0
- package/lib/commonjs/surfaces/resolveModalLayout.js +7 -3
- package/lib/commonjs/surfaces/resolveModalLayout.js.map +1 -1
- package/lib/commonjs/surfaces/resolveTooltipLayout.js +0 -4
- package/lib/commonjs/surfaces/resolveTooltipLayout.js.map +1 -1
- package/lib/commonjs/surfaces/surfaceInteractionConfig.js +33 -0
- package/lib/commonjs/surfaces/surfaceInteractionConfig.js.map +1 -0
- package/lib/commonjs/surfaces/surfaceLayoutInsets.js +128 -0
- package/lib/commonjs/surfaces/surfaceLayoutInsets.js.map +1 -0
- package/lib/commonjs/surfaces/themeChrome.js +4 -1
- package/lib/commonjs/surfaces/themeChrome.js.map +1 -1
- package/lib/commonjs/surfaces/tooltip/TooltipBubble.js +142 -21
- package/lib/commonjs/surfaces/tooltip/TooltipBubble.js.map +1 -1
- package/lib/commonjs/surfaces/tooltip/TooltipCutout.js +100 -47
- package/lib/commonjs/surfaces/tooltip/TooltipCutout.js.map +1 -1
- package/lib/commonjs/surfaces/tooltip/TooltipHighlight.js +124 -0
- package/lib/commonjs/surfaces/tooltip/TooltipHighlight.js.map +1 -0
- package/lib/commonjs/surfaces/tooltip/computeTooltipPosition.js +67 -13
- package/lib/commonjs/surfaces/tooltip/computeTooltipPosition.js.map +1 -1
- package/lib/commonjs/surfaces/tooltip/inferTooltipPlacement.js +88 -19
- package/lib/commonjs/surfaces/tooltip/inferTooltipPlacement.js.map +1 -1
- package/lib/commonjs/surfaces/tooltip/placementDiagnostics.js +52 -0
- package/lib/commonjs/surfaces/tooltip/placementDiagnostics.js.map +1 -0
- package/lib/commonjs/surfaces/tooltip/rect.js +12 -0
- package/lib/commonjs/surfaces/tooltip/rect.js.map +1 -1
- package/lib/commonjs/surfaces/tooltip/resolveSideCardWidth.js +103 -0
- package/lib/commonjs/surfaces/tooltip/resolveSideCardWidth.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/module/anchors/AutoAnchorRegistry.js +126 -3
- package/lib/module/anchors/AutoAnchorRegistry.js.map +1 -1
- package/lib/module/anchors/anchorChangeTicker.js +10 -0
- package/lib/module/anchors/anchorChangeTicker.js.map +1 -1
- package/lib/module/anchors/autoAnchor.js +1 -1
- package/lib/module/anchors/elementConditionEvaluator.js +25 -12
- package/lib/module/anchors/elementConditionEvaluator.js.map +1 -1
- package/lib/module/anchors/fiber/FiberScanRoot.js +2 -43
- package/lib/module/anchors/fiber/FiberScanRoot.js.map +1 -1
- package/lib/module/anchors/fiber/FiberScanRootStore.js +46 -0
- package/lib/module/anchors/fiber/FiberScanRootStore.js.map +1 -0
- package/lib/module/anchors/fiber/fiberInternals.js +139 -3
- package/lib/module/anchors/fiber/fiberInternals.js.map +1 -1
- package/lib/module/anchors/fiber/indexHostFibers.js +122 -0
- package/lib/module/anchors/fiber/indexHostFibers.js.map +1 -0
- package/lib/module/anchors/fiber/readHostContent.js +127 -0
- package/lib/module/anchors/fiber/readHostContent.js.map +1 -0
- package/lib/module/anchors/fiberAnchorCache.js +40 -0
- package/lib/module/anchors/fiberAnchorCache.js.map +1 -0
- package/lib/module/anchors/hintsCodec.js +1 -1
- package/lib/module/anchors/resolveAnchorHost.js +15 -21
- package/lib/module/anchors/resolveAnchorHost.js.map +1 -1
- package/lib/module/anchors/resolveAutoAnchorHost.js +167 -0
- package/lib/module/anchors/resolveAutoAnchorHost.js.map +1 -0
- package/lib/module/anchors/semanticMatcher.js +280 -0
- package/lib/module/anchors/semanticMatcher.js.map +1 -0
- package/lib/module/authoring/ElementPickerOverlay.js +485 -0
- package/lib/module/authoring/ElementPickerOverlay.js.map +1 -0
- package/lib/module/authoring/capturePickerScreenshot.js +68 -0
- package/lib/module/authoring/capturePickerScreenshot.js.map +1 -0
- package/lib/module/authoring/chrome/ChromeBarTransition.js +88 -0
- package/lib/module/authoring/chrome/ChromeBarTransition.js.map +1 -0
- package/lib/module/authoring/chrome/ChromeBottomSheet.js +59 -0
- package/lib/module/authoring/chrome/ChromeBottomSheet.js.map +1 -0
- package/lib/module/authoring/chrome/ChromeButton.js +89 -0
- package/lib/module/authoring/chrome/ChromeButton.js.map +1 -0
- package/lib/module/authoring/chrome/ChromeDialog.js +126 -0
- package/lib/module/authoring/chrome/ChromeDialog.js.map +1 -0
- package/lib/module/authoring/chrome/ChromeIcon.js +33 -0
- package/lib/module/authoring/chrome/ChromeIcon.js.map +1 -0
- package/lib/module/authoring/chrome/ChromeTooltip.js +82 -0
- package/lib/module/authoring/chrome/ChromeTooltip.js.map +1 -0
- package/lib/module/authoring/chrome/ChromeTopBar.js +104 -0
- package/lib/module/authoring/chrome/ChromeTopBar.js.map +1 -0
- package/lib/module/authoring/chrome/DoubleTapBridge.js +52 -0
- package/lib/module/authoring/chrome/DoubleTapBridge.js.map +1 -0
- package/lib/module/authoring/chrome/doubleTapMonitor.js +75 -0
- package/lib/module/authoring/chrome/doubleTapMonitor.js.map +1 -0
- package/lib/module/authoring/chrome/icons/arrow-left-from-bracket.png +0 -0
- package/lib/module/authoring/chrome/icons/arrow-left-from-bracket@2x.png +0 -0
- package/lib/module/authoring/chrome/icons/arrow-left-from-bracket@3x.png +0 -0
- package/lib/module/authoring/chrome/icons/arrow-rotate-left.png +0 -0
- package/lib/module/authoring/chrome/icons/arrow-rotate-left@2x.png +0 -0
- package/lib/module/authoring/chrome/icons/arrow-rotate-left@3x.png +0 -0
- package/lib/module/authoring/chrome/icons/userflow-logomark.png +0 -0
- package/lib/module/authoring/chrome/icons/userflow-logomark@2x.png +0 -0
- package/lib/module/authoring/chrome/icons/userflow-logomark@3x.png +0 -0
- package/lib/module/authoring/chrome/icons/xmark.png +0 -0
- package/lib/module/authoring/chrome/icons/xmark@2x.png +0 -0
- package/lib/module/authoring/chrome/icons/xmark@3x.png +0 -0
- package/lib/module/authoring/chrome/tokens.js +146 -0
- package/lib/module/authoring/chrome/tokens.js.map +1 -0
- package/lib/module/authoring/doubleTap.js +18 -0
- package/lib/module/authoring/doubleTap.js.map +1 -0
- package/lib/module/authoring/elementPickerController.js +97 -0
- package/lib/module/authoring/elementPickerController.js.map +1 -0
- package/lib/module/authoring/fingerprintFromInstance.js +187 -0
- package/lib/module/authoring/fingerprintFromInstance.js.map +1 -0
- package/lib/module/authoring/hitTest.js +100 -0
- package/lib/module/authoring/hitTest.js.map +1 -0
- package/lib/module/content/RichContentRenderer.js +12 -2
- package/lib/module/content/RichContentRenderer.js.map +1 -1
- package/lib/module/content/StepButton.js +19 -4
- package/lib/module/content/StepButton.js.map +1 -1
- package/lib/module/content/resolveStepButtonChrome.js +8 -6
- package/lib/module/content/resolveStepButtonChrome.js.map +1 -1
- package/lib/module/content/themeColor.js +10 -0
- package/lib/module/content/themeColor.js.map +1 -1
- package/lib/module/deviceContext.js +142 -0
- package/lib/module/deviceContext.js.map +1 -0
- package/lib/module/expo-router/useUserflowExpoRouter.js +42 -6
- package/lib/module/expo-router/useUserflowExpoRouter.js.map +1 -1
- package/lib/module/hostAppVersion.js +225 -0
- package/lib/module/hostAppVersion.js.map +1 -0
- package/lib/module/index.js +119 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/lifecycle.js +2 -0
- package/lib/module/lifecycle.js.map +1 -1
- package/lib/module/navigation/WithUserflowReactNavigation.js +18 -9
- package/lib/module/navigation/WithUserflowReactNavigation.js.map +1 -1
- package/lib/module/navigation/isOverlayPresentation.js +58 -0
- package/lib/module/navigation/isOverlayPresentation.js.map +1 -0
- package/lib/module/pairing/PairingController.js +30 -3
- package/lib/module/pairing/PairingController.js.map +1 -1
- package/lib/module/pairing/PreviewModeBanner.js +212 -85
- package/lib/module/pairing/PreviewModeBanner.js.map +1 -1
- package/lib/module/pairing/diagnostics.js +10 -2
- package/lib/module/pairing/diagnostics.js.map +1 -1
- package/lib/module/pairing/elementPickerRelay.js +87 -0
- package/lib/module/pairing/elementPickerRelay.js.map +1 -0
- package/lib/module/pairing/resolvePreviewChrome.js +48 -0
- package/lib/module/pairing/resolvePreviewChrome.js.map +1 -0
- package/lib/module/pairing/tokenStorage.js +24 -2
- 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/runtime/FlowRenderer.js +45 -21
- package/lib/module/runtime/FlowRenderer.js.map +1 -1
- package/lib/module/runtime/FlowSurfaceFade.js +49 -26
- package/lib/module/runtime/FlowSurfaceFade.js.map +1 -1
- package/lib/module/runtime/TargetPressBridge.js +12 -43
- package/lib/module/runtime/TargetPressBridge.js.map +1 -1
- package/lib/module/runtime/UserflowProvider.js +74 -20
- package/lib/module/runtime/UserflowProvider.js.map +1 -1
- package/lib/module/runtime/changedTouchPoints.js +43 -0
- package/lib/module/runtime/changedTouchPoints.js.map +1 -0
- package/lib/module/runtime/flowEngine.js +3 -1
- package/lib/module/runtime/flowEngine.js.map +1 -1
- package/lib/module/runtime/flowSessionViewState.js +32 -7
- package/lib/module/runtime/flowSessionViewState.js.map +1 -1
- package/lib/module/runtime/useFlowSessionState.js +2 -1
- package/lib/module/runtime/useFlowSessionState.js.map +1 -1
- package/lib/module/screenTracker.js +42 -4
- package/lib/module/screenTracker.js.map +1 -1
- package/lib/module/surfaces/CardFade.js +26 -0
- package/lib/module/surfaces/CardFade.js.map +1 -0
- package/lib/module/surfaces/CloseButton.js +10 -6
- package/lib/module/surfaces/CloseButton.js.map +1 -1
- package/lib/module/surfaces/ModalSurface.js +52 -36
- package/lib/module/surfaces/ModalSurface.js.map +1 -1
- package/lib/module/surfaces/TooltipSurface.js +368 -90
- package/lib/module/surfaces/TooltipSurface.js.map +1 -1
- package/lib/module/surfaces/cardTransition.js +64 -0
- package/lib/module/surfaces/cardTransition.js.map +1 -0
- package/lib/module/surfaces/resolveHighlightChrome.js +102 -0
- package/lib/module/surfaces/resolveHighlightChrome.js.map +1 -0
- package/lib/module/surfaces/resolveModalLayout.js +7 -3
- package/lib/module/surfaces/resolveModalLayout.js.map +1 -1
- package/lib/module/surfaces/resolveTooltipLayout.js +1 -4
- package/lib/module/surfaces/resolveTooltipLayout.js.map +1 -1
- package/lib/module/surfaces/surfaceInteractionConfig.js +27 -0
- package/lib/module/surfaces/surfaceInteractionConfig.js.map +1 -0
- package/lib/module/surfaces/surfaceLayoutInsets.js +119 -0
- package/lib/module/surfaces/surfaceLayoutInsets.js.map +1 -0
- package/lib/module/surfaces/themeChrome.js +3 -1
- package/lib/module/surfaces/themeChrome.js.map +1 -1
- package/lib/module/surfaces/tooltip/TooltipBubble.js +143 -22
- package/lib/module/surfaces/tooltip/TooltipBubble.js.map +1 -1
- package/lib/module/surfaces/tooltip/TooltipCutout.js +100 -47
- package/lib/module/surfaces/tooltip/TooltipCutout.js.map +1 -1
- package/lib/module/surfaces/tooltip/TooltipHighlight.js +118 -0
- package/lib/module/surfaces/tooltip/TooltipHighlight.js.map +1 -0
- package/lib/module/surfaces/tooltip/computeTooltipPosition.js +67 -13
- package/lib/module/surfaces/tooltip/computeTooltipPosition.js.map +1 -1
- package/lib/module/surfaces/tooltip/inferTooltipPlacement.js +87 -19
- package/lib/module/surfaces/tooltip/inferTooltipPlacement.js.map +1 -1
- package/lib/module/surfaces/tooltip/placementDiagnostics.js +43 -0
- package/lib/module/surfaces/tooltip/placementDiagnostics.js.map +1 -0
- package/lib/module/surfaces/tooltip/rect.js +11 -0
- package/lib/module/surfaces/tooltip/rect.js.map +1 -1
- package/lib/module/surfaces/tooltip/resolveSideCardWidth.js +96 -0
- package/lib/module/surfaces/tooltip/resolveSideCardWidth.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/src/anchors/AutoAnchorRegistry.d.ts +27 -1
- package/lib/typescript/commonjs/src/anchors/AutoAnchorRegistry.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/anchorChangeTicker.d.ts +2 -0
- package/lib/typescript/commonjs/src/anchors/anchorChangeTicker.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/autoAnchor.d.ts +1 -1
- package/lib/typescript/commonjs/src/anchors/elementConditionEvaluator.d.ts +14 -10
- package/lib/typescript/commonjs/src/anchors/elementConditionEvaluator.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/fiber/FiberScanRoot.d.ts +1 -20
- package/lib/typescript/commonjs/src/anchors/fiber/FiberScanRoot.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/fiber/FiberScanRootStore.d.ts +21 -0
- package/lib/typescript/commonjs/src/anchors/fiber/FiberScanRootStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/fiber/fiberInternals.d.ts +42 -1
- package/lib/typescript/commonjs/src/anchors/fiber/fiberInternals.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/fiber/indexHostFibers.d.ts +42 -0
- package/lib/typescript/commonjs/src/anchors/fiber/indexHostFibers.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/fiber/readHostContent.d.ts +17 -0
- package/lib/typescript/commonjs/src/anchors/fiber/readHostContent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/fiberAnchorCache.d.ts +20 -0
- package/lib/typescript/commonjs/src/anchors/fiberAnchorCache.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/hintsCodec.d.ts +1 -1
- package/lib/typescript/commonjs/src/anchors/resolveAnchorHost.d.ts +5 -5
- package/lib/typescript/commonjs/src/anchors/resolveAnchorHost.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/resolveAutoAnchorHost.d.ts +38 -0
- package/lib/typescript/commonjs/src/anchors/resolveAutoAnchorHost.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/semanticMatcher.d.ts +48 -0
- package/lib/typescript/commonjs/src/anchors/semanticMatcher.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/ElementPickerOverlay.d.ts +7 -0
- package/lib/typescript/commonjs/src/authoring/ElementPickerOverlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/capturePickerScreenshot.d.ts +11 -0
- package/lib/typescript/commonjs/src/authoring/capturePickerScreenshot.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeBarTransition.d.ts +32 -0
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeBarTransition.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeBottomSheet.d.ts +13 -0
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeBottomSheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeButton.d.ts +20 -0
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeDialog.d.ts +14 -0
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeDialog.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeIcon.d.ts +13 -0
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeIcon.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeTooltip.d.ts +17 -0
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeTooltip.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeTopBar.d.ts +25 -0
- package/lib/typescript/commonjs/src/authoring/chrome/ChromeTopBar.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/chrome/DoubleTapBridge.d.ts +12 -0
- package/lib/typescript/commonjs/src/authoring/chrome/DoubleTapBridge.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/chrome/doubleTapMonitor.d.ts +26 -0
- package/lib/typescript/commonjs/src/authoring/chrome/doubleTapMonitor.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/chrome/tokens.d.ts +141 -0
- package/lib/typescript/commonjs/src/authoring/chrome/tokens.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/doubleTap.d.ts +14 -0
- package/lib/typescript/commonjs/src/authoring/doubleTap.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/elementPickerController.d.ts +59 -0
- package/lib/typescript/commonjs/src/authoring/elementPickerController.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/fingerprintFromInstance.d.ts +26 -0
- package/lib/typescript/commonjs/src/authoring/fingerprintFromInstance.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/authoring/hitTest.d.ts +31 -0
- package/lib/typescript/commonjs/src/authoring/hitTest.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/content/RichContentRenderer.d.ts +6 -1
- package/lib/typescript/commonjs/src/content/RichContentRenderer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/content/StepButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/content/resolveStepButtonChrome.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/content/themeColor.d.ts +5 -0
- package/lib/typescript/commonjs/src/content/themeColor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/deviceContext.d.ts +66 -0
- package/lib/typescript/commonjs/src/deviceContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-router/useUserflowExpoRouter.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hostAppVersion.d.ts +69 -0
- package/lib/typescript/commonjs/src/hostAppVersion.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +53 -2
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/lifecycle.d.ts +6 -0
- 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/isOverlayPresentation.d.ts +14 -0
- package/lib/typescript/commonjs/src/navigation/isOverlayPresentation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/pairing/PairingController.d.ts +7 -0
- package/lib/typescript/commonjs/src/pairing/PairingController.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/pairing/PreviewModeBanner.d.ts +6 -1
- package/lib/typescript/commonjs/src/pairing/PreviewModeBanner.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/pairing/diagnostics.d.ts +5 -0
- package/lib/typescript/commonjs/src/pairing/diagnostics.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/pairing/elementPickerRelay.d.ts +11 -0
- package/lib/typescript/commonjs/src/pairing/elementPickerRelay.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/pairing/resolvePreviewChrome.d.ts +16 -0
- package/lib/typescript/commonjs/src/pairing/resolvePreviewChrome.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/pairing/tokenStorage.d.ts +2 -0
- 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/runtime/FlowRenderer.d.ts +6 -3
- package/lib/typescript/commonjs/src/runtime/FlowRenderer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/FlowSurfaceFade.d.ts +20 -7
- package/lib/typescript/commonjs/src/runtime/FlowSurfaceFade.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/TargetPressBridge.d.ts +5 -1
- package/lib/typescript/commonjs/src/runtime/TargetPressBridge.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/UserflowProvider.d.ts +6 -4
- package/lib/typescript/commonjs/src/runtime/UserflowProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/changedTouchPoints.d.ts +10 -0
- package/lib/typescript/commonjs/src/runtime/changedTouchPoints.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/flowEngine.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/flowSessionViewState.d.ts +12 -3
- package/lib/typescript/commonjs/src/runtime/flowSessionViewState.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/useFlowSessionState.d.ts +1 -0
- package/lib/typescript/commonjs/src/runtime/useFlowSessionState.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/screenTracker.d.ts +21 -3
- package/lib/typescript/commonjs/src/screenTracker.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/CardFade.d.ts +12 -0
- package/lib/typescript/commonjs/src/surfaces/CardFade.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/CloseButton.d.ts +8 -2
- package/lib/typescript/commonjs/src/surfaces/CloseButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/MadeWithUserflow.d.ts +1 -1
- package/lib/typescript/commonjs/src/surfaces/ModalSurface.d.ts +1 -1
- package/lib/typescript/commonjs/src/surfaces/ModalSurface.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/TooltipSurface.d.ts +12 -1
- package/lib/typescript/commonjs/src/surfaces/TooltipSurface.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/cardTransition.d.ts +31 -0
- package/lib/typescript/commonjs/src/surfaces/cardTransition.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/resolveHighlightChrome.d.ts +44 -0
- package/lib/typescript/commonjs/src/surfaces/resolveHighlightChrome.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/resolveModalLayout.d.ts +1 -1
- package/lib/typescript/commonjs/src/surfaces/resolveModalLayout.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/resolveTooltipLayout.d.ts +0 -7
- package/lib/typescript/commonjs/src/surfaces/resolveTooltipLayout.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/surfaceInteractionConfig.d.ts +15 -0
- package/lib/typescript/commonjs/src/surfaces/surfaceInteractionConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/surfaceLayoutInsets.d.ts +38 -0
- package/lib/typescript/commonjs/src/surfaces/surfaceLayoutInsets.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/themeChrome.d.ts +3 -1
- package/lib/typescript/commonjs/src/surfaces/themeChrome.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipBubble.d.ts +21 -6
- package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipBubble.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipCutout.d.ts +18 -10
- package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipCutout.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipHighlight.d.ts +25 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipHighlight.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/computeTooltipPosition.d.ts +23 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/computeTooltipPosition.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/tooltip/inferTooltipPlacement.d.ts +47 -1
- package/lib/typescript/commonjs/src/surfaces/tooltip/inferTooltipPlacement.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/tooltip/placementDiagnostics.d.ts +39 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/placementDiagnostics.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/rect.d.ts +2 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/rect.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/tooltip/resolveSideCardWidth.d.ts +76 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/resolveSideCardWidth.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/version.d.ts +1 -1
- package/lib/typescript/module/src/anchors/AutoAnchorRegistry.d.ts +27 -1
- package/lib/typescript/module/src/anchors/AutoAnchorRegistry.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/anchorChangeTicker.d.ts +2 -0
- package/lib/typescript/module/src/anchors/anchorChangeTicker.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/autoAnchor.d.ts +1 -1
- package/lib/typescript/module/src/anchors/elementConditionEvaluator.d.ts +14 -10
- package/lib/typescript/module/src/anchors/elementConditionEvaluator.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/fiber/FiberScanRoot.d.ts +1 -20
- package/lib/typescript/module/src/anchors/fiber/FiberScanRoot.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/fiber/FiberScanRootStore.d.ts +21 -0
- package/lib/typescript/module/src/anchors/fiber/FiberScanRootStore.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/fiber/fiberInternals.d.ts +42 -1
- package/lib/typescript/module/src/anchors/fiber/fiberInternals.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/fiber/indexHostFibers.d.ts +42 -0
- package/lib/typescript/module/src/anchors/fiber/indexHostFibers.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/fiber/readHostContent.d.ts +17 -0
- package/lib/typescript/module/src/anchors/fiber/readHostContent.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/fiberAnchorCache.d.ts +20 -0
- package/lib/typescript/module/src/anchors/fiberAnchorCache.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/hintsCodec.d.ts +1 -1
- package/lib/typescript/module/src/anchors/resolveAnchorHost.d.ts +5 -5
- package/lib/typescript/module/src/anchors/resolveAnchorHost.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/resolveAutoAnchorHost.d.ts +38 -0
- package/lib/typescript/module/src/anchors/resolveAutoAnchorHost.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/semanticMatcher.d.ts +48 -0
- package/lib/typescript/module/src/anchors/semanticMatcher.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/ElementPickerOverlay.d.ts +7 -0
- package/lib/typescript/module/src/authoring/ElementPickerOverlay.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/capturePickerScreenshot.d.ts +11 -0
- package/lib/typescript/module/src/authoring/capturePickerScreenshot.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/chrome/ChromeBarTransition.d.ts +32 -0
- package/lib/typescript/module/src/authoring/chrome/ChromeBarTransition.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/chrome/ChromeBottomSheet.d.ts +13 -0
- package/lib/typescript/module/src/authoring/chrome/ChromeBottomSheet.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/chrome/ChromeButton.d.ts +20 -0
- package/lib/typescript/module/src/authoring/chrome/ChromeButton.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/chrome/ChromeDialog.d.ts +14 -0
- package/lib/typescript/module/src/authoring/chrome/ChromeDialog.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/chrome/ChromeIcon.d.ts +13 -0
- package/lib/typescript/module/src/authoring/chrome/ChromeIcon.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/chrome/ChromeTooltip.d.ts +17 -0
- package/lib/typescript/module/src/authoring/chrome/ChromeTooltip.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/chrome/ChromeTopBar.d.ts +25 -0
- package/lib/typescript/module/src/authoring/chrome/ChromeTopBar.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/chrome/DoubleTapBridge.d.ts +12 -0
- package/lib/typescript/module/src/authoring/chrome/DoubleTapBridge.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/chrome/doubleTapMonitor.d.ts +26 -0
- package/lib/typescript/module/src/authoring/chrome/doubleTapMonitor.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/chrome/tokens.d.ts +141 -0
- package/lib/typescript/module/src/authoring/chrome/tokens.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/doubleTap.d.ts +14 -0
- package/lib/typescript/module/src/authoring/doubleTap.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/elementPickerController.d.ts +59 -0
- package/lib/typescript/module/src/authoring/elementPickerController.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/fingerprintFromInstance.d.ts +26 -0
- package/lib/typescript/module/src/authoring/fingerprintFromInstance.d.ts.map +1 -0
- package/lib/typescript/module/src/authoring/hitTest.d.ts +31 -0
- package/lib/typescript/module/src/authoring/hitTest.d.ts.map +1 -0
- package/lib/typescript/module/src/content/RichContentRenderer.d.ts +6 -1
- package/lib/typescript/module/src/content/RichContentRenderer.d.ts.map +1 -1
- package/lib/typescript/module/src/content/StepButton.d.ts.map +1 -1
- package/lib/typescript/module/src/content/resolveStepButtonChrome.d.ts.map +1 -1
- package/lib/typescript/module/src/content/themeColor.d.ts +5 -0
- package/lib/typescript/module/src/content/themeColor.d.ts.map +1 -1
- package/lib/typescript/module/src/deviceContext.d.ts +66 -0
- package/lib/typescript/module/src/deviceContext.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-router/useUserflowExpoRouter.d.ts.map +1 -1
- package/lib/typescript/module/src/hostAppVersion.d.ts +69 -0
- package/lib/typescript/module/src/hostAppVersion.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +53 -2
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/lifecycle.d.ts +6 -0
- 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/isOverlayPresentation.d.ts +14 -0
- package/lib/typescript/module/src/navigation/isOverlayPresentation.d.ts.map +1 -0
- package/lib/typescript/module/src/pairing/PairingController.d.ts +7 -0
- package/lib/typescript/module/src/pairing/PairingController.d.ts.map +1 -1
- package/lib/typescript/module/src/pairing/PreviewModeBanner.d.ts +6 -1
- package/lib/typescript/module/src/pairing/PreviewModeBanner.d.ts.map +1 -1
- package/lib/typescript/module/src/pairing/diagnostics.d.ts +5 -0
- package/lib/typescript/module/src/pairing/diagnostics.d.ts.map +1 -1
- package/lib/typescript/module/src/pairing/elementPickerRelay.d.ts +11 -0
- package/lib/typescript/module/src/pairing/elementPickerRelay.d.ts.map +1 -0
- package/lib/typescript/module/src/pairing/resolvePreviewChrome.d.ts +16 -0
- package/lib/typescript/module/src/pairing/resolvePreviewChrome.d.ts.map +1 -0
- package/lib/typescript/module/src/pairing/tokenStorage.d.ts +2 -0
- 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/runtime/FlowRenderer.d.ts +6 -3
- package/lib/typescript/module/src/runtime/FlowRenderer.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/FlowSurfaceFade.d.ts +20 -7
- package/lib/typescript/module/src/runtime/FlowSurfaceFade.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/TargetPressBridge.d.ts +5 -1
- package/lib/typescript/module/src/runtime/TargetPressBridge.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/UserflowProvider.d.ts +6 -4
- package/lib/typescript/module/src/runtime/UserflowProvider.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/changedTouchPoints.d.ts +10 -0
- package/lib/typescript/module/src/runtime/changedTouchPoints.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/flowEngine.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/flowSessionViewState.d.ts +12 -3
- package/lib/typescript/module/src/runtime/flowSessionViewState.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/useFlowSessionState.d.ts +1 -0
- package/lib/typescript/module/src/runtime/useFlowSessionState.d.ts.map +1 -1
- package/lib/typescript/module/src/screenTracker.d.ts +21 -3
- package/lib/typescript/module/src/screenTracker.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/CardFade.d.ts +12 -0
- package/lib/typescript/module/src/surfaces/CardFade.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/CloseButton.d.ts +8 -2
- package/lib/typescript/module/src/surfaces/CloseButton.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/MadeWithUserflow.d.ts +1 -1
- package/lib/typescript/module/src/surfaces/ModalSurface.d.ts +1 -1
- package/lib/typescript/module/src/surfaces/ModalSurface.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/TooltipSurface.d.ts +12 -1
- package/lib/typescript/module/src/surfaces/TooltipSurface.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/cardTransition.d.ts +31 -0
- package/lib/typescript/module/src/surfaces/cardTransition.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/resolveHighlightChrome.d.ts +44 -0
- package/lib/typescript/module/src/surfaces/resolveHighlightChrome.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/resolveModalLayout.d.ts +1 -1
- package/lib/typescript/module/src/surfaces/resolveModalLayout.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/resolveTooltipLayout.d.ts +0 -7
- package/lib/typescript/module/src/surfaces/resolveTooltipLayout.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/surfaceInteractionConfig.d.ts +15 -0
- package/lib/typescript/module/src/surfaces/surfaceInteractionConfig.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/surfaceLayoutInsets.d.ts +38 -0
- package/lib/typescript/module/src/surfaces/surfaceLayoutInsets.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/themeChrome.d.ts +3 -1
- package/lib/typescript/module/src/surfaces/themeChrome.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/tooltip/TooltipBubble.d.ts +21 -6
- package/lib/typescript/module/src/surfaces/tooltip/TooltipBubble.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/tooltip/TooltipCutout.d.ts +18 -10
- package/lib/typescript/module/src/surfaces/tooltip/TooltipCutout.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/tooltip/TooltipHighlight.d.ts +25 -0
- package/lib/typescript/module/src/surfaces/tooltip/TooltipHighlight.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/tooltip/computeTooltipPosition.d.ts +23 -0
- package/lib/typescript/module/src/surfaces/tooltip/computeTooltipPosition.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/tooltip/inferTooltipPlacement.d.ts +47 -1
- package/lib/typescript/module/src/surfaces/tooltip/inferTooltipPlacement.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/tooltip/placementDiagnostics.d.ts +39 -0
- package/lib/typescript/module/src/surfaces/tooltip/placementDiagnostics.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/tooltip/rect.d.ts +2 -0
- package/lib/typescript/module/src/surfaces/tooltip/rect.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/tooltip/resolveSideCardWidth.d.ts +76 -0
- package/lib/typescript/module/src/surfaces/tooltip/resolveSideCardWidth.d.ts.map +1 -0
- package/lib/typescript/module/src/version.d.ts +1 -1
- package/package.json +32 -18
- package/src/anchors/AutoAnchorRegistry.ts +140 -3
- package/src/anchors/anchorChangeTicker.ts +10 -0
- package/src/anchors/autoAnchor.ts +1 -1
- package/src/anchors/elementConditionEvaluator.ts +29 -16
- package/src/anchors/fiber/FiberScanRoot.tsx +2 -50
- package/src/anchors/fiber/FiberScanRootStore.ts +51 -0
- package/src/anchors/fiber/fiberInternals.ts +166 -3
- package/src/anchors/fiber/indexHostFibers.ts +136 -0
- package/src/anchors/fiber/readHostContent.ts +146 -0
- package/src/anchors/fiberAnchorCache.ts +45 -0
- package/src/anchors/hintsCodec.ts +1 -1
- package/src/anchors/resolveAnchorHost.ts +23 -23
- package/src/anchors/resolveAutoAnchorHost.ts +180 -0
- package/src/anchors/semanticMatcher.ts +361 -0
- package/src/authoring/ElementPickerOverlay.tsx +553 -0
- package/src/authoring/capturePickerScreenshot.ts +90 -0
- package/src/authoring/chrome/ChromeBarTransition.tsx +106 -0
- package/src/authoring/chrome/ChromeBottomSheet.tsx +69 -0
- package/src/authoring/chrome/ChromeButton.tsx +103 -0
- package/src/authoring/chrome/ChromeDialog.tsx +121 -0
- package/src/authoring/chrome/ChromeIcon.tsx +40 -0
- package/src/authoring/chrome/ChromeTooltip.tsx +89 -0
- package/src/authoring/chrome/ChromeTopBar.tsx +126 -0
- package/src/authoring/chrome/DoubleTapBridge.tsx +60 -0
- package/src/authoring/chrome/doubleTapMonitor.ts +80 -0
- package/src/authoring/chrome/icons/arrow-left-from-bracket.png +0 -0
- package/src/authoring/chrome/icons/arrow-left-from-bracket@2x.png +0 -0
- package/src/authoring/chrome/icons/arrow-left-from-bracket@3x.png +0 -0
- package/src/authoring/chrome/icons/arrow-rotate-left.png +0 -0
- package/src/authoring/chrome/icons/arrow-rotate-left@2x.png +0 -0
- package/src/authoring/chrome/icons/arrow-rotate-left@3x.png +0 -0
- package/src/authoring/chrome/icons/userflow-logomark.png +0 -0
- package/src/authoring/chrome/icons/userflow-logomark@2x.png +0 -0
- package/src/authoring/chrome/icons/userflow-logomark@3x.png +0 -0
- package/src/authoring/chrome/icons/xmark.png +0 -0
- package/src/authoring/chrome/icons/xmark@2x.png +0 -0
- package/src/authoring/chrome/icons/xmark@3x.png +0 -0
- package/src/authoring/chrome/tokens.ts +106 -0
- package/src/authoring/doubleTap.ts +27 -0
- package/src/authoring/elementPickerController.ts +135 -0
- package/src/authoring/fingerprintFromInstance.ts +152 -0
- package/src/authoring/hitTest.ts +133 -0
- package/src/content/RichContentRenderer.tsx +22 -1
- package/src/content/StepButton.tsx +17 -2
- package/src/content/resolveStepButtonChrome.ts +12 -6
- package/src/content/themeColor.ts +10 -0
- package/src/deviceContext.ts +168 -0
- package/src/expo-router/useUserflowExpoRouter.ts +47 -4
- package/src/hostAppVersion.ts +258 -0
- package/src/index.ts +148 -4
- package/src/lifecycle.ts +8 -0
- package/src/navigation/WithUserflowReactNavigation.tsx +23 -7
- package/src/navigation/isOverlayPresentation.ts +76 -0
- package/src/pairing/PairingController.ts +32 -3
- package/src/pairing/PreviewModeBanner.tsx +250 -94
- package/src/pairing/diagnostics.ts +10 -2
- package/src/pairing/elementPickerRelay.ts +100 -0
- package/src/pairing/resolvePreviewChrome.ts +57 -0
- package/src/pairing/tokenStorage.ts +31 -2
- package/src/pairing/usePairingState.ts +2 -0
- package/src/runtime/FlowRenderer.tsx +55 -27
- package/src/runtime/FlowSurfaceFade.tsx +51 -30
- package/src/runtime/TargetPressBridge.tsx +14 -32
- package/src/runtime/UserflowProvider.tsx +76 -13
- package/src/runtime/changedTouchPoints.ts +34 -0
- package/src/runtime/flowEngine.ts +2 -0
- package/src/runtime/flowSessionViewState.ts +42 -4
- package/src/runtime/useFlowSessionState.ts +2 -0
- package/src/screenTracker.ts +46 -4
- package/src/surfaces/CardFade.tsx +18 -0
- package/src/surfaces/CloseButton.tsx +17 -7
- package/src/surfaces/MadeWithUserflow.tsx +1 -1
- package/src/surfaces/ModalSurface.tsx +48 -35
- package/src/surfaces/TooltipSurface.tsx +406 -86
- package/src/surfaces/cardTransition.ts +67 -0
- package/src/surfaces/resolveHighlightChrome.ts +139 -0
- package/src/surfaces/resolveModalLayout.ts +16 -8
- package/src/surfaces/resolveTooltipLayout.ts +1 -14
- package/src/surfaces/surfaceInteractionConfig.ts +25 -0
- package/src/surfaces/surfaceLayoutInsets.tsx +135 -0
- package/src/surfaces/themeChrome.ts +5 -3
- package/src/surfaces/tooltip/TooltipBubble.tsx +154 -19
- package/src/surfaces/tooltip/TooltipCutout.tsx +106 -49
- package/src/surfaces/tooltip/TooltipHighlight.tsx +144 -0
- package/src/surfaces/tooltip/computeTooltipPosition.ts +98 -12
- package/src/surfaces/tooltip/inferTooltipPlacement.ts +107 -18
- package/src/surfaces/tooltip/placementDiagnostics.ts +70 -0
- package/src/surfaces/tooltip/rect.ts +11 -0
- package/src/surfaces/tooltip/resolveSideCardWidth.ts +121 -0
- package/src/version.ts +1 -1
- package/vendor/core/LICENSE +76 -0
- package/vendor/core/README.md +9 -0
- package/vendor/core/dist/attributes.d.ts +15 -0
- package/vendor/core/dist/attributes.d.ts.map +1 -0
- package/vendor/core/dist/attributes.js +55 -0
- package/vendor/core/dist/attributes.js.map +1 -0
- package/vendor/core/dist/constants.d.ts +21 -0
- package/vendor/core/dist/constants.d.ts.map +1 -0
- package/vendor/core/dist/constants.js +21 -0
- package/vendor/core/dist/constants.js.map +1 -0
- package/vendor/core/dist/engine/ClientConditionEngine.d.ts +68 -0
- package/vendor/core/dist/engine/ClientConditionEngine.d.ts.map +1 -0
- package/vendor/core/dist/engine/ClientConditionEngine.js +197 -0
- package/vendor/core/dist/engine/ClientConditionEngine.js.map +1 -0
- package/vendor/core/dist/engine/FlowSessionEngine.d.ts +160 -0
- package/vendor/core/dist/engine/FlowSessionEngine.d.ts.map +1 -0
- package/vendor/core/dist/engine/FlowSessionEngine.js +571 -0
- package/vendor/core/dist/engine/FlowSessionEngine.js.map +1 -0
- package/vendor/core/dist/engine/PairingEngine.d.ts +135 -0
- package/vendor/core/dist/engine/PairingEngine.d.ts.map +1 -0
- package/vendor/core/dist/engine/PairingEngine.js +396 -0
- package/vendor/core/dist/engine/PairingEngine.js.map +1 -0
- package/vendor/core/dist/engine/UserflowCore.d.ts +145 -0
- package/vendor/core/dist/engine/UserflowCore.d.ts.map +1 -0
- package/vendor/core/dist/engine/UserflowCore.js +329 -0
- package/vendor/core/dist/engine/UserflowCore.js.map +1 -0
- package/vendor/core/dist/engine/conditionOperators.d.ts +16 -0
- package/vendor/core/dist/engine/conditionOperators.d.ts.map +1 -0
- package/vendor/core/dist/engine/conditionOperators.js +168 -0
- package/vendor/core/dist/engine/conditionOperators.js.map +1 -0
- package/vendor/core/dist/engine/handleActions.d.ts +42 -0
- package/vendor/core/dist/engine/handleActions.d.ts.map +1 -0
- package/vendor/core/dist/engine/handleActions.js +198 -0
- package/vendor/core/dist/engine/handleActions.js.map +1 -0
- package/vendor/core/dist/engine/interpolateSessionData.d.ts +7 -0
- package/vendor/core/dist/engine/interpolateSessionData.d.ts.map +1 -0
- package/vendor/core/dist/engine/interpolateSessionData.js +29 -0
- package/vendor/core/dist/engine/interpolateSessionData.js.map +1 -0
- package/vendor/core/dist/engine/simpleObservable.d.ts +13 -0
- package/vendor/core/dist/engine/simpleObservable.d.ts.map +1 -0
- package/vendor/core/dist/engine/simpleObservable.js +29 -0
- package/vendor/core/dist/engine/simpleObservable.js.map +1 -0
- package/vendor/core/dist/engine/trackCondition.d.ts +25 -0
- package/vendor/core/dist/engine/trackCondition.d.ts.map +1 -0
- package/vendor/core/dist/engine/trackCondition.js +177 -0
- package/vendor/core/dist/engine/trackCondition.js.map +1 -0
- package/vendor/core/dist/engine/trackStepTriggers.d.ts +21 -0
- package/vendor/core/dist/engine/trackStepTriggers.d.ts.map +1 -0
- package/vendor/core/dist/engine/trackStepTriggers.js +49 -0
- package/vendor/core/dist/engine/trackStepTriggers.js.map +1 -0
- package/vendor/core/dist/errors.d.ts +9 -0
- package/vendor/core/dist/errors.d.ts.map +1 -0
- package/vendor/core/dist/errors.js +15 -0
- package/vendor/core/dist/errors.js.map +1 -0
- package/vendor/core/dist/eventAttributes.d.ts +7 -0
- package/vendor/core/dist/eventAttributes.d.ts.map +1 -0
- package/vendor/core/dist/eventAttributes.js +31 -0
- package/vendor/core/dist/eventAttributes.js.map +1 -0
- package/vendor/core/dist/index.d.ts +31 -0
- package/vendor/core/dist/index.d.ts.map +1 -0
- package/vendor/core/dist/index.js +22 -0
- package/vendor/core/dist/index.js.map +1 -0
- package/vendor/core/dist/normalizeAttributes.d.ts +8 -0
- package/vendor/core/dist/normalizeAttributes.d.ts.map +1 -0
- package/vendor/core/dist/normalizeAttributes.js +127 -0
- package/vendor/core/dist/normalizeAttributes.js.map +1 -0
- package/vendor/core/dist/transport/backoff.d.ts +11 -0
- package/vendor/core/dist/transport/backoff.d.ts.map +1 -0
- package/vendor/core/dist/transport/backoff.js +17 -0
- package/vendor/core/dist/transport/backoff.js.map +1 -0
- package/vendor/core/dist/transport/pairing.d.ts +121 -0
- package/vendor/core/dist/transport/pairing.d.ts.map +1 -0
- package/vendor/core/dist/transport/pairing.js +551 -0
- package/vendor/core/dist/transport/pairing.js.map +1 -0
- package/vendor/core/dist/transport/phoenix.d.ts +228 -0
- package/vendor/core/dist/transport/phoenix.d.ts.map +1 -0
- package/vendor/core/dist/transport/phoenix.js +811 -0
- package/vendor/core/dist/transport/phoenix.js.map +1 -0
- package/vendor/core/dist/transport/rateLimiter.d.ts +17 -0
- package/vendor/core/dist/transport/rateLimiter.d.ts.map +1 -0
- package/vendor/core/dist/transport/rateLimiter.js +30 -0
- package/vendor/core/dist/transport/rateLimiter.js.map +1 -0
- package/vendor/core/dist/transport/scheduler.d.ts +12 -0
- package/vendor/core/dist/transport/scheduler.d.ts.map +1 -0
- package/vendor/core/dist/transport/scheduler.js +11 -0
- package/vendor/core/dist/transport/scheduler.js.map +1 -0
- package/vendor/core/dist/types.d.ts +60 -0
- package/vendor/core/dist/types.d.ts.map +1 -0
- package/vendor/core/dist/types.js +2 -0
- package/vendor/core/dist/types.js.map +1 -0
- package/vendor/core/dist/version.d.ts +3 -0
- package/vendor/core/dist/version.d.ts.map +1 -0
- package/vendor/core/dist/version.js +3 -0
- package/vendor/core/dist/version.js.map +1 -0
- package/vendor/core/package.json +20 -0
- package/vendor/protocol/LICENSE +76 -0
- package/vendor/protocol/README.md +8 -0
- package/vendor/protocol/dist/attributes.d.ts +43 -0
- package/vendor/protocol/dist/attributes.d.ts.map +1 -0
- package/vendor/protocol/dist/attributes.js +15 -0
- package/vendor/protocol/dist/attributes.js.map +1 -0
- package/vendor/protocol/dist/autoData.d.ts +232 -0
- package/vendor/protocol/dist/autoData.d.ts.map +1 -0
- package/vendor/protocol/dist/autoData.js +78 -0
- package/vendor/protocol/dist/autoData.js.map +1 -0
- package/vendor/protocol/dist/events.d.ts +24 -0
- package/vendor/protocol/dist/events.d.ts.map +1 -0
- package/vendor/protocol/dist/events.js +8 -0
- package/vendor/protocol/dist/events.js.map +1 -0
- package/vendor/protocol/dist/flows.d.ts +360 -0
- package/vendor/protocol/dist/flows.d.ts.map +1 -0
- package/vendor/protocol/dist/flows.js +201 -0
- package/vendor/protocol/dist/flows.js.map +1 -0
- package/vendor/protocol/dist/index.d.ts +25 -0
- package/vendor/protocol/dist/index.d.ts.map +1 -0
- package/vendor/protocol/dist/index.js +17 -0
- package/vendor/protocol/dist/index.js.map +1 -0
- package/vendor/protocol/dist/messages.d.ts +187 -0
- package/vendor/protocol/dist/messages.d.ts.map +1 -0
- package/vendor/protocol/dist/messages.js +61 -0
- package/vendor/protocol/dist/messages.js.map +1 -0
- package/vendor/protocol/dist/pairing.d.ts +82 -0
- package/vendor/protocol/dist/pairing.d.ts.map +1 -0
- package/vendor/protocol/dist/pairing.js +146 -0
- package/vendor/protocol/dist/pairing.js.map +1 -0
- package/vendor/protocol/package.json +17 -0
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleSheet, View, type GestureResponderEvent, type ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { pointInRect, TARGET_PRESS_TAP_SLOP } from '../anchors/targetPressMonitor';
|
|
5
|
+
import { ABSOLUTE_FILL } from '../surfaces/absoluteFill';
|
|
6
|
+
import {
|
|
7
|
+
useReportAuthoringBottomHeight,
|
|
8
|
+
useReportPreviewBannerHeight,
|
|
9
|
+
} from '../surfaces/surfaceLayoutInsets';
|
|
10
|
+
import { TooltipCutout } from '../surfaces/tooltip/TooltipCutout';
|
|
11
|
+
|
|
12
|
+
import { capturePickerScreenshot } from './capturePickerScreenshot';
|
|
13
|
+
import { ChromeBarTransition, useChromeBarMounted } from './chrome/ChromeBarTransition';
|
|
14
|
+
import { ChromeBottomSheet } from './chrome/ChromeBottomSheet';
|
|
15
|
+
import { ChromeButton } from './chrome/ChromeButton';
|
|
16
|
+
import { ChromeTooltip } from './chrome/ChromeTooltip';
|
|
17
|
+
import { ChromeTopBar } from './chrome/ChromeTopBar';
|
|
18
|
+
import { chromeColors, chromeOverlay, chromeRadius } from './chrome/tokens';
|
|
19
|
+
import { DOUBLE_TAP_WINDOW_MS, isDoubleTap, type TapSample } from './doubleTap';
|
|
20
|
+
import { elementPickerController, type ElementPickerState } from './elementPickerController';
|
|
21
|
+
import {
|
|
22
|
+
validatePickerFingerprint,
|
|
23
|
+
type PickerFingerprintFailure,
|
|
24
|
+
} from './fingerprintFromInstance';
|
|
25
|
+
import { hitTestAt, nextContainingIndex, type HitCandidate, type HitRect } from './hitTest';
|
|
26
|
+
|
|
27
|
+
function statusForValidationFailure(reason: PickerFingerprintFailure['reason']): string {
|
|
28
|
+
if (reason === 'not-unique' || reason === 'ambiguous-explicit-id') {
|
|
29
|
+
return 'This element is not uniquely identifiable — add a testID or userflowId, or it may match the wrong item at play time.';
|
|
30
|
+
}
|
|
31
|
+
if (reason === 'wrong-instance') {
|
|
32
|
+
return 'That fingerprint matches a different element — pick again or add a testID.';
|
|
33
|
+
}
|
|
34
|
+
return 'Could not uniquely match that element at play time.';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type PickerMode = 'navigate' | 'select';
|
|
38
|
+
type PickerPhase = 'selecting' | 'navigating' | 'selected';
|
|
39
|
+
|
|
40
|
+
const CONFIRM_HELPER = 'Navigate back to the Userflow app after confirming';
|
|
41
|
+
const ONBOARDING_COPY = 'Double tap anywhere to access the menu';
|
|
42
|
+
|
|
43
|
+
/** Yield until chrome has left the native tree so captureScreen cannot include it. */
|
|
44
|
+
function waitForCapturePaint(): Promise<void> {
|
|
45
|
+
return new Promise((resolve) => {
|
|
46
|
+
const raf = globalThis.requestAnimationFrame;
|
|
47
|
+
if (typeof raf === 'function') {
|
|
48
|
+
raf.call(globalThis, () => {
|
|
49
|
+
raf.call(globalThis, () => resolve());
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
setTimeout(resolve, 0);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function ringStyle(rect: HitRect, inset: number): ViewStyle {
|
|
58
|
+
return {
|
|
59
|
+
position: 'absolute',
|
|
60
|
+
left: rect.x - inset,
|
|
61
|
+
top: rect.y - inset,
|
|
62
|
+
width: rect.width + inset * 2,
|
|
63
|
+
height: rect.height + inset * 2,
|
|
64
|
+
borderRadius: chromeRadius.lg,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Overlay chrome for in-app element picking. Mounted by UserflowProvider;
|
|
70
|
+
* renders nothing until {@link elementPickerController.beginSelection}.
|
|
71
|
+
*/
|
|
72
|
+
export function ElementPickerOverlay(): React.ReactElement | null {
|
|
73
|
+
const [state, setState] = React.useState<ElementPickerState>(() =>
|
|
74
|
+
elementPickerController.getState(),
|
|
75
|
+
);
|
|
76
|
+
const [mode, setMode] = React.useState<PickerMode>('select');
|
|
77
|
+
const [candidates, setCandidates] = React.useState<HitCandidate[]>([]);
|
|
78
|
+
const [index, setIndex] = React.useState(0);
|
|
79
|
+
const [busy, setBusy] = React.useState(false);
|
|
80
|
+
const [status, setStatus] = React.useState<string | null>(null);
|
|
81
|
+
const [chromeVisible, setChromeVisible] = React.useState(true);
|
|
82
|
+
const [hidingForCapture, setHidingForCapture] = React.useState(false);
|
|
83
|
+
const [showOnboarding, setShowOnboarding] = React.useState(false);
|
|
84
|
+
const [barHeight, setBarHeight] = React.useState(0);
|
|
85
|
+
const [sheetHeight, setSheetHeight] = React.useState(0);
|
|
86
|
+
const tapStartRef = React.useRef<{ pageX: number; pageY: number } | null>(null);
|
|
87
|
+
const lastTapRef = React.useRef<TapSample | null>(null);
|
|
88
|
+
const tapGenRef = React.useRef(0);
|
|
89
|
+
const applyTimerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
90
|
+
const applyResolveRef = React.useRef<(() => void) | null>(null);
|
|
91
|
+
const modeRef = React.useRef<PickerMode>('select');
|
|
92
|
+
const armedRequestIdRef = React.useRef<string | undefined>(undefined);
|
|
93
|
+
const setBannerHeight = useReportPreviewBannerHeight('picker');
|
|
94
|
+
const setBottomHeight = useReportAuthoringBottomHeight('picker');
|
|
95
|
+
|
|
96
|
+
const cancelPendingSelection = React.useCallback(() => {
|
|
97
|
+
tapGenRef.current += 1;
|
|
98
|
+
if (applyTimerRef.current != null) {
|
|
99
|
+
clearTimeout(applyTimerRef.current);
|
|
100
|
+
applyTimerRef.current = null;
|
|
101
|
+
}
|
|
102
|
+
const resolveWait = applyResolveRef.current;
|
|
103
|
+
applyResolveRef.current = null;
|
|
104
|
+
resolveWait?.();
|
|
105
|
+
setBusy(false);
|
|
106
|
+
}, []);
|
|
107
|
+
|
|
108
|
+
const resetTransient = React.useCallback(
|
|
109
|
+
(options?: { resetCaptureHide?: boolean }) => {
|
|
110
|
+
cancelPendingSelection();
|
|
111
|
+
lastTapRef.current = null;
|
|
112
|
+
setMode('select');
|
|
113
|
+
setCandidates([]);
|
|
114
|
+
setIndex(0);
|
|
115
|
+
setBusy(false);
|
|
116
|
+
setStatus(null);
|
|
117
|
+
setChromeVisible(true);
|
|
118
|
+
setBarHeight(0);
|
|
119
|
+
setSheetHeight(0);
|
|
120
|
+
modeRef.current = 'select';
|
|
121
|
+
if (options?.resetCaptureHide !== false) {
|
|
122
|
+
setHidingForCapture(false);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
[cancelPendingSelection],
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
React.useEffect(() => {
|
|
129
|
+
return elementPickerController.subscribe((next) => {
|
|
130
|
+
setState(next);
|
|
131
|
+
if (!next.active) {
|
|
132
|
+
armedRequestIdRef.current = undefined;
|
|
133
|
+
resetTransient({ resetCaptureHide: false });
|
|
134
|
+
setShowOnboarding(false);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
// Successful confirm leaves hidingForCapture true so chrome does not
|
|
138
|
+
// flash back during teardown. Clear it with the new session's setState
|
|
139
|
+
// so the first paint of this pick has bars.
|
|
140
|
+
if (armedRequestIdRef.current !== next.requestId) {
|
|
141
|
+
setHidingForCapture(false);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}, [resetTransient]);
|
|
145
|
+
|
|
146
|
+
React.useEffect(() => {
|
|
147
|
+
if (!state.active || state.requestId == null) return;
|
|
148
|
+
if (armedRequestIdRef.current === state.requestId) return;
|
|
149
|
+
armedRequestIdRef.current = state.requestId;
|
|
150
|
+
resetTransient();
|
|
151
|
+
setShowOnboarding(true);
|
|
152
|
+
}, [resetTransient, state.active, state.requestId]);
|
|
153
|
+
|
|
154
|
+
React.useEffect(() => {
|
|
155
|
+
return () => {
|
|
156
|
+
cancelPendingSelection();
|
|
157
|
+
};
|
|
158
|
+
}, [cancelPendingSelection]);
|
|
159
|
+
|
|
160
|
+
React.useEffect(() => {
|
|
161
|
+
if (!state.active) {
|
|
162
|
+
setBannerHeight(0);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (hidingForCapture) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (!chromeVisible) {
|
|
169
|
+
setBannerHeight(0);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (barHeight > 0) {
|
|
173
|
+
setBannerHeight(barHeight);
|
|
174
|
+
}
|
|
175
|
+
}, [barHeight, chromeVisible, hidingForCapture, setBannerHeight, state.active]);
|
|
176
|
+
|
|
177
|
+
React.useEffect(() => {
|
|
178
|
+
if (!state.active) {
|
|
179
|
+
setBottomHeight(0);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
if (hidingForCapture) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (!chromeVisible) {
|
|
186
|
+
setBottomHeight(0);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (sheetHeight > 0) {
|
|
190
|
+
setBottomHeight(sheetHeight);
|
|
191
|
+
}
|
|
192
|
+
}, [chromeVisible, hidingForCapture, setBottomHeight, sheetHeight, state.active]);
|
|
193
|
+
|
|
194
|
+
const onMeasureHeight = React.useCallback((height: number) => {
|
|
195
|
+
setBarHeight(Math.max(0, height));
|
|
196
|
+
}, []);
|
|
197
|
+
|
|
198
|
+
const onMeasureSheetHeight = React.useCallback((height: number) => {
|
|
199
|
+
setSheetHeight(Math.max(0, height));
|
|
200
|
+
}, []);
|
|
201
|
+
|
|
202
|
+
const selected = candidates[index] ?? null;
|
|
203
|
+
const phase: PickerPhase = selected ? 'selected' : mode === 'select' ? 'selecting' : 'navigating';
|
|
204
|
+
modeRef.current = mode;
|
|
205
|
+
|
|
206
|
+
// Bars slide/fade in with the picker, out on double-tap hide, and out again
|
|
207
|
+
// on teardown. Keep them mounted through the exit even after the picker goes
|
|
208
|
+
// inactive; the dim, capture, and spotlight below drop immediately instead.
|
|
209
|
+
const chromeBarsVisible = state.active && chromeVisible && !hidingForCapture;
|
|
210
|
+
const chromeBarsMounted = useChromeBarMounted(chromeBarsVisible);
|
|
211
|
+
const showChromeBars = hidingForCapture ? false : chromeBarsMounted;
|
|
212
|
+
|
|
213
|
+
React.useEffect(() => {
|
|
214
|
+
if (phase !== 'selecting') {
|
|
215
|
+
setShowOnboarding(false);
|
|
216
|
+
}
|
|
217
|
+
}, [phase]);
|
|
218
|
+
|
|
219
|
+
const applyHits = React.useCallback((hits: HitCandidate[]) => {
|
|
220
|
+
if (modeRef.current !== 'select') return;
|
|
221
|
+
lastTapRef.current = null;
|
|
222
|
+
setChromeVisible(true);
|
|
223
|
+
if (hits.length === 0) {
|
|
224
|
+
setCandidates([]);
|
|
225
|
+
setIndex(0);
|
|
226
|
+
setStatus('No stamped element under that tap.');
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
setCandidates(hits);
|
|
230
|
+
setIndex(0);
|
|
231
|
+
setStatus(null);
|
|
232
|
+
}, []);
|
|
233
|
+
|
|
234
|
+
const scheduleSelection = React.useCallback(
|
|
235
|
+
(pageX: number, pageY: number) => {
|
|
236
|
+
cancelPendingSelection();
|
|
237
|
+
const gen = tapGenRef.current;
|
|
238
|
+
setBusy(true);
|
|
239
|
+
setStatus(null);
|
|
240
|
+
const hitsPromise = hitTestAt(pageX, pageY);
|
|
241
|
+
const wait = new Promise<void>((resolve) => {
|
|
242
|
+
applyResolveRef.current = resolve;
|
|
243
|
+
applyTimerRef.current = setTimeout(() => {
|
|
244
|
+
applyTimerRef.current = null;
|
|
245
|
+
applyResolveRef.current = null;
|
|
246
|
+
resolve();
|
|
247
|
+
}, DOUBLE_TAP_WINDOW_MS);
|
|
248
|
+
});
|
|
249
|
+
void (async () => {
|
|
250
|
+
try {
|
|
251
|
+
const [hits] = await Promise.all([hitsPromise, wait]);
|
|
252
|
+
if (tapGenRef.current !== gen) return;
|
|
253
|
+
applyHits(hits);
|
|
254
|
+
} finally {
|
|
255
|
+
if (tapGenRef.current === gen) setBusy(false);
|
|
256
|
+
}
|
|
257
|
+
})();
|
|
258
|
+
},
|
|
259
|
+
[applyHits, cancelPendingSelection],
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
const onTap = React.useCallback(
|
|
263
|
+
async (pageX: number, pageY: number) => {
|
|
264
|
+
if (selected && candidates.length > 1 && pointInRect(pageX, pageY, selected.rect)) {
|
|
265
|
+
setIndex((current) => nextContainingIndex(candidates, current));
|
|
266
|
+
setStatus(null);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
setBusy(true);
|
|
270
|
+
setStatus(null);
|
|
271
|
+
try {
|
|
272
|
+
const hits = await hitTestAt(pageX, pageY);
|
|
273
|
+
if (hits.length === 0) {
|
|
274
|
+
setCandidates([]);
|
|
275
|
+
setIndex(0);
|
|
276
|
+
setStatus('No stamped element under that tap.');
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
setCandidates(hits);
|
|
280
|
+
setIndex(0);
|
|
281
|
+
} finally {
|
|
282
|
+
setBusy(false);
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
[candidates, selected],
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
const onGrant = React.useCallback((event: GestureResponderEvent) => {
|
|
289
|
+
const { pageX, pageY } = event.nativeEvent;
|
|
290
|
+
tapStartRef.current = { pageX, pageY };
|
|
291
|
+
}, []);
|
|
292
|
+
|
|
293
|
+
const onRelease = React.useCallback(
|
|
294
|
+
(event: GestureResponderEvent) => {
|
|
295
|
+
const start = tapStartRef.current;
|
|
296
|
+
tapStartRef.current = null;
|
|
297
|
+
if (!start) return;
|
|
298
|
+
const { pageX, pageY } = event.nativeEvent;
|
|
299
|
+
const dx = pageX - start.pageX;
|
|
300
|
+
const dy = pageY - start.pageY;
|
|
301
|
+
if (dx * dx + dy * dy > TARGET_PRESS_TAP_SLOP * TARGET_PRESS_TAP_SLOP) return;
|
|
302
|
+
|
|
303
|
+
const sample: TapSample = { pageX, pageY, timestamp: Date.now() };
|
|
304
|
+
if (!selected && isDoubleTap(lastTapRef.current, sample)) {
|
|
305
|
+
cancelPendingSelection();
|
|
306
|
+
lastTapRef.current = null;
|
|
307
|
+
setShowOnboarding(false);
|
|
308
|
+
setChromeVisible((visible) => !visible);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
lastTapRef.current = sample;
|
|
312
|
+
|
|
313
|
+
if (selected) {
|
|
314
|
+
void onTap(pageX, pageY);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
scheduleSelection(pageX, pageY);
|
|
318
|
+
},
|
|
319
|
+
[cancelPendingSelection, onTap, scheduleSelection, selected],
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
const deselect = React.useCallback(() => {
|
|
323
|
+
setCandidates([]);
|
|
324
|
+
setIndex(0);
|
|
325
|
+
setStatus(null);
|
|
326
|
+
setChromeVisible(true);
|
|
327
|
+
}, []);
|
|
328
|
+
|
|
329
|
+
const confirm = React.useCallback(async () => {
|
|
330
|
+
if (!selected) return;
|
|
331
|
+
const requestId = elementPickerController.getState().requestId;
|
|
332
|
+
if (!requestId) return;
|
|
333
|
+
setBusy(true);
|
|
334
|
+
setStatus(null);
|
|
335
|
+
try {
|
|
336
|
+
const validated = validatePickerFingerprint(selected.instance);
|
|
337
|
+
if (!validated.ok) {
|
|
338
|
+
setStatus(statusForValidationFailure(validated.reason));
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
setHidingForCapture(true);
|
|
342
|
+
await waitForCapturePaint();
|
|
343
|
+
const screenshot = await capturePickerScreenshot(selected.rect);
|
|
344
|
+
const delivered = await elementPickerController.commit(
|
|
345
|
+
{
|
|
346
|
+
instance: selected.instance,
|
|
347
|
+
autoData: validated.autoData,
|
|
348
|
+
text: selected.instance.childText ?? selected.instance.accessibilityLabel ?? null,
|
|
349
|
+
rect: selected.rect,
|
|
350
|
+
...(screenshot ? { screenshot } : {}),
|
|
351
|
+
},
|
|
352
|
+
requestId,
|
|
353
|
+
);
|
|
354
|
+
if (!delivered && elementPickerController.getState().requestId === requestId) {
|
|
355
|
+
setHidingForCapture(false);
|
|
356
|
+
setStatus("Couldn't send to Builder");
|
|
357
|
+
}
|
|
358
|
+
} catch {
|
|
359
|
+
setHidingForCapture(false);
|
|
360
|
+
setStatus('Could not serialize that element.');
|
|
361
|
+
} finally {
|
|
362
|
+
setBusy(false);
|
|
363
|
+
}
|
|
364
|
+
}, [selected]);
|
|
365
|
+
|
|
366
|
+
if (!state.active && !chromeBarsMounted) return null;
|
|
367
|
+
|
|
368
|
+
const barLabel =
|
|
369
|
+
phase === 'selected'
|
|
370
|
+
? 'Confirm selected element'
|
|
371
|
+
: phase === 'selecting'
|
|
372
|
+
? 'Tap an element to select it'
|
|
373
|
+
: 'Navigate screens';
|
|
374
|
+
|
|
375
|
+
const helperText = status ?? (phase === 'selected' ? CONFIRM_HELPER : undefined);
|
|
376
|
+
const tooltipVisible = state.active && showOnboarding && chromeVisible && phase === 'selecting';
|
|
377
|
+
|
|
378
|
+
return (
|
|
379
|
+
<View pointerEvents="box-none" style={styles.root} testID="userflow-element-picker">
|
|
380
|
+
{state.active && phase === 'selecting' ? (
|
|
381
|
+
<View pointerEvents="none" style={styles.dim} testID="userflow-element-picker-dim" />
|
|
382
|
+
) : null}
|
|
383
|
+
|
|
384
|
+
{state.active && selected ? (
|
|
385
|
+
<>
|
|
386
|
+
{/*
|
|
387
|
+
* Painter only. TooltipCutout's band pointerEvents follow the end-user
|
|
388
|
+
* surface-interaction setting; the capture layer above absorbs every
|
|
389
|
+
* touch first so that flag cannot leak into picking.
|
|
390
|
+
*/}
|
|
391
|
+
<TooltipCutout
|
|
392
|
+
backdropColor={chromeOverlay.color}
|
|
393
|
+
backdropOpacity={chromeOverlay.opacity}
|
|
394
|
+
targetBlocked={false}
|
|
395
|
+
targetRect={{
|
|
396
|
+
top: selected.rect.y,
|
|
397
|
+
left: selected.rect.x,
|
|
398
|
+
width: selected.rect.width,
|
|
399
|
+
height: selected.rect.height,
|
|
400
|
+
}}
|
|
401
|
+
/>
|
|
402
|
+
<View
|
|
403
|
+
pointerEvents="none"
|
|
404
|
+
style={[
|
|
405
|
+
ringStyle(selected.rect, 5),
|
|
406
|
+
{ borderWidth: 4, borderColor: chromeColors.focusRing },
|
|
407
|
+
]}
|
|
408
|
+
testID="userflow-element-picker-focus-ring"
|
|
409
|
+
/>
|
|
410
|
+
<View
|
|
411
|
+
pointerEvents="none"
|
|
412
|
+
style={[
|
|
413
|
+
ringStyle(selected.rect, 1),
|
|
414
|
+
{ borderWidth: 1, borderColor: chromeColors.white },
|
|
415
|
+
]}
|
|
416
|
+
testID="userflow-element-picker-focus-ring-inner"
|
|
417
|
+
/>
|
|
418
|
+
</>
|
|
419
|
+
) : null}
|
|
420
|
+
|
|
421
|
+
{state.active && mode === 'select' ? (
|
|
422
|
+
<View
|
|
423
|
+
testID="userflow-element-picker-capture"
|
|
424
|
+
style={styles.capture}
|
|
425
|
+
onStartShouldSetResponder={() => true}
|
|
426
|
+
onResponderGrant={onGrant}
|
|
427
|
+
onResponderRelease={onRelease}
|
|
428
|
+
/>
|
|
429
|
+
) : null}
|
|
430
|
+
|
|
431
|
+
{showChromeBars ? (
|
|
432
|
+
<ChromeBarTransition
|
|
433
|
+
edge="top"
|
|
434
|
+
pointerEvents="box-none"
|
|
435
|
+
style={styles.top}
|
|
436
|
+
visible={chromeBarsVisible}
|
|
437
|
+
>
|
|
438
|
+
<ChromeTopBar label={barLabel} onMeasureHeight={onMeasureHeight} />
|
|
439
|
+
</ChromeBarTransition>
|
|
440
|
+
) : null}
|
|
441
|
+
|
|
442
|
+
{tooltipVisible ? (
|
|
443
|
+
<View pointerEvents="none" style={[styles.tooltip, { top: barHeight }]}>
|
|
444
|
+
<ChromeTooltip
|
|
445
|
+
onDismiss={() => {
|
|
446
|
+
setShowOnboarding(false);
|
|
447
|
+
}}
|
|
448
|
+
>
|
|
449
|
+
{ONBOARDING_COPY}
|
|
450
|
+
</ChromeTooltip>
|
|
451
|
+
</View>
|
|
452
|
+
) : null}
|
|
453
|
+
|
|
454
|
+
{showChromeBars ? (
|
|
455
|
+
<ChromeBarTransition
|
|
456
|
+
edge="bottom"
|
|
457
|
+
pointerEvents="box-none"
|
|
458
|
+
style={styles.bottom}
|
|
459
|
+
visible={chromeBarsVisible}
|
|
460
|
+
>
|
|
461
|
+
<ChromeBottomSheet helperText={helperText} onMeasureHeight={onMeasureSheetHeight}>
|
|
462
|
+
{phase === 'selected' ? (
|
|
463
|
+
<>
|
|
464
|
+
<ChromeButton
|
|
465
|
+
accessibilityLabel="Deselect"
|
|
466
|
+
label="Deselect"
|
|
467
|
+
onPress={deselect}
|
|
468
|
+
testID="userflow-element-picker-deselect"
|
|
469
|
+
variant="secondary"
|
|
470
|
+
/>
|
|
471
|
+
<ChromeButton
|
|
472
|
+
accessibilityLabel="Confirm element"
|
|
473
|
+
disabled={busy}
|
|
474
|
+
label="Confirm element"
|
|
475
|
+
onPress={() => {
|
|
476
|
+
void confirm();
|
|
477
|
+
}}
|
|
478
|
+
testID="userflow-element-picker-confirm"
|
|
479
|
+
/>
|
|
480
|
+
</>
|
|
481
|
+
) : (
|
|
482
|
+
<>
|
|
483
|
+
<ChromeButton
|
|
484
|
+
accessibilityLabel="Cancel element selection"
|
|
485
|
+
label="Cancel"
|
|
486
|
+
onPress={() => elementPickerController.cancel()}
|
|
487
|
+
testID="userflow-element-picker-cancel"
|
|
488
|
+
variant="secondary"
|
|
489
|
+
/>
|
|
490
|
+
{phase === 'selecting' ? (
|
|
491
|
+
<ChromeButton
|
|
492
|
+
accessibilityLabel="Navigate screens"
|
|
493
|
+
label="Navigate screens"
|
|
494
|
+
onPress={() => {
|
|
495
|
+
cancelPendingSelection();
|
|
496
|
+
lastTapRef.current = null;
|
|
497
|
+
setStatus(null);
|
|
498
|
+
setMode('navigate');
|
|
499
|
+
}}
|
|
500
|
+
testID="userflow-element-picker-navigate"
|
|
501
|
+
/>
|
|
502
|
+
) : (
|
|
503
|
+
<ChromeButton
|
|
504
|
+
accessibilityLabel="Select element here"
|
|
505
|
+
label="Select element here"
|
|
506
|
+
onPress={() => {
|
|
507
|
+
setStatus(null);
|
|
508
|
+
setMode('select');
|
|
509
|
+
}}
|
|
510
|
+
testID="userflow-element-picker-select-here"
|
|
511
|
+
/>
|
|
512
|
+
)}
|
|
513
|
+
</>
|
|
514
|
+
)}
|
|
515
|
+
</ChromeBottomSheet>
|
|
516
|
+
</ChromeBarTransition>
|
|
517
|
+
) : null}
|
|
518
|
+
</View>
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
const styles = StyleSheet.create({
|
|
523
|
+
root: {
|
|
524
|
+
...ABSOLUTE_FILL,
|
|
525
|
+
zIndex: 1100,
|
|
526
|
+
},
|
|
527
|
+
dim: {
|
|
528
|
+
...ABSOLUTE_FILL,
|
|
529
|
+
backgroundColor: chromeOverlay.color,
|
|
530
|
+
opacity: chromeOverlay.opacity,
|
|
531
|
+
},
|
|
532
|
+
capture: {
|
|
533
|
+
...ABSOLUTE_FILL,
|
|
534
|
+
},
|
|
535
|
+
top: {
|
|
536
|
+
position: 'absolute',
|
|
537
|
+
top: 0,
|
|
538
|
+
left: 0,
|
|
539
|
+
right: 0,
|
|
540
|
+
},
|
|
541
|
+
tooltip: {
|
|
542
|
+
position: 'absolute',
|
|
543
|
+
left: 0,
|
|
544
|
+
right: 0,
|
|
545
|
+
alignItems: 'center',
|
|
546
|
+
},
|
|
547
|
+
bottom: {
|
|
548
|
+
position: 'absolute',
|
|
549
|
+
bottom: 0,
|
|
550
|
+
left: 0,
|
|
551
|
+
right: 0,
|
|
552
|
+
},
|
|
553
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Dimensions } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type { ElementPickerScreenshot } from './elementPickerController';
|
|
4
|
+
import type { HitRect } from './hitTest';
|
|
5
|
+
|
|
6
|
+
const MAX_CAPTURE_WIDTH = 480;
|
|
7
|
+
|
|
8
|
+
const MISSING_VIEW_SHOT_WARNING =
|
|
9
|
+
'[Userflow] Required peer react-native-view-shot is not installed; ' +
|
|
10
|
+
'skipping picker screenshot. Install react-native-view-shot (>=5.0.0) and rebuild native.';
|
|
11
|
+
|
|
12
|
+
interface ViewShotModule {
|
|
13
|
+
captureScreen: (options: {
|
|
14
|
+
format?: 'jpg' | 'png';
|
|
15
|
+
quality?: number;
|
|
16
|
+
result?: 'tmpfile' | 'base64' | 'data-uri';
|
|
17
|
+
width?: number;
|
|
18
|
+
height?: number;
|
|
19
|
+
}) => Promise<string>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let didWarnMissingViewShot = false;
|
|
23
|
+
|
|
24
|
+
function warnMissingViewShot(): void {
|
|
25
|
+
if (didWarnMissingViewShot) return;
|
|
26
|
+
didWarnMissingViewShot = true;
|
|
27
|
+
if (__DEV__) {
|
|
28
|
+
// eslint-disable-next-line no-console -- intentional missing-required-peer diagnostic
|
|
29
|
+
console.warn(MISSING_VIEW_SHOT_WARNING);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function loadViewShot(): ViewShotModule | null {
|
|
34
|
+
try {
|
|
35
|
+
// Required peer; degrade if unlinked or the JS package is missing.
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
|
|
37
|
+
return require('react-native-view-shot') as ViewShotModule;
|
|
38
|
+
} catch {
|
|
39
|
+
warnMissingViewShot();
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Capture a downscaled JPEG of the current screen and map `rect` (window DIP)
|
|
46
|
+
* onto the captured pixel grid. Returns null when the native module is missing
|
|
47
|
+
* or capture fails.
|
|
48
|
+
*/
|
|
49
|
+
export async function capturePickerScreenshot(
|
|
50
|
+
rect: HitRect,
|
|
51
|
+
): Promise<ElementPickerScreenshot | null> {
|
|
52
|
+
const viewShot = loadViewShot();
|
|
53
|
+
if (!viewShot?.captureScreen) return null;
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
const window = Dimensions.get('window');
|
|
57
|
+
const winW = window.width || 1;
|
|
58
|
+
const winH = window.height || 1;
|
|
59
|
+
const captureWidth = Math.min(Math.round(winW), MAX_CAPTURE_WIDTH);
|
|
60
|
+
const captureHeight = Math.max(1, Math.round(winH * (captureWidth / winW)));
|
|
61
|
+
|
|
62
|
+
const dataUrl = await viewShot.captureScreen({
|
|
63
|
+
format: 'jpg',
|
|
64
|
+
quality: 0.55,
|
|
65
|
+
result: 'data-uri',
|
|
66
|
+
width: captureWidth,
|
|
67
|
+
height: captureHeight,
|
|
68
|
+
});
|
|
69
|
+
if (typeof dataUrl !== 'string' || dataUrl.length === 0) return null;
|
|
70
|
+
|
|
71
|
+
const sx = captureWidth / winW;
|
|
72
|
+
const sy = captureHeight / winH;
|
|
73
|
+
return {
|
|
74
|
+
dataUrl,
|
|
75
|
+
width: captureWidth,
|
|
76
|
+
height: captureHeight,
|
|
77
|
+
targetX1: Math.round(rect.x * sx),
|
|
78
|
+
targetY1: Math.round(rect.y * sy),
|
|
79
|
+
targetX2: Math.round((rect.x + rect.width) * sx),
|
|
80
|
+
targetY2: Math.round((rect.y + rect.height) * sy),
|
|
81
|
+
};
|
|
82
|
+
} catch {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** @internal */
|
|
88
|
+
export function resetViewShotWarningForTests(): void {
|
|
89
|
+
didWarnMissingViewShot = false;
|
|
90
|
+
}
|