@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,228 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { isValidElement, useCallback, useEffect, useId, useMemo, useRef, useState, } from 'react';
3
+ import { tourLayout, } from '../engine/tour-engine.js';
4
+ import { containsPoint, inflate } from '../geometry/box.util.js';
5
+ import { useTourView } from '../react/use-tour-view.hook.js';
6
+ import { formatTemplate } from '../utils/i18n.util.js';
7
+ import { entranceFor, fadeDuration, motion } from './motion.js';
8
+ import { RendererContext, TooltipLimitsContext } from './renderer-context.js';
9
+ function noop() {
10
+ // Intentionally empty.
11
+ }
12
+ /**
13
+ * The tour on screen, for every platform: decides what is visible, how it animates, what it
14
+ * says and what input means, and draws it with the platform's primitives ({@link TourRenderer}).
15
+ * Keeps the last step on screen while the tour fades out.
16
+ */
17
+ export function TourOverlay(props) {
18
+ const view = useTourView(props.engine);
19
+ // When the tour ends, the last view stays on screen while it fades out. Worked out during render
20
+ // (not in an effect), so the overlay is never unmounted in between and the fade really plays.
21
+ const [tracked, setTracked] = useState(() => ({
22
+ view,
23
+ closing: undefined,
24
+ }));
25
+ let { closing } = tracked;
26
+ if (tracked.view !== view) {
27
+ const before = tracked.view;
28
+ closing = view.phase === 'idle' ? (before.phase === 'idle' ? closing : before) : undefined;
29
+ setTracked({ view, closing });
30
+ }
31
+ const onClosed = useCallback(() => {
32
+ setTracked((current) => ({ ...current, closing: undefined }));
33
+ }, []);
34
+ const isClosing = view.phase === 'idle' && closing !== undefined;
35
+ const rendered = view.phase === 'idle' ? closing : view;
36
+ return rendered ? _jsx(OverlayContent, { ...props, view: rendered, isClosing: isClosing, onClosed: onClosed }) : null;
37
+ }
38
+ function OverlayContent({ engine, renderer, theme, i18n, Tooltip, isOverlayDismissible, isReducedMotion, view, isClosing, onClosed, }) {
39
+ const { Layer, Backdrop, Spotlight } = renderer;
40
+ const id = useId();
41
+ const titleId = `${id}title`;
42
+ const descriptionId = `${id}description`;
43
+ const { shown, phase, measure } = view;
44
+ const totalSteps = view.steps.length;
45
+ // The first step can take a while (navigation in onBeforeStep): dim the screen after a moment.
46
+ const isWaitingDimmed = useDelayedFlag(!shown && !isClosing, motion.waitingDimDelayMs);
47
+ // Once on screen, the overlay stays until the tour ends (also when another tour takes over).
48
+ const [hasBeenVisible, setHasBeenVisible] = useState(false);
49
+ const isShowingSomething = shown !== undefined || isWaitingDimmed;
50
+ if (isShowingSomething && !isClosing && !hasBeenVisible) {
51
+ setHasBeenVisible(true);
52
+ }
53
+ const isVisible = !isClosing && (isShowingSomething || hasBeenVisible);
54
+ // When the overlay became visible: presses on the dimmed area only count once it has faded in.
55
+ const visibleSince = useRef(undefined);
56
+ useEffect(() => {
57
+ visibleSince.current = isVisible ? Date.now() : undefined;
58
+ }, [isVisible]);
59
+ const spotlight = useSpotlight(view, isVisible, isReducedMotion);
60
+ const announcement = useAnnouncement(shown, totalSteps, i18n, isClosing);
61
+ // Fade out, then unmount.
62
+ useEffect(() => {
63
+ if (!isClosing) {
64
+ return undefined;
65
+ }
66
+ const timer = setTimeout(onClosed, fadeDuration(true, isReducedMotion) + 20);
67
+ return () => {
68
+ clearTimeout(timer);
69
+ };
70
+ }, [isClosing, isReducedMotion, onClosed]);
71
+ const onIntent = useCallback((intent) => {
72
+ if (isClosing) {
73
+ return;
74
+ }
75
+ switch (intent) {
76
+ case 'next': {
77
+ engine.actions.nextStep();
78
+ break;
79
+ }
80
+ case 'previous': {
81
+ engine.actions.prevStep();
82
+ break;
83
+ }
84
+ case 'escape': {
85
+ engine.dismiss('escape');
86
+ break;
87
+ }
88
+ case 'back': {
89
+ engine.dismiss('closed');
90
+ break;
91
+ }
92
+ }
93
+ }, [engine, isClosing]);
94
+ const onBackdropPress = (point) => {
95
+ // Not while the overlay is still appearing (a double click on the button that started the
96
+ // tour), nor while a step change is under way (a second tap on Next falls through the busy tooltip).
97
+ const since = visibleSince.current;
98
+ const hasFadedIn = since !== undefined && Date.now() - since >= motion.fadeInMs;
99
+ const isChangingStep = shown !== undefined && phase !== 'showing';
100
+ if (!isOverlayDismissible || isClosing || !hasFadedIn || isChangingStep) {
101
+ return;
102
+ }
103
+ // Presses on the highlighted element go nowhere; presses on the dimmed area close the tour.
104
+ if (spotlight.hole === undefined || !containsPoint(spotlight.hole, point)) {
105
+ engine.dismiss('blur');
106
+ }
107
+ };
108
+ const context = useMemo(() => ({ renderer, theme, i18n }), [renderer, theme, i18n]);
109
+ const counter = shown
110
+ ? formatTemplate(i18n.stepCounterTemplate, { current: shown.stepIndex + 1, total: totalSteps })
111
+ : '';
112
+ return (_jsx(RendererContext.Provider, { value: context, children: _jsxs(Layer, { state: isClosing ? 'closing' : phase, isVisible: isVisible, fadeMs: fadeDuration(isClosing, isReducedMotion), isInteractive: !isClosing, theme: theme, titleId: shown ? titleId : undefined, descriptionId: shown ? descriptionId : undefined, fallbackLabel: (shown ? textOf(shown.step.title) : '') || counter, announcement: announcement, stepKey: shown?.transitionId, onIntent: onIntent, children: [_jsx(Backdrop, { isDismissible: isOverlayDismissible, onPress: onBackdropPress }), _jsx(Spotlight, { hole: spotlight.hole, transition: spotlight.transition, theme: theme }), shown ? (_jsx(ShownTooltip, { engine: engine, renderer: renderer, Tooltip: Tooltip, shown: shown, totalSteps: totalSteps, isBusy: phase === 'preparing' && !isClosing, isHidden: phase === 'revealing', isDelayed: spotlight.isMorphing, isReducedMotion: isReducedMotion, titleId: titleId, descriptionId: descriptionId, onIntent: onIntent }, shown.transitionId)) : null, measure && !isClosing ? (_jsx(MeasuredTooltip, { engine: engine, renderer: renderer, Tooltip: Tooltip, request: measure, totalSteps: totalSteps }, measure.id)) : null] }) }));
113
+ }
114
+ /** The step on screen: its tooltip in the platform's frame. Mounted once per shown step. */
115
+ function ShownTooltip({ engine, renderer, Tooltip, shown, totalSteps, isBusy, isHidden, isDelayed, isReducedMotion, titleId, descriptionId, onIntent, }) {
116
+ const { TooltipFrame } = renderer;
117
+ const { transitionId, layout } = shown;
118
+ const onSize = useCallback((size) => {
119
+ engine.reportTooltipSize(transitionId, size);
120
+ }, [engine, transitionId]);
121
+ const onClose = useCallback(() => {
122
+ engine.dismiss('closed');
123
+ }, [engine]);
124
+ // The entrance is played once, when the step appears.
125
+ const [entrance] = useState(() => entranceFor(layout.placement, { isDelayed, isReducedMotion }));
126
+ return (_jsx(TooltipFrame, { layout: layout, entrance: entrance, isBusy: isBusy, isHidden: isHidden, onSize: onSize, onIntent: onIntent, children: _jsx(TooltipLimitsContext.Provider, { value: layout, children: _jsx(Tooltip, { step: shown.step, currentStep: shown.stepIndex, totalSteps: totalSteps, placement: layout.placement, arrowOffset: layout.arrowOffset, titleId: titleId, descriptionId: descriptionId, onNext: engine.actions.nextStep, onPrev: engine.actions.prevStep, onClose: onClose, onGoToStep: engine.actions.goToStep }) }) }));
127
+ }
128
+ /** The next step's tooltip, rendered invisibly with the same limits to learn its size: same content, no actions. */
129
+ function MeasuredTooltip({ engine, renderer, Tooltip, request, totalSteps }) {
130
+ const { MeasureFrame } = renderer;
131
+ const id = useId();
132
+ const onSize = useCallback((size) => {
133
+ engine.reportTooltipSize(request.id, size);
134
+ }, [engine, request.id]);
135
+ return (_jsx(MeasureFrame, { maxWidth: request.maxWidth, maxHeight: request.maxHeight, onSize: onSize, children: _jsx(TooltipLimitsContext.Provider, { value: request, children: _jsx(Tooltip, { step: request.step, currentStep: request.stepIndex, totalSteps: totalSteps, placement: request.step.target === undefined ? 'center' : (request.step.placement ?? 'bottom'), arrowOffset: undefined, titleId: `${id}title`, descriptionId: `${id}description`, onNext: noop, onPrev: noop, onClose: noop, onGoToStep: noop }) }) }));
136
+ }
137
+ /** True once `isWaiting` has been true for `delayMs`, as long as it stays true. */
138
+ function useDelayedFlag(isWaiting, delayMs) {
139
+ const [isDue, setIsDue] = useState(false);
140
+ const [wasWaiting, setWasWaiting] = useState(isWaiting);
141
+ if (wasWaiting !== isWaiting) {
142
+ setWasWaiting(isWaiting);
143
+ setIsDue(false);
144
+ }
145
+ useEffect(() => {
146
+ if (!isWaiting) {
147
+ return undefined;
148
+ }
149
+ const timer = setTimeout(() => {
150
+ setIsDue(true);
151
+ }, delayMs);
152
+ return () => {
153
+ clearTimeout(timer);
154
+ };
155
+ }, [isWaiting, delayMs]);
156
+ return isWaiting && isDue;
157
+ }
158
+ /**
159
+ * Where the spotlight's hole is and how it gets there. While the next target is scrolled into
160
+ * view, the hole goes with it (frame by frame, or straight to where it will end up); otherwise it
161
+ * marks the step on screen. Moving to another step is animated; following a target that moves on
162
+ * its own (layout changes, resizing) is instant. Nothing animates before the overlay has appeared.
163
+ */
164
+ function useSpotlight(view, isVisible, isReducedMotion) {
165
+ const { shown, phase, revealHighlight, followsScroll } = view;
166
+ const isRevealing = phase === 'revealing';
167
+ const source = isRevealing ? revealHighlight : shown?.highlight;
168
+ const hole = source ? inflate(source, tourLayout.highlightPadding) : undefined;
169
+ const shownKey = shown?.transitionId ?? 'none';
170
+ const key = isRevealing ? `reveal:${shownKey}` : `${shownKey}:${hole ? 'open' : 'closed'}`;
171
+ // The key at which the overlay appeared: it appears in place, later changes animate.
172
+ const [appearedAtKey, setAppearedAtKey] = useState(undefined);
173
+ if (isVisible && appearedAtKey === undefined) {
174
+ setAppearedAtKey(key);
175
+ }
176
+ // A move to a new key keeps animating until it has had time to finish.
177
+ const [settledKey, setSettledKey] = useState(key);
178
+ useEffect(() => {
179
+ if (key === settledKey) {
180
+ return undefined;
181
+ }
182
+ const timer = setTimeout(() => {
183
+ setSettledKey(key);
184
+ }, motion.morphMs + 50);
185
+ return () => {
186
+ clearTimeout(timer);
187
+ };
188
+ }, [key, settledKey]);
189
+ const hasAppeared = appearedAtKey !== undefined;
190
+ const isMorphing = hasAppeared && key !== appearedAtKey && key !== settledKey;
191
+ let transition;
192
+ if (hasAppeared && !isReducedMotion) {
193
+ if (isRevealing && followsScroll) {
194
+ transition = { durationMs: motion.chaseMs, easing: 'linear' };
195
+ }
196
+ else if (isMorphing) {
197
+ transition = { durationMs: motion.morphMs, easing: 'standard' };
198
+ }
199
+ }
200
+ return { hole, transition, isMorphing };
201
+ }
202
+ /** "2 of 5: Title" when the step changes (the first step is announced by the tour appearing). */
203
+ function useAnnouncement(shown, totalSteps, i18n, isClosing) {
204
+ const [firstKey, setFirstKey] = useState(undefined);
205
+ if (shown && firstKey === undefined) {
206
+ setFirstKey(shown.transitionId);
207
+ }
208
+ if (!shown || isClosing || shown.transitionId === firstKey) {
209
+ return '';
210
+ }
211
+ const counter = formatTemplate(i18n.stepCounterTemplate, { current: shown.stepIndex + 1, total: totalSteps });
212
+ const title = textOf(shown.step.title);
213
+ return title ? `${counter}: ${title}` : counter;
214
+ }
215
+ /** The plain text of React content (strings, numbers, arrays and the children of elements). */
216
+ export function textOf(node) {
217
+ if (typeof node === 'string' || typeof node === 'number') {
218
+ return String(node);
219
+ }
220
+ if (Array.isArray(node)) {
221
+ return node.map((child) => textOf(child)).join('');
222
+ }
223
+ if (isValidElement(node)) {
224
+ return textOf(node.props.children);
225
+ }
226
+ return '';
227
+ }
228
+ //# sourceMappingURL=tour-overlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-overlay.js","sourceRoot":"","sources":["../../../src/shared/renderer/tour-overlay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,cAAc,EAEd,WAAW,EACX,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAIL,UAAU,GAEX,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAC,aAAa,EAAE,OAAO,EAAC,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAC,WAAW,EAAC,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAC,cAAc,EAAoB,MAAM,uBAAuB,CAAC;AAExE,OAAO,EAAC,WAAW,EAAE,YAAY,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAC,eAAe,EAA6B,oBAAoB,EAAC,MAAM,uBAAuB,CAAC;AAavG,SAAS,IAAI;IACX,uBAAuB;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACvC,iGAAiG;IACjG,8FAA8F;IAC9F,MAAM,CA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AC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,KAAgB,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,cAAc,CAAyB,IAAI,CAAC,EAAE,CAAC;QACjD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -1,13 +1,23 @@
1
- import { type StartTourOptions } from './tour-end-info.type';
2
- import { type TourStep } from './tour-step.type';
1
+ import type { StartTourOptions } from './tour-end-info.type.js';
2
+ import type { TourStep } from './tour-step.type.js';
3
+ /** What `useTour()` returns. The functions keep their identity for the lifetime of the provider. */
3
4
  export type TourContextType = {
4
- isActive: boolean;
5
- currentStep: number;
6
- steps: TourStep[];
7
- currentTourId: string | undefined;
8
- startTour: (steps: TourStep[], tourId?: string, options?: StartTourOptions) => void;
9
- endTour: () => void;
10
- nextStep: () => void;
11
- prevStep: () => void;
12
- goToStep: (step: number) => void;
5
+ /** `true` from `startTour` until the tour ends. */
6
+ readonly isActive: boolean;
7
+ /** Zero-based index of the step on screen. */
8
+ readonly currentStep: number;
9
+ readonly steps: readonly TourStep[];
10
+ readonly currentTourId: string | undefined;
11
+ /**
12
+ * Starts a tour. Starting the tour that is already running (same id, or same steps array without
13
+ * an id) does nothing; starting a different one ends the current tour with the reason `'closed'`.
14
+ */
15
+ readonly startTour: (steps: readonly TourStep[], tourId?: string, options?: StartTourOptions) => void;
16
+ /** Ends the tour with the reason `'closed'`. */
17
+ readonly endTour: () => void;
18
+ /** Goes to the next step, or completes the tour on the last step. */
19
+ readonly nextStep: () => void;
20
+ readonly prevStep: () => void;
21
+ readonly goToStep: (index: number) => void;
13
22
  };
23
+ //# sourceMappingURL=tour-context.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-context.type.d.ts","sourceRoot":"","sources":["../../../src/shared/types/tour-context.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAElD,oGAAoG;AACpG,MAAM,MAAM,eAAe,GAAG;IAC5B,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,8CAA8C;IAC9C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACtG,gDAAgD;IAChD,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAC7B,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C,CAAC"}
@@ -1,12 +1,29 @@
1
- import { type TourStep } from './tour-step.type';
2
- export type TourEndReason = 'completed' | 'closed' | 'blur' | 'escape' | 'target-missing';
1
+ import type { TourStep } from './tour-step.type.js';
2
+ /**
3
+ * Why a tour ended.
4
+ * - `completed`: the user finished the last step.
5
+ * - `closed`: the close button, `endTour()`, the Android back button, or another tour was started.
6
+ * - `blur`: the user clicked or tapped the dimmed area (see `closeOnOverlayClick`).
7
+ * - `escape`: Escape on the web, the VoiceOver escape gesture on iOS.
8
+ * - `target-missing`: no remaining step had a target that could be found and shown.
9
+ * - `error`: a step's `onBeforeStep` threw or rejected; see {@link TourEndInfo.error}.
10
+ */
11
+ export type TourEndReason = 'completed' | 'closed' | 'blur' | 'escape' | 'target-missing' | 'error';
12
+ /** Details about how and where a tour ended. */
3
13
  export type TourEndInfo = {
4
14
  readonly reason: TourEndReason;
15
+ /** Zero-based index of the step the user was on (for `target-missing`: the last step that was tried). */
5
16
  readonly stepIndex: number;
6
17
  readonly step: TourStep;
7
18
  readonly totalSteps: number;
19
+ /** The error thrown by `onBeforeStep` when `reason` is `'error'`. */
20
+ readonly error?: unknown;
8
21
  };
22
+ /** Called once when a tour ends. */
9
23
  export type TourEndCallback = (tourId: string | undefined, info: TourEndInfo) => void;
24
+ /** Options for a single tour, passed to `startTour`. */
10
25
  export type StartTourOptions = {
26
+ /** Called when this tour ends, before the provider's `onTourEnd`. */
11
27
  readonly onTourEnd?: TourEndCallback;
12
28
  };
29
+ //# sourceMappingURL=tour-end-info.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-end-info.type.d.ts","sourceRoot":"","sources":["../../../src/shared/types/tour-end-info.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,gBAAgB,GAAG,OAAO,CAAC;AAEpG,gDAAgD;AAChD,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,yGAAyG;IACzG,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,oCAAoC;AACpC,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;AAEtF,wDAAwD;AACxD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,qEAAqE;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;CACtC,CAAC"}
@@ -1,8 +1,16 @@
1
+ /** Texts of the built-in tooltip. Every key is optional. */
1
2
  export type TourI18n = {
3
+ /** @defaultValue `'Next'` */
2
4
  readonly nextLabel?: string;
5
+ /** @defaultValue `'Back'` */
3
6
  readonly prevLabel?: string;
7
+ /** Label of the Next button on the last step. @defaultValue `'Finish'` */
4
8
  readonly finishLabel?: string;
9
+ /** Step counter; `{current}` and `{total}` are replaced. @defaultValue `'{current} of {total}'` */
5
10
  readonly stepCounterTemplate?: string;
11
+ /** Accessible name of the close button. @defaultValue `'Close tour'` */
6
12
  readonly closeAriaLabel?: string;
13
+ /** Accessible name of each step dot; `{step}` and `{total}` are replaced. @defaultValue `'Go to step {step}'` */
7
14
  readonly dotAriaLabelTemplate?: string;
8
15
  };
16
+ //# sourceMappingURL=tour-i18n.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-i18n.type.d.ts","sourceRoot":"","sources":["../../../src/shared/types/tour-i18n.type.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,MAAM,MAAM,QAAQ,GAAG;IACrB,6BAA6B;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,6BAA6B;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,mGAAmG;IACnG,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,wEAAwE;IACxE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,iHAAiH;IACjH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACxC,CAAC"}
@@ -1,8 +1,37 @@
1
- import { type TourTarget, type Placement } from './rect.type';
1
+ import type { ReactNode, RefObject } from 'react';
2
+ /**
3
+ * Preferred side of the target for the tooltip. If there is not enough room on that side, the
4
+ * tooltip moves to the opposite side, then to the roomier of the remaining sides.
5
+ */
6
+ export type TourPlacement = 'top' | 'bottom' | 'left' | 'right';
7
+ /**
8
+ * What a step highlights.
9
+ * - Web: a CSS selector such as `'[data-tour="settings"]'`, or a ref to a DOM element.
10
+ * - React Native: an id registered with `useTourTarget`, or a ref to a native view.
11
+ */
12
+ export type TourTarget = string | RefObject<unknown>;
13
+ /** Second argument of {@link TourStep.onBeforeStep}. */
14
+ export type TourStepContext = {
15
+ /**
16
+ * Aborted when the step is abandoned before it is shown (the user navigates elsewhere or the
17
+ * tour ends). Pass it to `fetch` or check `signal.aborted` in long-running work.
18
+ */
19
+ readonly signal: AbortSignal;
20
+ };
2
21
  export type TourStep = {
3
- target: TourTarget;
4
- title: string;
5
- content: string;
6
- placement?: Placement;
7
- onBeforeStep?: (target: TourTarget) => void | Promise<void>;
22
+ /** The element to highlight. Leave it out for a step that is shown in the centre of the screen. */
23
+ readonly target?: TourTarget;
24
+ readonly title: ReactNode;
25
+ readonly content: ReactNode;
26
+ /** @defaultValue `'bottom'` */
27
+ readonly placement?: TourPlacement;
28
+ /**
29
+ * Runs before the step is shown, for example to navigate to another page or open a menu.
30
+ * The tour then waits (up to 5 seconds) for the target to appear, so there is no need to poll.
31
+ *
32
+ * Make it idempotent: it runs again if the user comes back to this step.
33
+ * If it throws or rejects, the tour ends with the reason `'error'`.
34
+ */
35
+ readonly onBeforeStep?: (target: TourTarget | undefined, context: TourStepContext) => void | Promise<void>;
8
36
  };
37
+ //# sourceMappingURL=tour-step.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-step.type.d.ts","sourceRoot":"","sources":["../../../src/shared/types/tour-step.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhE;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;AAErD,wDAAwD;AACxD,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,mGAAmG;IACnG,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,+BAA+B;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,EAAE,OAAO,EAAE,eAAe,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5G,CAAC"}
@@ -1,9 +1,29 @@
1
+ /** Colours of the built-in tooltip and overlay. Every key is optional. */
1
2
  export type TourTheme = {
3
+ /**
4
+ * Buttons, the step badge, the active dot and the highlight ring.
5
+ * @defaultValue `'#2563eb'`
6
+ */
2
7
  readonly primaryColor?: string;
8
+ /**
9
+ * Text on `primaryColor` (the Next button and the step badge).
10
+ * @defaultValue `'#ffffff'`
11
+ */
12
+ readonly primaryTextColor?: string;
13
+ /** @defaultValue `'#ffffff'` */
3
14
  readonly tooltipBackground?: string;
15
+ /** @defaultValue `'#111827'` */
4
16
  readonly titleColor?: string;
17
+ /**
18
+ * Body text. Muted elements (inactive dots, dividers, the Back button) are derived from it, so a
19
+ * dark theme only needs a dark `tooltipBackground` and light text colours.
20
+ * @defaultValue `'#4b5563'`
21
+ */
5
22
  readonly contentColor?: string;
23
+ /**
24
+ * The dimmed area around the highlighted element. Include transparency.
25
+ * @defaultValue `'rgba(0, 0, 0, 0.5)'`
26
+ */
6
27
  readonly overlayColor?: string;
7
28
  };
8
- export declare const defaultTheme: Required<TourTheme>;
9
- export declare function resolveTheme(theme?: TourTheme): Required<TourTheme>;
29
+ //# sourceMappingURL=tour-theme.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-theme.type.d.ts","sourceRoot":"","sources":["../../../src/shared/types/tour-theme.type.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,MAAM,MAAM,SAAS,GAAG;IACtB;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,gCAAgC;IAChC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,gCAAgC;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC"}
@@ -1,17 +1,2 @@
1
- export const defaultTheme = {
2
- primaryColor: '#3b82f6',
3
- tooltipBackground: '#ffffff',
4
- titleColor: '#1f2937',
5
- contentColor: '#4b5563',
6
- overlayColor: 'rgba(0, 0, 0, 0.5)',
7
- };
8
- export function resolveTheme(theme) {
9
- if (!theme) {
10
- return defaultTheme;
11
- }
12
- return {
13
- ...defaultTheme,
14
- ...theme,
15
- };
16
- }
1
+ export {};
17
2
  //# sourceMappingURL=tour-theme.type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tour-theme.type.js","sourceRoot":"","sources":["../../../src/shared/types/tour-theme.type.ts"],"names":[],"mappings":"AAsCA,MAAM,CAAC,MAAM,YAAY,GAAwB;IAC/C,YAAY,EAAE,SAAS;IACvB,iBAAiB,EAAE,SAAS;IAC5B,UAAU,EAAE,SAAS;IACrB,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE,oBAAoB;CACnC,CAAC;AAKF,MAAM,UAAU,YAAY,CAAC,KAAiB;IAC5C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,OAAO;QACL,GAAG,YAAY;QACf,GAAG,KAAK;KACT,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"tour-theme.type.js","sourceRoot":"","sources":["../../../src/shared/types/tour-theme.type.ts"],"names":[],"mappings":""}
@@ -1,23 +1,27 @@
1
- import { type TourI18n } from './tour-i18n.type';
2
- import { type TourTheme } from './tour-theme.type';
1
+ import type { TourPlacement, TourStep } from './tour-step.type.js';
2
+ /**
3
+ * Props of a custom `TooltipComponent`. The component only renders the card's content: the tour
4
+ * measures, positions, animates and focuses it, and keeps it on screen.
5
+ */
3
6
  export type TourTooltipProps = {
4
- readonly title: string;
5
- readonly content: string;
7
+ readonly step: TourStep;
8
+ /** Zero-based index of the step. */
6
9
  readonly currentStep: number;
7
10
  readonly totalSteps: number;
8
- readonly position: {
9
- top: number;
10
- left: number;
11
- };
12
- readonly isPositioned: boolean;
13
- readonly onClose: () => void;
14
11
  readonly onNext: () => void;
15
12
  readonly onPrev: () => void;
16
- readonly onGoToStep: (step: number) => void;
17
- readonly theme: Required<TourTheme>;
18
- readonly i18n?: TourI18n;
19
- readonly onMeasured?: (size: {
20
- width: number;
21
- height: number;
22
- }) => void;
13
+ readonly onClose: () => void;
14
+ readonly onGoToStep: (index: number) => void;
15
+ /** Side of the target the tooltip ended up on, or `'center'` for steps without a target. Use it to draw an arrow. */
16
+ readonly placement: TourPlacement | 'center';
17
+ /**
18
+ * Distance in pixels from the tooltip's left edge (for `top`/`bottom`) or top edge (for
19
+ * `left`/`right`) to where an arrow should point. `undefined` when no arrow should be drawn.
20
+ */
21
+ readonly arrowOffset: number | undefined;
22
+ /** Put `id={titleId}` on the element showing the title so screen readers announce it. */
23
+ readonly titleId: string;
24
+ /** Put `id={descriptionId}` on the element showing the content. */
25
+ readonly descriptionId: string;
23
26
  };
27
+ //# sourceMappingURL=tour-tooltip-props.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-tooltip-props.type.d.ts","sourceRoot":"","sources":["../../../src/shared/types/tour-tooltip-props.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,oCAAoC;IACpC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,qHAAqH;IACrH,QAAQ,CAAC,SAAS,EAAE,aAAa,GAAG,QAAQ,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,yFAAyF;IACzF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Calls `callback` before the next frame is drawn, or after about one frame where there are no
3
+ * frames (test environments without `requestAnimationFrame`). Returns the cancellation.
4
+ */
5
+ export declare function requestFrame(callback: () => void): () => void;
6
+ //# sourceMappingURL=frame.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame.util.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/frame.util.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAc7D"}
@@ -0,0 +1,20 @@
1
+ const frameMs = 16;
2
+ /**
3
+ * Calls `callback` before the next frame is drawn, or after about one frame where there are no
4
+ * frames (test environments without `requestAnimationFrame`). Returns the cancellation.
5
+ */
6
+ export function requestFrame(callback) {
7
+ if (typeof globalThis.requestAnimationFrame === 'function') {
8
+ const frame = globalThis.requestAnimationFrame(() => {
9
+ callback();
10
+ });
11
+ return () => {
12
+ globalThis.cancelAnimationFrame(frame);
13
+ };
14
+ }
15
+ const timer = setTimeout(callback, frameMs);
16
+ return () => {
17
+ clearTimeout(timer);
18
+ };
19
+ }
20
+ //# sourceMappingURL=frame.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame.util.js","sourceRoot":"","sources":["../../../src/shared/utils/frame.util.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,EAAE,CAAC;AAEnB;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,QAAoB;IAC/C,IAAI,OAAO,UAAU,CAAC,qBAAqB,KAAK,UAAU,EAAE,CAAC;QAC3D,MAAM,KAAK,GAAG,UAAU,CAAC,qBAAqB,CAAC,GAAG,EAAE;YAClD,QAAQ,EAAE,CAAC;QACb,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5C,OAAO,GAAG,EAAE;QACV,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC,CAAC;AACJ,CAAC"}
@@ -1,11 +1,17 @@
1
- export declare const MAX_VISIBLE_DOTS = 7;
2
- export declare const DOT_SIZE = 8;
3
- export declare const DOT_GAP = 6;
4
- export declare const DOTS_CONTAINER_WIDTH: number;
1
+ /** One item in the step indicator: a dot for a step, or an ellipsis standing in for several steps. */
5
2
  export type DotItem = {
6
- type: 'dot';
7
- index: number;
3
+ readonly type: 'dot';
4
+ readonly index: number;
8
5
  } | {
9
- type: 'ellipsis';
6
+ readonly type: 'ellipsis';
7
+ readonly position: 'start' | 'end';
10
8
  };
9
+ /**
10
+ * The step indicator for `totalSteps` steps with `currentStep` (zero-based) selected.
11
+ *
12
+ * Up to 7 steps every step gets a dot. Above that the result always has exactly 7 items, so the
13
+ * indicator keeps a constant width: the first and last step, the current step and its neighbours,
14
+ * and ellipses for the rest. An ellipsis always stands for at least two steps.
15
+ */
11
16
  export declare function getTruncatedDots(currentStep: number, totalSteps: number): DotItem[];
17
+ //# sourceMappingURL=get-truncated-dots.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-truncated-dots.util.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/get-truncated-dots.util.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,MAAM,MAAM,OAAO,GACjB;IAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAC,GAAG;IAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,KAAK,CAAA;CAAC,CAAC;AASnH;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,EAAE,CA2BnF"}