@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
package/CHANGELOG.md ADDED
@@ -0,0 +1,48 @@
1
+ # Changelog
2
+
3
+ Releases are published automatically from `main`; each GitHub release lists its commits. This file describes the larger changes.
4
+
5
+ ## 1.0.1
6
+
7
+ ### Fixed
8
+
9
+ - Targets moved by animations that report no events are followed: a React Native screen sliding in with the native driver (a stack navigator, for example), or an animation of the Web Animations API. Until such an animation ends, the target is measured where it started:
10
+ - when that was on screen, the highlight and tooltip stayed there instead of following the target;
11
+ - when it was off screen (a screen sliding in from the side), the step was skipped.
12
+
13
+ ## 1.0.0
14
+
15
+ A rewrite for reliability, smoothness and accessibility. The everyday API is unchanged; see [MIGRATION.md](./MIGRATION.md) for the breaking changes.
16
+
17
+ ### Breaking
18
+
19
+ - Custom tooltips (`TooltipComponent`) only render content; the tour measures, positions, animates and focuses them. `position`, `isPositioned`, `onMeasured`, `theme` and `i18n` props and `forwardRef` are gone; `step`, `placement`, `arrowOffset`, `titleId` and `descriptionId` are new.
20
+ - `OverlayComponent` and the `platform` prop are removed, as are the internal exports (`TourContext`, `TourOverlay`, `TourTooltip`, `calculateTooltipPosition`, `findVisibleElement`, the platform adapters, the target registry, the `DOT_*` constants and the `Rect` and `TourOverlayProps` types).
21
+ - React Native: the tour is drawn in the app's root view instead of a `<Modal>`. `TourProvider` must wrap the app root, outside `SafeAreaView`. `react-native-svg` is no longer used. React Native 0.79 or newer is required.
22
+ - `TourEndReason` has a new member, `'error'`.
23
+ - Step types are wider: `title` and `content` are `ReactNode`, `target` is optional, and `onBeforeStep` receives `TourTarget | undefined` and a `{signal}`.
24
+ - Default primary colour `#2563eb` and title colour `#111827` (WCAG AA contrast); the same default texts on both platforms (`'Finish'`, `'{current} of {total}'`).
25
+ - ESM-only package.
26
+
27
+ ### Added
28
+
29
+ - **Never out of sight**: targets are scrolled into view through every scroll container (vertical and horizontal), clear of sticky headers, banners and floating buttons; the tooltip always stays inside the visible screen and its safe areas, on every screen size, orientation and zoom level, and flips sides when there is no room.
30
+ - Targets are awaited (up to 5 seconds) after `onBeforeStep`: no more polling or delays.
31
+ - Smooth animations: the highlight glides between steps together with the scroll, the tooltip enters from its side, and the tour fades in and out. Reduced motion is respected.
32
+ - Steps without a `target` are shown in the centre. `title` and `content` accept any React content. On the web, `target` can be a ref.
33
+ - `onBeforeStep` receives an `AbortSignal` that is aborted when the step is abandoned. Errors end the tour with `'error'` and `info.error`.
34
+ - Web: the tour is a modal `<dialog>` in the browser's top layer — above every `z-index` and stacking context — with focus management, screen-reader announcements and right-to-left support. Page scrolling is blocked while a tour is open. Presses, focus and keys inside the tour do not reach the page's own listeners (menus that close on "click outside" stay open). Global styles such as Tailwind's preflight cannot break it. Stable `rtk-*` classes and CSS variables for styling, in a cascade layer that app CSS overrides. Elements with `overflow: hidden` (carousels) are never scrolled by the tour.
35
+ - React Native: `useTourScrollView()` lets the tour scroll `ScrollView`, `FlatList` and `SectionList`; `<TourHost />` shows tours in native modal screens; an `insets` prop for safe areas (with conservative defaults); the on-screen keyboard is avoided; the Android back button closes the tour; screen-reader focus moves to the tooltip and step changes are announced; stable `testID`s for UI tests.
36
+ - Server rendering and Next.js App Router support (`'use client'`).
37
+
38
+ ### Fixed
39
+
40
+ - No work while idle: 0.x re-rendered, re-measured and called `scrollTo` about 19 times a second while a step was open, pulling the page back when the user scrolled.
41
+ - `onBeforeStep` runs exactly once per step; it used to run again whenever the app re-rendered with a new `onTourEnd` function.
42
+ - React 18 works (0.x used React 19-only APIs).
43
+ - The package loads in Node (0.x failed with `ERR_UNSUPPORTED_DIR_IMPORT`).
44
+ - Android: no white strip over the navigation bar under edge to edge (caused by the `<Modal>` window).
45
+ - The highlight lines up exactly on React Native, including with translucent status bars.
46
+ - Double clicks no longer skip steps; arrow keys no longer act while typing in a text field; clicks inside the highlight no longer close the tour; going back no longer skips forward over missing targets.
47
+ - `onTourEnd` fires exactly once per tour, also when a tour is replaced by another one.
48
+ - Accessibility: dialog semantics, labelled buttons, keyboard support, AA contrast and Windows high-contrast mode (0.x had none of these).
package/MIGRATION.md ADDED
@@ -0,0 +1,205 @@
1
+ # Migrating from 0.x to 1.0
2
+
3
+ 1.0 is a rewrite. The everyday API — `TourProvider`, `useTour()`, `startTour(steps, id, {onTourEnd})`, the step fields, `theme`, `i18n`, `onTourEnd`, `closeOnOverlayClick` and `useTourTarget` — is unchanged. What changed is mostly what you no longer have to do yourself.
4
+
5
+ ## Checklist
6
+
7
+ - [ ] **Custom tooltip?** Make it content-only: no `forwardRef`, no `position`, no `isPositioned`. → [details](#custom-tooltips-are-content-only)
8
+ - [ ] **Custom overlay?** Remove `OverlayComponent`; use `theme.overlayColor` or CSS. → [details](#overlaycomponent-and-platform-are-removed)
9
+ - [ ] **Polling or delays in `onBeforeStep`?** Delete them. → [details](#onbeforestep-no-polling-no-delays)
10
+ - [ ] **React Native:** move `TourProvider` to the root, outside `SafeAreaView`, pass `insets`, remove `react-native-svg` if nothing else uses it. → [details](#react-native)
11
+ - [ ] **Exhaustive `switch` on `info.reason`?** Add `'error'`. → [details](#a-new-end-reason-error)
12
+ - [ ] **Imports of internals** (`webPlatformAdapter`, `calculateTooltipPosition`, `TourContext`, …)? Remove them. → [details](#removed-exports)
13
+ - [ ] **TypeScript code that reads steps** (`step.title` as a `string`, `onBeforeStep(target: TourTarget)`)? See [step types](#step-types).
14
+ - [ ] **Snapshot or end-to-end tests** that check labels or colours? Check the [new defaults](#changed-defaults).
15
+
16
+ ## Custom tooltips are content-only
17
+
18
+ In 0.x a custom tooltip had to position itself, forward a ref so it could be measured, and hide itself until it was positioned. In 1.0 the tour does all of that — measuring, placing, flipping, keeping it on screen, animating, focusing — and your component only renders the content.
19
+
20
+ **Before**
21
+
22
+ ```tsx
23
+ const MyTooltip = forwardRef<HTMLDivElement, TourTooltipProps>(
24
+ ({title, content, currentStep, totalSteps, position, isPositioned, onNext, onPrev, onClose}, ref) => (
25
+ <div
26
+ ref={ref}
27
+ className="my-tooltip"
28
+ style={{position: 'fixed', top: position.top, left: position.left, opacity: isPositioned ? 1 : 0}}
29
+ >
30
+ <h3>{title}</h3>
31
+ <p>{content}</p>
32
+ <button onClick={onPrev}>Back</button>
33
+ <button onClick={onNext}>Next</button>
34
+ </div>
35
+ ),
36
+ );
37
+ ```
38
+
39
+ **After**
40
+
41
+ ```tsx
42
+ function MyTooltip({step, currentStep, totalSteps, onNext, onPrev, onClose, titleId, descriptionId}: TourTooltipProps) {
43
+ return (
44
+ <div className="my-tooltip">
45
+ <h3 id={titleId}>{step.title}</h3>
46
+ <div id={descriptionId}>{step.content}</div>
47
+ <button onClick={onPrev}>Back</button>
48
+ <button onClick={onNext}>Next</button>
49
+ </div>
50
+ );
51
+ }
52
+ ```
53
+
54
+ `TourTooltipProps`:
55
+
56
+ | 0.x | 1.0 |
57
+ | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------- |
58
+ | `title`, `content` | `step.title`, `step.content` |
59
+ | `position`, `isPositioned` | removed — the tour positions and reveals the tooltip |
60
+ | `onMeasured` (React Native) | removed — the tour measures the tooltip |
61
+ | `theme`, `i18n` | removed — use your own design tokens and texts in your component |
62
+ | `currentStep`, `totalSteps`, `onNext`, `onPrev`, `onClose`, `onGoToStep` | unchanged |
63
+ | — | new: `placement` and `arrowOffset` (to draw an arrow), `titleId` and `descriptionId` (web, for screen readers) |
64
+
65
+ Remove positioning styles (`position: fixed/absolute`, `top`, `left`, `z-index`, `opacity` for hiding) from your tooltip. The card around your content provides the background, rounded corners and shadow from the theme.
66
+
67
+ ## `OverlayComponent` and `platform` are removed
68
+
69
+ A custom overlay could not keep the guarantees 1.0 makes (the highlight follows the target while scrolling, clicks inside the highlight are ignored, the overlay is above everything). Colour the overlay with `theme.overlayColor`; on the web you can also style `.rtk-spotlight` (see [Styling with CSS](./README.md#styling-with-css-web)).
70
+
71
+ The `platform` prop (a custom platform adapter) is removed as well; each entry point has its platform built in.
72
+
73
+ ## `onBeforeStep`: no polling, no delays
74
+
75
+ The tour now waits for the target to appear (up to 5 seconds, event-driven) after `onBeforeStep` finishes, and scrolls it into view. Remove polling loops and timeouts:
76
+
77
+ **Before**
78
+
79
+ ```ts
80
+ onBeforeStep: async (target) => {
81
+ navigate('/settings');
82
+ while (!document.querySelector(target as string)) {
83
+ await new Promise((resolve) => setTimeout(resolve, 50));
84
+ }
85
+ },
86
+ ```
87
+
88
+ ```ts
89
+ // React Native
90
+ onBeforeStep: async () => {
91
+ navigation.navigate('Settings');
92
+ await new Promise((resolve) => setTimeout(resolve, 300));
93
+ },
94
+ ```
95
+
96
+ **After**
97
+
98
+ ```ts
99
+ onBeforeStep() {
100
+ navigate('/settings');
101
+ },
102
+ ```
103
+
104
+ `onBeforeStep` now runs again when the user comes back to the step with Back, so make it idempotent (navigating to the page that is already open is fine; on the web, skip `navigate` when already on the path to avoid duplicate history entries). It also receives a second argument, `{signal}`, which is aborted when the step is abandoned.
105
+
106
+ If `onBeforeStep` throws or rejects, the tour ends with the new reason `'error'` (in 0.x the rejection went unhandled and the step never appeared).
107
+
108
+ ## React Native
109
+
110
+ ### Place `TourProvider` at the root and pass `insets`
111
+
112
+ 1.0 draws the tour inside your app's root view instead of a React Native `<Modal>`. This fixes the white navigation-bar strip on Android with edge-to-edge, makes the highlight line up exactly, and lets the Android back button close the tour. For that, the provider has to fill the window:
113
+
114
+ **Before**
115
+
116
+ ```tsx
117
+ <SafeAreaView style={{flex: 1}}>
118
+ <TourProvider>
119
+ <App />
120
+ </TourProvider>
121
+ </SafeAreaView>
122
+ ```
123
+
124
+ **After**
125
+
126
+ ```tsx
127
+ function Root() {
128
+ const insets = useSafeAreaInsets(); // react-native-safe-area-context
129
+ return (
130
+ <TourProvider insets={insets}>
131
+ <SafeAreaView style={{flex: 1}}>
132
+ <App />
133
+ </SafeAreaView>
134
+ </TourProvider>
135
+ );
136
+ }
137
+ ```
138
+
139
+ In development, a warning tells you when the provider does not fill the window.
140
+
141
+ ### Native modal screens need a `<TourHost />`
142
+
143
+ Screens presented as native modals (react-navigation `presentation: 'modal'`, React Native `<Modal>`) are drawn above your root view. To highlight elements in them, render `<TourHost />` as the last child of the modal screen. See [Modal screens](./README.md#modal-screens).
144
+
145
+ ### Scroll views
146
+
147
+ To let the tour scroll targets into view, register the scroll views around them with the new `useTourScrollView()` hook. Without it, steps whose target is off screen are skipped.
148
+
149
+ ### Android navigation bar
150
+
151
+ To keep the navigation bar transparent behind the tour (no contrast scrim), set `enforceContrast: false` — see [Android navigation bar](./README.md#android-navigation-bar). The `statusBarTranslucent`/`navigationBarTranslucent` workarounds for the 0.x modal are no longer needed.
152
+
153
+ ### `react-native-svg` is no longer needed
154
+
155
+ The overlay is drawn with plain views. Uninstall `react-native-svg` unless your app uses it elsewhere.
156
+
157
+ ### Minimum version
158
+
159
+ React Native 0.79 (Expo SDK 53), whose Metro reads the package's `exports`. In TypeScript, `moduleResolution` must be `bundler`, `node16` or `nodenext` (the defaults of current React Native, Expo, Next.js and Vite projects).
160
+
161
+ ## A new end reason: `'error'`
162
+
163
+ `TourEndReason` has a new member, `'error'`, used when `onBeforeStep` throws or rejects (`info.error` holds the error). A `switch` that TypeScript checks for exhaustiveness needs a new case.
164
+
165
+ ## Missing targets
166
+
167
+ 0.x checked for the target once, right after `onBeforeStep`; if it was not there yet it skipped to the next step — also when the user was going back — and ended the tour on the last step. 1.0 waits up to 5 seconds for the target to appear, then skips in the direction the user is going (with a warning in development). Going back past the first step returns to the step the user came from. The tour ends with `'target-missing'` only when no remaining step can be shown.
168
+
169
+ ## Starting tours
170
+
171
+ - Calling `startTour` with the id of the tour that is already running does nothing (it used to restart it). This makes "start on mount" effects safe in Strict Mode.
172
+ - Starting a different tour while one is running ends the running one with the reason `'closed'`, so its `onTourEnd` callbacks run.
173
+
174
+ ## Removed exports
175
+
176
+ These were internals and are no longer exported: `TourContext`, `TourOverlay`, `TourTooltip`, `TourOverlayProps`, `Rect`, `calculateTooltipPosition`, `findVisibleElement`, `webPlatformAdapter`, `nativePlatformAdapter`, `targetRegistry`, `MAX_VISIBLE_DOTS`, `DOT_SIZE`, `DOT_GAP`, `DOTS_CONTAINER_WIDTH`.
177
+
178
+ Still exported: `TourProvider`, `useTour`, `useTourTarget` (React Native), `getTruncatedDots` and the types `TourStep`, `TourTarget`, `TourContextType`, `TourProviderProps`, `TourTooltipProps`, `TourTheme`, `TourI18n`, `TourEndReason`, `TourEndInfo`, `TourEndCallback`, `StartTourOptions`, `DotItem`. New: the types `TourPlacement` and `TourStepContext`; `useTourScrollView`, `TourHost` and `TourInsets` (React Native).
179
+
180
+ `getTruncatedDots` returns ellipsis items with a `position` (`'start'` or `'end'`); `steps` in `useTour()` is now a `readonly` array.
181
+
182
+ ## Changed defaults
183
+
184
+ | Setting | 0.x | 1.0 |
185
+ | ----------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------- |
186
+ | `theme.primaryColor` | `'#3b82f6'` | `'#2563eb'` (WCAG AA) |
187
+ | `theme.titleColor` | `'#1f2937'` | `'#111827'` |
188
+ | `i18n.finishLabel` | `'Finish'` (web), `'Done'` (React Native) | `'Finish'` |
189
+ | `i18n.stepCounterTemplate` | `'{current} / {total}'` (web), `'Step {current} of {total}'` (React Native) | `'{current} of {total}'` |
190
+ | Page scrolling while a tour is open (web) | allowed | blocked, so the step cannot be scrolled away |
191
+ | Arrow keys (web) | captured globally, also while typing | only while the tour has focus, never in text fields |
192
+
193
+ `i18n.closeAriaLabel` and `i18n.dotAriaLabelTemplate` are now used on React Native too.
194
+
195
+ ## Step types
196
+
197
+ Steps can do more, so their types are wider. Writing steps needs no change; TypeScript code that _reads_ them may:
198
+
199
+ - `title` and `content` accept any React content (`ReactNode`), not only strings. Code that uses `step.title` as a `string` (for example `info.step.title` in analytics) has to handle other content, or keep its own string.
200
+ - `target` is optional: a step without a target is shown in the centre of the screen. `onBeforeStep` therefore receives `TourTarget | undefined`, plus a second argument `{signal}`; an annotated `(target: TourTarget) => …` becomes `(target: TourTarget | undefined) => …`.
201
+ - On the web, `target` can also be a ref to an element.
202
+
203
+ ## Package format
204
+
205
+ The package is ESM-only, with the entry points `@robertlinde/react-tour-kit/react` and `@robertlinde/react-tour-kit/react-native` as before. Bundlers (Vite, webpack, Next.js, Metro) and Node's `import` work as before; 0.x's broken CommonJS entry is gone. Jest (CommonJS by default) has to transform the package, on the web and with React Native's preset (see [Testing your app](./README.md#testing-your-app)).