@robertlinde/react-tour-kit 0.8.9 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/MIGRATION.md +205 -0
  3. package/README.md +401 -850
  4. package/dist/react-native-platform/hooks/use-tour-scroll-view.hook.d.ts +14 -0
  5. package/dist/react-native-platform/hooks/use-tour-scroll-view.hook.d.ts.map +1 -0
  6. package/dist/react-native-platform/hooks/use-tour-scroll-view.hook.js +21 -0
  7. package/dist/react-native-platform/hooks/use-tour-scroll-view.hook.js.map +1 -0
  8. package/dist/react-native-platform/hooks/use-tour-target.hook.d.ts +15 -0
  9. package/dist/react-native-platform/hooks/use-tour-target.hook.d.ts.map +1 -0
  10. package/dist/react-native-platform/hooks/use-tour-target.hook.js +28 -0
  11. package/dist/react-native-platform/hooks/use-tour-target.hook.js.map +1 -0
  12. package/dist/react-native-platform/host-store.d.ts +24 -0
  13. package/dist/react-native-platform/host-store.d.ts.map +1 -0
  14. package/dist/react-native-platform/host-store.js +63 -0
  15. package/dist/react-native-platform/host-store.js.map +1 -0
  16. package/dist/react-native-platform/insets.util.d.ts +11 -0
  17. package/dist/react-native-platform/insets.util.d.ts.map +1 -0
  18. package/dist/react-native-platform/insets.util.js +31 -0
  19. package/dist/react-native-platform/insets.util.js.map +1 -0
  20. package/dist/react-native-platform/layer/native-renderer.d.ts +7 -0
  21. package/dist/react-native-platform/layer/native-renderer.d.ts.map +1 -0
  22. package/dist/react-native-platform/layer/native-renderer.js +496 -0
  23. package/dist/react-native-platform/layer/native-renderer.js.map +1 -0
  24. package/dist/react-native-platform/layer/tour-host.d.ts +13 -0
  25. package/dist/react-native-platform/layer/tour-host.d.ts.map +1 -0
  26. package/dist/react-native-platform/layer/tour-host.js +70 -0
  27. package/dist/react-native-platform/layer/tour-host.js.map +1 -0
  28. package/dist/react-native-platform/measure.util.d.ts +20 -0
  29. package/dist/react-native-platform/measure.util.d.ts.map +1 -0
  30. package/dist/react-native-platform/measure.util.js +100 -0
  31. package/dist/react-native-platform/measure.util.js.map +1 -0
  32. package/dist/react-native-platform/native-context.d.ts +12 -0
  33. package/dist/react-native-platform/native-context.d.ts.map +1 -0
  34. package/dist/react-native-platform/native-context.js +4 -0
  35. package/dist/react-native-platform/native-context.js.map +1 -0
  36. package/dist/react-native-platform/native-environment.d.ts +14 -0
  37. package/dist/react-native-platform/native-environment.d.ts.map +1 -0
  38. package/dist/react-native-platform/native-environment.js +20 -0
  39. package/dist/react-native-platform/native-environment.js.map +1 -0
  40. package/dist/react-native-platform/native-platform.d.ts +19 -0
  41. package/dist/react-native-platform/native-platform.d.ts.map +1 -0
  42. package/dist/react-native-platform/native-platform.js +265 -0
  43. package/dist/react-native-platform/native-platform.js.map +1 -0
  44. package/dist/react-native-platform/reduced-motion.d.ts +4 -0
  45. package/dist/react-native-platform/reduced-motion.d.ts.map +1 -0
  46. package/dist/react-native-platform/reduced-motion.js +44 -0
  47. package/dist/react-native-platform/reduced-motion.js.map +1 -0
  48. package/dist/react-native-platform/registry.d.ts +18 -0
  49. package/dist/react-native-platform/registry.d.ts.map +1 -0
  50. package/dist/react-native-platform/registry.js +51 -0
  51. package/dist/react-native-platform/registry.js.map +1 -0
  52. package/dist/react-native-platform/tour-provider.d.ts +16 -3
  53. package/dist/react-native-platform/tour-provider.d.ts.map +1 -0
  54. package/dist/react-native-platform/tour-provider.js +92 -211
  55. package/dist/react-native-platform/tour-provider.js.map +1 -1
  56. package/dist/react-native.d.ts +14 -10
  57. package/dist/react-native.d.ts.map +1 -0
  58. package/dist/react-native.js +7 -7
  59. package/dist/react-native.js.map +1 -1
  60. package/dist/react-platform/dom/elements.util.d.ts +35 -0
  61. package/dist/react-platform/dom/elements.util.d.ts.map +1 -0
  62. package/dist/react-platform/dom/elements.util.js +155 -0
  63. package/dist/react-platform/dom/elements.util.js.map +1 -0
  64. package/dist/react-platform/dom/occluders.util.d.ts +13 -0
  65. package/dist/react-platform/dom/occluders.util.d.ts.map +1 -0
  66. package/dist/react-platform/dom/occluders.util.js +75 -0
  67. package/dist/react-platform/dom/occluders.util.js.map +1 -0
  68. package/dist/react-platform/dom/scroll-lock.util.d.ts +13 -0
  69. package/dist/react-platform/dom/scroll-lock.util.d.ts.map +1 -0
  70. package/dist/react-platform/dom/scroll-lock.util.js +219 -0
  71. package/dist/react-platform/dom/scroll-lock.util.js.map +1 -0
  72. package/dist/react-platform/dom/scroll.util.d.ts +44 -0
  73. package/dist/react-platform/dom/scroll.util.d.ts.map +1 -0
  74. package/dist/react-platform/dom/scroll.util.js +250 -0
  75. package/dist/react-platform/dom/scroll.util.js.map +1 -0
  76. package/dist/react-platform/dom/viewport.util.d.ts +16 -0
  77. package/dist/react-platform/dom/viewport.util.d.ts.map +1 -0
  78. package/dist/react-platform/dom/viewport.util.js +65 -0
  79. package/dist/react-platform/dom/viewport.util.js.map +1 -0
  80. package/dist/react-platform/dom/web-platform.d.ts +15 -0
  81. package/dist/react-platform/dom/web-platform.d.ts.map +1 -0
  82. package/dist/react-platform/dom/web-platform.js +169 -0
  83. package/dist/react-platform/dom/web-platform.js.map +1 -0
  84. package/dist/react-platform/layer/styles.d.ts +12 -0
  85. package/dist/react-platform/layer/styles.d.ts.map +1 -0
  86. package/dist/react-platform/layer/styles.js +285 -0
  87. package/dist/react-platform/layer/styles.js.map +1 -0
  88. package/dist/react-platform/layer/web-renderer.d.ts +4 -0
  89. package/dist/react-platform/layer/web-renderer.d.ts.map +1 -0
  90. package/dist/react-platform/layer/web-renderer.js +390 -0
  91. package/dist/react-platform/layer/web-renderer.js.map +1 -0
  92. package/dist/react-platform/tour-provider.d.ts +9 -3
  93. package/dist/react-platform/tour-provider.d.ts.map +1 -0
  94. package/dist/react-platform/tour-provider.js +28 -218
  95. package/dist/react-platform/tour-provider.js.map +1 -1
  96. package/dist/react.d.ts +10 -10
  97. package/dist/react.d.ts.map +1 -0
  98. package/dist/react.js +5 -7
  99. package/dist/react.js.map +1 -1
  100. package/dist/shared/engine/abort.util.d.ts +17 -0
  101. package/dist/shared/engine/abort.util.d.ts.map +1 -0
  102. package/dist/shared/engine/abort.util.js +72 -0
  103. package/dist/shared/engine/abort.util.js.map +1 -0
  104. package/dist/shared/engine/report.util.d.ts +12 -0
  105. package/dist/shared/engine/report.util.d.ts.map +1 -0
  106. package/dist/shared/engine/report.util.js +51 -0
  107. package/dist/shared/engine/report.util.js.map +1 -0
  108. package/dist/shared/engine/tour-adapter.type.d.ts +67 -0
  109. package/dist/shared/engine/tour-adapter.type.d.ts.map +1 -0
  110. package/dist/shared/engine/tour-adapter.type.js +2 -0
  111. package/dist/shared/engine/tour-adapter.type.js.map +1 -0
  112. package/dist/shared/engine/tour-engine.d.ts +101 -0
  113. package/dist/shared/engine/tour-engine.d.ts.map +1 -0
  114. package/dist/shared/engine/tour-engine.js +835 -0
  115. package/dist/shared/engine/tour-engine.js.map +1 -0
  116. package/dist/shared/geometry/box.util.d.ts +39 -0
  117. package/dist/shared/geometry/box.util.d.ts.map +1 -0
  118. package/dist/shared/geometry/box.util.js +146 -0
  119. package/dist/shared/geometry/box.util.js.map +1 -0
  120. package/dist/shared/geometry/compute-tooltip-layout.util.d.ts +60 -0
  121. package/dist/shared/geometry/compute-tooltip-layout.util.d.ts.map +1 -0
  122. package/dist/shared/geometry/compute-tooltip-layout.util.js +148 -0
  123. package/dist/shared/geometry/compute-tooltip-layout.util.js.map +1 -0
  124. package/dist/shared/geometry/geometry.type.d.ts +34 -0
  125. package/dist/shared/geometry/geometry.type.d.ts.map +1 -0
  126. package/dist/shared/geometry/geometry.type.js +2 -0
  127. package/dist/shared/geometry/geometry.type.js.map +1 -0
  128. package/dist/shared/geometry/reveal.util.d.ts +38 -0
  129. package/dist/shared/geometry/reveal.util.d.ts.map +1 -0
  130. package/dist/shared/geometry/reveal.util.js +135 -0
  131. package/dist/shared/geometry/reveal.util.js.map +1 -0
  132. package/dist/shared/geometry/target-visibility.util.d.ts +10 -0
  133. package/dist/shared/geometry/target-visibility.util.d.ts.map +1 -0
  134. package/dist/shared/geometry/target-visibility.util.js +29 -0
  135. package/dist/shared/geometry/target-visibility.util.js.map +1 -0
  136. package/dist/shared/platform/create-tour-adapter.d.ts +9 -0
  137. package/dist/shared/platform/create-tour-adapter.d.ts.map +1 -0
  138. package/dist/shared/platform/create-tour-adapter.js +145 -0
  139. package/dist/shared/platform/create-tour-adapter.js.map +1 -0
  140. package/dist/shared/platform/platform.type.d.ts +77 -0
  141. package/dist/shared/platform/platform.type.d.ts.map +1 -0
  142. package/dist/shared/platform/platform.type.js +2 -0
  143. package/dist/shared/platform/platform.type.js.map +1 -0
  144. package/dist/shared/platform/reveal-in-scroll-containers.d.ts +27 -0
  145. package/dist/shared/platform/reveal-in-scroll-containers.d.ts.map +1 -0
  146. package/dist/shared/platform/reveal-in-scroll-containers.js +49 -0
  147. package/dist/shared/platform/reveal-in-scroll-containers.js.map +1 -0
  148. package/dist/shared/react/tour-context.d.ts +7 -0
  149. package/dist/shared/react/tour-context.d.ts.map +1 -0
  150. package/dist/shared/react/tour-context.js +23 -0
  151. package/dist/shared/react/tour-context.js.map +1 -0
  152. package/dist/shared/react/tour-provider-core.d.ts +41 -0
  153. package/dist/shared/react/tour-provider-core.d.ts.map +1 -0
  154. package/dist/shared/react/tour-provider-core.js +24 -0
  155. package/dist/shared/react/tour-provider-core.js.map +1 -0
  156. package/dist/shared/react/tour-root.d.ts +14 -0
  157. package/dist/shared/react/tour-root.d.ts.map +1 -0
  158. package/dist/shared/react/tour-root.js +22 -0
  159. package/dist/shared/react/tour-root.js.map +1 -0
  160. package/dist/shared/react/use-isomorphic-layout-effect.hook.d.ts +4 -0
  161. package/dist/shared/react/use-isomorphic-layout-effect.hook.d.ts.map +1 -0
  162. package/dist/shared/react/use-isomorphic-layout-effect.hook.js +5 -0
  163. package/dist/shared/react/use-isomorphic-layout-effect.hook.js.map +1 -0
  164. package/dist/shared/react/use-tour-view.hook.d.ts +5 -0
  165. package/dist/shared/react/use-tour-view.hook.d.ts.map +1 -0
  166. package/dist/shared/react/use-tour-view.hook.js +14 -0
  167. package/dist/shared/react/use-tour-view.hook.js.map +1 -0
  168. package/dist/shared/react/use-tour.hook.d.ts +7 -0
  169. package/dist/shared/react/use-tour.hook.d.ts.map +1 -0
  170. package/dist/shared/react/use-tour.hook.js +10 -0
  171. package/dist/shared/react/use-tour.hook.js.map +1 -0
  172. package/dist/shared/renderer/default-tooltip.d.ts +5 -0
  173. package/dist/shared/renderer/default-tooltip.d.ts.map +1 -0
  174. package/dist/shared/renderer/default-tooltip.js +13 -0
  175. package/dist/shared/renderer/default-tooltip.js.map +1 -0
  176. package/dist/shared/renderer/motion.d.ts +29 -0
  177. package/dist/shared/renderer/motion.d.ts.map +1 -0
  178. package/dist/shared/renderer/motion.js +49 -0
  179. package/dist/shared/renderer/motion.js.map +1 -0
  180. package/dist/shared/renderer/renderer-context.d.ts +17 -0
  181. package/dist/shared/renderer/renderer-context.d.ts.map +1 -0
  182. package/dist/shared/renderer/renderer-context.js +16 -0
  183. package/dist/shared/renderer/renderer-context.js.map +1 -0
  184. package/dist/shared/renderer/renderer.type.d.ts +164 -0
  185. package/dist/shared/renderer/renderer.type.d.ts.map +1 -0
  186. package/dist/shared/renderer/renderer.type.js +2 -0
  187. package/dist/shared/renderer/renderer.type.js.map +1 -0
  188. package/dist/shared/renderer/tooltip-model.d.ts +32 -0
  189. package/dist/shared/renderer/tooltip-model.d.ts.map +1 -0
  190. package/dist/shared/renderer/tooltip-model.js +24 -0
  191. package/dist/shared/renderer/tooltip-model.js.map +1 -0
  192. package/dist/shared/renderer/tour-overlay.d.ts +24 -0
  193. package/dist/shared/renderer/tour-overlay.d.ts.map +1 -0
  194. package/dist/shared/renderer/tour-overlay.js +228 -0
  195. package/dist/shared/renderer/tour-overlay.js.map +1 -0
  196. package/dist/shared/types/tour-context.type.d.ts +21 -11
  197. package/dist/shared/types/tour-context.type.d.ts.map +1 -0
  198. package/dist/shared/types/tour-end-info.type.d.ts +19 -2
  199. package/dist/shared/types/tour-end-info.type.d.ts.map +1 -0
  200. package/dist/shared/types/tour-i18n.type.d.ts +8 -0
  201. package/dist/shared/types/tour-i18n.type.d.ts.map +1 -0
  202. package/dist/shared/types/tour-step.type.d.ts +35 -6
  203. package/dist/shared/types/tour-step.type.d.ts.map +1 -0
  204. package/dist/shared/types/tour-theme.type.d.ts +22 -2
  205. package/dist/shared/types/tour-theme.type.d.ts.map +1 -0
  206. package/dist/shared/types/tour-theme.type.js +1 -16
  207. package/dist/shared/types/tour-theme.type.js.map +1 -1
  208. package/dist/shared/types/tour-tooltip-props.type.d.ts +21 -17
  209. package/dist/shared/types/tour-tooltip-props.type.d.ts.map +1 -0
  210. package/dist/shared/utils/frame.util.d.ts +6 -0
  211. package/dist/shared/utils/frame.util.d.ts.map +1 -0
  212. package/dist/shared/utils/frame.util.js +20 -0
  213. package/dist/shared/utils/frame.util.js.map +1 -0
  214. package/dist/shared/utils/get-truncated-dots.util.d.ts +13 -7
  215. package/dist/shared/utils/get-truncated-dots.util.d.ts.map +1 -0
  216. package/dist/shared/utils/get-truncated-dots.util.js +30 -30
  217. package/dist/shared/utils/get-truncated-dots.util.js.map +1 -1
  218. package/dist/shared/utils/i18n.util.d.ts +7 -0
  219. package/dist/shared/utils/i18n.util.d.ts.map +1 -0
  220. package/dist/shared/utils/i18n.util.js +34 -0
  221. package/dist/shared/utils/i18n.util.js.map +1 -0
  222. package/dist/shared/utils/theme.util.d.ts +6 -0
  223. package/dist/shared/utils/theme.util.d.ts.map +1 -0
  224. package/dist/shared/utils/theme.util.js +31 -0
  225. package/dist/shared/utils/theme.util.js.map +1 -0
  226. package/package.json +72 -55
  227. package/src/react-native-platform/hooks/use-tour-scroll-view.hook.ts +24 -0
  228. package/src/react-native-platform/hooks/use-tour-target.hook.ts +30 -0
  229. package/src/react-native-platform/host-store.ts +92 -0
  230. package/src/react-native-platform/insets.util.ts +39 -0
  231. package/src/react-native-platform/layer/native-renderer.tsx +776 -0
  232. package/src/react-native-platform/layer/tour-host.tsx +105 -0
  233. package/src/react-native-platform/measure.util.ts +140 -0
  234. package/src/react-native-platform/native-context.ts +15 -0
  235. package/src/react-native-platform/native-environment.ts +33 -0
  236. package/src/react-native-platform/native-platform.ts +368 -0
  237. package/src/react-native-platform/reduced-motion.ts +47 -0
  238. package/src/react-native-platform/registry.ts +70 -0
  239. package/src/react-native-platform/tour-provider.tsx +148 -0
  240. package/src/react-native.ts +15 -0
  241. package/src/react-platform/dom/elements.util.ts +191 -0
  242. package/src/react-platform/dom/occluders.util.ts +88 -0
  243. package/src/react-platform/dom/scroll-lock.util.ts +261 -0
  244. package/src/react-platform/dom/scroll.util.ts +310 -0
  245. package/src/react-platform/dom/viewport.util.ts +74 -0
  246. package/src/react-platform/dom/web-platform.ts +208 -0
  247. package/src/react-platform/layer/styles.ts +286 -0
  248. package/src/react-platform/layer/web-renderer.tsx +594 -0
  249. package/src/react-platform/tour-provider.tsx +44 -0
  250. package/src/react.ts +13 -0
  251. package/src/shared/engine/abort.util.ts +84 -0
  252. package/src/shared/engine/report.util.ts +58 -0
  253. package/src/shared/engine/tour-adapter.type.ts +73 -0
  254. package/src/shared/engine/tour-engine.ts +1147 -0
  255. package/src/shared/geometry/box.util.ts +185 -0
  256. package/src/shared/geometry/compute-tooltip-layout.util.ts +238 -0
  257. package/src/shared/geometry/geometry.type.ts +38 -0
  258. package/src/shared/geometry/reveal.util.ts +190 -0
  259. package/src/shared/geometry/target-visibility.util.ts +44 -0
  260. package/src/shared/platform/create-tour-adapter.ts +169 -0
  261. package/src/shared/platform/platform.type.ts +81 -0
  262. package/src/shared/platform/reveal-in-scroll-containers.ts +78 -0
  263. package/src/shared/react/tour-context.ts +28 -0
  264. package/src/shared/react/tour-provider-core.ts +67 -0
  265. package/src/shared/react/tour-root.tsx +34 -0
  266. package/src/shared/react/use-isomorphic-layout-effect.hook.ts +7 -0
  267. package/src/shared/react/use-tour-view.hook.ts +17 -0
  268. package/src/shared/react/use-tour.hook.ts +11 -0
  269. package/src/shared/renderer/default-tooltip.tsx +52 -0
  270. package/src/shared/renderer/motion.ts +59 -0
  271. package/src/shared/renderer/renderer-context.ts +33 -0
  272. package/src/shared/renderer/renderer.type.ts +183 -0
  273. package/src/shared/renderer/tooltip-model.ts +44 -0
  274. package/src/shared/renderer/tour-overlay.tsx +453 -0
  275. package/src/shared/types/tour-context.type.ts +23 -0
  276. package/src/shared/types/tour-end-info.type.ts +32 -0
  277. package/src/shared/types/tour-i18n.type.ts +15 -0
  278. package/src/shared/types/tour-step.type.ts +40 -0
  279. package/src/shared/types/tour-theme.type.ts +28 -0
  280. package/src/shared/types/tour-tooltip-props.type.ts +27 -0
  281. package/src/shared/utils/frame.util.ts +21 -0
  282. package/src/shared/utils/get-truncated-dots.util.ts +46 -0
  283. package/src/shared/utils/i18n.util.ts +44 -0
  284. package/src/shared/utils/theme.util.ts +38 -0
  285. package/dist/react-native-platform/components/index.d.ts +0 -2
  286. package/dist/react-native-platform/components/index.js +0 -3
  287. package/dist/react-native-platform/components/index.js.map +0 -1
  288. package/dist/react-native-platform/components/tour-overlay.d.ts +0 -3
  289. package/dist/react-native-platform/components/tour-overlay.js +0 -26
  290. package/dist/react-native-platform/components/tour-overlay.js.map +0 -1
  291. package/dist/react-native-platform/components/tour-tooltip.d.ts +0 -3
  292. package/dist/react-native-platform/components/tour-tooltip.js +0 -167
  293. package/dist/react-native-platform/components/tour-tooltip.js.map +0 -1
  294. package/dist/react-native-platform/hooks/index.d.ts +0 -1
  295. package/dist/react-native-platform/hooks/index.js +0 -2
  296. package/dist/react-native-platform/hooks/index.js.map +0 -1
  297. package/dist/react-native-platform/hooks/use-tour-target.d.ts +0 -2
  298. package/dist/react-native-platform/hooks/use-tour-target.js +0 -13
  299. package/dist/react-native-platform/hooks/use-tour-target.js.map +0 -1
  300. package/dist/react-native-platform/index.d.ts +0 -7
  301. package/dist/react-native-platform/index.js +0 -7
  302. package/dist/react-native-platform/index.js.map +0 -1
  303. package/dist/react-native-platform/platform-adapter.d.ts +0 -2
  304. package/dist/react-native-platform/platform-adapter.js +0 -84
  305. package/dist/react-native-platform/platform-adapter.js.map +0 -1
  306. package/dist/react-native-platform/target-registry.d.ts +0 -10
  307. package/dist/react-native-platform/target-registry.js +0 -17
  308. package/dist/react-native-platform/target-registry.js.map +0 -1
  309. package/dist/react-native-platform/types/tour-provider.props.type.d.ts +0 -12
  310. package/dist/react-native-platform/types/tour-provider.props.type.js +0 -2
  311. package/dist/react-native-platform/types/tour-provider.props.type.js.map +0 -1
  312. package/dist/react-platform/components/index.d.ts +0 -2
  313. package/dist/react-platform/components/index.js +0 -3
  314. package/dist/react-platform/components/index.js.map +0 -1
  315. package/dist/react-platform/components/tour-overlay.d.ts +0 -3
  316. package/dist/react-platform/components/tour-overlay.js +0 -29
  317. package/dist/react-platform/components/tour-overlay.js.map +0 -1
  318. package/dist/react-platform/components/tour-tooltip.d.ts +0 -2
  319. package/dist/react-platform/components/tour-tooltip.js +0 -155
  320. package/dist/react-platform/components/tour-tooltip.js.map +0 -1
  321. package/dist/react-platform/index.d.ts +0 -6
  322. package/dist/react-platform/index.js +0 -6
  323. package/dist/react-platform/index.js.map +0 -1
  324. package/dist/react-platform/platform-adapter.d.ts +0 -2
  325. package/dist/react-platform/platform-adapter.js +0 -101
  326. package/dist/react-platform/platform-adapter.js.map +0 -1
  327. package/dist/react-platform/types/tour-provider.props.type.d.ts +0 -12
  328. package/dist/react-platform/types/tour-provider.props.type.js +0 -2
  329. package/dist/react-platform/types/tour-provider.props.type.js.map +0 -1
  330. package/dist/react-platform/utils/find-visible-element.util.d.ts +0 -1
  331. package/dist/react-platform/utils/find-visible-element.util.js +0 -11
  332. package/dist/react-platform/utils/find-visible-element.util.js.map +0 -1
  333. package/dist/react-platform/utils/index.d.ts +0 -1
  334. package/dist/react-platform/utils/index.js +0 -2
  335. package/dist/react-platform/utils/index.js.map +0 -1
  336. package/dist/shared/context/index.d.ts +0 -1
  337. package/dist/shared/context/index.js +0 -2
  338. package/dist/shared/context/index.js.map +0 -1
  339. package/dist/shared/context/tour-context.d.ts +0 -3
  340. package/dist/shared/context/tour-context.js +0 -14
  341. package/dist/shared/context/tour-context.js.map +0 -1
  342. package/dist/shared/hooks/index.d.ts +0 -1
  343. package/dist/shared/hooks/index.js +0 -2
  344. package/dist/shared/hooks/index.js.map +0 -1
  345. package/dist/shared/hooks/use-tour.hook.d.ts +0 -2
  346. package/dist/shared/hooks/use-tour.hook.js +0 -7
  347. package/dist/shared/hooks/use-tour.hook.js.map +0 -1
  348. package/dist/shared/index.d.ts +0 -7
  349. package/dist/shared/index.js +0 -6
  350. package/dist/shared/index.js.map +0 -1
  351. package/dist/shared/types/index.d.ts +0 -10
  352. package/dist/shared/types/index.js +0 -2
  353. package/dist/shared/types/index.js.map +0 -1
  354. package/dist/shared/types/platform-adapter.type.d.ts +0 -24
  355. package/dist/shared/types/platform-adapter.type.js +0 -2
  356. package/dist/shared/types/platform-adapter.type.js.map +0 -1
  357. package/dist/shared/types/rect.type.d.ts +0 -11
  358. package/dist/shared/types/rect.type.js +0 -2
  359. package/dist/shared/types/rect.type.js.map +0 -1
  360. package/dist/shared/types/tour-overlay-props.type.d.ts +0 -8
  361. package/dist/shared/types/tour-overlay-props.type.js +0 -2
  362. package/dist/shared/types/tour-overlay-props.type.js.map +0 -1
  363. package/dist/shared/utils/calculate-tooltip-position.util.d.ts +0 -14
  364. package/dist/shared/utils/calculate-tooltip-position.util.js +0 -49
  365. package/dist/shared/utils/calculate-tooltip-position.util.js.map +0 -1
  366. package/dist/shared/utils/index.d.ts +0 -3
  367. package/dist/shared/utils/index.js +0 -3
  368. package/dist/shared/utils/index.js.map +0 -1
@@ -0,0 +1,155 @@
1
+ export function toBox(rect) {
2
+ return { x: rect.left, y: rect.top, width: rect.width, height: rect.height };
3
+ }
4
+ /**
5
+ * False in documents without a layout engine (jsdom, happy-dom in test suites): every size there is
6
+ * zero. A real page always has a size, also a zero-sized frame (its window is zero-sized too).
7
+ */
8
+ export function hasLayout() {
9
+ const root = document.documentElement;
10
+ return root.clientWidth > 0 || root.clientHeight > 0 || globalThis.innerWidth === 0 || globalThis.innerHeight === 0;
11
+ }
12
+ /** `checkVisibility()` where the browser has it. */
13
+ export function checkVisibility(element, options) {
14
+ const check = element.checkVisibility;
15
+ return typeof check === 'function' ? check.call(element, options) : undefined;
16
+ }
17
+ /** True when the element takes up space and is not hidden (`display: none`, `visibility: hidden`, closed `<details>`). */
18
+ export function isRendered(element) {
19
+ if (!hasLayout()) {
20
+ // Nothing has a size: count every element that is not explicitly hidden.
21
+ return element.isConnected && !element.closest('[hidden]') && getComputedStyle(element).display !== 'none';
22
+ }
23
+ const rect = element.getBoundingClientRect();
24
+ if (rect.width <= 0 && rect.height <= 0) {
25
+ return false;
26
+ }
27
+ return checkVisibility(element, { visibilityProperty: true }) ?? getComputedStyle(element).visibility !== 'hidden';
28
+ }
29
+ /**
30
+ * Resolves a target to an element. For selectors, the first rendered match wins, which handles
31
+ * layouts that duplicate markup (for example a mobile and a desktop navigation).
32
+ */
33
+ export function resolveTarget(target) {
34
+ if (typeof target === 'string') {
35
+ let matches;
36
+ try {
37
+ matches = document.querySelectorAll(target);
38
+ }
39
+ catch {
40
+ return undefined;
41
+ }
42
+ for (const element of matches) {
43
+ if (isRendered(element)) {
44
+ return element;
45
+ }
46
+ }
47
+ return matches[0] ?? undefined;
48
+ }
49
+ const { current } = target;
50
+ return current instanceof Element ? current : undefined;
51
+ }
52
+ /** The parent element, crossing shadow-root boundaries. */
53
+ export function parentOf(element) {
54
+ if (element.parentElement) {
55
+ return element.parentElement;
56
+ }
57
+ const root = element.getRootNode();
58
+ return root instanceof ShadowRoot ? root.host : undefined;
59
+ }
60
+ /** `ancestor.contains(element)`, also for elements inside shadow roots of the ancestor's descendants. */
61
+ export function containsComposed(ancestor, element) {
62
+ for (let current = element; current; current = parentOf(current)) {
63
+ if (current === ancestor) {
64
+ return true;
65
+ }
66
+ }
67
+ return false;
68
+ }
69
+ /**
70
+ * The page's direction. Browsers take it from `<body>` (CSS calls it the principal writing mode),
71
+ * so `<body dir="rtl">` turns the page right-to-left even when `<html>` is left-to-right.
72
+ */
73
+ export function pageDirection() {
74
+ const element = document.body ?? document.documentElement;
75
+ return getComputedStyle(element).direction === 'rtl' ? 'rtl' : 'ltr';
76
+ }
77
+ const textInputTypes = new Set([
78
+ 'text',
79
+ 'search',
80
+ 'email',
81
+ 'url',
82
+ 'tel',
83
+ 'password',
84
+ 'number',
85
+ 'date',
86
+ 'datetime-local',
87
+ 'month',
88
+ 'week',
89
+ 'time',
90
+ ]);
91
+ /** Inputs that a space press activates or toggles. */
92
+ const pressableInputTypes = new Set(['button', 'submit', 'reset', 'image', 'checkbox', 'file', 'color']);
93
+ const arrowKeys = new Set(['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight']);
94
+ const rangeKeys = new Set([...arrowKeys, 'PageUp', 'PageDown', 'Home', 'End']);
95
+ /** Widgets whose arrow, page, Home and End keys move a selection or change a value. */
96
+ const keyedWidgetSelector = [
97
+ 'slider',
98
+ 'spinbutton',
99
+ 'radio',
100
+ 'radiogroup',
101
+ 'tab',
102
+ 'tablist',
103
+ 'listbox',
104
+ 'option',
105
+ 'menu',
106
+ 'menubar',
107
+ 'menuitem',
108
+ 'menuitemcheckbox',
109
+ 'menuitemradio',
110
+ 'tree',
111
+ 'treeitem',
112
+ 'treegrid',
113
+ 'grid',
114
+ 'gridcell',
115
+ 'combobox',
116
+ 'textbox',
117
+ 'searchbox',
118
+ 'scrollbar',
119
+ ]
120
+ .map((role) => `[role="${role}"]`)
121
+ .join(', ');
122
+ /** Widgets that a space press activates (links do not: space scrolls the page there). */
123
+ const pressableSelector = 'button, summary, [role="button"], [role="checkbox"], [role="switch"], [role="radio"], [role="option"], [role="tab"], [role="treeitem"], [role^="menuitem"]';
124
+ /**
125
+ * True when the focused element handles `key` itself (typing, toggling, choosing, adjusting a
126
+ * value), so the tour neither navigates nor blocks scrolling with it.
127
+ */
128
+ export function handlesKey(target, key) {
129
+ if (!(target instanceof HTMLElement)) {
130
+ return false;
131
+ }
132
+ if (target.isContentEditable ||
133
+ target instanceof HTMLTextAreaElement ||
134
+ target instanceof HTMLSelectElement ||
135
+ ((target instanceof HTMLAudioElement || target instanceof HTMLVideoElement) && target.controls)) {
136
+ return true;
137
+ }
138
+ if (target instanceof HTMLInputElement) {
139
+ if (textInputTypes.has(target.type)) {
140
+ return true;
141
+ }
142
+ if (target.type === 'radio') {
143
+ return key === ' ' || arrowKeys.has(key);
144
+ }
145
+ if (target.type === 'range') {
146
+ return rangeKeys.has(key);
147
+ }
148
+ return key === ' ' && pressableInputTypes.has(target.type);
149
+ }
150
+ if (key === ' ') {
151
+ return target.closest(pressableSelector) !== null;
152
+ }
153
+ return rangeKeys.has(key) && target.closest(keyedWidgetSelector) !== null;
154
+ }
155
+ //# sourceMappingURL=elements.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elements.util.js","sourceRoot":"","sources":["../../../src/react-platform/dom/elements.util.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,KAAK,CAAC,IAAqB;IACzC,OAAO,EAAC,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC;AAC7E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,IAAI,GAAG,QAAQ,CAAC,eAAe,CAAC;IACtC,OAAO,IAAI,CAAC,WAAW,GAAG,CAAC,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC,IAAI,UAAU,CAAC,UAAU,KAAK,CAAC,IAAI,UAAU,CAAC,WAAW,KAAK,CAAC,CAAC;AACtH,CAAC;AAID,oDAAoD;AACpD,MAAM,UAAU,eAAe,CAC7B,OAAgB,EAChB,OAAkE;IAElE,MAAM,KAAK,GAAI,OAA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AAY,gBAAgB,EAAE,CAAC;QACvC,IAAI,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC5B,OAAO,GAAG,KAAK,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC5B,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC;QAED,OAAO,GAAG,KAAK,GAAG,IAAI,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;QAChB,OAAO,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACpD,CAAC;IAED,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Box } from '../../shared/geometry/geometry.type.js';
2
+ /** Forgets the cached elements, so a page that has been navigated away from is not kept in memory. */
3
+ export declare function clearOccluderCache(): void;
4
+ /**
5
+ * Rectangles (viewport coordinates) of elements that can cover the target. Excluded: elements
6
+ * containing the target (highlighting a link in a sticky navigation) or inside it, empty or
7
+ * invisible ones, and ones covering more than half the screen (app shells, full-screen
8
+ * backgrounds), which cannot be scrolled away from.
9
+ */
10
+ export declare function findOccluders(target: Element | undefined, layer: Element | undefined): Box[];
11
+ /** The occluders overlapping `box`. */
12
+ export declare function occludersOver(box: Box, occluders: readonly Box[]): Box[];
13
+ //# sourceMappingURL=occluders.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"occluders.util.d.ts","sourceRoot":"","sources":["../../../src/react-platform/dom/occluders.util.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,wCAAwC,CAAC;AAgBhE,sGAAsG;AACtG,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAuCD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,GAAG,EAAE,CAiB5F;AAED,uCAAuC;AACvC,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,GAAG,EAAE,GAAG,GAAG,EAAE,CAExE"}
@@ -0,0 +1,75 @@
1
+ import { intersect } from '../../shared/geometry/box.util.js';
2
+ import { checkVisibility, containsComposed, toBox } from './elements.util.js';
3
+ /**
4
+ * Elements that stay put while the page scrolls (`position: fixed` or `sticky`): navigation bars,
5
+ * headers, floating buttons, chat widgets, cookie banners, toasts. Anything scrolled underneath
6
+ * them is hidden, so the tour scrolls targets clear of them where it can.
7
+ *
8
+ * Hit-testing (`elementsFromPoint`) cannot find them while the tour is open: the tour is a modal
9
+ * dialog and the inert page is excluded from hit-testing. They are found by computed style instead,
10
+ * also inside open shadow roots (web components). The list is cached briefly so following a
11
+ * scrolling target does not rescan the page every frame.
12
+ */
13
+ const rescanAfterMs = 500;
14
+ let cache;
15
+ /** Forgets the cached elements, so a page that has been navigated away from is not kept in memory. */
16
+ export function clearOccluderCache() {
17
+ cache = undefined;
18
+ }
19
+ function stayingPutElements(layer) {
20
+ const now = performance.now();
21
+ if (cache && now - cache.at < rescanAfterMs) {
22
+ return cache.elements;
23
+ }
24
+ const elements = [];
25
+ const scan = (root) => {
26
+ for (const element of root.querySelectorAll('*')) {
27
+ if (element.shadowRoot) {
28
+ scan(element.shadowRoot);
29
+ }
30
+ const { position } = getComputedStyle(element);
31
+ if (position === 'fixed' || position === 'sticky') {
32
+ elements.push(element);
33
+ }
34
+ }
35
+ };
36
+ scan(document.body);
37
+ const found = elements.filter((element) => !layer?.contains(element) && !element.matches('[data-rtk-probe]'));
38
+ cache = { at: now, elements: found };
39
+ return found;
40
+ }
41
+ /** False for elements that are there but cannot be seen: closed menus faded out with `visibility` or `opacity`. */
42
+ function isSeen(element) {
43
+ const checked = checkVisibility(element, { visibilityProperty: true, opacityProperty: true });
44
+ if (checked !== undefined) {
45
+ return checked;
46
+ }
47
+ const style = getComputedStyle(element);
48
+ return style.visibility !== 'hidden' && style.opacity !== '0';
49
+ }
50
+ /**
51
+ * Rectangles (viewport coordinates) of elements that can cover the target. Excluded: elements
52
+ * containing the target (highlighting a link in a sticky navigation) or inside it, empty or
53
+ * invisible ones, and ones covering more than half the screen (app shells, full-screen
54
+ * backgrounds), which cannot be scrolled away from.
55
+ */
56
+ export function findOccluders(target, layer) {
57
+ const screen = { width: document.documentElement.clientWidth, height: document.documentElement.clientHeight };
58
+ const occluders = [];
59
+ for (const element of stayingPutElements(layer)) {
60
+ if (!element.isConnected || (target && (containsComposed(element, target) || containsComposed(target, element)))) {
61
+ continue;
62
+ }
63
+ const rect = toBox(element.getBoundingClientRect());
64
+ const isCovering = rect.width > 0 && rect.height > 0 && rect.width * rect.height <= (screen.width * screen.height) / 2;
65
+ if (isCovering && isSeen(element)) {
66
+ occluders.push(rect);
67
+ }
68
+ }
69
+ return occluders;
70
+ }
71
+ /** The occluders overlapping `box`. */
72
+ export function occludersOver(box, occluders) {
73
+ return occluders.filter((occluder) => intersect(occluder, box) !== undefined);
74
+ }
75
+ //# sourceMappingURL=occluders.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"occluders.util.js","sourceRoot":"","sources":["../../../src/react-platform/dom/occluders.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAE5D,OAAO,EAAC,eAAe,EAAE,gBAAgB,EAAE,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAE5E;;;;;;;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CAAC;YAClC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,aAAa,CAAC,GAAQ,EAAE,SAAyB;IAC/D,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC;AAChF,CAAC"}
@@ -0,0 +1,13 @@
1
+ /** The page's own overflow, also while the tour has locked it. */
2
+ export declare function pageOverflow(): {
3
+ readonly x: string;
4
+ readonly y: string;
5
+ };
6
+ /**
7
+ * Keeps the page from scrolling while the tour is open (wheel, touch, keyboard, overlay scrollbars), so
8
+ * the user cannot scroll the highlighted element out of view. Scrolling inside the tooltip still
9
+ * works, with the keyboard too, and so do keys that controls in the tooltip use themselves.
10
+ * Programmatic scrolling (the tour's own, or the app's) is not affected. Returns the cleanup.
11
+ */
12
+ export declare function lockScroll(layer: HTMLElement): () => void;
13
+ //# sourceMappingURL=scroll-lock.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll-lock.util.d.ts","sourceRoot":"","sources":["../../../src/react-platform/dom/scroll-lock.util.ts"],"names":[],"mappings":"AAuHA,kEAAkE;AAClE,wBAAgB,YAAY,IAAI;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAC,CAEvE;AAyED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,IAAI,CA2DzD"}
@@ -0,0 +1,219 @@
1
+ import { handlesKey, hasLayout } from './elements.util.js';
2
+ import { readPageOverflow } from './scroll.util.js';
3
+ function canScroll(element, deltaX, deltaY) {
4
+ const style = getComputedStyle(element);
5
+ const scrollsY = /auto|scroll|overlay/u.test(style.overflowY) && element.scrollHeight > element.clientHeight;
6
+ const scrollsX = /auto|scroll|overlay/u.test(style.overflowX) && element.scrollWidth > element.clientWidth;
7
+ if (scrollsY && deltaY !== 0) {
8
+ const atTop = element.scrollTop <= 0;
9
+ const atBottom = element.scrollTop + element.clientHeight >= element.scrollHeight - 1;
10
+ if ((deltaY < 0 && !atTop) || (deltaY > 0 && !atBottom)) {
11
+ return true;
12
+ }
13
+ }
14
+ if (scrollsX && deltaX !== 0) {
15
+ const max = element.scrollWidth - element.clientWidth;
16
+ const position = Math.abs(element.scrollLeft);
17
+ if ((deltaX < 0 && position > 0) || (deltaX > 0 && position < max - 1)) {
18
+ return true;
19
+ }
20
+ }
21
+ return false;
22
+ }
23
+ /** True when `from` or one of its ancestors (up to `boundary`) can scroll further in the given direction. */
24
+ function canScrollWithin(from, boundary, deltaX, deltaY) {
25
+ for (let element = from instanceof Element ? from : null; element && element !== boundary; element = element.parentElement) {
26
+ if (canScroll(element, deltaX, deltaY)) {
27
+ return true;
28
+ }
29
+ }
30
+ return false;
31
+ }
32
+ /**
33
+ * The scrollable part of the tooltip (the built-in card's body, or a custom tooltip that does not
34
+ * fit) that can scroll in the given direction, when the focus is on the tooltip itself: browsers
35
+ * only scroll the focused element's ancestors with the keyboard, never its descendants.
36
+ */
37
+ function scrollableInTooltip(from, layer, deltaY) {
38
+ const frame = from === layer
39
+ ? layer.querySelector('[data-rtk-tooltip]:not([data-hidden])')
40
+ : from instanceof Element
41
+ ? from.closest('[data-rtk-tooltip]')
42
+ : null;
43
+ if (!frame || !(from instanceof Element) || (from !== layer && !frame.contains(from))) {
44
+ return undefined;
45
+ }
46
+ return [frame, ...frame.querySelectorAll('*')].find((element) => canScroll(element, 0, deltaY));
47
+ }
48
+ /** How far each scrolling key scrolls: pixels, or `page` / `end`. */
49
+ function keyScroll(event) {
50
+ // Ctrl/Cmd with an arrow goes all the way.
51
+ const arrowAmount = event.ctrlKey || event.metaKey ? 'end' : 40;
52
+ switch (event.key) {
53
+ case 'ArrowUp': {
54
+ return { direction: -1, amount: arrowAmount };
55
+ }
56
+ case 'ArrowDown': {
57
+ return { direction: 1, amount: arrowAmount };
58
+ }
59
+ case 'PageUp': {
60
+ return { direction: -1, amount: 'page' };
61
+ }
62
+ case 'Home': {
63
+ return { direction: -1, amount: 'end' };
64
+ }
65
+ case 'End': {
66
+ return { direction: 1, amount: 'end' };
67
+ }
68
+ default: {
69
+ // PageDown, and the space bar (with Shift: up).
70
+ return { direction: event.key === ' ' && event.shiftKey ? -1 : 1, amount: 'page' };
71
+ }
72
+ }
73
+ }
74
+ function prefersReducedMotion() {
75
+ return (typeof globalThis.matchMedia === 'function' && globalThis.matchMedia('(prefers-reduced-motion: reduce)').matches);
76
+ }
77
+ const scrollKeys = new Set(['PageUp', 'PageDown', 'Home', 'End', 'ArrowUp', 'ArrowDown', ' ']);
78
+ /** Where smooth keyboard scrolls are heading, so quick presses add up like the browser's own. */
79
+ const keyScrollDestinations = new WeakMap();
80
+ const smoothScrollMs = 400;
81
+ function scrollByKey(element, direction, amount) {
82
+ const max = element.scrollHeight - element.clientHeight;
83
+ const pending = keyScrollDestinations.get(element);
84
+ const from = pending && performance.now() - pending.at < smoothScrollMs ? pending.top : element.scrollTop;
85
+ const distance = amount === 'end' ? max : amount === 'page' ? element.clientHeight * 0.875 : amount;
86
+ const top = Math.min(max, Math.max(0, from + direction * distance));
87
+ const isSmooth = !prefersReducedMotion();
88
+ keyScrollDestinations.set(element, { top, at: performance.now() });
89
+ element.scrollTo({ top, behavior: isSmooth ? 'smooth' : 'instant' });
90
+ }
91
+ let pageLock;
92
+ let pageLockUsers = 0;
93
+ /** The page's own overflow, also while the tour has locked it. */
94
+ export function pageOverflow() {
95
+ return pageLock?.overflow ?? readPageOverflow();
96
+ }
97
+ /**
98
+ * Hides the page's scrollbar (`overflow: hidden` on `<html>`), so it cannot be dragged while the
99
+ * tour is open; programmatic scrolling still works. Only where that cannot move anything: with
100
+ * overlay scrollbars, which take no space (macOS, mobile). Hiding a classic scrollbar would widen
101
+ * the page (browsers drop the space of styled scrollbars even with `scrollbar-gutter: stable`), and
102
+ * pages cannot block it (the wheel over it scrolls the page whatever its listeners do), so it stays
103
+ * usable; the tour keeps the target in view when it is used. Pages whose `<body>` has an overflow of
104
+ * its own, and pinch-zoomed pages, are left alone too.
105
+ */
106
+ function lockPage() {
107
+ const overflow = readPageOverflow();
108
+ const root = document.documentElement;
109
+ const body = document.body ? getComputedStyle(document.body) : undefined;
110
+ const isRootOverflow = getComputedStyle(root).overflowY !== 'visible' ||
111
+ !body ||
112
+ (body.overflowX === 'visible' && body.overflowY === 'visible');
113
+ const hasClassicScrollbar = globalThis.innerWidth - root.clientWidth > 0.5 || globalThis.innerHeight - root.clientHeight > 0.5;
114
+ const isZoomed = Math.abs((globalThis.visualViewport?.scale ?? 1) - 1) >= 0.01;
115
+ if (!hasLayout() || !isRootOverflow || hasClassicScrollbar || isZoomed) {
116
+ return {
117
+ overflow,
118
+ release() {
119
+ // Nothing was changed.
120
+ },
121
+ };
122
+ }
123
+ const hadStyle = root.hasAttribute('style');
124
+ const previous = ['overflow-x', 'overflow-y'].map((property) => [property, root.style.getPropertyValue(property), root.style.getPropertyPriority(property)]);
125
+ root.style.setProperty('overflow-x', 'hidden');
126
+ root.style.setProperty('overflow-y', 'hidden');
127
+ return {
128
+ overflow,
129
+ release() {
130
+ for (const [property, value, priority] of previous) {
131
+ if (value) {
132
+ root.style.setProperty(property, value, priority);
133
+ }
134
+ else {
135
+ root.style.removeProperty(property);
136
+ }
137
+ }
138
+ if (!hadStyle && !root.getAttribute('style')) {
139
+ root.removeAttribute('style');
140
+ }
141
+ },
142
+ };
143
+ }
144
+ function acquirePageLock() {
145
+ pageLockUsers++;
146
+ pageLock ??= lockPage();
147
+ let isReleased = false;
148
+ return () => {
149
+ if (isReleased) {
150
+ return;
151
+ }
152
+ isReleased = true;
153
+ pageLockUsers--;
154
+ if (pageLockUsers === 0) {
155
+ pageLock?.release();
156
+ pageLock = undefined;
157
+ }
158
+ };
159
+ }
160
+ /**
161
+ * Keeps the page from scrolling while the tour is open (wheel, touch, keyboard, overlay scrollbars), so
162
+ * the user cannot scroll the highlighted element out of view. Scrolling inside the tooltip still
163
+ * works, with the keyboard too, and so do keys that controls in the tooltip use themselves.
164
+ * Programmatic scrolling (the tour's own, or the app's) is not affected. Returns the cleanup.
165
+ */
166
+ export function lockScroll(layer) {
167
+ let touchX = 0;
168
+ let touchY = 0;
169
+ const releasePage = acquirePageLock();
170
+ const onWheel = (event) => {
171
+ if (!event.ctrlKey && !canScrollWithin(event.target, layer, event.deltaX, event.deltaY)) {
172
+ event.preventDefault();
173
+ }
174
+ };
175
+ const onTouchStart = (event) => {
176
+ const touch = event.touches[0];
177
+ if (touch) {
178
+ touchX = touch.clientX;
179
+ touchY = touch.clientY;
180
+ }
181
+ };
182
+ const onTouchMove = (event) => {
183
+ const touch = event.touches[0];
184
+ // Two fingers: pinch-zoom stays available.
185
+ if (!touch || event.touches.length > 1) {
186
+ return;
187
+ }
188
+ if (!canScrollWithin(event.target, layer, touchX - touch.clientX, touchY - touch.clientY)) {
189
+ event.preventDefault();
190
+ }
191
+ };
192
+ const onKeyDown = (event) => {
193
+ if (!scrollKeys.has(event.key) || event.defaultPrevented || handlesKey(event.target, event.key)) {
194
+ return;
195
+ }
196
+ const { direction, amount } = keyScroll(event);
197
+ if (canScrollWithin(event.target, layer, 0, direction)) {
198
+ // The browser scrolls the focused element's scrollable ancestor.
199
+ return;
200
+ }
201
+ event.preventDefault();
202
+ const scrollable = scrollableInTooltip(event.target, layer, direction);
203
+ if (scrollable) {
204
+ scrollByKey(scrollable, direction, amount);
205
+ }
206
+ };
207
+ layer.addEventListener('wheel', onWheel, { passive: false });
208
+ layer.addEventListener('touchstart', onTouchStart, { passive: true });
209
+ layer.addEventListener('touchmove', onTouchMove, { passive: false });
210
+ layer.addEventListener('keydown', onKeyDown);
211
+ return () => {
212
+ releasePage();
213
+ layer.removeEventListener('wheel', onWheel);
214
+ layer.removeEventListener('touchstart', onTouchStart);
215
+ layer.removeEventListener('touchmove', onTouchMove);
216
+ layer.removeEventListener('keydown', onKeyDown);
217
+ };
218
+ }
219
+ //# sourceMappingURL=scroll-lock.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll-lock.util.js","sourceRoot":"","sources":["../../../src/react-platform/dom/scroll-lock.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAElD,SAAS,SAAS,CAAC,OAAgB,EAAE,MAAc,EAAE,MAAc;IACjE,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAC7G,MAAM,QAAQ,GAAG,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAC3G,IAAI,QAAQ,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC;QACrC,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,YAAY,GAAG,CAAC,CAAC;QACtF,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,GAAG,GAAG,OAAO,CAAC,WAAW,GAAG,OAAO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,SAAS,CAAC,CAAC;IAC7C,OAAO,GAAG,EAAE;QACV,WAAW,EAAE,CAAC;QACd,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5C,KAAK,CAAC,mBAAmB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QACtD,KAAK,CAAC,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QACpD,KAAK,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAClD,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,44 @@
1
+ import type { Box } from '../../shared/geometry/geometry.type.js';
2
+ import type { ScrollContainer } from '../../shared/platform/platform.type.js';
3
+ /** Which axes of a scroll container the tour may scroll. */
4
+ export type ScrollAxes = {
5
+ readonly x: boolean;
6
+ readonly y: boolean;
7
+ };
8
+ /** The page's own overflow per axis (from `<html>`, or from `<body>` when `<html>` has none). */
9
+ export declare function readPageOverflow(): {
10
+ readonly x: string;
11
+ readonly y: string;
12
+ };
13
+ /** A computed length (`20px`, `10%`, `calc(10% + 20px)`) in pixels; percentages refer to `basis`. */
14
+ export declare function resolveLength(value: string, basis: number): number;
15
+ type Ancestors = {
16
+ /** Scroll containers that move the target, innermost first (the page itself is not included). */
17
+ readonly scrollers: ReadonlyArray<{
18
+ readonly element: Element;
19
+ readonly axes: ScrollAxes;
20
+ }>;
21
+ /** Intersection of every clipping ancestor's padding box, or `undefined` when nothing clips. */
22
+ readonly clip: Box | undefined;
23
+ /** True when the target sits inside a `position: fixed` element, so scrolling the page does not move it. */
24
+ readonly fixed: boolean;
25
+ };
26
+ /**
27
+ * Walks up from `element`, collecting the scroll containers and clipping that apply to it. An
28
+ * absolutely positioned element escapes the overflow of the ancestors between it and its
29
+ * containing block (a dropdown sticking out of a navigation bar); a fixed one escapes everything
30
+ * up to the page.
31
+ */
32
+ export declare function inspectAncestors(element: Element): Ancestors;
33
+ /** A nested scroll container. Horizontal offsets are normalised to [0, max] in right-to-left containers too. */
34
+ export declare function elementContainer(element: Element, axes: ScrollAxes, occluders: () => readonly Box[]): ScrollContainer;
35
+ /**
36
+ * The page itself; its visible area is the visual viewport minus safe areas and the page's
37
+ * scroll-padding. `overflow` is the page's own (see `readPageOverflow`), not the tour's scroll lock.
38
+ */
39
+ export declare function pageContainer(occluders: () => readonly Box[], overflow: {
40
+ readonly x: string;
41
+ readonly y: string;
42
+ }): ScrollContainer;
43
+ export {};
44
+ //# sourceMappingURL=scroll.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll.util.d.ts","sourceRoot":"","sources":["../../../src/react-platform/dom/scroll.util.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,GAAG,EAAgB,MAAM,wCAAwC,CAAC;AAC/E,OAAO,KAAK,EAAC,eAAe,EAAwC,MAAM,wCAAwC,CAAC;AAanH,4DAA4D;AAC5D,MAAM,MAAM,UAAU,GAAG;IAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAA;CAAC,CAAC;AAcpE,iGAAiG;AACjG,wBAAgB,gBAAgB,IAAI;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAC,CAI3E;AAwCD,qGAAqG;AACrG,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAqBlE;AAYD,KAAK,SAAS,GAAG;IACf,iGAAiG;IACjG,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;KAAC,CAAC,CAAC;IAC1F,gGAAgG;IAChG,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,SAAS,CAAC;IAC/B,4GAA4G;IAC5G,QAAQ,CAAC,KAAK,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