@userflow-tech/react-native 0.3.0 → 0.4.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.
Files changed (253) hide show
  1. package/README.md +360 -70
  2. package/docs/anchoring.md +58 -42
  3. package/docs/troubleshooting.md +69 -27
  4. package/expo-plugin/hostDependencyWarnings.d.ts +21 -0
  5. package/expo-plugin/hostDependencyWarnings.d.ts.map +1 -0
  6. package/expo-plugin/hostDependencyWarnings.js +101 -0
  7. package/expo-plugin/hostDependencyWarnings.js.map +1 -0
  8. package/expo-plugin/withUserflow.d.ts.map +1 -1
  9. package/expo-plugin/withUserflow.js +16 -0
  10. package/expo-plugin/withUserflow.js.map +1 -1
  11. package/lib/commonjs/anchors/AnchorRegistry.js +7 -0
  12. package/lib/commonjs/anchors/AnchorRegistry.js.map +1 -1
  13. package/lib/commonjs/anchors/elementConditionEvaluator.js +189 -55
  14. package/lib/commonjs/anchors/elementConditionEvaluator.js.map +1 -1
  15. package/lib/commonjs/anchors/elementTapMonitor.js +92 -0
  16. package/lib/commonjs/anchors/elementTapMonitor.js.map +1 -0
  17. package/lib/commonjs/anchors/elementTargetMatch.js +85 -0
  18. package/lib/commonjs/anchors/elementTargetMatch.js.map +1 -0
  19. package/lib/commonjs/anchors/fiber/findAnchorFiber.js +64 -39
  20. package/lib/commonjs/anchors/fiber/findAnchorFiber.js.map +1 -1
  21. package/lib/commonjs/anchors/fiber/touchTargetFiber.js +105 -0
  22. package/lib/commonjs/anchors/fiber/touchTargetFiber.js.map +1 -0
  23. package/lib/commonjs/anchors/resolveAnchorHost.js +2 -1
  24. package/lib/commonjs/anchors/resolveAnchorHost.js.map +1 -1
  25. package/lib/commonjs/anchors/resolveAutoAnchorHost.js +4 -2
  26. package/lib/commonjs/anchors/resolveAutoAnchorHost.js.map +1 -1
  27. package/lib/commonjs/anchors/resolveElementTargets.js +158 -0
  28. package/lib/commonjs/anchors/resolveElementTargets.js.map +1 -0
  29. package/lib/commonjs/anchors/targetPressMonitor.js +9 -3
  30. package/lib/commonjs/anchors/targetPressMonitor.js.map +1 -1
  31. package/lib/commonjs/anchors/useUserflowAnchor.js +1 -0
  32. package/lib/commonjs/anchors/useUserflowAnchor.js.map +1 -1
  33. package/lib/commonjs/anonymousId.js +16 -7
  34. package/lib/commonjs/anonymousId.js.map +1 -1
  35. package/lib/commonjs/authoring/capturePickerScreenshot.js +9 -1
  36. package/lib/commonjs/authoring/capturePickerScreenshot.js.map +1 -1
  37. package/lib/commonjs/evalJs/getWebView.js +5 -13
  38. package/lib/commonjs/evalJs/getWebView.js.map +1 -1
  39. package/lib/commonjs/hostAppVersion.js +6 -1
  40. package/lib/commonjs/hostAppVersion.js.map +1 -1
  41. package/lib/commonjs/index.js +5 -0
  42. package/lib/commonjs/index.js.map +1 -1
  43. package/lib/commonjs/installCheck.js +183 -0
  44. package/lib/commonjs/installCheck.js.map +1 -0
  45. package/lib/commonjs/nativeModules.js +44 -0
  46. package/lib/commonjs/nativeModules.js.map +1 -0
  47. package/lib/commonjs/network.js +20 -7
  48. package/lib/commonjs/network.js.map +1 -1
  49. package/lib/commonjs/pairing/deviceId.js +14 -11
  50. package/lib/commonjs/pairing/deviceId.js.map +1 -1
  51. package/lib/commonjs/pairing/tokenStorage.js +17 -4
  52. package/lib/commonjs/pairing/tokenStorage.js.map +1 -1
  53. package/lib/commonjs/runtime/TargetPressBridge.js +12 -1
  54. package/lib/commonjs/runtime/TargetPressBridge.js.map +1 -1
  55. package/lib/commonjs/runtime/UserflowProvider.js +6 -3
  56. package/lib/commonjs/runtime/UserflowProvider.js.map +1 -1
  57. package/lib/commonjs/storage/asyncStorage.js +67 -0
  58. package/lib/commonjs/storage/asyncStorage.js.map +1 -0
  59. package/lib/commonjs/surfaces/BannerSurface.js +3 -1
  60. package/lib/commonjs/surfaces/BannerSurface.js.map +1 -1
  61. package/lib/commonjs/surfaces/safeArea.js +74 -28
  62. package/lib/commonjs/surfaces/safeArea.js.map +1 -1
  63. package/lib/commonjs/version.js +1 -1
  64. package/lib/module/anchors/AnchorRegistry.js +7 -0
  65. package/lib/module/anchors/AnchorRegistry.js.map +1 -1
  66. package/lib/module/anchors/elementConditionEvaluator.js +189 -55
  67. package/lib/module/anchors/elementConditionEvaluator.js.map +1 -1
  68. package/lib/module/anchors/elementTapMonitor.js +87 -0
  69. package/lib/module/anchors/elementTapMonitor.js.map +1 -0
  70. package/lib/module/anchors/elementTargetMatch.js +78 -0
  71. package/lib/module/anchors/elementTargetMatch.js.map +1 -0
  72. package/lib/module/anchors/fiber/findAnchorFiber.js +62 -39
  73. package/lib/module/anchors/fiber/findAnchorFiber.js.map +1 -1
  74. package/lib/module/anchors/fiber/touchTargetFiber.js +100 -0
  75. package/lib/module/anchors/fiber/touchTargetFiber.js.map +1 -0
  76. package/lib/module/anchors/resolveAnchorHost.js +2 -1
  77. package/lib/module/anchors/resolveAnchorHost.js.map +1 -1
  78. package/lib/module/anchors/resolveAutoAnchorHost.js +3 -3
  79. package/lib/module/anchors/resolveAutoAnchorHost.js.map +1 -1
  80. package/lib/module/anchors/resolveElementTargets.js +152 -0
  81. package/lib/module/anchors/resolveElementTargets.js.map +1 -0
  82. package/lib/module/anchors/targetPressMonitor.js +8 -3
  83. package/lib/module/anchors/targetPressMonitor.js.map +1 -1
  84. package/lib/module/anchors/useUserflowAnchor.js +1 -0
  85. package/lib/module/anchors/useUserflowAnchor.js.map +1 -1
  86. package/lib/module/anonymousId.js +15 -5
  87. package/lib/module/anonymousId.js.map +1 -1
  88. package/lib/module/authoring/capturePickerScreenshot.js +9 -1
  89. package/lib/module/authoring/capturePickerScreenshot.js.map +1 -1
  90. package/lib/module/evalJs/getWebView.js +5 -13
  91. package/lib/module/evalJs/getWebView.js.map +1 -1
  92. package/lib/module/hostAppVersion.js +6 -1
  93. package/lib/module/hostAppVersion.js.map +1 -1
  94. package/lib/module/index.js +5 -0
  95. package/lib/module/index.js.map +1 -1
  96. package/lib/module/installCheck.js +169 -0
  97. package/lib/module/installCheck.js.map +1 -0
  98. package/lib/module/nativeModules.js +40 -0
  99. package/lib/module/nativeModules.js.map +1 -0
  100. package/lib/module/network.js +20 -7
  101. package/lib/module/network.js.map +1 -1
  102. package/lib/module/pairing/deviceId.js +14 -10
  103. package/lib/module/pairing/deviceId.js.map +1 -1
  104. package/lib/module/pairing/tokenStorage.js +17 -4
  105. package/lib/module/pairing/tokenStorage.js.map +1 -1
  106. package/lib/module/runtime/TargetPressBridge.js +12 -1
  107. package/lib/module/runtime/TargetPressBridge.js.map +1 -1
  108. package/lib/module/runtime/UserflowProvider.js +7 -4
  109. package/lib/module/runtime/UserflowProvider.js.map +1 -1
  110. package/lib/module/storage/asyncStorage.js +61 -0
  111. package/lib/module/storage/asyncStorage.js.map +1 -0
  112. package/lib/module/surfaces/BannerSurface.js +3 -1
  113. package/lib/module/surfaces/BannerSurface.js.map +1 -1
  114. package/lib/module/surfaces/safeArea.js +70 -28
  115. package/lib/module/surfaces/safeArea.js.map +1 -1
  116. package/lib/module/version.js +1 -1
  117. package/lib/typescript/commonjs/src/anchors/AnchorRegistry.d.ts +7 -0
  118. package/lib/typescript/commonjs/src/anchors/AnchorRegistry.d.ts.map +1 -1
  119. package/lib/typescript/commonjs/src/anchors/elementConditionEvaluator.d.ts +12 -16
  120. package/lib/typescript/commonjs/src/anchors/elementConditionEvaluator.d.ts.map +1 -1
  121. package/lib/typescript/commonjs/src/anchors/elementTapMonitor.d.ts +36 -0
  122. package/lib/typescript/commonjs/src/anchors/elementTapMonitor.d.ts.map +1 -0
  123. package/lib/typescript/commonjs/src/anchors/elementTargetMatch.d.ts +20 -0
  124. package/lib/typescript/commonjs/src/anchors/elementTargetMatch.d.ts.map +1 -0
  125. package/lib/typescript/commonjs/src/anchors/fiber/findAnchorFiber.d.ts +17 -5
  126. package/lib/typescript/commonjs/src/anchors/fiber/findAnchorFiber.d.ts.map +1 -1
  127. package/lib/typescript/commonjs/src/anchors/fiber/touchTargetFiber.d.ts +24 -0
  128. package/lib/typescript/commonjs/src/anchors/fiber/touchTargetFiber.d.ts.map +1 -0
  129. package/lib/typescript/commonjs/src/anchors/resolveAnchorHost.d.ts +2 -1
  130. package/lib/typescript/commonjs/src/anchors/resolveAnchorHost.d.ts.map +1 -1
  131. package/lib/typescript/commonjs/src/anchors/resolveAutoAnchorHost.d.ts +10 -1
  132. package/lib/typescript/commonjs/src/anchors/resolveAutoAnchorHost.d.ts.map +1 -1
  133. package/lib/typescript/commonjs/src/anchors/resolveElementTargets.d.ts +39 -0
  134. package/lib/typescript/commonjs/src/anchors/resolveElementTargets.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/src/anchors/targetPressMonitor.d.ts +2 -0
  136. package/lib/typescript/commonjs/src/anchors/targetPressMonitor.d.ts.map +1 -1
  137. package/lib/typescript/commonjs/src/anchors/useUserflowAnchor.d.ts.map +1 -1
  138. package/lib/typescript/commonjs/src/anonymousId.d.ts +2 -0
  139. package/lib/typescript/commonjs/src/anonymousId.d.ts.map +1 -1
  140. package/lib/typescript/commonjs/src/authoring/capturePickerScreenshot.d.ts.map +1 -1
  141. package/lib/typescript/commonjs/src/evalJs/getWebView.d.ts +2 -1
  142. package/lib/typescript/commonjs/src/evalJs/getWebView.d.ts.map +1 -1
  143. package/lib/typescript/commonjs/src/hostAppVersion.d.ts +1 -1
  144. package/lib/typescript/commonjs/src/hostAppVersion.d.ts.map +1 -1
  145. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  146. package/lib/typescript/commonjs/src/installCheck.d.ts +48 -0
  147. package/lib/typescript/commonjs/src/installCheck.d.ts.map +1 -0
  148. package/lib/typescript/commonjs/src/nativeModules.d.ts +13 -0
  149. package/lib/typescript/commonjs/src/nativeModules.d.ts.map +1 -0
  150. package/lib/typescript/commonjs/src/network.d.ts.map +1 -1
  151. package/lib/typescript/commonjs/src/pairing/deviceId.d.ts.map +1 -1
  152. package/lib/typescript/commonjs/src/pairing/tokenStorage.d.ts.map +1 -1
  153. package/lib/typescript/commonjs/src/runtime/TargetPressBridge.d.ts +2 -1
  154. package/lib/typescript/commonjs/src/runtime/TargetPressBridge.d.ts.map +1 -1
  155. package/lib/typescript/commonjs/src/runtime/UserflowProvider.d.ts.map +1 -1
  156. package/lib/typescript/commonjs/src/storage/asyncStorage.d.ts +15 -0
  157. package/lib/typescript/commonjs/src/storage/asyncStorage.d.ts.map +1 -0
  158. package/lib/typescript/commonjs/src/surfaces/BannerSurface.d.ts.map +1 -1
  159. package/lib/typescript/commonjs/src/surfaces/safeArea.d.ts +6 -2
  160. package/lib/typescript/commonjs/src/surfaces/safeArea.d.ts.map +1 -1
  161. package/lib/typescript/commonjs/src/version.d.ts +1 -1
  162. package/lib/typescript/module/src/anchors/AnchorRegistry.d.ts +7 -0
  163. package/lib/typescript/module/src/anchors/AnchorRegistry.d.ts.map +1 -1
  164. package/lib/typescript/module/src/anchors/elementConditionEvaluator.d.ts +12 -16
  165. package/lib/typescript/module/src/anchors/elementConditionEvaluator.d.ts.map +1 -1
  166. package/lib/typescript/module/src/anchors/elementTapMonitor.d.ts +36 -0
  167. package/lib/typescript/module/src/anchors/elementTapMonitor.d.ts.map +1 -0
  168. package/lib/typescript/module/src/anchors/elementTargetMatch.d.ts +20 -0
  169. package/lib/typescript/module/src/anchors/elementTargetMatch.d.ts.map +1 -0
  170. package/lib/typescript/module/src/anchors/fiber/findAnchorFiber.d.ts +17 -5
  171. package/lib/typescript/module/src/anchors/fiber/findAnchorFiber.d.ts.map +1 -1
  172. package/lib/typescript/module/src/anchors/fiber/touchTargetFiber.d.ts +24 -0
  173. package/lib/typescript/module/src/anchors/fiber/touchTargetFiber.d.ts.map +1 -0
  174. package/lib/typescript/module/src/anchors/resolveAnchorHost.d.ts +2 -1
  175. package/lib/typescript/module/src/anchors/resolveAnchorHost.d.ts.map +1 -1
  176. package/lib/typescript/module/src/anchors/resolveAutoAnchorHost.d.ts +10 -1
  177. package/lib/typescript/module/src/anchors/resolveAutoAnchorHost.d.ts.map +1 -1
  178. package/lib/typescript/module/src/anchors/resolveElementTargets.d.ts +39 -0
  179. package/lib/typescript/module/src/anchors/resolveElementTargets.d.ts.map +1 -0
  180. package/lib/typescript/module/src/anchors/targetPressMonitor.d.ts +2 -0
  181. package/lib/typescript/module/src/anchors/targetPressMonitor.d.ts.map +1 -1
  182. package/lib/typescript/module/src/anchors/useUserflowAnchor.d.ts.map +1 -1
  183. package/lib/typescript/module/src/anonymousId.d.ts +2 -0
  184. package/lib/typescript/module/src/anonymousId.d.ts.map +1 -1
  185. package/lib/typescript/module/src/authoring/capturePickerScreenshot.d.ts.map +1 -1
  186. package/lib/typescript/module/src/evalJs/getWebView.d.ts +2 -1
  187. package/lib/typescript/module/src/evalJs/getWebView.d.ts.map +1 -1
  188. package/lib/typescript/module/src/hostAppVersion.d.ts +1 -1
  189. package/lib/typescript/module/src/hostAppVersion.d.ts.map +1 -1
  190. package/lib/typescript/module/src/index.d.ts.map +1 -1
  191. package/lib/typescript/module/src/installCheck.d.ts +48 -0
  192. package/lib/typescript/module/src/installCheck.d.ts.map +1 -0
  193. package/lib/typescript/module/src/nativeModules.d.ts +13 -0
  194. package/lib/typescript/module/src/nativeModules.d.ts.map +1 -0
  195. package/lib/typescript/module/src/network.d.ts.map +1 -1
  196. package/lib/typescript/module/src/pairing/deviceId.d.ts.map +1 -1
  197. package/lib/typescript/module/src/pairing/tokenStorage.d.ts.map +1 -1
  198. package/lib/typescript/module/src/runtime/TargetPressBridge.d.ts +2 -1
  199. package/lib/typescript/module/src/runtime/TargetPressBridge.d.ts.map +1 -1
  200. package/lib/typescript/module/src/runtime/UserflowProvider.d.ts.map +1 -1
  201. package/lib/typescript/module/src/storage/asyncStorage.d.ts +15 -0
  202. package/lib/typescript/module/src/storage/asyncStorage.d.ts.map +1 -0
  203. package/lib/typescript/module/src/surfaces/BannerSurface.d.ts.map +1 -1
  204. package/lib/typescript/module/src/surfaces/safeArea.d.ts +6 -2
  205. package/lib/typescript/module/src/surfaces/safeArea.d.ts.map +1 -1
  206. package/lib/typescript/module/src/version.d.ts +1 -1
  207. package/package.json +25 -8
  208. package/src/anchors/AnchorRegistry.ts +12 -0
  209. package/src/anchors/elementConditionEvaluator.ts +235 -70
  210. package/src/anchors/elementTapMonitor.ts +95 -0
  211. package/src/anchors/elementTargetMatch.ts +90 -0
  212. package/src/anchors/fiber/findAnchorFiber.ts +66 -35
  213. package/src/anchors/fiber/touchTargetFiber.ts +125 -0
  214. package/src/anchors/resolveAnchorHost.ts +2 -1
  215. package/src/anchors/resolveAutoAnchorHost.ts +3 -3
  216. package/src/anchors/resolveElementTargets.ts +165 -0
  217. package/src/anchors/targetPressMonitor.ts +12 -3
  218. package/src/anchors/useUserflowAnchor.ts +1 -0
  219. package/src/anonymousId.ts +19 -8
  220. package/src/authoring/capturePickerScreenshot.ts +10 -1
  221. package/src/evalJs/getWebView.ts +6 -13
  222. package/src/hostAppVersion.ts +7 -1
  223. package/src/index.ts +10 -0
  224. package/src/installCheck.ts +225 -0
  225. package/src/nativeModules.ts +48 -0
  226. package/src/network.ts +27 -11
  227. package/src/pairing/deviceId.ts +14 -11
  228. package/src/pairing/tokenStorage.ts +23 -7
  229. package/src/runtime/TargetPressBridge.tsx +17 -1
  230. package/src/runtime/UserflowProvider.tsx +11 -4
  231. package/src/storage/asyncStorage.ts +88 -0
  232. package/src/surfaces/BannerSurface.tsx +7 -5
  233. package/src/surfaces/safeArea.ts +85 -40
  234. package/src/version.ts +1 -1
  235. package/vendor/core/dist/constants.d.ts +2 -0
  236. package/vendor/core/dist/constants.d.ts.map +1 -1
  237. package/vendor/core/dist/constants.js +2 -0
  238. package/vendor/core/dist/constants.js.map +1 -1
  239. package/vendor/core/dist/engine/ClientConditionEngine.d.ts +20 -1
  240. package/vendor/core/dist/engine/ClientConditionEngine.d.ts.map +1 -1
  241. package/vendor/core/dist/engine/ClientConditionEngine.js +13 -10
  242. package/vendor/core/dist/engine/ClientConditionEngine.js.map +1 -1
  243. package/vendor/core/dist/engine/UserflowCore.d.ts.map +1 -1
  244. package/vendor/core/dist/engine/UserflowCore.js +21 -2
  245. package/vendor/core/dist/engine/UserflowCore.js.map +1 -1
  246. package/vendor/core/dist/index.d.ts +1 -1
  247. package/vendor/core/dist/index.d.ts.map +1 -1
  248. package/vendor/core/dist/index.js.map +1 -1
  249. package/vendor/core/dist/version.d.ts +1 -1
  250. package/vendor/core/dist/version.js +1 -1
  251. package/vendor/core/package.json +1 -1
  252. package/vendor/protocol/package.json +1 -1
  253. package/docs/webview-custom-banner-poc.md +0 -64
@@ -39,6 +39,13 @@ export class AnchorRegistry {
39
39
  return last;
40
40
  }
41
41
 
42
+ /** Every host registered for `id`, in registration order. */
43
+ getAll(id) {
44
+ const set = this.anchors.get(id);
45
+ if (!set || set.size === 0) return [];
46
+ return [...set];
47
+ }
48
+
42
49
  /** True when more than one host is registered for the same id. */
43
50
  isAmbiguous(id) {
44
51
  return (this.anchors.get(id)?.size ?? 0) > 1;
@@ -1 +1 @@
1
- {"version":3,"names":["AnchorRegistry","anchors","Map","listeners","Set","register","id","host","set","get","add","emit","unregister","delete","size","last","isAmbiguous","subscribe","listener","clear","anchorRegistry"],"sourceRoot":"../../../src","sources":["anchors/AnchorRegistry.ts"],"mappings":";;AAAA;;AAcA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,cAAc,CAAC;EACTC,OAAO,GAAG,IAAIC,GAAG,CAA0B,CAAC;EAC5CC,SAAS,GAAG,IAAIC,GAAG,CAAW,CAAC;EAEhDC,QAAQA,CAACC,EAAU,EAAEC,IAAgB,EAAQ;IAC3C,IAAI,CAACD,EAAE,EAAE;IACT,IAAIE,GAAG,GAAG,IAAI,CAACP,OAAO,CAACQ,GAAG,CAACH,EAAE,CAAC;IAC9B,IAAI,CAACE,GAAG,EAAE;MACRA,GAAG,GAAG,IAAIJ,GAAG,CAAC,CAAC;MACf,IAAI,CAACH,OAAO,CAACO,GAAG,CAACF,EAAE,EAAEE,GAAG,CAAC;IAC3B;IACAA,GAAG,CAACE,GAAG,CAACH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IAAI,CAACf,SAAS,EAAE;MACrCe,QAAQ,CAAC,CAAC;IACZ;EACF;AACF;;AAEA;AACA,OAAO,MAAME,cAAc,GAAG,IAAIpB,cAAc,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["AnchorRegistry","anchors","Map","listeners","Set","register","id","host","set","get","add","emit","unregister","delete","size","last","getAll","isAmbiguous","subscribe","listener","clear","anchorRegistry"],"sourceRoot":"../../../src","sources":["anchors/AnchorRegistry.ts"],"mappings":";;AAAA;;AAmBA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,cAAc,CAAC;EACTC,OAAO,GAAG,IAAIC,GAAG,CAA0B,CAAC;EAC5CC,SAAS,GAAG,IAAIC,GAAG,CAAW,CAAC;EAEhDC,QAAQA,CAACC,EAAU,EAAEC,IAAgB,EAAQ;IAC3C,IAAI,CAACD,EAAE,EAAE;IACT,IAAIE,GAAG,GAAG,IAAI,CAACP,OAAO,CAACQ,GAAG,CAACH,EAAE,CAAC;IAC9B,IAAI,CAACE,GAAG,EAAE;MACRA,GAAG,GAAG,IAAIJ,GAAG,CAAC,CAAC;MACf,IAAI,CAACH,OAAO,CAACO,GAAG,CAACF,EAAE,EAAEE,GAAG,CAAC;IAC3B;IACAA,GAAG,CAACE,GAAG,CAACH,IAAI,CAAC;IACb,IAAI,CAACI,IAAI,CAAC,CAAC;EACb;EAEAC,UAAUA,CAACN,EAAU,EAAEC,IAAgB,EAAQ;IAC7C,MAAMC,GAAG,GAAG,IAAI,CAACP,OAAO,CAACQ,GAAG,CAACH,EAAE,CAAC;IAChC,IAAI,CAACE,GAAG,EAAE;IACVA,GAAG,CAACK,MAAM,CAACN,IAAI,CAAC;IAChB,IAAIC,GAAG,CAACM,IAAI,KAAK,CAAC,EAAE;MAClB,IAAI,CAACb,OAAO,CAACY,MAAM,CAACP,EAAE,CAAC;IACzB;IACA,IAAI,CAACK,IAAI,CAAC,CAAC;EACb;EAEAF,GAAGA,CAACH,EAAU,EAAqB;IACjC,MA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Data } from '@userflow-tech/protocol';
3
4
  import { anchorChangeTicker } from "./anchorChangeTicker.js";
4
- import { resolveAnchorHost } from "./resolveAnchorHost.js";
5
- import { resolveAutoAnchorHost } from "./resolveAutoAnchorHost.js";
5
+ import { elementTapMonitor } from "./elementTapMonitor.js";
6
+ import { fiberIsUnder, tapPathDisabled } from "./elementTargetMatch.js";
7
+ import { resolveElementTargets, tapMayHitSelector } from "./resolveElementTargets.js";
6
8
  import { resolveManualAnchorId } from "./resolveManualAnchorId.js";
7
9
 
8
- /** ELEMENT states the mobile SDK can evaluate today. */
9
- const SUPPORTED_ELEMENT_STATES = new Set(['PRESENT', 'NOT_PRESENT']);
10
+ /** How many hosts to measure before giving up on a crowded duplicate id. */
11
+ const MAX_MEASURED_HOSTS = 8;
12
+
13
+ /** Same bound tooltip measurement uses. A host that never calls back is unknown. */
14
+ const MEASURE_TIMEOUT_MS = 400;
10
15
 
11
16
  /**
12
17
  * Evaluate ELEMENT client conditions against manual anchors, fiber-resolved
13
- * `testID` / `nativeID` / `accessibilityLabel` targets, and AUTO (codeless)
14
- * selectors.
18
+ * `userflowId` / `testID` / `nativeID` / `accessibilityLabel` targets, and AUTO
19
+ * (codeless) selectors.
15
20
  *
16
- * Supports PRESENT / NOT_PRESENT for MANUAL selectors (`css` → anchor id) and
17
- * AUTO selectors (`autoData` → {@link resolveAutoAnchorHost}). AUTO fails
18
- * closed: `unknown` / `ambiguous` stay `null` so a gated flow never starts
19
- * just because the auto-anchor registry is empty. Web-interaction states
20
- * (CLICK, DISABLED, …) still report unknown.
21
+ * PRESENT / NOT_PRESENT: any uniquely-or-not host on a visible navigator screen
22
+ * counts (web parity — duplicates are present). A measured 0×0 host counts as
23
+ * absent. AUTO `unknown` / `ambiguous` stay `null`.
21
24
  *
22
- * "Present" means a unique host on a **visible** navigator screen. MANUAL
23
- * goes through `resolveAnchorHost`; AUTO through `resolveAutoAnchorHost`.
24
- * Both skip screens covered by another navigator screen, so an id on a
25
- * pushed-under screen counts as absent. Pixel visibility (off-screen inside a
26
- * ScrollView, opacity 0, etc.) would need async `measureInWindow` and is out
27
- * of scope.
25
+ * CLICK / NOT_CLICK: latch from the first matching tap, including a tap on a
26
+ * descendant. The latch survives re-attach via `previousIsTrue` and is cleared
27
+ * when the server untracks. Disabled hosts are ignored. Until it latches, an
28
+ * AUTO selector that does not resolve reports `null`, like presence.
28
29
  *
29
- * Note: compares string literals rather than importing protocol enums so Jest
30
- * (which cannot resolve the ESM-only `@userflow-tech/protocol` package) stays
31
- * hermetic. Wire values match `FlowConditionElementState` / `FlowSelectorType`.
30
+ * Element states are compared as string literals rather than protocol enums so
31
+ * the wire values stay obvious next to the branches. They match
32
+ * `FlowConditionElementState`.
32
33
  */
33
34
  export function createElementConditionEvaluator(warn = message => {
34
35
  if (__DEV__) {
@@ -42,51 +43,184 @@ export function createElementConditionEvaluator(warn = message => {
42
43
  warnedConditionIds.add(conditionId);
43
44
  warn(message);
44
45
  };
45
- return (condition, report) => {
46
- const evaluate = () => {
47
- const result = evaluateElementCondition(condition, warnOnce);
48
- report(result);
46
+ return (condition, report, context) => {
47
+ const elementState = condition.elementState;
48
+ if (elementState === 'PRESENT' || elementState === 'NOT_PRESENT') {
49
+ return trackPresence(condition, elementState, report, warnOnce);
50
+ }
51
+ if (elementState === 'CLICK' || elementState === 'NOT_CLICK') {
52
+ return trackClick(condition, elementState, report, context, warnOnce);
53
+ }
54
+ warnOnce(condition.id, `[Userflow] ELEMENT condition ${condition.id} uses unsupported elementState ` + `"${elementState ?? 'null'}" (supported: PRESENT, NOT_PRESENT, CLICK, NOT_CLICK); ` + 'leaving unknown');
55
+ report(null);
56
+ return () => {};
57
+ };
58
+ }
59
+ function trackPresence(condition, elementState, report, warnOnce) {
60
+ // A synchronous result supersedes any older measurement. Only one
61
+ // measurement runs at a time, and a change during it re-runs once it settles
62
+ // instead of discarding it, so steady anchor churn cannot hold the condition
63
+ // at unknown.
64
+ let generation = 0;
65
+ let reportedGeneration = 0;
66
+ let measuring = false;
67
+ let changedWhileMeasuring = false;
68
+ let disposed = false;
69
+ const evaluate = () => {
70
+ if (disposed) return;
71
+ const gen = ++generation;
72
+ const resolution = resolveElementTargets(condition.selector);
73
+ if (resolution.status === 'unknown') {
74
+ if (!resolution.silent) warnUnknown(condition, warnOnce);
75
+ reportedGeneration = gen;
76
+ report(null);
77
+ return;
78
+ }
79
+ if (resolution.status === 'absent') {
80
+ reportedGeneration = gen;
81
+ report(elementState === 'PRESENT' ? false : true);
82
+ return;
83
+ }
84
+ if (measuring) {
85
+ changedWhileMeasuring = true;
86
+ return;
87
+ }
88
+ measuring = true;
89
+ void measureVisibility(resolution.targets).catch(() => 'unknown').then(visibility => {
90
+ measuring = false;
91
+ if (disposed) return;
92
+ if (gen > reportedGeneration) {
93
+ reportedGeneration = gen;
94
+ if (visibility === 'unknown') {
95
+ report(null);
96
+ } else {
97
+ const present = visibility === 'present';
98
+ report(elementState === 'PRESENT' ? present : !present);
99
+ }
100
+ }
101
+ if (changedWhileMeasuring) {
102
+ changedWhileMeasuring = false;
103
+ evaluate();
104
+ }
105
+ });
106
+ };
107
+ evaluate();
108
+ const unsubscribe = anchorChangeTicker.subscribe(evaluate);
109
+ return () => {
110
+ disposed = true;
111
+ unsubscribe();
112
+ };
113
+ }
114
+ function trackClick(condition, elementState, report, context, warnOnce) {
115
+ if (!clickSelectorUsable(condition)) {
116
+ warnUnknown(condition, warnOnce);
117
+ report(null);
118
+ return () => {};
119
+ }
120
+
121
+ // CLICK starts false and latches true. NOT_CLICK starts true and latches false.
122
+ const valueWhenOccurred = elementState === 'CLICK';
123
+ if (context?.previousIsTrue === valueWhenOccurred) {
124
+ report(valueWhenOccurred);
125
+ return () => {};
126
+ }
127
+ let latched = false;
128
+ let stopWatchingResolution = () => {};
129
+ if (condition.selector?.type === 'AUTO') {
130
+ // An AUTO selector can stay unresolvable (empty auto-anchor registry, a
131
+ // tie between look-alikes), and then no tap can latch. Report unknown
132
+ // until it resolves, as presence does, rather than an unclicked value
133
+ // nothing could clear.
134
+ const reportUnclickedOnceResolvable = () => {
135
+ if (latched) return;
136
+ const resolution = resolveElementTargets(condition.selector);
137
+ if (resolution.status === 'unknown') {
138
+ if (!resolution.silent) warnUnknown(condition, warnOnce);
139
+ report(null);
140
+ return;
141
+ }
142
+ report(!valueWhenOccurred);
49
143
  };
50
- evaluate();
51
- return anchorChangeTicker.subscribe(evaluate);
144
+ reportUnclickedOnceResolvable();
145
+ stopWatchingResolution = anchorChangeTicker.subscribe(reportUnclickedOnceResolvable);
146
+ } else {
147
+ report(!valueWhenOccurred);
148
+ }
149
+ const subscription = {
150
+ unsubscribe: () => {}
151
+ };
152
+ subscription.unsubscribe = elementTapMonitor.subscribe(tap => {
153
+ if (latched) return;
154
+ if (!tapMayHitSelector(condition.selector, tap)) return;
155
+ const resolution = resolveElementTargets(condition.selector);
156
+ if (resolution.status !== 'found') return;
157
+ const matched = resolution.targets.find(target => target.fiber != null && fiberIsUnder(tap.targetFiber, target.fiber));
158
+ if (!matched?.fiber) return;
159
+ if (tapPathDisabled(tap.targetFiber, matched.fiber)) return;
160
+ latched = true;
161
+ report(valueWhenOccurred, {
162
+ immediate: true
163
+ });
164
+ subscription.unsubscribe();
165
+ stopWatchingResolution();
166
+ });
167
+ return () => {
168
+ subscription.unsubscribe();
169
+ stopWatchingResolution();
52
170
  };
53
171
  }
54
- function evaluateElementCondition(condition, warnOnce) {
55
- const elementState = condition.elementState;
56
- if (elementState == null || !SUPPORTED_ELEMENT_STATES.has(elementState)) {
57
- warnOnce(condition.id, `[Userflow] ELEMENT condition ${condition.id} uses unsupported elementState ` + `"${elementState ?? 'null'}" (only PRESENT / NOT_PRESENT are supported); ` + 'leaving unknown');
58
- return null;
172
+ function clickSelectorUsable(condition) {
173
+ const selector = condition.selector;
174
+ if (selector == null) return false;
175
+ if (selector.type === 'AUTO') {
176
+ // Without a fingerprint the selector can never resolve, so a definite
177
+ // NOT_CLICK true would start the flow on a target nobody can tap.
178
+ return decodeMobileAutoData(selector.autoData)?.fingerprint != null;
59
179
  }
180
+ return resolveManualAnchorId(selector.css) != null;
181
+ }
182
+ function warnUnknown(condition, warnOnce) {
60
183
  const selector = condition.selector;
61
184
  if (selector == null) {
62
185
  warnOnce(condition.id, `[Userflow] ELEMENT condition ${condition.id} has no selector; leaving unknown`);
63
- return null;
186
+ return;
64
187
  }
65
188
  if (selector.type === 'AUTO') {
66
- const resolution = resolveAutoAnchorHost(selector.autoData);
67
- if (resolution.status === 'unknown') {
68
- warnOnce(condition.id, `[Userflow] ELEMENT condition ${condition.id} uses an AUTO (codeless) selector ` + 'that could not be resolved; leaving unknown');
69
- return null;
70
- }
71
- if (resolution.status === 'ambiguous') {
72
- return null;
73
- }
74
- const present = resolution.status === 'found';
75
- return elementState === 'PRESENT' ? present : !present;
189
+ warnOnce(condition.id, `[Userflow] ELEMENT condition ${condition.id} uses an AUTO (codeless) selector ` + 'that could not be resolved; leaving unknown');
190
+ return;
76
191
  }
77
- const anchorId = resolveManualAnchorId(selector.css);
78
- if (anchorId == null) {
79
- warnOnce(condition.id, `[Userflow] ELEMENT condition ${condition.id} has no resolvable manual anchor id; ` + 'leaving unknown');
80
- return null;
81
- }
82
- const resolution = resolveAnchorHost(anchorId);
83
- // Ambiguous counts as not present for PRESENT (fail closed) and as "present"
84
- // for NOT_PRESENT would be wrong — treat ambiguous as unknown so gated flows
85
- // stay blocked rather than inventing a truth value.
86
- if (resolution.status === 'ambiguous') {
87
- return null;
192
+ warnOnce(condition.id, `[Userflow] ELEMENT condition ${condition.id} has no resolvable manual anchor id; ` + 'leaving unknown');
193
+ }
194
+ /** Measures hosts in parallel so duplicates cost one timeout, not one each. */
195
+ async function measureVisibility(targets) {
196
+ const slice = targets.slice(0, MAX_MEASURED_HOSTS);
197
+ const measured = await Promise.all(slice.map(measureHost));
198
+ if (measured.some(size => size !== 'timeout' && size.width > 0 && size.height > 0)) {
199
+ return 'present';
88
200
  }
89
- const present = resolution.status === 'found';
90
- return elementState === 'PRESENT' ? present : !present;
201
+ if (measured.includes('timeout') || targets.length > slice.length) return 'unknown';
202
+ return 'absent';
203
+ }
204
+ function measureHost(target) {
205
+ return new Promise(resolve => {
206
+ let settled = false;
207
+ const finish = value => {
208
+ if (settled) return;
209
+ settled = true;
210
+ clearTimeout(timer);
211
+ resolve(value);
212
+ };
213
+ const timer = setTimeout(() => finish('timeout'), MEASURE_TIMEOUT_MS);
214
+ try {
215
+ target.host.measureInWindow((_x, _y, width, height) => {
216
+ finish({
217
+ width,
218
+ height
219
+ });
220
+ });
221
+ } catch {
222
+ finish('timeout');
223
+ }
224
+ });
91
225
  }
92
226
  //# sourceMappingURL=elementConditionEvaluator.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["anchorChangeTicker","resolveAnchorHost","resolveAutoAnchorHost","resolveManualAnchorId","SUPPORTED_ELEMENT_STATES","Set","createElementConditionEvaluator","warn","message","__DEV__","console","warnedConditionIds","warnOnce","conditionId","has","add","condition","report","evaluate","result","evaluateElementCondition","subscribe","elementState","id","selector","type","resolution","autoData","status","present","anchorId","css"],"sourceRoot":"../../../src","sources":["anchors/elementConditionEvaluator.ts"],"mappings":";;AAGA,SAASA,kBAAkB,QAAQ,yBAAsB;AACzD,SAASC,iBAAiB,QAAQ,wBAAqB;AACvD,SAASC,qBAAqB,QAAQ,4BAAyB;AAC/D,SAASC,qBAAqB,QAAQ,4BAAyB;;AAE/D;AACA,MAAMC,wBAAwB,GAAG,IAAIC,GAAG,CAAC,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,+BAA+BA,CAC7CC,IAA+B,GAAIC,OAAO,IAAK;EAC7C,IAAIC,OAAO,EAAE;IACX;IACAC,OAAO,CAACH,IAAI,CAACC,OAAO,CAAC;EACvB;AACF,CAAC,EACmB;EACpB,MAAMG,kBAAkB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AU,CAACE,MAAM,KAAK,SAAS,EAAE;MACnChB,QAAQ,CACNI,SAAS,CAACO,EAAE,EACZ,gCAAgCP,SAAS,CAACO,EAAE,oCAAoC,GAC9E,6CACJ,CAAC;MACD,OAAO,IAAI;IACb;IACA,IAAIG,UAAU,CAACE,MAAM,KAAK,WAAW,EAAE;MACrC,OAAO,IAAI;IACb;IACA,MAAMC,OAAO,GAAGH,UAAU,CAACE,MAAM,KAAK,OAAO;IAC7C,OAAON,YAAY,KAAK,SAAS,GAAGO,OAAO,GAAG,CAACA,OAAO;EACxD;EAEA,MAAMC,QAAQ,GAAG3B,qBAAqB,CAACqB,QAAQ,CAACO,GAAG,CAAC;EACpD,IAAID,QAAQ,IAAI,IAAI,EAAE;IACpBlB,QAAQ,CACNI,SAAS,CAACO,EAAE,EACZ,gCAAgCP,SAAS,CAACO,EAAE,uCAAuC,GACjF,iBACJ,CAAC;IACD,OAAO,IAAI;EACb;EAEA,MAAMG,UAAU,GAAGzB,iBAAiB,CAAC6B,QAAQ,CAAC;EAC9C;EACA;EACA;EACA,IAAIJ,UAAU,CAACE,MAAM,KAAK,WAAW,EAAE;IACrC,OAAO,IAAI;EACb;EACA,MAAMC,OAAO,GAAGH,UAAU,CAACE,MAAM,KAAK,OAAO;EAC7C,OAAON,YAAY,KAAK,SAAS,GAAGO,OAAO,GAAG,CAACA,OAAO;AACxD","ignoreList":[]}
1
+ {"version":3,"names":["decodeMobileAutoData","anchorChangeTicker","elementTapMonitor","fiberIsUnder","tapPathDisabled","resolveElementTargets","tapMayHitSelector","resolveManualAnchorId","MAX_MEASURED_HOSTS","MEASURE_TIMEOUT_MS","createElementConditionEvaluator","warn","message","__DEV__","console","warnedConditionIds","Set","warnOnce","conditionId","has","add","condition","report","context","elementState","trackPresence","trackClick","id","generation","reportedGeneration","measuring","changedWhileMeasuring","disposed","evaluate","gen","resolution","selector","status","silent","warnUnknown","measureVisibility","targets","catch","then","visibility","present","unsubscribe","subscribe","clickSelectorUsable","valueWhenOccurred","previousIsTrue","latched","stopWatchingResolution","type","reportUnclickedOnceResolvable","subscription","tap","matched","find","target","fiber","targetFiber","immediate","autoData","fingerprint","css","slice","measured","Promise","all","map","measureHost","some","size","width","height","includes","length","resolve","settled","finish","value","clearTimeout","timer","setTimeout","host","measureInWindow","_x","_y"],"sourceRoot":"../../../src","sources":["anchors/elementConditionEvaluator.ts"],"mappings":";;AAKA,SAASA,oBAAoB,QAAoC,yBAAyB;AAE1F,SAASC,kBAAkB,QAAQ,yBAAsB;AACzD,SAASC,iBAAiB,QAAQ,wBAAqB;AACvD,SAASC,YAAY,EAAEC,eAAe,QAAQ,yBAAsB;AACpE,SACEC,qBAAqB,EACrBC,iBAAiB,QAEZ,4BAAyB;AAChC,SAASC,qBAAqB,QAAQ,4BAAyB;;AAE/D;AACA,MAAMC,kBAAkB,GAAG,CAAC;;AAE5B;AACA,MAAMC,kBAAkB,GAAG,GAAG;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,+BAA+BA,CAC7CC,IAA+B,GAAIC,OAAO,IAAK;EAC7C,IAAIC,OAAO,EAAE;IACX;IACAC,OAAO,CAACH,IAAI,CAACC,OAAO,CAAC;EACvB;AACF,CAAC,EACmB;EACpB,MAAMG,kBAAkB,GAAG,IAAIC,GAAG,CAAS,CAAC;EAE5C,MAAMC,QAAQ,GAAGA,CAACC,WAAmB,EAAEN,OAAe,KAAW;IAC/D,IAAIG,kBAAkB,CAACI,GAAG,CAACD,WAAW,CAAC,EAAE;IACzCH,kBAAkB,CAACK,GAAG,CAACF,WAAW,CAAC;IACnCP,IAAI,CAACC,OAAO,CAAC;EACf,CAAC;EAED,OAAO,CAACS,SAAS,EAAEC,MAAM,EAAEC,OAAO,KAAK;IACrC,MAAMC,YAAY,GAAGH,SAAS,CAACG,YAA6B;IAC5D,IAAIA,YAAY,KAAK,SAAS,IAAIA,YAAY,KAAK,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d,KAAK,EAAEC,MAAM,KAAK;QACrDK,MAAM,CAAC;UAAEN,KAAK;UAAEC;QAAO,CAAC,CAAC;MAC3B,CAAC,CAAC;IACJ,CAAC,CAAC,MAAM;MACNK,MAAM,CAAC,SAAS,CAAC;IACnB;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Pass-through tap observation for ELEMENT CLICK / NOT_CLICK conditions.
5
+ *
6
+ * Many conditions can subscribe at once. Touch start/end are paired per finger
7
+ * and a tap is emitted only when movement stays within the same slop the
8
+ * tooltip target-press monitor uses. The host fiber is the one captured at
9
+ * touch start, before the press's setState commits a new tree.
10
+ *
11
+ * With no subscribers the monitor stores nothing, so the bridge can skip the
12
+ * fiber lookup entirely.
13
+ */
14
+
15
+ import { withinTapSlop } from "./targetPressMonitor.js";
16
+ export class ElementTapMonitor {
17
+ listeners = new Set();
18
+ touchStarts = new Map();
19
+ get subscriberCount() {
20
+ return this.listeners.size;
21
+ }
22
+ subscribe(listener) {
23
+ this.listeners.add(listener);
24
+ return () => {
25
+ this.listeners.delete(listener);
26
+ if (this.listeners.size === 0) {
27
+ this.touchStarts.clear();
28
+ }
29
+ };
30
+ }
31
+ handleTouchStart(identifier, pageX, pageY, targetFiber) {
32
+ if (this.listeners.size === 0) {
33
+ this.touchStarts.clear();
34
+ return;
35
+ }
36
+ this.touchStarts.set(identifier, {
37
+ pageX,
38
+ pageY,
39
+ targetFiber
40
+ });
41
+ }
42
+
43
+ /**
44
+ * Emit a tap when this finger started and ended within slop on a resolved
45
+ * host. Never claims the responder.
46
+ */
47
+ handleTouchEnd(identifier, pageX, pageY) {
48
+ const start = this.touchStarts.get(identifier) ?? null;
49
+ this.touchStarts.delete(identifier);
50
+ if (!start || this.listeners.size === 0 || !start.targetFiber) return;
51
+ if (!withinTapSlop(start, {
52
+ pageX,
53
+ pageY
54
+ })) return;
55
+ const tap = {
56
+ targetFiber: start.targetFiber
57
+ };
58
+ for (const listener of this.listeners) {
59
+ // One condition's failure must not cost the others this tap, or abort
60
+ // the bridge's handling of the event's remaining touches.
61
+ try {
62
+ listener(tap);
63
+ } catch {
64
+ // The condition stays at its current value.
65
+ }
66
+ }
67
+ }
68
+
69
+ /** Drop in-progress gesture(s). Omit `identifier` to clear every finger. */
70
+ cancelTouch(identifier) {
71
+ if (identifier == null) {
72
+ this.touchStarts.clear();
73
+ return;
74
+ }
75
+ this.touchStarts.delete(identifier);
76
+ }
77
+
78
+ /** Test helper. */
79
+ resetForTests() {
80
+ this.listeners.clear();
81
+ this.touchStarts.clear();
82
+ }
83
+ }
84
+
85
+ /** Shared singleton used by TargetPressBridge and the element-condition evaluator. */
86
+ export const elementTapMonitor = new ElementTapMonitor();
87
+ //# sourceMappingURL=elementTapMonitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withinTapSlop","ElementTapMonitor","listeners","Set","touchStarts","Map","subscriberCount","size","subscribe","listener","add","delete","clear","handleTouchStart","identifier","pageX","pageY","targetFiber","set","handleTouchEnd","start","get","tap","cancelTouch","resetForTests","elementTapMonitor"],"sourceRoot":"../../../src","sources":["anchors/elementTapMonitor.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAgDA,aAAa,QAAQ,yBAAsB;AAY3F,OAAO,MAAMC,iBAAiB,CAAC;EACZC,SAAS,GAAG,IAAIC,GAAG,CAAqB,CAAC;EACzCC,WAAW,GAAG,IAAIC,GAAG,CAA8B,CAAC;EAErE,IAAIC,eAAeA,CAAA,EAAW;IAC5B,OAAO,IAAI,CAACJ,SAAS,CAACK,IAAI;EAC5B;EAEAC,SAASA,CAACC,QAA4B,EAAc;IAClD,IAAI,CAACP,SAAS,CAACQ,GAAG,CAACD,QAAQ,CAAC;IAC5B,OAAO,MAAM;MACX,IAAI,CAACP,SAAS,CAACS,MAAM,CAACF,QAAQ,CAAC;MAC/B,IAAI,IAAI,CAACP,SAA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O,MAAM,CAACG,UAAU,CAAC;EACrC;;EAEA;EACAU,aAAaA,CAAA,EAAS;IACpB,IAAI,CAACtB,SAAS,CAACU,KAAK,CAAC,CAAC;IACtB,IAAI,CAACR,WAAW,CAACQ,KAAK,CAAC,CAAC;EAC1B;AACF;;AAEA;AACA,OAAO,MAAMa,iBAAiB,GAAG,IAAIxB,iBAAiB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Compare a touch-start fiber with a host resolved later, tolerating the
5
+ * alternate swap a Pressable `pressed` re-render does mid-gesture.
6
+ */
7
+
8
+ import { MAX_ANCESTOR_WALK, getAlternate, getLiveHostProps, getMemoizedProps, getReturn } from "./fiber/fiberInternals.js";
9
+ import { ANCHOR_PROP_TIERS } from "./fiber/findAnchorFiber.js";
10
+ const anchorIdsByTap = new WeakMap();
11
+
12
+ /**
13
+ * Anchor ids on the tapped fiber and its ancestors, built once per tap and
14
+ * shared by every click condition it is delivered to.
15
+ */
16
+ export function anchorIdsAboveTap(tap) {
17
+ const cached = anchorIdsByTap.get(tap);
18
+ if (cached) return cached;
19
+ const ids = new Set();
20
+ let current = tap.targetFiber;
21
+ for (let depth = 0; current && depth < MAX_ANCESTOR_WALK; depth += 1) {
22
+ const props = getMemoizedProps(current);
23
+ if (props) {
24
+ for (const tier of ANCHOR_PROP_TIERS) {
25
+ const value = props[tier];
26
+ if (typeof value === 'string') ids.add(value);
27
+ }
28
+ }
29
+ current = getReturn(current);
30
+ }
31
+ anchorIdsByTap.set(tap, ids);
32
+ return ids;
33
+ }
34
+ export function sameFiber(a, b) {
35
+ if (a == null || b == null) return false;
36
+ if (a === b) return true;
37
+ const aAlt = getAlternate(a);
38
+ const bAlt = getAlternate(b);
39
+ return a === bAlt || aAlt === b || aAlt != null && aAlt === bAlt;
40
+ }
41
+
42
+ /** True when `node` is `host` or a descendant of it. */
43
+ export function fiberIsUnder(node, host) {
44
+ let current = node;
45
+ for (let depth = 0; current && depth < MAX_ANCESTOR_WALK; depth += 1) {
46
+ if (sameFiber(current, host)) return true;
47
+ current = getReturn(current);
48
+ }
49
+ return false;
50
+ }
51
+ function fiberDisabled(fiber) {
52
+ let props;
53
+ try {
54
+ props = getLiveHostProps(fiber);
55
+ } catch {
56
+ return false;
57
+ }
58
+ if (!props) return false;
59
+ if (props.disabled === true) return true;
60
+ if (props['aria-disabled'] === true) return true;
61
+ const state = props.accessibilityState;
62
+ return typeof state === 'object' && state !== null && state.disabled === true;
63
+ }
64
+
65
+ /**
66
+ * True when the tapped fiber, the matched host, or a fiber between them is
67
+ * disabled. Browsers do not fire `click` on a disabled control.
68
+ */
69
+ export function tapPathDisabled(tapped, host) {
70
+ let current = tapped;
71
+ for (let depth = 0; current && depth < MAX_ANCESTOR_WALK; depth += 1) {
72
+ if (fiberDisabled(current)) return true;
73
+ if (sameFiber(current, host)) return false;
74
+ current = getReturn(current);
75
+ }
76
+ return fiberDisabled(host);
77
+ }
78
+ //# sourceMappingURL=elementTargetMatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MAX_ANCESTOR_WALK","getAlternate","getLiveHostProps","getMemoizedProps","getReturn","ANCHOR_PROP_TIERS","anchorIdsByTap","WeakMap","anchorIdsAboveTap","tap","cached","get","ids","Set","current","targetFiber","depth","props","tier","value","add","set","sameFiber","a","b","aAlt","bAlt","fiberIsUnder","node","host","fiberDisabled","fiber","disabled","state","accessibilityState","tapPathDisabled","tapped"],"sourceRoot":"../../../src","sources":["anchors/elementTargetMatch.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,SAEEA,iBAAiB,EACjBC,YAAY,EACZC,gBAAgB,EAChBC,gBAAgB,EAChBC,SAAS,QACJ,2BAAwB;AAC/B,SAASC,iBAAiB,QAAQ,4BAAyB;AAE3D,MAAMC,cAAc,GAAG,IAAIC,OAAO,CAAkC,CAAC;;AAErE;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,GAAe,EAAuB;E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