@userflow-tech/react-native 0.4.5 → 0.6.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 +31 -2
- package/docs/anchoring.md +6 -1
- package/docs/custom-fonts.md +36 -0
- package/docs/troubleshooting.md +33 -6
- package/lib/commonjs/anchors/AutoAnchorRegistry.js +144 -34
- package/lib/commonjs/anchors/AutoAnchorRegistry.js.map +1 -1
- package/lib/commonjs/anchors/animationFrame.js +29 -1
- package/lib/commonjs/anchors/animationFrame.js.map +1 -1
- package/lib/commonjs/anchors/appActive.js +61 -0
- package/lib/commonjs/anchors/appActive.js.map +1 -0
- package/lib/commonjs/anchors/elementConditionEvaluator.js +25 -8
- package/lib/commonjs/anchors/elementConditionEvaluator.js.map +1 -1
- package/lib/commonjs/anchors/elementTapMonitor.js +67 -12
- package/lib/commonjs/anchors/elementTapMonitor.js.map +1 -1
- package/lib/commonjs/anchors/elementTargetMatch.js +33 -7
- package/lib/commonjs/anchors/elementTargetMatch.js.map +1 -1
- package/lib/commonjs/anchors/fiber/FiberScanRootStore.js +8 -0
- package/lib/commonjs/anchors/fiber/FiberScanRootStore.js.map +1 -1
- package/lib/commonjs/anchors/fiber/detectAppFontFamily.js +341 -0
- package/lib/commonjs/anchors/fiber/detectAppFontFamily.js.map +1 -0
- package/lib/commonjs/anchors/fiber/fiberInternals.js +66 -0
- package/lib/commonjs/anchors/fiber/fiberInternals.js.map +1 -1
- package/lib/commonjs/anchors/fiber/indexHostFibers.js +4 -3
- package/lib/commonjs/anchors/fiber/indexHostFibers.js.map +1 -1
- package/lib/commonjs/anchors/fiber/resolveFiberPath.js +30 -15
- package/lib/commonjs/anchors/fiber/resolveFiberPath.js.map +1 -1
- package/lib/commonjs/anchors/fiber/visibleScreens.js +6 -0
- package/lib/commonjs/anchors/fiber/visibleScreens.js.map +1 -1
- package/lib/commonjs/anchors/fiberAnchorCache.js +20 -0
- package/lib/commonjs/anchors/fiberAnchorCache.js.map +1 -1
- package/lib/commonjs/anchors/gestureHandlerHandoff.js +304 -0
- package/lib/commonjs/anchors/gestureHandlerHandoff.js.map +1 -0
- package/lib/commonjs/anchors/resolveAnchorHost.js +6 -0
- package/lib/commonjs/anchors/resolveAnchorHost.js.map +1 -1
- package/lib/commonjs/anchors/resolveAutoAnchorHost.js +11 -6
- package/lib/commonjs/anchors/resolveAutoAnchorHost.js.map +1 -1
- package/lib/commonjs/anchors/resolveElementTargets.js +63 -8
- package/lib/commonjs/anchors/resolveElementTargets.js.map +1 -1
- package/lib/commonjs/anchors/semanticMatcher.js +43 -21
- package/lib/commonjs/anchors/semanticMatcher.js.map +1 -1
- package/lib/commonjs/anchors/tapSlop.js +16 -0
- package/lib/commonjs/anchors/tapSlop.js.map +1 -0
- package/lib/commonjs/anchors/targetPressMonitor.js +66 -12
- package/lib/commonjs/anchors/targetPressMonitor.js.map +1 -1
- package/lib/commonjs/authoring/fingerprintFromInstance.js +5 -9
- package/lib/commonjs/authoring/fingerprintFromInstance.js.map +1 -1
- package/lib/commonjs/content/BannerStepButton.js +2 -1
- package/lib/commonjs/content/BannerStepButton.js.map +1 -1
- package/lib/commonjs/content/RichContentRenderer.js +20 -14
- package/lib/commonjs/content/RichContentRenderer.js.map +1 -1
- package/lib/commonjs/content/StepButton.js +2 -1
- package/lib/commonjs/content/StepButton.js.map +1 -1
- package/lib/commonjs/content/openSafeUrl.js +3 -1
- package/lib/commonjs/content/openSafeUrl.js.map +1 -1
- package/lib/commonjs/content/resolveContentFontFamily.js +96 -0
- package/lib/commonjs/content/resolveContentFontFamily.js.map +1 -0
- package/lib/commonjs/expo-router/useUserflowExpoRouter.js +6 -0
- package/lib/commonjs/expo-router/useUserflowExpoRouter.js.map +1 -1
- package/lib/commonjs/index.js +21 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigation/navigateUrlUtils.js +105 -0
- package/lib/commonjs/navigation/navigateUrlUtils.js.map +1 -0
- package/lib/commonjs/navigation/openExternalNavigateUrl.js +14 -0
- package/lib/commonjs/navigation/openExternalNavigateUrl.js.map +1 -0
- package/lib/commonjs/navigation/openFlowNavigateUrl.js +47 -41
- package/lib/commonjs/navigation/openFlowNavigateUrl.js.map +1 -1
- package/lib/commonjs/pairing/PairingController.js +3 -1
- package/lib/commonjs/pairing/PairingController.js.map +1 -1
- package/lib/commonjs/runtime/BannerHost.js +38 -29
- package/lib/commonjs/runtime/BannerHost.js.map +1 -1
- package/lib/commonjs/runtime/TargetPressBridge.js +55 -7
- package/lib/commonjs/runtime/TargetPressBridge.js.map +1 -1
- package/lib/commonjs/runtime/UserflowOverlay.js +5 -11
- package/lib/commonjs/runtime/UserflowOverlay.js.map +1 -1
- package/lib/commonjs/runtime/UserflowProvider.js +66 -40
- package/lib/commonjs/runtime/UserflowProvider.js.map +1 -1
- package/lib/commonjs/runtime/bannerEngine.js +8 -2
- package/lib/commonjs/runtime/bannerEngine.js.map +1 -1
- package/lib/commonjs/runtime/bannerFlowSpacer.js +71 -0
- package/lib/commonjs/runtime/bannerFlowSpacer.js.map +1 -0
- package/lib/commonjs/runtime/flowEngine.js +11 -0
- package/lib/commonjs/runtime/flowEngine.js.map +1 -1
- package/lib/commonjs/runtime/previewStart.js +39 -0
- package/lib/commonjs/runtime/previewStart.js.map +1 -0
- package/lib/commonjs/runtime/pushBannerLayoutContext.js +101 -0
- package/lib/commonjs/runtime/pushBannerLayoutContext.js.map +1 -0
- package/lib/commonjs/screenTracker.js +12 -0
- package/lib/commonjs/screenTracker.js.map +1 -1
- package/lib/commonjs/surfaces/BannerBar.js +79 -61
- package/lib/commonjs/surfaces/BannerBar.js.map +1 -1
- package/lib/commonjs/surfaces/BannerSurface.js +28 -6
- package/lib/commonjs/surfaces/BannerSurface.js.map +1 -1
- package/lib/commonjs/surfaces/ProgressBar.js +2 -1
- package/lib/commonjs/surfaces/ProgressBar.js.map +1 -1
- package/lib/commonjs/surfaces/TooltipSurface.js +48 -41
- package/lib/commonjs/surfaces/TooltipSurface.js.map +1 -1
- package/lib/commonjs/surfaces/bannerBarLayout.js +77 -10
- package/lib/commonjs/surfaces/bannerBarLayout.js.map +1 -1
- package/lib/commonjs/surfaces/bannerWebView/BannerWebViewBar.js +114 -63
- package/lib/commonjs/surfaces/bannerWebView/BannerWebViewBar.js.map +1 -1
- package/lib/commonjs/surfaces/bannerWebView/bannerNeedsWebView.js +3 -33
- package/lib/commonjs/surfaces/bannerWebView/bannerNeedsWebView.js.map +1 -1
- package/lib/commonjs/surfaces/bannerWebView/bannerThemeStyles.js +2 -1
- package/lib/commonjs/surfaces/bannerWebView/bannerThemeStyles.js.map +1 -1
- package/lib/commonjs/surfaces/bannerWebView/bannerWebViewHeight.js +33 -0
- package/lib/commonjs/surfaces/bannerWebView/bannerWebViewHeight.js.map +1 -0
- package/lib/commonjs/surfaces/bannerWebView/buildCustomBannerHtml.js +104 -23
- package/lib/commonjs/surfaces/bannerWebView/buildCustomBannerHtml.js.map +1 -1
- package/lib/commonjs/surfaces/hostAccessibilityTrap.js +28 -0
- package/lib/commonjs/surfaces/hostAccessibilityTrap.js.map +1 -0
- package/lib/commonjs/surfaces/resolveBannerTheme.js +6 -3
- package/lib/commonjs/surfaces/resolveBannerTheme.js.map +1 -1
- package/lib/commonjs/surfaces/tooltip/TooltipBubble.js +3 -2
- package/lib/commonjs/surfaces/tooltip/TooltipBubble.js.map +1 -1
- package/lib/commonjs/surfaces/tooltip/targetSearchSchedule.js +134 -0
- package/lib/commonjs/surfaces/tooltip/targetSearchSchedule.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/module/anchors/AutoAnchorRegistry.js +145 -35
- package/lib/module/anchors/AutoAnchorRegistry.js.map +1 -1
- package/lib/module/anchors/animationFrame.js +29 -2
- package/lib/module/anchors/animationFrame.js.map +1 -1
- package/lib/module/anchors/appActive.js +57 -0
- package/lib/module/anchors/appActive.js.map +1 -0
- package/lib/module/anchors/elementConditionEvaluator.js +26 -9
- package/lib/module/anchors/elementConditionEvaluator.js.map +1 -1
- package/lib/module/anchors/elementTapMonitor.js +67 -12
- package/lib/module/anchors/elementTapMonitor.js.map +1 -1
- package/lib/module/anchors/elementTargetMatch.js +32 -7
- package/lib/module/anchors/elementTargetMatch.js.map +1 -1
- package/lib/module/anchors/fiber/FiberScanRootStore.js +8 -0
- package/lib/module/anchors/fiber/FiberScanRootStore.js.map +1 -1
- package/lib/module/anchors/fiber/detectAppFontFamily.js +330 -0
- package/lib/module/anchors/fiber/detectAppFontFamily.js.map +1 -0
- package/lib/module/anchors/fiber/fiberInternals.js +65 -0
- package/lib/module/anchors/fiber/fiberInternals.js.map +1 -1
- package/lib/module/anchors/fiber/indexHostFibers.js +4 -3
- package/lib/module/anchors/fiber/indexHostFibers.js.map +1 -1
- package/lib/module/anchors/fiber/resolveFiberPath.js +30 -15
- package/lib/module/anchors/fiber/resolveFiberPath.js.map +1 -1
- package/lib/module/anchors/fiber/visibleScreens.js +5 -0
- package/lib/module/anchors/fiber/visibleScreens.js.map +1 -1
- package/lib/module/anchors/fiberAnchorCache.js +19 -0
- package/lib/module/anchors/fiberAnchorCache.js.map +1 -1
- package/lib/module/anchors/gestureHandlerHandoff.js +298 -0
- package/lib/module/anchors/gestureHandlerHandoff.js.map +1 -0
- package/lib/module/anchors/resolveAnchorHost.js +1 -0
- package/lib/module/anchors/resolveAnchorHost.js.map +1 -1
- package/lib/module/anchors/resolveAutoAnchorHost.js +11 -6
- package/lib/module/anchors/resolveAutoAnchorHost.js.map +1 -1
- package/lib/module/anchors/resolveElementTargets.js +63 -8
- package/lib/module/anchors/resolveElementTargets.js.map +1 -1
- package/lib/module/anchors/semanticMatcher.js +43 -21
- package/lib/module/anchors/semanticMatcher.js.map +1 -1
- package/lib/module/anchors/tapSlop.js +11 -0
- package/lib/module/anchors/tapSlop.js.map +1 -0
- package/lib/module/anchors/targetPressMonitor.js +53 -8
- package/lib/module/anchors/targetPressMonitor.js.map +1 -1
- package/lib/module/authoring/fingerprintFromInstance.js +6 -10
- package/lib/module/authoring/fingerprintFromInstance.js.map +1 -1
- package/lib/module/content/BannerStepButton.js +2 -1
- package/lib/module/content/BannerStepButton.js.map +1 -1
- package/lib/module/content/RichContentRenderer.js +20 -14
- package/lib/module/content/RichContentRenderer.js.map +1 -1
- package/lib/module/content/StepButton.js +2 -1
- package/lib/module/content/StepButton.js.map +1 -1
- package/lib/module/content/openSafeUrl.js +3 -1
- package/lib/module/content/openSafeUrl.js.map +1 -1
- package/lib/module/content/resolveContentFontFamily.js +89 -0
- package/lib/module/content/resolveContentFontFamily.js.map +1 -0
- package/lib/module/expo-router/useUserflowExpoRouter.js +7 -1
- package/lib/module/expo-router/useUserflowExpoRouter.js.map +1 -1
- package/lib/module/index.js +24 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigation/navigateUrlUtils.js +94 -0
- package/lib/module/navigation/navigateUrlUtils.js.map +1 -0
- package/lib/module/navigation/openExternalNavigateUrl.js +11 -0
- package/lib/module/navigation/openExternalNavigateUrl.js.map +1 -0
- package/lib/module/navigation/openFlowNavigateUrl.js +22 -36
- package/lib/module/navigation/openFlowNavigateUrl.js.map +1 -1
- package/lib/module/pairing/PairingController.js +3 -1
- package/lib/module/pairing/PairingController.js.map +1 -1
- package/lib/module/runtime/BannerHost.js +38 -29
- package/lib/module/runtime/BannerHost.js.map +1 -1
- package/lib/module/runtime/TargetPressBridge.js +56 -8
- package/lib/module/runtime/TargetPressBridge.js.map +1 -1
- package/lib/module/runtime/UserflowOverlay.js +5 -11
- package/lib/module/runtime/UserflowOverlay.js.map +1 -1
- package/lib/module/runtime/UserflowProvider.js +66 -40
- package/lib/module/runtime/UserflowProvider.js.map +1 -1
- package/lib/module/runtime/bannerEngine.js +7 -2
- package/lib/module/runtime/bannerEngine.js.map +1 -1
- package/lib/module/runtime/bannerFlowSpacer.js +65 -0
- package/lib/module/runtime/bannerFlowSpacer.js.map +1 -0
- package/lib/module/runtime/flowEngine.js +11 -0
- package/lib/module/runtime/flowEngine.js.map +1 -1
- package/lib/module/runtime/previewStart.js +35 -0
- package/lib/module/runtime/previewStart.js.map +1 -0
- package/lib/module/runtime/pushBannerLayoutContext.js +94 -0
- package/lib/module/runtime/pushBannerLayoutContext.js.map +1 -0
- package/lib/module/screenTracker.js +11 -0
- package/lib/module/screenTracker.js.map +1 -1
- package/lib/module/surfaces/BannerBar.js +80 -62
- package/lib/module/surfaces/BannerBar.js.map +1 -1
- package/lib/module/surfaces/BannerSurface.js +28 -6
- package/lib/module/surfaces/BannerSurface.js.map +1 -1
- package/lib/module/surfaces/ProgressBar.js +2 -1
- package/lib/module/surfaces/ProgressBar.js.map +1 -1
- package/lib/module/surfaces/TooltipSurface.js +49 -42
- package/lib/module/surfaces/TooltipSurface.js.map +1 -1
- package/lib/module/surfaces/bannerBarLayout.js +72 -11
- package/lib/module/surfaces/bannerBarLayout.js.map +1 -1
- package/lib/module/surfaces/bannerWebView/BannerWebViewBar.js +115 -64
- package/lib/module/surfaces/bannerWebView/BannerWebViewBar.js.map +1 -1
- package/lib/module/surfaces/bannerWebView/bannerNeedsWebView.js +3 -31
- package/lib/module/surfaces/bannerWebView/bannerNeedsWebView.js.map +1 -1
- package/lib/module/surfaces/bannerWebView/bannerThemeStyles.js +2 -1
- package/lib/module/surfaces/bannerWebView/bannerThemeStyles.js.map +1 -1
- package/lib/module/surfaces/bannerWebView/bannerWebViewHeight.js +29 -0
- package/lib/module/surfaces/bannerWebView/bannerWebViewHeight.js.map +1 -0
- package/lib/module/surfaces/bannerWebView/buildCustomBannerHtml.js +104 -23
- package/lib/module/surfaces/bannerWebView/buildCustomBannerHtml.js.map +1 -1
- package/lib/module/surfaces/hostAccessibilityTrap.js +24 -0
- package/lib/module/surfaces/hostAccessibilityTrap.js.map +1 -0
- package/lib/module/surfaces/resolveBannerTheme.js +6 -3
- package/lib/module/surfaces/resolveBannerTheme.js.map +1 -1
- package/lib/module/surfaces/tooltip/TooltipBubble.js +3 -2
- package/lib/module/surfaces/tooltip/TooltipBubble.js.map +1 -1
- package/lib/module/surfaces/tooltip/targetSearchSchedule.js +128 -0
- package/lib/module/surfaces/tooltip/targetSearchSchedule.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/src/anchors/AutoAnchorRegistry.d.ts +36 -2
- package/lib/typescript/commonjs/src/anchors/AutoAnchorRegistry.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/animationFrame.d.ts +0 -4
- package/lib/typescript/commonjs/src/anchors/animationFrame.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/appActive.d.ts +8 -0
- package/lib/typescript/commonjs/src/anchors/appActive.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/elementTapMonitor.d.ts +17 -0
- package/lib/typescript/commonjs/src/anchors/elementTapMonitor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/elementTargetMatch.d.ts +7 -0
- package/lib/typescript/commonjs/src/anchors/elementTargetMatch.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/fiber/FiberScanRootStore.d.ts +5 -0
- package/lib/typescript/commonjs/src/anchors/fiber/FiberScanRootStore.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/fiber/detectAppFontFamily.d.ts +30 -0
- package/lib/typescript/commonjs/src/anchors/fiber/detectAppFontFamily.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/fiber/fiberInternals.d.ts +7 -0
- package/lib/typescript/commonjs/src/anchors/fiber/fiberInternals.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/fiber/indexHostFibers.d.ts +3 -2
- package/lib/typescript/commonjs/src/anchors/fiber/indexHostFibers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/fiber/resolveFiberPath.d.ts +3 -0
- package/lib/typescript/commonjs/src/anchors/fiber/resolveFiberPath.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/fiber/visibleScreens.d.ts +2 -0
- package/lib/typescript/commonjs/src/anchors/fiber/visibleScreens.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/fiberAnchorCache.d.ts +5 -0
- package/lib/typescript/commonjs/src/anchors/fiberAnchorCache.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/gestureHandlerHandoff.d.ts +70 -0
- package/lib/typescript/commonjs/src/anchors/gestureHandlerHandoff.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/resolveAnchorHost.d.ts +1 -0
- package/lib/typescript/commonjs/src/anchors/resolveAnchorHost.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/resolveAutoAnchorHost.d.ts +11 -4
- package/lib/typescript/commonjs/src/anchors/resolveAutoAnchorHost.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/resolveElementTargets.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/semanticMatcher.d.ts +2 -0
- package/lib/typescript/commonjs/src/anchors/semanticMatcher.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/anchors/tapSlop.d.ts +9 -0
- package/lib/typescript/commonjs/src/anchors/tapSlop.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/anchors/targetPressMonitor.d.ts +13 -8
- package/lib/typescript/commonjs/src/anchors/targetPressMonitor.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/authoring/fingerprintFromInstance.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/content/BannerStepButton.d.ts.map +1 -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/openSafeUrl.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/content/resolveContentFontFamily.d.ts +35 -0
- package/lib/typescript/commonjs/src/content/resolveContentFontFamily.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-router/useUserflowExpoRouter.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +6 -5
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/navigation/navigateUrlUtils.d.ts +15 -0
- package/lib/typescript/commonjs/src/navigation/navigateUrlUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/navigation/openExternalNavigateUrl.d.ts +3 -0
- package/lib/typescript/commonjs/src/navigation/openExternalNavigateUrl.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/navigation/openFlowNavigateUrl.d.ts +2 -5
- package/lib/typescript/commonjs/src/navigation/openFlowNavigateUrl.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/pairing/PairingController.d.ts +6 -0
- package/lib/typescript/commonjs/src/pairing/PairingController.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/BannerHost.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/TargetPressBridge.d.ts +3 -0
- package/lib/typescript/commonjs/src/runtime/TargetPressBridge.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/UserflowOverlay.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/UserflowProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/bannerEngine.d.ts +5 -1
- package/lib/typescript/commonjs/src/runtime/bannerEngine.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/bannerFlowSpacer.d.ts +15 -0
- package/lib/typescript/commonjs/src/runtime/bannerFlowSpacer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/flowEngine.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/runtime/previewStart.d.ts +13 -0
- package/lib/typescript/commonjs/src/runtime/previewStart.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/runtime/pushBannerLayoutContext.d.ts +22 -0
- package/lib/typescript/commonjs/src/runtime/pushBannerLayoutContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/screenTracker.d.ts +6 -0
- package/lib/typescript/commonjs/src/screenTracker.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/BannerBar.d.ts +3 -1
- package/lib/typescript/commonjs/src/surfaces/BannerBar.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/BannerSurface.d.ts +6 -5
- package/lib/typescript/commonjs/src/surfaces/BannerSurface.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/ProgressBar.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/TooltipSurface.d.ts +1 -1
- package/lib/typescript/commonjs/src/surfaces/TooltipSurface.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/bannerBarLayout.d.ts +17 -0
- package/lib/typescript/commonjs/src/surfaces/bannerBarLayout.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/BannerWebViewBar.d.ts +3 -1
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/BannerWebViewBar.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerNeedsWebView.d.ts +3 -12
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerNeedsWebView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerThemeStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerWebViewHeight.d.ts +13 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/bannerWebViewHeight.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/bannerWebView/buildCustomBannerHtml.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/hostAccessibilityTrap.d.ts +14 -0
- package/lib/typescript/commonjs/src/surfaces/hostAccessibilityTrap.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/surfaces/resolveBannerTheme.d.ts +4 -1
- package/lib/typescript/commonjs/src/surfaces/resolveBannerTheme.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipBubble.d.ts +7 -1
- package/lib/typescript/commonjs/src/surfaces/tooltip/TooltipBubble.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/tooltip/targetSearchSchedule.d.ts +60 -0
- package/lib/typescript/commonjs/src/surfaces/tooltip/targetSearchSchedule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/version.d.ts +1 -1
- package/lib/typescript/module/src/anchors/AutoAnchorRegistry.d.ts +36 -2
- package/lib/typescript/module/src/anchors/AutoAnchorRegistry.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/animationFrame.d.ts +0 -4
- package/lib/typescript/module/src/anchors/animationFrame.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/appActive.d.ts +8 -0
- package/lib/typescript/module/src/anchors/appActive.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/elementTapMonitor.d.ts +17 -0
- package/lib/typescript/module/src/anchors/elementTapMonitor.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/elementTargetMatch.d.ts +7 -0
- package/lib/typescript/module/src/anchors/elementTargetMatch.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/fiber/FiberScanRootStore.d.ts +5 -0
- package/lib/typescript/module/src/anchors/fiber/FiberScanRootStore.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/fiber/detectAppFontFamily.d.ts +30 -0
- package/lib/typescript/module/src/anchors/fiber/detectAppFontFamily.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/fiber/fiberInternals.d.ts +7 -0
- package/lib/typescript/module/src/anchors/fiber/fiberInternals.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/fiber/indexHostFibers.d.ts +3 -2
- package/lib/typescript/module/src/anchors/fiber/indexHostFibers.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/fiber/resolveFiberPath.d.ts +3 -0
- package/lib/typescript/module/src/anchors/fiber/resolveFiberPath.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/fiber/visibleScreens.d.ts +2 -0
- package/lib/typescript/module/src/anchors/fiber/visibleScreens.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/fiberAnchorCache.d.ts +5 -0
- package/lib/typescript/module/src/anchors/fiberAnchorCache.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/gestureHandlerHandoff.d.ts +70 -0
- package/lib/typescript/module/src/anchors/gestureHandlerHandoff.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/resolveAnchorHost.d.ts +1 -0
- package/lib/typescript/module/src/anchors/resolveAnchorHost.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/resolveAutoAnchorHost.d.ts +11 -4
- package/lib/typescript/module/src/anchors/resolveAutoAnchorHost.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/resolveElementTargets.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/semanticMatcher.d.ts +2 -0
- package/lib/typescript/module/src/anchors/semanticMatcher.d.ts.map +1 -1
- package/lib/typescript/module/src/anchors/tapSlop.d.ts +9 -0
- package/lib/typescript/module/src/anchors/tapSlop.d.ts.map +1 -0
- package/lib/typescript/module/src/anchors/targetPressMonitor.d.ts +13 -8
- package/lib/typescript/module/src/anchors/targetPressMonitor.d.ts.map +1 -1
- package/lib/typescript/module/src/authoring/fingerprintFromInstance.d.ts.map +1 -1
- package/lib/typescript/module/src/content/BannerStepButton.d.ts.map +1 -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/openSafeUrl.d.ts.map +1 -1
- package/lib/typescript/module/src/content/resolveContentFontFamily.d.ts +35 -0
- package/lib/typescript/module/src/content/resolveContentFontFamily.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-router/useUserflowExpoRouter.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +6 -5
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/navigation/navigateUrlUtils.d.ts +15 -0
- package/lib/typescript/module/src/navigation/navigateUrlUtils.d.ts.map +1 -0
- package/lib/typescript/module/src/navigation/openExternalNavigateUrl.d.ts +3 -0
- package/lib/typescript/module/src/navigation/openExternalNavigateUrl.d.ts.map +1 -0
- package/lib/typescript/module/src/navigation/openFlowNavigateUrl.d.ts +2 -5
- package/lib/typescript/module/src/navigation/openFlowNavigateUrl.d.ts.map +1 -1
- package/lib/typescript/module/src/pairing/PairingController.d.ts +6 -0
- package/lib/typescript/module/src/pairing/PairingController.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/BannerHost.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/TargetPressBridge.d.ts +3 -0
- package/lib/typescript/module/src/runtime/TargetPressBridge.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/UserflowOverlay.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/UserflowProvider.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/bannerEngine.d.ts +5 -1
- package/lib/typescript/module/src/runtime/bannerEngine.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/bannerFlowSpacer.d.ts +15 -0
- package/lib/typescript/module/src/runtime/bannerFlowSpacer.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/flowEngine.d.ts.map +1 -1
- package/lib/typescript/module/src/runtime/previewStart.d.ts +13 -0
- package/lib/typescript/module/src/runtime/previewStart.d.ts.map +1 -0
- package/lib/typescript/module/src/runtime/pushBannerLayoutContext.d.ts +22 -0
- package/lib/typescript/module/src/runtime/pushBannerLayoutContext.d.ts.map +1 -0
- package/lib/typescript/module/src/screenTracker.d.ts +6 -0
- package/lib/typescript/module/src/screenTracker.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/BannerBar.d.ts +3 -1
- package/lib/typescript/module/src/surfaces/BannerBar.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/BannerSurface.d.ts +6 -5
- package/lib/typescript/module/src/surfaces/BannerSurface.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/ProgressBar.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/TooltipSurface.d.ts +1 -1
- package/lib/typescript/module/src/surfaces/TooltipSurface.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/bannerBarLayout.d.ts +17 -0
- package/lib/typescript/module/src/surfaces/bannerBarLayout.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/bannerWebView/BannerWebViewBar.d.ts +3 -1
- package/lib/typescript/module/src/surfaces/bannerWebView/BannerWebViewBar.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerNeedsWebView.d.ts +3 -12
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerNeedsWebView.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerThemeStyles.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerWebViewHeight.d.ts +13 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/bannerWebViewHeight.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/bannerWebView/buildCustomBannerHtml.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/hostAccessibilityTrap.d.ts +14 -0
- package/lib/typescript/module/src/surfaces/hostAccessibilityTrap.d.ts.map +1 -0
- package/lib/typescript/module/src/surfaces/resolveBannerTheme.d.ts +4 -1
- package/lib/typescript/module/src/surfaces/resolveBannerTheme.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/tooltip/TooltipBubble.d.ts +7 -1
- package/lib/typescript/module/src/surfaces/tooltip/TooltipBubble.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/tooltip/targetSearchSchedule.d.ts +60 -0
- package/lib/typescript/module/src/surfaces/tooltip/targetSearchSchedule.d.ts.map +1 -0
- package/lib/typescript/module/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/anchors/AutoAnchorRegistry.ts +166 -35
- package/src/anchors/animationFrame.ts +31 -1
- package/src/anchors/appActive.ts +63 -0
- package/src/anchors/elementConditionEvaluator.ts +29 -12
- package/src/anchors/elementTapMonitor.ts +68 -10
- package/src/anchors/elementTargetMatch.ts +34 -7
- package/src/anchors/fiber/FiberScanRootStore.ts +8 -0
- package/src/anchors/fiber/detectAppFontFamily.ts +400 -0
- package/src/anchors/fiber/fiberInternals.ts +68 -0
- package/src/anchors/fiber/indexHostFibers.ts +8 -3
- package/src/anchors/fiber/resolveFiberPath.ts +25 -16
- package/src/anchors/fiber/visibleScreens.ts +5 -0
- package/src/anchors/fiberAnchorCache.ts +19 -0
- package/src/anchors/gestureHandlerHandoff.ts +356 -0
- package/src/anchors/resolveAnchorHost.ts +2 -0
- package/src/anchors/resolveAutoAnchorHost.ts +18 -8
- package/src/anchors/resolveElementTargets.ts +64 -7
- package/src/anchors/semanticMatcher.ts +48 -27
- package/src/anchors/tapSlop.ts +18 -0
- package/src/anchors/targetPressMonitor.ts +56 -19
- package/src/authoring/fingerprintFromInstance.ts +4 -5
- package/src/content/BannerStepButton.tsx +2 -1
- package/src/content/RichContentRenderer.tsx +19 -13
- package/src/content/StepButton.tsx +2 -1
- package/src/content/openSafeUrl.ts +3 -1
- package/src/content/resolveContentFontFamily.ts +119 -0
- package/src/expo-router/useUserflowExpoRouter.ts +10 -1
- package/src/index.ts +22 -9
- package/src/navigation/navigateUrlUtils.ts +100 -0
- package/src/navigation/openExternalNavigateUrl.ts +9 -0
- package/src/navigation/openFlowNavigateUrl.ts +36 -36
- package/src/pairing/PairingController.ts +9 -1
- package/src/runtime/BannerHost.tsx +41 -23
- package/src/runtime/TargetPressBridge.tsx +66 -9
- package/src/runtime/UserflowOverlay.tsx +7 -9
- package/src/runtime/UserflowProvider.tsx +56 -32
- package/src/runtime/bannerEngine.ts +10 -2
- package/src/runtime/bannerFlowSpacer.tsx +70 -0
- package/src/runtime/flowEngine.ts +11 -0
- package/src/runtime/previewStart.ts +49 -0
- package/src/runtime/pushBannerLayoutContext.tsx +126 -0
- package/src/screenTracker.ts +11 -0
- package/src/surfaces/BannerBar.tsx +93 -55
- package/src/surfaces/BannerSurface.tsx +61 -9
- package/src/surfaces/ProgressBar.tsx +2 -1
- package/src/surfaces/TooltipSurface.tsx +78 -53
- package/src/surfaces/bannerBarLayout.ts +80 -7
- package/src/surfaces/bannerWebView/BannerWebViewBar.tsx +151 -57
- package/src/surfaces/bannerWebView/bannerNeedsWebView.ts +4 -36
- package/src/surfaces/bannerWebView/bannerThemeStyles.ts +2 -1
- package/src/surfaces/bannerWebView/bannerWebViewHeight.ts +32 -0
- package/src/surfaces/bannerWebView/buildCustomBannerHtml.ts +111 -23
- package/src/surfaces/hostAccessibilityTrap.ts +25 -0
- package/src/surfaces/resolveBannerTheme.ts +14 -3
- package/src/surfaces/tooltip/TooltipBubble.tsx +8 -1
- package/src/surfaces/tooltip/targetSearchSchedule.ts +140 -0
- package/src/version.ts +1 -1
- package/vendor/core/dist/engine/BannerSessionEngine.d.ts +29 -2
- package/vendor/core/dist/engine/BannerSessionEngine.d.ts.map +1 -1
- package/vendor/core/dist/engine/BannerSessionEngine.js +87 -6
- package/vendor/core/dist/engine/BannerSessionEngine.js.map +1 -1
- package/vendor/core/dist/engine/ClientConditionEngine.d.ts.map +1 -1
- package/vendor/core/dist/engine/ClientConditionEngine.js +30 -7
- package/vendor/core/dist/engine/ClientConditionEngine.js.map +1 -1
- package/vendor/core/dist/engine/PairingEngine.d.ts +6 -1
- package/vendor/core/dist/engine/PairingEngine.d.ts.map +1 -1
- package/vendor/core/dist/engine/PairingEngine.js +23 -3
- package/vendor/core/dist/engine/PairingEngine.js.map +1 -1
- package/vendor/core/dist/engine/handleActions.d.ts.map +1 -1
- package/vendor/core/dist/engine/handleActions.js +67 -2
- package/vendor/core/dist/engine/handleActions.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/flows.d.ts +2 -0
- package/vendor/protocol/dist/flows.d.ts.map +1 -1
- package/vendor/protocol/package.json +1 -1
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.concreteFontFamily = concreteFontFamily;
|
|
7
|
+
exports.detectAppFontFamily = detectAppFontFamily;
|
|
8
|
+
exports.isBareCssFamily = isBareCssFamily;
|
|
9
|
+
exports.isIconFontFamily = isIconFontFamily;
|
|
10
|
+
exports.resetDetectedAppFont = resetDetectedAppFont;
|
|
11
|
+
exports.splitCssFamilies = splitCssFamilies;
|
|
12
|
+
exports.themeConcreteFontFamily = themeConcreteFontFamily;
|
|
13
|
+
var _screenTracker = require("../../screenTracker.js");
|
|
14
|
+
var _FiberScanRootStore = require("./FiberScanRootStore.js");
|
|
15
|
+
var _fiberInternals = require("./fiberInternals.js");
|
|
16
|
+
var _visibleScreens = require("./visibleScreens.js");
|
|
17
|
+
var _walkVisibleFibers = require("./walkVisibleFibers.js");
|
|
18
|
+
/**
|
|
19
|
+
* Host-app font used when a theme is still on the default CSS stack.
|
|
20
|
+
*
|
|
21
|
+
* React Native does not inherit `fontFamily` from a parent view, so the family
|
|
22
|
+
* actually in use is the one set on `Text`. The primary font is whichever
|
|
23
|
+
* family appears on the most visible host text under the scan root (the SDK
|
|
24
|
+
* overlay is a sibling and is not walked). Embedded banners are inside that
|
|
25
|
+
* root; their hosts use a `userflow-` testID and are not votes, or the bar's
|
|
26
|
+
* own text would win. Text with no family counts as the platform font. Icon
|
|
27
|
+
* faces are not content. Nested text with no family does not vote: the
|
|
28
|
+
* ancestor text already does, and a child run must not add another vote for
|
|
29
|
+
* that family or for the platform font.
|
|
30
|
+
*
|
|
31
|
+
* A finished walk is cached until the visible screen changes, the reported
|
|
32
|
+
* screen changes, or `Userflow.reset()`. A walk that hits the node cap is not
|
|
33
|
+
* cached. Failures return null.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
const TEXT_HOST_NAMES = new Set(['Text', 'RCTText', 'RCTVirtualText']);
|
|
37
|
+
|
|
38
|
+
/** SDK hosts inside the scan root (embedded banners). Not the app's font. */
|
|
39
|
+
const SDK_HOST_TEST_ID_PREFIX = 'userflow-';
|
|
40
|
+
|
|
41
|
+
/** Cycle guard for nested-text inheritance. Real trees are only a few levels deep. */
|
|
42
|
+
const MAX_FONT_ANCESTORS = 50;
|
|
43
|
+
const CSS_GENERIC_FAMILIES = new Set(['sans-serif', 'serif', 'monospace', 'system-ui', 'ui-sans-serif', 'ui-serif', 'ui-monospace', 'ui-rounded', 'cursive', 'fantasy', 'emoji', 'math', 'fangsong', 'inherit', 'initial', 'unset']);
|
|
44
|
+
|
|
45
|
+
/** Short vector-icon families. Matched after stripping spaces and punctuation. */
|
|
46
|
+
const ICON_FONT_EXACT = new Set(['feather', 'antdesign', 'entypo', 'fontisto', 'simplelineicons', 'octicons', 'zocial', 'foundation', 'evilicons']);
|
|
47
|
+
let cache = null;
|
|
48
|
+
|
|
49
|
+
/** Drop the cached app font. Called from `Userflow.reset()`. */
|
|
50
|
+
function resetDetectedAppFont() {
|
|
51
|
+
cache = null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Family to apply, or null when the app font is the platform face or could
|
|
56
|
+
* not be read. Never throws.
|
|
57
|
+
*/
|
|
58
|
+
function detectAppFontFamily() {
|
|
59
|
+
try {
|
|
60
|
+
const instance = _FiberScanRootStore.fiberScanRoot.getInstance();
|
|
61
|
+
if (!instance || typeof instance !== 'object') return null;
|
|
62
|
+
const root = _FiberScanRootStore.fiberScanRoot.getFiber();
|
|
63
|
+
if (!root) return null;
|
|
64
|
+
if (cache?.instance === instance && cacheStillCurrent(cache, root)) return cache.family;
|
|
65
|
+
const tally = tallyHostText(root);
|
|
66
|
+
if (tally.truncated) {
|
|
67
|
+
if (!tally.voted) return null;
|
|
68
|
+
return pickMajority(tally.counts);
|
|
69
|
+
}
|
|
70
|
+
const family = tally.voted ? pickMajority(tally.counts) : null;
|
|
71
|
+
cache = {
|
|
72
|
+
instance,
|
|
73
|
+
family,
|
|
74
|
+
screens: tally.screens,
|
|
75
|
+
screenKey: reportedScreenKey()
|
|
76
|
+
};
|
|
77
|
+
return family;
|
|
78
|
+
} catch {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Faces that appear in the builder's default system stack. A comma-separated
|
|
85
|
+
* list made only of these and generic keywords is that default, not a custom
|
|
86
|
+
* font. A single concrete name is still kept, including `Roboto`.
|
|
87
|
+
*/
|
|
88
|
+
const DEFAULT_STACK_FACES = new Set(['blinkmacsystemfont', 'segoe ui', 'roboto', 'helvetica', 'arial', 'apple color emoji', 'segoe ui emoji', 'segoe ui symbol']);
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* A single React Native family name. CSS stacks and generic keywords are not
|
|
92
|
+
* usable as a host `fontFamily` — RN treats the whole string as one face.
|
|
93
|
+
* Theme stacks are parsed by {@link themeConcreteFontFamily}.
|
|
94
|
+
*/
|
|
95
|
+
function concreteFontFamily(value) {
|
|
96
|
+
if (typeof value !== 'string') return undefined;
|
|
97
|
+
const name = unwrapFontName(value);
|
|
98
|
+
if (!name || name.includes(',') || name.startsWith('-')) return undefined;
|
|
99
|
+
if (CSS_GENERIC_FAMILIES.has(name.toLowerCase())) return undefined;
|
|
100
|
+
return name;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Family a theme author chose. A single concrete name is kept. A comma-separated
|
|
105
|
+
* list keeps the first family that is not a generic or a default-stack face,
|
|
106
|
+
* so `"Source Sans Pro", sans-serif` stays Source Sans Pro and the system
|
|
107
|
+
* stack still resolves to undefined.
|
|
108
|
+
*/
|
|
109
|
+
function themeConcreteFontFamily(value) {
|
|
110
|
+
if (typeof value !== 'string') return undefined;
|
|
111
|
+
const parts = splitCssFamilies(value);
|
|
112
|
+
if (parts.length === 0) return undefined;
|
|
113
|
+
if (parts.length === 1) return concreteFontFamily(parts[0]);
|
|
114
|
+
for (const part of parts) {
|
|
115
|
+
const name = concreteFontFamily(part);
|
|
116
|
+
if (!name || DEFAULT_STACK_FACES.has(name.toLowerCase())) continue;
|
|
117
|
+
return name;
|
|
118
|
+
}
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Split a CSS `font-family` list. A quote that opens a family is wrapping and
|
|
124
|
+
* is removed; a quote inside a name stays, so `Foo"Bar` is one family.
|
|
125
|
+
* Commas inside wrapping quotes are not separators.
|
|
126
|
+
*/
|
|
127
|
+
function splitCssFamilies(value) {
|
|
128
|
+
const parts = [];
|
|
129
|
+
let current = '';
|
|
130
|
+
let quote = null;
|
|
131
|
+
for (const char of value) {
|
|
132
|
+
if (quote) {
|
|
133
|
+
if (char === quote) quote = null;else current += char;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if ((char === '"' || char === "'") && current.trim() === '') {
|
|
137
|
+
quote = char;
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (char === ',') {
|
|
141
|
+
const name = current.trim();
|
|
142
|
+
if (name) parts.push(name);
|
|
143
|
+
current = '';
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
current += char;
|
|
147
|
+
}
|
|
148
|
+
const name = current.trim();
|
|
149
|
+
if (name) parts.push(name);
|
|
150
|
+
return parts;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Generic keywords and vendor-prefixed faces stay unquoted in CSS. */
|
|
154
|
+
function isBareCssFamily(name) {
|
|
155
|
+
return name.startsWith('-') || CSS_GENERIC_FAMILIES.has(name.toLowerCase());
|
|
156
|
+
}
|
|
157
|
+
function isIconFontFamily(name) {
|
|
158
|
+
const key = name.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
159
|
+
if (ICON_FONT_EXACT.has(key)) return true;
|
|
160
|
+
return key.startsWith('fontawesome') || key.startsWith('ionicons') || key.startsWith('materialcommunityicons') || key.startsWith('materialicons') || key.startsWith('materialsymbols');
|
|
161
|
+
}
|
|
162
|
+
function tallyHostText(root) {
|
|
163
|
+
const counts = new Map();
|
|
164
|
+
const screens = [];
|
|
165
|
+
let voted = false;
|
|
166
|
+
const {
|
|
167
|
+
truncated
|
|
168
|
+
} = (0, _walkVisibleFibers.walkVisibleFibers)(root, fiber => {
|
|
169
|
+
try {
|
|
170
|
+
if ((0, _visibleScreens.isScreenHostFiber)(fiber)) screens.push(fiber);
|
|
171
|
+
if (!isTextHost(fiber)) return;
|
|
172
|
+
const vote = voteFor(fiber, root);
|
|
173
|
+
if (vote === 'skip') return;
|
|
174
|
+
voted = true;
|
|
175
|
+
counts.set(vote, (counts.get(vote) ?? 0) + 1);
|
|
176
|
+
} catch {
|
|
177
|
+
// One unreadable node is not a vote.
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
return {
|
|
181
|
+
voted,
|
|
182
|
+
truncated,
|
|
183
|
+
screens,
|
|
184
|
+
counts
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Usable family, null for the platform font, or skip for an icon face. */
|
|
189
|
+
function voteFor(fiber, root) {
|
|
190
|
+
if (isUnderSdkHost(fiber, root)) return 'skip';
|
|
191
|
+
const own = classifyFamily(readFontFamily(fiber));
|
|
192
|
+
if (own.kind === 'icon') return 'skip';
|
|
193
|
+
if (own.kind === 'family') return own.name;
|
|
194
|
+
if (own.kind === 'unusable') return null;
|
|
195
|
+
// No family of its own. The ancestor text node casts the vote for this run.
|
|
196
|
+
if (hasAncestorText(fiber, root)) return 'skip';
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
function hasAncestorText(fiber, root) {
|
|
200
|
+
let parent = (0, _fiberInternals.getReturn)(fiber);
|
|
201
|
+
for (let depth = 0; parent && parent !== root && depth < MAX_FONT_ANCESTORS; depth += 1) {
|
|
202
|
+
if (isTextHost(parent)) return true;
|
|
203
|
+
parent = (0, _fiberInternals.getReturn)(parent);
|
|
204
|
+
}
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
function cacheStillCurrent(cached, root) {
|
|
208
|
+
if (cached.screenKey !== reportedScreenKey()) return false;
|
|
209
|
+
if (cached.screens.length === 0) return true;
|
|
210
|
+
return cached.screens.every(screen => screenStillCurrent(screen, root));
|
|
211
|
+
}
|
|
212
|
+
function screenStillCurrent(screen, root) {
|
|
213
|
+
if (!(0, _visibleScreens.isFiberOnVisibleScreen)(screen)) return false;
|
|
214
|
+
let current = screen;
|
|
215
|
+
for (let depth = 0; current && depth < _fiberInternals.MAX_ANCESTOR_WALK; depth += 1) {
|
|
216
|
+
if (current === root) return true;
|
|
217
|
+
current = (0, _fiberInternals.getReturn)(current);
|
|
218
|
+
}
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
function reportedScreenKey() {
|
|
222
|
+
const location = (0, _screenTracker.getCurrentScreenLocation)();
|
|
223
|
+
if (!location) return null;
|
|
224
|
+
const key = 'path' in location ? location.path : location.screen;
|
|
225
|
+
return key || null;
|
|
226
|
+
}
|
|
227
|
+
function classifyFamily(raw) {
|
|
228
|
+
if (!raw) return {
|
|
229
|
+
kind: 'absent'
|
|
230
|
+
};
|
|
231
|
+
if (isIconFontFamily(raw)) return {
|
|
232
|
+
kind: 'icon'
|
|
233
|
+
};
|
|
234
|
+
const concrete = concreteFontFamily(raw);
|
|
235
|
+
if (!concrete) return {
|
|
236
|
+
kind: 'unusable'
|
|
237
|
+
};
|
|
238
|
+
return {
|
|
239
|
+
kind: 'family',
|
|
240
|
+
name: concrete
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function pickMajority(counts) {
|
|
244
|
+
const platform = counts.get(null) ?? 0;
|
|
245
|
+
let bestName = null;
|
|
246
|
+
let bestCount = 0;
|
|
247
|
+
for (const [name, count] of counts) {
|
|
248
|
+
if (name == null) continue;
|
|
249
|
+
if (bestName == null || count > bestCount || count === bestCount && name < bestName) {
|
|
250
|
+
bestName = name;
|
|
251
|
+
bestCount = count;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (bestName == null || platform > bestCount) return null;
|
|
255
|
+
return bestName;
|
|
256
|
+
}
|
|
257
|
+
function isUnderSdkHost(fiber, root) {
|
|
258
|
+
let parent = (0, _fiberInternals.getReturn)(fiber);
|
|
259
|
+
for (let depth = 0; parent && parent !== root && depth < MAX_FONT_ANCESTORS; depth += 1) {
|
|
260
|
+
try {
|
|
261
|
+
const testID = (0, _fiberInternals.getLiveHostProps)(parent)?.testID;
|
|
262
|
+
if (typeof testID === 'string' && testID.startsWith(SDK_HOST_TEST_ID_PREFIX)) {
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
} catch {
|
|
266
|
+
// An unreadable ancestor is not an SDK host.
|
|
267
|
+
}
|
|
268
|
+
parent = (0, _fiberInternals.getReturn)(parent);
|
|
269
|
+
}
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
function isTextHost(fiber) {
|
|
273
|
+
const typeName = (0, _fiberInternals.getHostTypeName)(fiber);
|
|
274
|
+
if (typeName && TEXT_HOST_NAMES.has(typeName)) return true;
|
|
275
|
+
const elementType = fiber?.elementType;
|
|
276
|
+
if (typeof elementType === 'string' && TEXT_HOST_NAMES.has(elementType)) return true;
|
|
277
|
+
try {
|
|
278
|
+
const node = (0, _fiberInternals.getStateNode)(fiber);
|
|
279
|
+
const className = node?.viewConfig?.uiViewClassName ?? node?.__viewConfig?.uiViewClassName;
|
|
280
|
+
return typeof className === 'string' && TEXT_HOST_NAMES.has(className);
|
|
281
|
+
} catch {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function readFontFamily(fiber) {
|
|
286
|
+
try {
|
|
287
|
+
const flat = flattenFontStyle((0, _fiberInternals.getLiveHostProps)(fiber)?.style);
|
|
288
|
+
const family = flat?.fontFamily;
|
|
289
|
+
if (typeof family !== 'string') return undefined;
|
|
290
|
+
const trimmed = family.trim();
|
|
291
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
292
|
+
} catch {
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
function flattenFontStyle(style) {
|
|
297
|
+
if (style == null || style === false) return null;
|
|
298
|
+
if (typeof style === 'number') return flattenRegisteredStyle(style);
|
|
299
|
+
if (Array.isArray(style)) {
|
|
300
|
+
let family;
|
|
301
|
+
for (const entry of style) {
|
|
302
|
+
const flat = flattenFontStyle(entry);
|
|
303
|
+
if (flat && flat.fontFamily != null) family = flat.fontFamily;
|
|
304
|
+
}
|
|
305
|
+
return {
|
|
306
|
+
fontFamily: family
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
if (typeof style === 'object') return style;
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* StyleSheet ids are numbers. Resolve them only when one shows up so tests
|
|
315
|
+
* that pass plain style objects do not load react-native.
|
|
316
|
+
*/
|
|
317
|
+
function flattenRegisteredStyle(styleId) {
|
|
318
|
+
try {
|
|
319
|
+
// Lazy require so unit tests that pass plain style objects do not load RN.
|
|
320
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
|
|
321
|
+
const {
|
|
322
|
+
StyleSheet
|
|
323
|
+
} = require('react-native');
|
|
324
|
+
const flat = StyleSheet?.flatten?.(styleId);
|
|
325
|
+
return flat ?? null;
|
|
326
|
+
} catch {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
function unwrapFontName(value) {
|
|
331
|
+
const trimmed = value.trim();
|
|
332
|
+
if (trimmed.length >= 2) {
|
|
333
|
+
const first = trimmed[0];
|
|
334
|
+
const last = trimmed[trimmed.length - 1];
|
|
335
|
+
if (first === '"' && last === '"' || first === "'" && last === "'") {
|
|
336
|
+
return trimmed.slice(1, -1).trim();
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return trimmed;
|
|
340
|
+
}
|
|
341
|
+
//# sourceMappingURL=detectAppFontFamily.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_screenTracker","require","_FiberScanRootStore","_fiberInternals","_visibleScreens","_walkVisibleFibers","TEXT_HOST_NAMES","Set","SDK_HOST_TEST_ID_PREFIX","MAX_FONT_ANCESTORS","CSS_GENERIC_FAMILIES","ICON_FONT_EXACT","cache","resetDetectedAppFont","detectAppFontFamily","instance","fiberScanRoot","getInstance","root","getFiber","cacheStillCurrent","family","tally","tallyHostText","truncated","voted","pickMajority","counts","screens","screenKey","reportedScreenKey","DEFAULT_STACK_FACES","concreteFontFamily","value","undefined","name","unwrapFontName","includes","startsWith","has","toLowerCase","themeConcreteFontFamily","parts","splitCssFamilies","length","part","current","quote","char","trim","push","isBareCssFamily","isIconFontFamily","key","replace","Map","walkVisibleFibers","fiber","isScreenHostFiber","isTextHost","vote","voteFor","set","get","isUnderSdkHost","own","classifyFamily","readFontFamily","kind","hasAncestorText","parent","getReturn","depth","cached","every","screen","screenStillCurrent","isFiberOnVisibleScreen","MAX_ANCESTOR_WALK","location","getCurrentScreenLocation","path","raw","concrete","platform","bestName","bestCount","count","testID","getLiveHostProps","typeName","getHostTypeName","elementType","node","getStateNode","className","viewConfig","uiViewClassName","__viewConfig","flat","flattenFontStyle","style","fontFamily","trimmed","flattenRegisteredStyle","Array","isArray","entry","styleId","StyleSheet","flatten","first","last","slice"],"sourceRoot":"../../../../src","sources":["anchors/fiber/detectAppFontFamily.ts"],"mappings":";;;;;;;;;;;;AAiBA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAQA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AA7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA,MAAMK,eAAe,GAAG,IAAIC,GAAG,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC;;AAEtE;AACA,MAAMC,uBAAuB,GAAG,WAAW;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TOR_WALK = void 0;
|
|
7
7
|
exports.coerceToFiber = coerceToFiber;
|
|
8
|
+
exports.createCurrentFiberResolver = createCurrentFiberResolver;
|
|
8
9
|
exports.fiberFromPublicInstance = fiberFromPublicInstance;
|
|
9
10
|
exports.getAlternate = getAlternate;
|
|
10
11
|
exports.getChild = getChild;
|
|
@@ -296,6 +297,71 @@ function resolveCurrentFiber(fiber) {
|
|
|
296
297
|
}
|
|
297
298
|
return fiber;
|
|
298
299
|
}
|
|
300
|
+
|
|
301
|
+
/** Where a fiber sits: its tree's current fiber, and whether it is under it. */
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* {@link resolveCurrentFiber} for many fibers in one synchronous pass. Where
|
|
305
|
+
* each ancestor sits is remembered, so the pass walks every ancestor once
|
|
306
|
+
* instead of once per fiber below it. Discard it when the pass ends: a render
|
|
307
|
+
* moves `return` pointers.
|
|
308
|
+
*/
|
|
309
|
+
function createCurrentFiberResolver() {
|
|
310
|
+
const placeOf = new Map();
|
|
311
|
+
const locate = fiber => {
|
|
312
|
+
const path = [];
|
|
313
|
+
let above = null;
|
|
314
|
+
let cur = fiber;
|
|
315
|
+
for (let depth = 0; cur && depth < MAX_ANCESTOR_WALK; depth += 1) {
|
|
316
|
+
const known = placeOf.get(cur);
|
|
317
|
+
if (known !== undefined) {
|
|
318
|
+
above = known;
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
path.push(cur);
|
|
322
|
+
// Only a HostRoot (or a detached fiber) has no parent, so the tag is
|
|
323
|
+
// read once, at the top, not at every step.
|
|
324
|
+
const parent = getReturn(cur);
|
|
325
|
+
if (!parent) {
|
|
326
|
+
const rootState = getFiberTag(cur) === HOST_ROOT_TAG ? getStateNode(cur) : null;
|
|
327
|
+
above = rootState?.current ? {
|
|
328
|
+
current: rootState.current,
|
|
329
|
+
inTree: false
|
|
330
|
+
} : null;
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
cur = parent;
|
|
334
|
+
}
|
|
335
|
+
// Top down: a fiber is in the current tree when the current fiber is it
|
|
336
|
+
// or one of its ancestors.
|
|
337
|
+
let place = above;
|
|
338
|
+
for (let i = path.length - 1; i >= 0; i -= 1) {
|
|
339
|
+
if (place && !place.inTree && path[i] === place.current) {
|
|
340
|
+
place = {
|
|
341
|
+
current: place.current,
|
|
342
|
+
inTree: true
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
placeOf.set(path[i], place);
|
|
346
|
+
}
|
|
347
|
+
return place;
|
|
348
|
+
};
|
|
349
|
+
return fiber => {
|
|
350
|
+
if (!fiber) return fiber;
|
|
351
|
+
try {
|
|
352
|
+
const alternate = getAlternate(fiber);
|
|
353
|
+
if (!alternate) return fiber;
|
|
354
|
+
const own = locate(fiber);
|
|
355
|
+
if (!own || own.inTree) return fiber;
|
|
356
|
+
const other = locate(alternate);
|
|
357
|
+
// Two trees for one pair only happens on a corrupt graph.
|
|
358
|
+
if (!other || other.current !== own.current) return resolveCurrentFiber(fiber);
|
|
359
|
+
return other.inTree ? alternate : fiber;
|
|
360
|
+
} catch {
|
|
361
|
+
return fiber;
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
}
|
|
299
365
|
function isInTree(fiber, root) {
|
|
300
366
|
let cur = fiber;
|
|
301
367
|
for (let depth = 0; cur && depth < MAX_ANCESTOR_WALK; depth += 1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HOST_COMPONENT_TAG","HOST_ROOT_TAG","MAX_ANCESTOR_WALK","exports","HOST_STATE_NODE_KEYS","getChild","fiber","child","getSibling","sibling","getReturn","return","getAlternate","alternate","getMemoizedProps","p","memoizedProps","undefined","MAX_REACT_FIBER_TAG","FIBER_STRUCTURAL_KEYS","looksLikeHostNode","value","v","__nativeTag","_nativeTag","isReactFiber","tag","Number","isInteger","some","key","coerceToFiber","candidates","canonical","internalInstanceHandle","_internalInstanceHandle","candidate","nativeTagFromNode","nativeTag","isFinite","nativeTagFromHostFiber","getStateNode","publicInstanceFromHostFiber","node","n","pub","publicInstance","measureInWindow","measure","getLiveHostProps","memo","current","currentProps","stateNode","getFiberTag","t","getHostTypeName","type","isHostFiber","k","measureLayout","INSTANCE_FIBER_KEYS","fiberFromPublicInstance","instance","inst","fromCanonical","resolveCurrentFiber","cur","depth","rootState","currentRoot","isInTree","root","isFiberMounted"],"sourceRoot":"../../../../src","sources":["anchors/fiber/fiberInternals.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["HOST_COMPONENT_TAG","HOST_ROOT_TAG","MAX_ANCESTOR_WALK","exports","HOST_STATE_NODE_KEYS","getChild","fiber","child","getSibling","sibling","getReturn","return","getAlternate","alternate","getMemoizedProps","p","memoizedProps","undefined","MAX_REACT_FIBER_TAG","FIBER_STRUCTURAL_KEYS","looksLikeHostNode","value","v","__nativeTag","_nativeTag","isReactFiber","tag","Number","isInteger","some","key","coerceToFiber","candidates","canonical","internalInstanceHandle","_internalInstanceHandle","candidate","nativeTagFromNode","nativeTag","isFinite","nativeTagFromHostFiber","getStateNode","publicInstanceFromHostFiber","node","n","pub","publicInstance","measureInWindow","measure","getLiveHostProps","memo","current","currentProps","stateNode","getFiberTag","t","getHostTypeName","type","isHostFiber","k","measureLayout","INSTANCE_FIBER_KEYS","fiberFromPublicInstance","instance","inst","fromCanonical","resolveCurrentFiber","cur","depth","rootState","currentRoot","isInTree","createCurrentFiberResolver","placeOf","Map","locate","path","above","known","get","push","parent","inTree","place","i","length","set","own","other","root","isFiberMounted"],"sourceRoot":"../../../../src","sources":["anchors/fiber/fiberInternals.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAGA;AACA,MAAMA,kBAAkB,GAAG,CAAC;;AAE5B;AACA,MAAMC,aAAa,GAAG,CAAC;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,M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AGrE,SAAS,GAAGP,KAAK;IACzC,CAAC,CAAC,MAAM;MACN,OAAOA,KAAK;IACd;EACF,CAAC;AACH;AAEA,SAASiE,QAAQA,CAACjE,KAAe,EAAEmF,IAAc,EAAW;EAC1D,IAAItB,GAAa,GAAG7D,KAAK;EACzB,KAAK,IAAI8D,KAAK,GAAG,CAAC,EAAED,GAAG,IAAIC,KAAK,GAAGlE,iBAAiB,EAAEkE,KAAK,IAAI,CAAC,EAAE;IAChE,IAAID,GAAG,KAAKsB,IAAI,EAAE,OAAO,IAAI;IAC7BtB,GAAG,GAAGzD,SAAS,CAACyD,GAAG,CAAC;EACtB;EACA,OAAO,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACO,SAASuB,cAAcA,CAACpF,KAAe,EAAW;EACvD,IAAI,CAACA,KAAK,EAAE,OAAO,KAAK;EACxB,IAAI;IACF,IAAIgD,WAAW,CAAChD,KAAK,CAAC,KAAKL,aAAa,EAAE,OAAO,IAAI;IACrD;IACA,OAAOS,SAAS,CAACJ,KAAK,CAAC,IAAI,IAAI;EACjC,CAAC,CAAC,MAAM;IACN,OAAO,KAAK;EACd;AACF","ignoreList":[]}
|
|
@@ -103,13 +103,14 @@ function createLazyHostFiberIndex(build = indexLiveHostFibers) {
|
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
105
|
* Fiber for a public instance: direct pointer first, then the scan-root index
|
|
106
|
-
* by identity / native tag.
|
|
106
|
+
* by identity / native tag. Pass a `createCurrentFiberResolver()` resolver when
|
|
107
|
+
* looking up many instances in one pass.
|
|
107
108
|
*/
|
|
108
|
-
function lookupHostFiber(index, instance) {
|
|
109
|
+
function lookupHostFiber(index, instance, resolveCurrent = _fiberInternals.resolveCurrentFiber) {
|
|
109
110
|
const direct = (0, _fiberInternals.fiberFromPublicInstance)(instance);
|
|
110
111
|
if (direct) {
|
|
111
112
|
try {
|
|
112
|
-
return (
|
|
113
|
+
return resolveCurrent(direct);
|
|
113
114
|
} catch {
|
|
114
115
|
return direct;
|
|
115
116
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_FiberScanRootStore","require","_fiberInternals","MAX_INDEX_NODES","emptyHostFiberIndex","byNativeTag","Map","byInstance","WeakMap","createHostFiberIndex","root","index","stack","visited","length","fiber","pop","isHostFiber","tag","nativeTagFromHostFiber","undefined","has","set","pub","publicInstanceFromHostFiber","sibling","getSibling","push","child","getChild","indexLiveHostFibers","fiberScanRoot","getFiber","createLazyHostFiberIndex","build","cached","lookupHostFiber","instance","
|
|
1
|
+
{"version":3,"names":["_FiberScanRootStore","require","_fiberInternals","MAX_INDEX_NODES","emptyHostFiberIndex","byNativeTag","Map","byInstance","WeakMap","createHostFiberIndex","root","index","stack","visited","length","fiber","pop","isHostFiber","tag","nativeTagFromHostFiber","undefined","has","set","pub","publicInstanceFromHostFiber","sibling","getSibling","push","child","getChild","indexLiveHostFibers","fiberScanRoot","getFiber","createLazyHostFiberIndex","build","cached","lookupHostFiber","instance","resolveCurrent","resolveCurrentFiber","direct","fiberFromPublicInstance","resolved","fromMap","get","nativeTagFromNode"],"sourceRoot":"../../../../src","sources":["anchors/fiber/indexHostFibers.ts"],"mappings":";;;;;;;;;;AAiBA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA;AACA,MAAME,eAAe,GAAG,MAAM;AAOvB,SAASC,mBAAmBA,CAAA,EAAmB;EACpD,OAAO;IAAEC,WAAW,EAAE,IAAIC,GAAG,CAAC,CAAC;IAAEC,UAAU,EAAE,IAAIC,OAAO,CAAC;EAAE,CAAC;AAC9D;;AAEA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAACC,IAAiC,EAAkB;EACtF,MAAMC,KAAK,GAAGP,mBAAmB,CAAC,CAAC;EACnC,IAAI,CAACM,IAAI,EAAE,OAAOC,KAAK;EACvB,IA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|
|
21
21
|
|
|
22
22
|
const MIN_SCORE = 40;
|
|
23
23
|
const UNIQUENESS_MARGIN = 12;
|
|
24
|
+
|
|
25
|
+
/** Why a fiber path did not resolve. Element conditions map these differently. */
|
|
26
|
+
|
|
24
27
|
function stringProp(value) {
|
|
25
28
|
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
26
29
|
}
|
|
@@ -32,17 +35,13 @@ function sameFiber(a, b) {
|
|
|
32
35
|
const alt = (0, _fiberInternals.getAlternate)(a);
|
|
33
36
|
return alt != null && alt === b;
|
|
34
37
|
}
|
|
35
|
-
|
|
38
|
+
|
|
39
|
+
/** The live segment without its text, which needs a subtree walk. */
|
|
40
|
+
function liveIdentity(fiber) {
|
|
36
41
|
const props = (0, _fiberInternals.getLiveHostProps)(fiber);
|
|
37
42
|
const role = stringProp(props?.accessibilityRole) ?? stringProp(props?.role);
|
|
38
43
|
const testID = stringProp(props?.testID);
|
|
39
44
|
const accessibilityLabel = stringProp(props?.accessibilityLabel) ?? stringProp(props?.['aria-label']);
|
|
40
|
-
let text;
|
|
41
|
-
try {
|
|
42
|
-
text = (0, _readHostContent.readHostText)(fiber, 1);
|
|
43
|
-
} catch {
|
|
44
|
-
text = undefined;
|
|
45
|
-
}
|
|
46
45
|
const hostKind = (0, _fiberInternals.getHostTypeName)(fiber);
|
|
47
46
|
return {
|
|
48
47
|
displayName: typeof fiber?.type === 'string' ? fiber.type : '',
|
|
@@ -57,7 +56,18 @@ function liveSegment(fiber) {
|
|
|
57
56
|
} : {}),
|
|
58
57
|
...(accessibilityLabel ? {
|
|
59
58
|
accessibilityLabel
|
|
60
|
-
} : {})
|
|
59
|
+
} : {})
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function liveSegment(fiber) {
|
|
63
|
+
let text;
|
|
64
|
+
try {
|
|
65
|
+
text = (0, _readHostContent.readHostText)(fiber, 1);
|
|
66
|
+
} catch {
|
|
67
|
+
text = undefined;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
...liveIdentity(fiber),
|
|
61
71
|
...(text ? {
|
|
62
72
|
text
|
|
63
73
|
} : {})
|
|
@@ -79,7 +89,8 @@ function scoreAlignment(expected, actual) {
|
|
|
79
89
|
let kindAligned = 0;
|
|
80
90
|
for (let i = 0; i < n; i += 1) {
|
|
81
91
|
const exp = expected[expected.length - 1 - i];
|
|
82
|
-
|
|
92
|
+
// Alignment never compares text, so skip the subtree walk for every ancestor.
|
|
93
|
+
const live = liveIdentity(actual[actual.length - 1 - i]);
|
|
83
94
|
const expKind = exp.hostKind ?? exp.displayName;
|
|
84
95
|
const liveKind = live.hostKind ?? live.displayName;
|
|
85
96
|
if (expKind && liveKind && expKind !== liveKind) break;
|
|
@@ -92,16 +103,17 @@ function scoreAlignment(expected, actual) {
|
|
|
92
103
|
return score + kindAligned * 6;
|
|
93
104
|
}
|
|
94
105
|
function scoreHost(path, fiber) {
|
|
95
|
-
const live = liveSegment(fiber);
|
|
96
106
|
const leaf = path.segments[path.segments.length - 1];
|
|
97
107
|
const leafKind = leaf?.hostKind ?? path.leafKind;
|
|
98
|
-
|
|
108
|
+
// Kind first: most hosts fail here, before any props or text are read.
|
|
109
|
+
const liveKind = (0, _fiberInternals.getHostTypeName)(fiber) ?? '';
|
|
99
110
|
if (leafKind && liveKind && leafKind !== liveKind) {
|
|
100
111
|
return {
|
|
101
112
|
score: -Infinity,
|
|
102
113
|
textDisagreed: false
|
|
103
114
|
};
|
|
104
115
|
}
|
|
116
|
+
const live = liveSegment(fiber);
|
|
105
117
|
let score = 20;
|
|
106
118
|
if (leaf?.role && live.role === leaf.role) score += 15;
|
|
107
119
|
if (leaf?.testID && live.testID === leaf.testID) score += 90;
|
|
@@ -135,9 +147,9 @@ function scoreHost(path, fiber) {
|
|
|
135
147
|
}
|
|
136
148
|
function resolveScored(path, root) {
|
|
137
149
|
const scored = [];
|
|
150
|
+
// The walk already skips covered screens, so no per-host visibility walk.
|
|
138
151
|
(0, _walkVisibleFibers.walkVisibleFibers)(root, fiber => {
|
|
139
152
|
if (!(0, _fiberInternals.isHostFiber)(fiber)) return;
|
|
140
|
-
if (!(0, _visibleScreens.isFiberOnVisibleScreen)(fiber)) return;
|
|
141
153
|
const {
|
|
142
154
|
score,
|
|
143
155
|
textDisagreed
|
|
@@ -151,7 +163,8 @@ function resolveScored(path, root) {
|
|
|
151
163
|
scored.sort((a, b) => b.score - a.score);
|
|
152
164
|
const best = scored[0];
|
|
153
165
|
if (!best || best.score < MIN_SCORE) return {
|
|
154
|
-
status: 'unknown'
|
|
166
|
+
status: 'unknown',
|
|
167
|
+
reason: 'no-match'
|
|
155
168
|
};
|
|
156
169
|
const second = scored[1];
|
|
157
170
|
if (second && best.score - second.score < UNIQUENESS_MARGIN) return {
|
|
@@ -173,7 +186,8 @@ function resolveScored(path, root) {
|
|
|
173
186
|
*/
|
|
174
187
|
function resolveFiberPath(path) {
|
|
175
188
|
if (!path || path.segments.length === 0) return {
|
|
176
|
-
status: 'unknown'
|
|
189
|
+
status: 'unknown',
|
|
190
|
+
reason: 'empty'
|
|
177
191
|
};
|
|
178
192
|
const leaf = path.segments[path.segments.length - 1];
|
|
179
193
|
const exactId = leaf?.testID;
|
|
@@ -202,7 +216,8 @@ function resolveFiberPath(path) {
|
|
|
202
216
|
}
|
|
203
217
|
const root = _FiberScanRoot.fiberScanRoot.getFiber();
|
|
204
218
|
if (!root) return {
|
|
205
|
-
status: 'unknown'
|
|
219
|
+
status: 'unknown',
|
|
220
|
+
reason: 'no-root'
|
|
206
221
|
};
|
|
207
222
|
const resolved = resolveScored(path, root);
|
|
208
223
|
if (resolved.status === 'found') {
|