@cratis/showrunner.cue.react 0.0.0-stage → 2.10.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 (417) hide show
  1. package/.storybook/main.ts +11 -0
  2. package/.storybook/preview.tsx +21 -0
  3. package/Configuration/CueConfiguration.ts +27 -0
  4. package/Configuration/CueProvider.tsx +64 -0
  5. package/Configuration/CueStageBoundary.tsx +37 -0
  6. package/Configuration/index.ts +6 -0
  7. package/Icons.tsx +36 -0
  8. package/Labels/CueLabels.ts +39 -0
  9. package/Labels/defaultCueLabels.ts +23 -0
  10. package/Labels/index.ts +6 -0
  11. package/Labels/resolveLabels.ts +12 -0
  12. package/Markdown/CueMarkdown.tsx +31 -0
  13. package/Markdown/index.ts +5 -0
  14. package/Markdown/safeUrl.ts +29 -0
  15. package/README.md +54 -2
  16. package/Speech/CueSpeech.ts +27 -0
  17. package/Speech/CueSpeechConfiguration.ts +21 -0
  18. package/Speech/HttpSpeechOptions.ts +37 -0
  19. package/Speech/createHttpSpeech.ts +135 -0
  20. package/Speech/index.ts +7 -0
  21. package/Speech/silentSpeech.ts +15 -0
  22. package/Speech/speechClips.ts +66 -0
  23. package/TourAnchor.tsx +162 -0
  24. package/TourAnchorSpace.ts +15 -0
  25. package/TourCallout.ts +22 -0
  26. package/TourCalloutBubble.tsx +38 -0
  27. package/TourCamera.ts +17 -0
  28. package/TourChapter.ts +24 -0
  29. package/TourChapterList.tsx +65 -0
  30. package/TourGesture.ts +30 -0
  31. package/TourOverlayShell.tsx +102 -0
  32. package/TourPointer.tsx +83 -0
  33. package/TourSection.ts +24 -0
  34. package/TourSelfPacedPanel.tsx +26 -0
  35. package/TourStep.ts +40 -0
  36. package/TourSubtitles.tsx +22 -0
  37. package/TourTimelineBar.tsx +127 -0
  38. package/Tours/index.ts +5 -0
  39. package/Tours/useCueTours.ts +63 -0
  40. package/Tours/useTourNudge.ts +37 -0
  41. package/cursorSvg.ts +12 -0
  42. package/dist/cjs/Configuration/CueConfiguration.d.ts +11 -0
  43. package/dist/cjs/Configuration/CueConfiguration.d.ts.map +1 -0
  44. package/dist/cjs/Configuration/CueProvider.d.ts +19 -0
  45. package/dist/cjs/Configuration/CueProvider.d.ts.map +1 -0
  46. package/dist/cjs/Configuration/CueProvider.js +44 -0
  47. package/dist/cjs/Configuration/CueProvider.js.map +1 -0
  48. package/dist/cjs/Configuration/CueStageBoundary.d.ts +14 -0
  49. package/dist/cjs/Configuration/CueStageBoundary.d.ts.map +1 -0
  50. package/dist/cjs/Configuration/CueStageBoundary.js +45 -0
  51. package/dist/cjs/Configuration/CueStageBoundary.js.map +1 -0
  52. package/dist/cjs/Configuration/index.d.ts +4 -0
  53. package/dist/cjs/Configuration/index.d.ts.map +1 -0
  54. package/dist/cjs/Examples/AppShell.d.ts +5 -0
  55. package/dist/cjs/Examples/AppShell.d.ts.map +1 -0
  56. package/dist/cjs/Examples/LocalizedCue.d.ts +5 -0
  57. package/dist/cjs/Examples/LocalizedCue.d.ts.map +1 -0
  58. package/dist/cjs/Examples/OrderDeskTour.d.ts +2 -0
  59. package/dist/cjs/Examples/OrderDeskTour.d.ts.map +1 -0
  60. package/dist/cjs/Examples/OwnStageGuard.d.ts +5 -0
  61. package/dist/cjs/Examples/OwnStageGuard.d.ts.map +1 -0
  62. package/dist/cjs/Examples/OwnVoice.d.ts +3 -0
  63. package/dist/cjs/Examples/OwnVoice.d.ts.map +1 -0
  64. package/dist/cjs/Icons.d.ts +19 -0
  65. package/dist/cjs/Icons.d.ts.map +1 -0
  66. package/dist/cjs/Icons.js +33 -0
  67. package/dist/cjs/Icons.js.map +1 -0
  68. package/dist/cjs/Labels/CueLabels.d.ts +18 -0
  69. package/dist/cjs/Labels/CueLabels.d.ts.map +1 -0
  70. package/dist/cjs/Labels/defaultCueLabels.d.ts +3 -0
  71. package/dist/cjs/Labels/defaultCueLabels.d.ts.map +1 -0
  72. package/dist/cjs/Labels/defaultCueLabels.js +24 -0
  73. package/dist/cjs/Labels/defaultCueLabels.js.map +1 -0
  74. package/dist/cjs/Labels/index.d.ts +4 -0
  75. package/dist/cjs/Labels/index.d.ts.map +1 -0
  76. package/dist/cjs/Labels/resolveLabels.d.ts +3 -0
  77. package/dist/cjs/Labels/resolveLabels.d.ts.map +1 -0
  78. package/dist/cjs/Labels/resolveLabels.js +17 -0
  79. package/dist/cjs/Labels/resolveLabels.js.map +1 -0
  80. package/dist/cjs/Markdown/CueMarkdown.d.ts +6 -0
  81. package/dist/cjs/Markdown/CueMarkdown.d.ts.map +1 -0
  82. package/dist/cjs/Markdown/CueMarkdown.js +34 -0
  83. package/dist/cjs/Markdown/CueMarkdown.js.map +1 -0
  84. package/dist/cjs/Markdown/index.d.ts +3 -0
  85. package/dist/cjs/Markdown/index.d.ts.map +1 -0
  86. package/dist/cjs/Markdown/safeUrl.d.ts +2 -0
  87. package/dist/cjs/Markdown/safeUrl.d.ts.map +1 -0
  88. package/dist/cjs/Markdown/safeUrl.js +34 -0
  89. package/dist/cjs/Markdown/safeUrl.js.map +1 -0
  90. package/dist/cjs/Speech/CueSpeech.d.ts +10 -0
  91. package/dist/cjs/Speech/CueSpeech.d.ts.map +1 -0
  92. package/dist/cjs/Speech/CueSpeechConfiguration.d.ts +6 -0
  93. package/dist/cjs/Speech/CueSpeechConfiguration.d.ts.map +1 -0
  94. package/dist/cjs/Speech/HttpSpeechOptions.d.ts +10 -0
  95. package/dist/cjs/Speech/HttpSpeechOptions.d.ts.map +1 -0
  96. package/dist/cjs/Speech/createHttpSpeech.d.ts +4 -0
  97. package/dist/cjs/Speech/createHttpSpeech.d.ts.map +1 -0
  98. package/dist/cjs/Speech/createHttpSpeech.js +140 -0
  99. package/dist/cjs/Speech/createHttpSpeech.js.map +1 -0
  100. package/dist/cjs/Speech/index.d.ts +5 -0
  101. package/dist/cjs/Speech/index.d.ts.map +1 -0
  102. package/dist/cjs/Speech/silentSpeech.d.ts +3 -0
  103. package/dist/cjs/Speech/silentSpeech.d.ts.map +1 -0
  104. package/dist/cjs/Speech/silentSpeech.js +16 -0
  105. package/dist/cjs/Speech/silentSpeech.js.map +1 -0
  106. package/dist/cjs/Speech/speechClips.d.ts +7 -0
  107. package/dist/cjs/Speech/speechClips.d.ts.map +1 -0
  108. package/dist/cjs/Speech/speechClips.js +60 -0
  109. package/dist/cjs/Speech/speechClips.js.map +1 -0
  110. package/dist/cjs/TourAnchor.d.ts +14 -0
  111. package/dist/cjs/TourAnchor.d.ts.map +1 -0
  112. package/dist/cjs/TourAnchor.js +150 -0
  113. package/dist/cjs/TourAnchor.js.map +1 -0
  114. package/dist/cjs/TourAnchorSpace.d.ts +2 -0
  115. package/dist/cjs/TourAnchorSpace.d.ts.map +1 -0
  116. package/dist/cjs/TourCallout.d.ts +8 -0
  117. package/dist/cjs/TourCallout.d.ts.map +1 -0
  118. package/dist/cjs/TourCalloutBubble.d.ts +9 -0
  119. package/dist/cjs/TourCalloutBubble.d.ts.map +1 -0
  120. package/dist/cjs/TourCalloutBubble.js +27 -0
  121. package/dist/cjs/TourCalloutBubble.js.map +1 -0
  122. package/dist/cjs/TourCamera.d.ts +6 -0
  123. package/dist/cjs/TourCamera.d.ts.map +1 -0
  124. package/dist/cjs/TourChapter.d.ts +8 -0
  125. package/dist/cjs/TourChapter.d.ts.map +1 -0
  126. package/dist/cjs/TourChapterList.d.ts +10 -0
  127. package/dist/cjs/TourChapterList.d.ts.map +1 -0
  128. package/dist/cjs/TourChapterList.js +68 -0
  129. package/dist/cjs/TourChapterList.js.map +1 -0
  130. package/dist/cjs/TourChapterList.stories.d.ts +21 -0
  131. package/dist/cjs/TourChapterList.stories.d.ts.map +1 -0
  132. package/dist/cjs/TourGesture.d.ts +12 -0
  133. package/dist/cjs/TourGesture.d.ts.map +1 -0
  134. package/dist/cjs/TourOverlayShell.d.ts +13 -0
  135. package/dist/cjs/TourOverlayShell.d.ts.map +1 -0
  136. package/dist/cjs/TourOverlayShell.js +77 -0
  137. package/dist/cjs/TourOverlayShell.js.map +1 -0
  138. package/dist/cjs/TourPointer.d.ts +9 -0
  139. package/dist/cjs/TourPointer.d.ts.map +1 -0
  140. package/dist/cjs/TourPointer.js +74 -0
  141. package/dist/cjs/TourPointer.js.map +1 -0
  142. package/dist/cjs/TourSection.d.ts +8 -0
  143. package/dist/cjs/TourSection.d.ts.map +1 -0
  144. package/dist/cjs/TourSelfPacedPanel.d.ts +6 -0
  145. package/dist/cjs/TourSelfPacedPanel.d.ts.map +1 -0
  146. package/dist/cjs/TourSelfPacedPanel.js +27 -0
  147. package/dist/cjs/TourSelfPacedPanel.js.map +1 -0
  148. package/dist/cjs/TourSelfPacedPanel.stories.d.ts +21 -0
  149. package/dist/cjs/TourSelfPacedPanel.stories.d.ts.map +1 -0
  150. package/dist/cjs/TourStep.d.ts +12 -0
  151. package/dist/cjs/TourStep.d.ts.map +1 -0
  152. package/dist/cjs/TourSubtitles.d.ts +5 -0
  153. package/dist/cjs/TourSubtitles.d.ts.map +1 -0
  154. package/dist/cjs/TourSubtitles.js +24 -0
  155. package/dist/cjs/TourSubtitles.js.map +1 -0
  156. package/dist/cjs/TourTimelineBar.d.ts +10 -0
  157. package/dist/cjs/TourTimelineBar.d.ts.map +1 -0
  158. package/dist/cjs/TourTimelineBar.js +134 -0
  159. package/dist/cjs/TourTimelineBar.js.map +1 -0
  160. package/dist/cjs/TourTimelineBar.stories.d.ts +24 -0
  161. package/dist/cjs/TourTimelineBar.stories.d.ts.map +1 -0
  162. package/dist/cjs/Tours/index.d.ts +3 -0
  163. package/dist/cjs/Tours/index.d.ts.map +1 -0
  164. package/dist/cjs/Tours/useCueTours.d.ts +7 -0
  165. package/dist/cjs/Tours/useCueTours.d.ts.map +1 -0
  166. package/dist/cjs/Tours/useCueTours.js +46 -0
  167. package/dist/cjs/Tours/useCueTours.js.map +1 -0
  168. package/dist/cjs/Tours/useTourNudge.d.ts +6 -0
  169. package/dist/cjs/Tours/useTourNudge.d.ts.map +1 -0
  170. package/dist/cjs/Tours/useTourNudge.js +28 -0
  171. package/dist/cjs/Tours/useTourNudge.js.map +1 -0
  172. package/dist/cjs/cursorSvg.d.ts +2 -0
  173. package/dist/cjs/cursorSvg.d.ts.map +1 -0
  174. package/dist/cjs/cursorSvg.js +15 -0
  175. package/dist/cjs/cursorSvg.js.map +1 -0
  176. package/dist/cjs/index.d.ts +41 -0
  177. package/dist/cjs/index.d.ts.map +1 -0
  178. package/dist/cjs/index.js +72 -0
  179. package/dist/cjs/index.js.map +1 -0
  180. package/dist/cjs/package.json +3 -0
  181. package/dist/cjs/tourClock.d.ts +19 -0
  182. package/dist/cjs/tourClock.d.ts.map +1 -0
  183. package/dist/cjs/tourClock.js +107 -0
  184. package/dist/cjs/tourClock.js.map +1 -0
  185. package/dist/cjs/tourGeometry.d.ts +18 -0
  186. package/dist/cjs/tourGeometry.d.ts.map +1 -0
  187. package/dist/cjs/tourGeometry.js +86 -0
  188. package/dist/cjs/tourGeometry.js.map +1 -0
  189. package/dist/cjs/tourSelfPaced.d.ts +12 -0
  190. package/dist/cjs/tourSelfPaced.d.ts.map +1 -0
  191. package/dist/cjs/tourSelfPaced.js +69 -0
  192. package/dist/cjs/tourSelfPaced.js.map +1 -0
  193. package/dist/cjs/tourTimeline.d.ts +40 -0
  194. package/dist/cjs/tourTimeline.d.ts.map +1 -0
  195. package/dist/cjs/tourTimeline.js +168 -0
  196. package/dist/cjs/tourTimeline.js.map +1 -0
  197. package/dist/cjs/useTourPlayback.d.ts +25 -0
  198. package/dist/cjs/useTourPlayback.d.ts.map +1 -0
  199. package/dist/cjs/useTourPlayback.js +245 -0
  200. package/dist/cjs/useTourPlayback.js.map +1 -0
  201. package/dist/esm/Configuration/CueConfiguration.d.ts +11 -0
  202. package/dist/esm/Configuration/CueConfiguration.d.ts.map +1 -0
  203. package/dist/esm/Configuration/CueConfiguration.js +2 -0
  204. package/dist/esm/Configuration/CueConfiguration.js.map +1 -0
  205. package/dist/esm/Configuration/CueProvider.d.ts +19 -0
  206. package/dist/esm/Configuration/CueProvider.d.ts.map +1 -0
  207. package/dist/esm/Configuration/CueProvider.js +41 -0
  208. package/dist/esm/Configuration/CueProvider.js.map +1 -0
  209. package/dist/esm/Configuration/CueStageBoundary.d.ts +14 -0
  210. package/dist/esm/Configuration/CueStageBoundary.d.ts.map +1 -0
  211. package/dist/esm/Configuration/CueStageBoundary.js +43 -0
  212. package/dist/esm/Configuration/CueStageBoundary.js.map +1 -0
  213. package/dist/esm/Configuration/index.d.ts +4 -0
  214. package/dist/esm/Configuration/index.d.ts.map +1 -0
  215. package/dist/esm/Configuration/index.js +4 -0
  216. package/dist/esm/Configuration/index.js.map +1 -0
  217. package/dist/esm/Examples/AppShell.d.ts +5 -0
  218. package/dist/esm/Examples/AppShell.d.ts.map +1 -0
  219. package/dist/esm/Examples/AppShell.js +10 -0
  220. package/dist/esm/Examples/AppShell.js.map +1 -0
  221. package/dist/esm/Examples/LocalizedCue.d.ts +5 -0
  222. package/dist/esm/Examples/LocalizedCue.d.ts.map +1 -0
  223. package/dist/esm/Examples/LocalizedCue.js +11 -0
  224. package/dist/esm/Examples/LocalizedCue.js.map +1 -0
  225. package/dist/esm/Examples/OrderDeskTour.d.ts +2 -0
  226. package/dist/esm/Examples/OrderDeskTour.d.ts.map +1 -0
  227. package/dist/esm/Examples/OrderDeskTour.js +33 -0
  228. package/dist/esm/Examples/OrderDeskTour.js.map +1 -0
  229. package/dist/esm/Examples/OwnStageGuard.d.ts +5 -0
  230. package/dist/esm/Examples/OwnStageGuard.d.ts.map +1 -0
  231. package/dist/esm/Examples/OwnStageGuard.js +17 -0
  232. package/dist/esm/Examples/OwnStageGuard.js.map +1 -0
  233. package/dist/esm/Examples/OwnVoice.d.ts +3 -0
  234. package/dist/esm/Examples/OwnVoice.d.ts.map +1 -0
  235. package/dist/esm/Examples/OwnVoice.js +35 -0
  236. package/dist/esm/Examples/OwnVoice.js.map +1 -0
  237. package/dist/esm/Icons.d.ts +19 -0
  238. package/dist/esm/Icons.d.ts.map +1 -0
  239. package/dist/esm/Icons.js +31 -0
  240. package/dist/esm/Icons.js.map +1 -0
  241. package/dist/esm/Labels/CueLabels.d.ts +18 -0
  242. package/dist/esm/Labels/CueLabels.d.ts.map +1 -0
  243. package/dist/esm/Labels/CueLabels.js +2 -0
  244. package/dist/esm/Labels/CueLabels.js.map +1 -0
  245. package/dist/esm/Labels/defaultCueLabels.d.ts +3 -0
  246. package/dist/esm/Labels/defaultCueLabels.d.ts.map +1 -0
  247. package/dist/esm/Labels/defaultCueLabels.js +22 -0
  248. package/dist/esm/Labels/defaultCueLabels.js.map +1 -0
  249. package/dist/esm/Labels/index.d.ts +4 -0
  250. package/dist/esm/Labels/index.d.ts.map +1 -0
  251. package/dist/esm/Labels/index.js +4 -0
  252. package/dist/esm/Labels/index.js.map +1 -0
  253. package/dist/esm/Labels/resolveLabels.d.ts +3 -0
  254. package/dist/esm/Labels/resolveLabels.d.ts.map +1 -0
  255. package/dist/esm/Labels/resolveLabels.js +15 -0
  256. package/dist/esm/Labels/resolveLabels.js.map +1 -0
  257. package/dist/esm/Markdown/CueMarkdown.d.ts +6 -0
  258. package/dist/esm/Markdown/CueMarkdown.d.ts.map +1 -0
  259. package/dist/esm/Markdown/CueMarkdown.js +32 -0
  260. package/dist/esm/Markdown/CueMarkdown.js.map +1 -0
  261. package/dist/esm/Markdown/index.d.ts +3 -0
  262. package/dist/esm/Markdown/index.d.ts.map +1 -0
  263. package/dist/esm/Markdown/index.js +3 -0
  264. package/dist/esm/Markdown/index.js.map +1 -0
  265. package/dist/esm/Markdown/safeUrl.d.ts +2 -0
  266. package/dist/esm/Markdown/safeUrl.d.ts.map +1 -0
  267. package/dist/esm/Markdown/safeUrl.js +32 -0
  268. package/dist/esm/Markdown/safeUrl.js.map +1 -0
  269. package/dist/esm/Speech/CueSpeech.d.ts +10 -0
  270. package/dist/esm/Speech/CueSpeech.d.ts.map +1 -0
  271. package/dist/esm/Speech/CueSpeech.js +2 -0
  272. package/dist/esm/Speech/CueSpeech.js.map +1 -0
  273. package/dist/esm/Speech/CueSpeechConfiguration.d.ts +6 -0
  274. package/dist/esm/Speech/CueSpeechConfiguration.d.ts.map +1 -0
  275. package/dist/esm/Speech/CueSpeechConfiguration.js +2 -0
  276. package/dist/esm/Speech/CueSpeechConfiguration.js.map +1 -0
  277. package/dist/esm/Speech/HttpSpeechOptions.d.ts +10 -0
  278. package/dist/esm/Speech/HttpSpeechOptions.d.ts.map +1 -0
  279. package/dist/esm/Speech/HttpSpeechOptions.js +2 -0
  280. package/dist/esm/Speech/HttpSpeechOptions.js.map +1 -0
  281. package/dist/esm/Speech/createHttpSpeech.d.ts +4 -0
  282. package/dist/esm/Speech/createHttpSpeech.d.ts.map +1 -0
  283. package/dist/esm/Speech/createHttpSpeech.js +138 -0
  284. package/dist/esm/Speech/createHttpSpeech.js.map +1 -0
  285. package/dist/esm/Speech/index.d.ts +5 -0
  286. package/dist/esm/Speech/index.d.ts.map +1 -0
  287. package/dist/esm/Speech/index.js +5 -0
  288. package/dist/esm/Speech/index.js.map +1 -0
  289. package/dist/esm/Speech/silentSpeech.d.ts +3 -0
  290. package/dist/esm/Speech/silentSpeech.d.ts.map +1 -0
  291. package/dist/esm/Speech/silentSpeech.js +14 -0
  292. package/dist/esm/Speech/silentSpeech.js.map +1 -0
  293. package/dist/esm/Speech/speechClips.d.ts +7 -0
  294. package/dist/esm/Speech/speechClips.d.ts.map +1 -0
  295. package/dist/esm/Speech/speechClips.js +58 -0
  296. package/dist/esm/Speech/speechClips.js.map +1 -0
  297. package/dist/esm/TourAnchor.d.ts +14 -0
  298. package/dist/esm/TourAnchor.d.ts.map +1 -0
  299. package/dist/esm/TourAnchor.js +148 -0
  300. package/dist/esm/TourAnchor.js.map +1 -0
  301. package/dist/esm/TourAnchorSpace.d.ts +2 -0
  302. package/dist/esm/TourAnchorSpace.d.ts.map +1 -0
  303. package/dist/esm/TourAnchorSpace.js +2 -0
  304. package/dist/esm/TourAnchorSpace.js.map +1 -0
  305. package/dist/esm/TourCallout.d.ts +8 -0
  306. package/dist/esm/TourCallout.d.ts.map +1 -0
  307. package/dist/esm/TourCallout.js +2 -0
  308. package/dist/esm/TourCallout.js.map +1 -0
  309. package/dist/esm/TourCalloutBubble.d.ts +9 -0
  310. package/dist/esm/TourCalloutBubble.d.ts.map +1 -0
  311. package/dist/esm/TourCalloutBubble.js +25 -0
  312. package/dist/esm/TourCalloutBubble.js.map +1 -0
  313. package/dist/esm/TourCamera.d.ts +6 -0
  314. package/dist/esm/TourCamera.d.ts.map +1 -0
  315. package/dist/esm/TourCamera.js +2 -0
  316. package/dist/esm/TourCamera.js.map +1 -0
  317. package/dist/esm/TourChapter.d.ts +8 -0
  318. package/dist/esm/TourChapter.d.ts.map +1 -0
  319. package/dist/esm/TourChapter.js +2 -0
  320. package/dist/esm/TourChapter.js.map +1 -0
  321. package/dist/esm/TourChapterList.d.ts +10 -0
  322. package/dist/esm/TourChapterList.d.ts.map +1 -0
  323. package/dist/esm/TourChapterList.js +66 -0
  324. package/dist/esm/TourChapterList.js.map +1 -0
  325. package/dist/esm/TourChapterList.stories.d.ts +21 -0
  326. package/dist/esm/TourChapterList.stories.d.ts.map +1 -0
  327. package/dist/esm/TourChapterList.stories.js +53 -0
  328. package/dist/esm/TourChapterList.stories.js.map +1 -0
  329. package/dist/esm/TourGesture.d.ts +12 -0
  330. package/dist/esm/TourGesture.d.ts.map +1 -0
  331. package/dist/esm/TourGesture.js +2 -0
  332. package/dist/esm/TourGesture.js.map +1 -0
  333. package/dist/esm/TourOverlayShell.d.ts +13 -0
  334. package/dist/esm/TourOverlayShell.d.ts.map +1 -0
  335. package/dist/esm/TourOverlayShell.js +75 -0
  336. package/dist/esm/TourOverlayShell.js.map +1 -0
  337. package/dist/esm/TourPointer.d.ts +9 -0
  338. package/dist/esm/TourPointer.d.ts.map +1 -0
  339. package/dist/esm/TourPointer.js +72 -0
  340. package/dist/esm/TourPointer.js.map +1 -0
  341. package/dist/esm/TourSection.d.ts +8 -0
  342. package/dist/esm/TourSection.d.ts.map +1 -0
  343. package/dist/esm/TourSection.js +2 -0
  344. package/dist/esm/TourSection.js.map +1 -0
  345. package/dist/esm/TourSelfPacedPanel.d.ts +6 -0
  346. package/dist/esm/TourSelfPacedPanel.d.ts.map +1 -0
  347. package/dist/esm/TourSelfPacedPanel.js +25 -0
  348. package/dist/esm/TourSelfPacedPanel.js.map +1 -0
  349. package/dist/esm/TourSelfPacedPanel.stories.d.ts +21 -0
  350. package/dist/esm/TourSelfPacedPanel.stories.d.ts.map +1 -0
  351. package/dist/esm/TourSelfPacedPanel.stories.js +41 -0
  352. package/dist/esm/TourSelfPacedPanel.stories.js.map +1 -0
  353. package/dist/esm/TourStep.d.ts +12 -0
  354. package/dist/esm/TourStep.d.ts.map +1 -0
  355. package/dist/esm/TourStep.js +2 -0
  356. package/dist/esm/TourStep.js.map +1 -0
  357. package/dist/esm/TourSubtitles.d.ts +5 -0
  358. package/dist/esm/TourSubtitles.d.ts.map +1 -0
  359. package/dist/esm/TourSubtitles.js +22 -0
  360. package/dist/esm/TourSubtitles.js.map +1 -0
  361. package/dist/esm/TourTimelineBar.d.ts +10 -0
  362. package/dist/esm/TourTimelineBar.d.ts.map +1 -0
  363. package/dist/esm/TourTimelineBar.js +132 -0
  364. package/dist/esm/TourTimelineBar.js.map +1 -0
  365. package/dist/esm/TourTimelineBar.stories.d.ts +24 -0
  366. package/dist/esm/TourTimelineBar.stories.d.ts.map +1 -0
  367. package/dist/esm/TourTimelineBar.stories.js +62 -0
  368. package/dist/esm/TourTimelineBar.stories.js.map +1 -0
  369. package/dist/esm/Tours/index.d.ts +3 -0
  370. package/dist/esm/Tours/index.d.ts.map +1 -0
  371. package/dist/esm/Tours/index.js +3 -0
  372. package/dist/esm/Tours/index.js.map +1 -0
  373. package/dist/esm/Tours/useCueTours.d.ts +7 -0
  374. package/dist/esm/Tours/useCueTours.d.ts.map +1 -0
  375. package/dist/esm/Tours/useCueTours.js +44 -0
  376. package/dist/esm/Tours/useCueTours.js.map +1 -0
  377. package/dist/esm/Tours/useTourNudge.d.ts +6 -0
  378. package/dist/esm/Tours/useTourNudge.d.ts.map +1 -0
  379. package/dist/esm/Tours/useTourNudge.js +26 -0
  380. package/dist/esm/Tours/useTourNudge.js.map +1 -0
  381. package/dist/esm/cursorSvg.d.ts +2 -0
  382. package/dist/esm/cursorSvg.d.ts.map +1 -0
  383. package/dist/esm/cursorSvg.js +13 -0
  384. package/dist/esm/cursorSvg.js.map +1 -0
  385. package/dist/esm/index.d.ts +41 -0
  386. package/dist/esm/index.d.ts.map +1 -0
  387. package/dist/esm/index.js +24 -0
  388. package/dist/esm/index.js.map +1 -0
  389. package/dist/esm/package.json +3 -0
  390. package/dist/esm/tourClock.d.ts +19 -0
  391. package/dist/esm/tourClock.d.ts.map +1 -0
  392. package/dist/esm/tourClock.js +103 -0
  393. package/dist/esm/tourClock.js.map +1 -0
  394. package/dist/esm/tourGeometry.d.ts +18 -0
  395. package/dist/esm/tourGeometry.d.ts.map +1 -0
  396. package/dist/esm/tourGeometry.js +80 -0
  397. package/dist/esm/tourGeometry.js.map +1 -0
  398. package/dist/esm/tourSelfPaced.d.ts +12 -0
  399. package/dist/esm/tourSelfPaced.d.ts.map +1 -0
  400. package/dist/esm/tourSelfPaced.js +64 -0
  401. package/dist/esm/tourSelfPaced.js.map +1 -0
  402. package/dist/esm/tourTimeline.d.ts +40 -0
  403. package/dist/esm/tourTimeline.d.ts.map +1 -0
  404. package/dist/esm/tourTimeline.js +154 -0
  405. package/dist/esm/tourTimeline.js.map +1 -0
  406. package/dist/esm/useTourPlayback.d.ts +25 -0
  407. package/dist/esm/useTourPlayback.d.ts.map +1 -0
  408. package/dist/esm/useTourPlayback.js +243 -0
  409. package/dist/esm/useTourPlayback.js.map +1 -0
  410. package/index.ts +68 -0
  411. package/package.json +93 -4
  412. package/styles.css +485 -0
  413. package/tourClock.ts +125 -0
  414. package/tourGeometry.ts +95 -0
  415. package/tourSelfPaced.ts +93 -0
  416. package/tourTimeline.ts +237 -0
  417. package/useTourPlayback.ts +291 -0
@@ -0,0 +1,6 @@
1
+ import type { CueSpeech } from './CueSpeech.js';
2
+ export interface CueSpeechConfiguration {
3
+ useSpeech: () => CueSpeech;
4
+ unlock?: () => void;
5
+ }
6
+ //# sourceMappingURL=CueSpeechConfiguration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CueSpeechConfiguration.d.ts","sourceRoot":"","sources":["../../../Speech/CueSpeechConfiguration.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAKhD,MAAM,WAAW,sBAAsB;IAKnC,SAAS,EAAE,MAAM,SAAS,CAAC;IAM3B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CueSpeechConfiguration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CueSpeechConfiguration.js","sourceRoot":"","sources":["../../../Speech/CueSpeechConfiguration.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ export interface HttpSpeechOptions {
2
+ speakUrl: string;
3
+ availableUrl?: string;
4
+ body?: (text: string) => unknown;
5
+ headers?: Record<string, string>;
6
+ credentials?: RequestCredentials;
7
+ cacheSize?: number;
8
+ fetch?: typeof fetch;
9
+ }
10
+ //# sourceMappingURL=HttpSpeechOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpSpeechOptions.d.ts","sourceRoot":"","sources":["../../../Speech/HttpSpeechOptions.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IAK9B,QAAQ,EAAE,MAAM,CAAC;IAMjB,YAAY,CAAC,EAAE,MAAM,CAAC;IAMtB,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAGjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAGjC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAGjC,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=HttpSpeechOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpSpeechOptions.js","sourceRoot":"","sources":["../../../Speech/HttpSpeechOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { CueSpeechConfiguration } from './CueSpeechConfiguration.js';
2
+ import type { HttpSpeechOptions } from './HttpSpeechOptions.js';
3
+ export declare function createHttpSpeech(options: HttpSpeechOptions): CueSpeechConfiguration;
4
+ //# sourceMappingURL=createHttpSpeech.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createHttpSpeech.d.ts","sourceRoot":"","sources":["../../../Speech/createHttpSpeech.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAgBhE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,sBAAsB,CAgHnF"}
@@ -0,0 +1,138 @@
1
+ import { useState, useRef, useEffect, useCallback } from 'react';
2
+ import { createSpeechClips } from './speechClips.js';
3
+
4
+ // Copyright (c) Cratis. All rights reserved.
5
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
6
+ // A tenth of a second of silence. Playing it from a gesture is what lets a browser that blocks sound until the viewer
7
+ // has done something allow the lines that follow.
8
+ const SILENT_CLIP = 'data:audio/wav;base64,UklGRkQDAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YSADAACAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgA==';
9
+ /**
10
+ * Gives a tour its voice-over from a text-to-speech service that is reached over HTTP: each line is sent to the service,
11
+ * which answers with audio, and the audio is played one line at a time.
12
+ * @param options Where the audio comes from.
13
+ * @returns The configuration to give {@link CueProvider}.
14
+ * @remarks
15
+ * Create it once, outside any component, and keep it. An application whose service streams, mixes voices or plays through
16
+ * its own audio pipeline gives the tour a {@link CueSpeechConfiguration} of its own instead.
17
+ */ function createHttpSpeech(options) {
18
+ const clips = createSpeechClips(options);
19
+ let availability;
20
+ let element;
21
+ const audio = ()=>element ??= new Audio();
22
+ // Whether a service is there is the same answer for every tour, so it is asked once.
23
+ const isAvailable = ()=>{
24
+ if (!options.availableUrl) {
25
+ return Promise.resolve(true);
26
+ }
27
+ availability ??= (options.fetch ?? fetch)(options.availableUrl, {
28
+ credentials: options.credentials ?? 'include',
29
+ headers: options.headers
30
+ }).then((response)=>response.ok ? response.json() : {
31
+ available: false
32
+ }).then((payload)=>Boolean(payload.available)).catch(()=>{
33
+ availability = undefined;
34
+ return false;
35
+ });
36
+ return availability;
37
+ };
38
+ const useSpeech = ()=>{
39
+ const [available, setAvailable] = useState(!options.availableUrl);
40
+ const [isPreparing, setIsPreparing] = useState(false);
41
+ const [isSpeaking, setIsSpeaking] = useState(false);
42
+ const [hasError, setHasError] = useState(false);
43
+ const request = useRef(0);
44
+ const finish = useRef(null);
45
+ useEffect(()=>{
46
+ let current = true;
47
+ void isAvailable().then((value)=>{
48
+ if (current) setAvailable(value);
49
+ });
50
+ return ()=>{
51
+ current = false;
52
+ };
53
+ }, []);
54
+ const stop = useCallback(()=>{
55
+ request.current++;
56
+ finish.current?.();
57
+ finish.current = null;
58
+ setIsPreparing(false);
59
+ setIsSpeaking(false);
60
+ }, []);
61
+ useEffect(()=>stop, [
62
+ stop
63
+ ]);
64
+ const speak = useCallback(async (text)=>{
65
+ stop();
66
+ const mine = request.current;
67
+ setHasError(false);
68
+ setIsPreparing(true);
69
+ let url;
70
+ try {
71
+ const clip = await clips.obtain(text);
72
+ if (mine !== request.current) return;
73
+ const player = audio();
74
+ url = URL.createObjectURL(clip);
75
+ const source = url;
76
+ await new Promise((resolve, reject)=>{
77
+ const done = ()=>{
78
+ player.onplaying = null;
79
+ player.onended = null;
80
+ player.onerror = null;
81
+ player.pause();
82
+ URL.revokeObjectURL(source);
83
+ resolve();
84
+ };
85
+ finish.current = done;
86
+ player.onplaying = ()=>{
87
+ if (mine !== request.current) return;
88
+ setIsPreparing(false);
89
+ setIsSpeaking(true);
90
+ };
91
+ player.onended = ()=>{
92
+ if (mine === request.current) {
93
+ finish.current = null;
94
+ setIsSpeaking(false);
95
+ }
96
+ done();
97
+ };
98
+ player.onerror = ()=>reject(new Error('The line could not be played.'));
99
+ player.src = source;
100
+ player.play().catch(reject);
101
+ });
102
+ } catch {
103
+ if (url) URL.revokeObjectURL(url);
104
+ if (mine === request.current) {
105
+ setIsPreparing(false);
106
+ setIsSpeaking(false);
107
+ setHasError(true);
108
+ }
109
+ }
110
+ }, [
111
+ stop
112
+ ]);
113
+ const prefetch = useCallback((text)=>clips.prefetch(text), []);
114
+ return {
115
+ isAvailable: available,
116
+ isPreparing,
117
+ isSpeaking,
118
+ hasError,
119
+ speak,
120
+ prefetch,
121
+ stop
122
+ };
123
+ };
124
+ const unlock = ()=>{
125
+ const player = audio();
126
+ if (player.paused && !player.src) {
127
+ player.src = SILENT_CLIP;
128
+ player.play().catch(()=>undefined);
129
+ }
130
+ };
131
+ return {
132
+ useSpeech,
133
+ unlock
134
+ };
135
+ }
136
+
137
+ export { createHttpSpeech };
138
+ //# sourceMappingURL=createHttpSpeech.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createHttpSpeech.js","sources":["../../../Speech/createHttpSpeech.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport type { CueSpeech } from './CueSpeech.js';\nimport type { CueSpeechConfiguration } from './CueSpeechConfiguration.js';\nimport type { HttpSpeechOptions } from './HttpSpeechOptions.js';\nimport { createSpeechClips } from './speechClips.js';\n\n// A tenth of a second of silence. Playing it from a gesture is what lets a browser that blocks sound until the viewer\n// has done something allow the lines that follow.\nconst SILENT_CLIP = 'data:audio/wav;base64,UklGRkQDAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YSADAACAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgA==';\n\n/**\n * Gives a tour its voice-over from a text-to-speech service that is reached over HTTP: each line is sent to the service,\n * which answers with audio, and the audio is played one line at a time.\n * @param options Where the audio comes from.\n * @returns The configuration to give {@link CueProvider}.\n * @remarks\n * Create it once, outside any component, and keep it. An application whose service streams, mixes voices or plays through\n * its own audio pipeline gives the tour a {@link CueSpeechConfiguration} of its own instead.\n */\nexport function createHttpSpeech(options: HttpSpeechOptions): CueSpeechConfiguration {\n const clips = createSpeechClips(options);\n let availability: Promise<boolean> | undefined;\n let element: HTMLAudioElement | undefined;\n\n const audio = (): HTMLAudioElement => element ??= new Audio();\n\n // Whether a service is there is the same answer for every tour, so it is asked once.\n const isAvailable = (): Promise<boolean> => {\n if (!options.availableUrl) {\n return Promise.resolve(true);\n }\n\n availability ??= (options.fetch ?? fetch)(options.availableUrl, { credentials: options.credentials ?? 'include', headers: options.headers })\n .then(response => (response.ok ? response.json() : { available: false }))\n .then(payload => Boolean((payload as { available?: boolean }).available))\n .catch(() => {\n availability = undefined;\n return false;\n });\n return availability;\n };\n\n const useSpeech = (): CueSpeech => {\n const [available, setAvailable] = useState(!options.availableUrl);\n const [isPreparing, setIsPreparing] = useState(false);\n const [isSpeaking, setIsSpeaking] = useState(false);\n const [hasError, setHasError] = useState(false);\n const request = useRef(0);\n const finish = useRef<(() => void) | null>(null);\n\n useEffect(() => {\n let current = true;\n void isAvailable().then(value => {\n if (current) setAvailable(value);\n });\n return () => { current = false; };\n }, []);\n\n const stop = useCallback(() => {\n request.current++;\n finish.current?.();\n finish.current = null;\n setIsPreparing(false);\n setIsSpeaking(false);\n }, []);\n\n useEffect(() => stop, [stop]);\n\n const speak = useCallback(async (text: string) => {\n stop();\n const mine = request.current;\n setHasError(false);\n setIsPreparing(true);\n let url: string | undefined;\n try {\n const clip = await clips.obtain(text);\n if (mine !== request.current) return;\n\n const player = audio();\n url = URL.createObjectURL(clip);\n const source = url;\n await new Promise<void>((resolve, reject) => {\n const done = () => {\n player.onplaying = null;\n player.onended = null;\n player.onerror = null;\n player.pause();\n URL.revokeObjectURL(source);\n resolve();\n };\n finish.current = done;\n player.onplaying = () => {\n if (mine !== request.current) return;\n setIsPreparing(false);\n setIsSpeaking(true);\n };\n player.onended = () => {\n if (mine === request.current) {\n finish.current = null;\n setIsSpeaking(false);\n }\n done();\n };\n player.onerror = () => reject(new Error('The line could not be played.'));\n player.src = source;\n player.play().catch(reject);\n });\n } catch {\n if (url) URL.revokeObjectURL(url);\n if (mine === request.current) {\n setIsPreparing(false);\n setIsSpeaking(false);\n setHasError(true);\n }\n }\n }, [stop]);\n\n const prefetch = useCallback((text: string) => clips.prefetch(text), []);\n\n return { isAvailable: available, isPreparing, isSpeaking, hasError, speak, prefetch, stop };\n };\n\n const unlock = () => {\n const player = audio();\n if (player.paused && !player.src) {\n player.src = SILENT_CLIP;\n player.play().catch(() => undefined);\n }\n };\n\n return { useSpeech, unlock };\n}\n"],"names":["SILENT_CLIP","createHttpSpeech","options","clips","createSpeechClips","availability","element","audio","Audio","isAvailable","availableUrl","Promise","resolve","fetch","credentials","headers","then","response","ok","json","available","payload","Boolean","catch","undefined","useSpeech","setAvailable","useState","isPreparing","setIsPreparing","isSpeaking","setIsSpeaking","hasError","setHasError","request","useRef","finish","useEffect","current","value","stop","useCallback","speak","text","mine","url","clip","obtain","player","URL","createObjectURL","source","reject","done","onplaying","onended","onerror","pause","revokeObjectURL","Error","src","play","prefetch","unlock","paused"],"mappings":";;;AAAA;AACA;AAQA;AACA;AACA,MAAMA,WAAAA,GAAc,goCAAA;AAEpB;;;;;;;;IASO,SAASC,gBAAAA,CAAiBC,OAA0B,EAAA;AACvD,IAAA,MAAMC,QAAQC,iBAAAA,CAAkBF,OAAAA,CAAAA;IAChC,IAAIG,YAAAA;IACJ,IAAIC,OAAAA;IAEJ,MAAMC,KAAAA,GAAQ,IAAwBD,OAAAA,KAAY,IAAIE,KAAAA,EAAAA;;AAGtD,IAAA,MAAMC,WAAAA,GAAc,IAAA;QAChB,IAAI,CAACP,OAAAA,CAAQQ,YAAY,EAAE;YACvB,OAAOC,OAAAA,CAAQC,OAAO,CAAC,IAAA,CAAA;AAC3B,QAAA;QAEAP,YAAAA,KAAkBH,CAAAA,OAAAA,CAAQW,KAAK,IAAIA,KAAI,EAAGX,OAAAA,CAAQQ,YAAY,EAAE;YAAEI,WAAAA,EAAaZ,OAAAA,CAAQY,WAAW,IAAI,SAAA;AAAWC,YAAAA,OAAAA,EAASb,QAAQa;SAAQ,CAAA,CACrIC,IAAI,CAACC,CAAAA,QAAAA,GAAaA,SAASC,EAAE,GAAGD,QAAAA,CAASE,IAAI,EAAA,GAAK;gBAAEC,SAAAA,EAAW;aAAM,CAAA,C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AS,IAAA;AACX,QAAA,MAAMf,MAAAA,GAASzC,KAAAA,EAAAA;AACf,QAAA,IAAIyC,OAAOgB,MAAM,IAAI,CAAChB,MAAAA,CAAOY,GAAG,EAAE;AAC9BZ,YAAAA,MAAAA,CAAOY,GAAG,GAAG5D,WAAAA;AACbgD,YAAAA,MAAAA,CAAOa,IAAI,EAAA,CAAGtC,KAAK,CAAC,IAAMC,SAAAA,CAAAA;AAC9B,QAAA;AACJ,IAAA,CAAA;IAEA,OAAO;AAAEC,QAAAA,SAAAA;AAAWsC,QAAAA;AAAO,KAAA;AAC/B;;"}
@@ -0,0 +1,5 @@
1
+ export * from './CueSpeech.js';
2
+ export * from './CueSpeechConfiguration.js';
3
+ export * from './createHttpSpeech.js';
4
+ export * from './HttpSpeechOptions.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Speech/index.ts"],"names":[],"mappings":"AAGA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './CueSpeech.js';
2
+ export * from './CueSpeechConfiguration.js';
3
+ export * from './createHttpSpeech.js';
4
+ export * from './HttpSpeechOptions.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../Speech/index.ts"],"names":[],"mappings":"AAGA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { CueSpeech } from './CueSpeech.js';
2
+ export declare const silentSpeech: CueSpeech;
3
+ //# sourceMappingURL=silentSpeech.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"silentSpeech.d.ts","sourceRoot":"","sources":["../../../Speech/silentSpeech.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,eAAO,MAAM,YAAY,EAAE,SAQ1B,CAAC"}
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ /** The voice a tour has when its application gives it none: there is no service, so nothing is said. */ const silentSpeech = {
4
+ isAvailable: false,
5
+ isPreparing: false,
6
+ isSpeaking: false,
7
+ hasError: false,
8
+ speak: ()=>Promise.resolve(),
9
+ prefetch: ()=>undefined,
10
+ stop: ()=>undefined
11
+ };
12
+
13
+ export { silentSpeech };
14
+ //# sourceMappingURL=silentSpeech.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"silentSpeech.js","sources":["../../../Speech/silentSpeech.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { CueSpeech } from './CueSpeech.js';\n\n/** The voice a tour has when its application gives it none: there is no service, so nothing is said. */\nexport const silentSpeech: CueSpeech = {\n isAvailable: false,\n isPreparing: false,\n isSpeaking: false,\n hasError: false,\n speak: () => Promise.resolve(),\n prefetch: () => undefined,\n stop: () => undefined\n};\n"],"names":["silentSpeech","isAvailable","isPreparing","isSpeaking","hasError","speak","Promise","resolve","prefetch","undefined","stop"],"mappings":"AAAA;AACA;AAIA,yGACO,MAAMA,YAAAA,GAA0B;IACnCC,WAAAA,EAAa,KAAA;IACbC,WAAAA,EAAa,KAAA;IACbC,UAAAA,EAAY,KAAA;IACZC,QAAAA,EAAU,KAAA;IACVC,KAAAA,EAAO,IAAMC,QAAQC,OAAO,EAAA;AAC5BC,IAAAA,QAAAA,EAAU,IAAMC,SAAAA;AAChBC,IAAAA,IAAAA,EAAM,IAAMD;AAChB;;"}
@@ -0,0 +1,7 @@
1
+ import type { HttpSpeechOptions } from './HttpSpeechOptions.js';
2
+ export interface SpeechClips {
3
+ obtain(text: string): Promise<Blob>;
4
+ prefetch(text: string): void;
5
+ }
6
+ export declare function createSpeechClips(options: HttpSpeechOptions): SpeechClips;
7
+ //# sourceMappingURL=speechClips.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"speechClips.d.ts","sourceRoot":"","sources":["../../../Speech/speechClips.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAKhE,MAAM,WAAW,WAAW;IAExB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAGpC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAUD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,WAAW,CAyCzE"}
@@ -0,0 +1,58 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ const DEFAULT_CACHE_SIZE = 24;
4
+ /**
5
+ * Creates the clips of a speech service.
6
+ * @param options Where the audio comes from.
7
+ * @returns The {@link SpeechClips}.
8
+ * @remarks
9
+ * A line that failed is forgotten, so asking for it again asks the service again. The oldest lines are dropped once the
10
+ * cache is full.
11
+ */ function createSpeechClips(options) {
12
+ const clips = new Map();
13
+ const limit = options.cacheSize ?? DEFAULT_CACHE_SIZE;
14
+ const request = async (text)=>{
15
+ const send = options.fetch ?? fetch;
16
+ const response = await send(options.speakUrl, {
17
+ method: 'POST',
18
+ credentials: options.credentials ?? 'include',
19
+ headers: {
20
+ 'Content-Type': 'application/json',
21
+ ...options.headers
22
+ },
23
+ body: JSON.stringify(options.body ? options.body(text) : {
24
+ text
25
+ })
26
+ });
27
+ if (!response.ok) {
28
+ throw new Error(`The speech service answered ${response.status}.`);
29
+ }
30
+ return response.blob();
31
+ };
32
+ const obtain = (text)=>{
33
+ const known = clips.get(text);
34
+ if (known) {
35
+ return known;
36
+ }
37
+ const clip = request(text);
38
+ clips.set(text, clip);
39
+ clip.catch(()=>{
40
+ if (clips.get(text) === clip) {
41
+ clips.delete(text);
42
+ }
43
+ });
44
+ while(clips.size > limit){
45
+ clips.delete(clips.keys().next().value);
46
+ }
47
+ return clip;
48
+ };
49
+ return {
50
+ obtain,
51
+ prefetch: (text)=>{
52
+ obtain(text).catch(()=>undefined);
53
+ }
54
+ };
55
+ }
56
+
57
+ export { createSpeechClips };
58
+ //# sourceMappingURL=speechClips.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"speechClips.js","sources":["../../../Speech/speechClips.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { HttpSpeechOptions } from './HttpSpeechOptions.js';\n\nconst DEFAULT_CACHE_SIZE = 24;\n\n/** The audio of the lines a tour speaks, asked for once each. */\nexport interface SpeechClips {\n /** Gets the audio of a line, asking the service for it unless it already has it or is already asking. */\n obtain(text: string): Promise<Blob>;\n\n /** Starts asking for the audio of a line, without waiting for it. */\n prefetch(text: string): void;\n}\n\n/**\n * Creates the clips of a speech service.\n * @param options Where the audio comes from.\n * @returns The {@link SpeechClips}.\n * @remarks\n * A line that failed is forgotten, so asking for it again asks the service again. The oldest lines are dropped once the\n * cache is full.\n */\nexport function createSpeechClips(options: HttpSpeechOptions): SpeechClips {\n const clips = new Map<string, Promise<Blob>>();\n const limit = options.cacheSize ?? DEFAULT_CACHE_SIZE;\n\n const request = async (text: string): Promise<Blob> => {\n const send = options.fetch ?? fetch;\n const response = await send(options.speakUrl, {\n method: 'POST',\n credentials: options.credentials ?? 'include',\n headers: { 'Content-Type': 'application/json', ...options.headers },\n body: JSON.stringify(options.body ? options.body(text) : { text })\n });\n if (!response.ok) {\n throw new Error(`The speech service answered ${response.status}.`);\n }\n return response.blob();\n };\n\n const obtain = (text: string): Promise<Blob> => {\n const known = clips.get(text);\n if (known) {\n return known;\n }\n\n const clip = request(text);\n clips.set(text, clip);\n clip.catch(() => {\n if (clips.get(text) === clip) {\n clips.delete(text);\n }\n });\n while (clips.size > limit) {\n clips.delete(clips.keys().next().value as string);\n }\n return clip;\n };\n\n return {\n obtain,\n prefetch: text => { obtain(text).catch(() => undefined); }\n };\n}\n"],"names":["DEFAULT_CACHE_SIZE","createSpeechClips","options","clips","Map","limit","cacheSize","request","text","send","fetch","response","speakUrl","method","credentials","headers","body","JSON","stringify","ok","Error","status","blob","obtain","known","get","clip","set","catch","delete","size","keys","next","value","prefetch","undefined"],"mappings":"AAAA;AACA;AAIA,MAAMA,kBAAAA,GAAqB,EAAA;AAW3B;;;;;;;IAQO,SAASC,iBAAAA,CAAkBC,OAA0B,EAAA;AACxD,IAAA,MAAMC,QAAQ,IAAIC,GAAAA,EAAAA;IAClB,MAAMC,KAAAA,GAAQH,OAAAA,CAAQI,SAAS,IAAIN,kBAAAA;AAEnC,IAAA,MAAMO,UAAU,OAAOC,IAAAA,GAAAA;QACnB,MAAMC,IAAAA,GAAOP,OAAAA,CAAQQ,KAAK,IAAIA,KAAAA;AAC9B,QAAA,MAAMC,QAAAA,GAAW,MAAMF,IAAAA,CAAKP,OAAAA,CAAQU,QAAQ,EAAE;YAC1CC,MAAAA,EAAQ,MAAA;YACRC,WAAAA,EAAaZ,OAAAA,CAAQY,WAAW,IAAI,SAAA;YACpCC,OAAAA,EAAS;gBAAE,cAAA,EAAgB,kBAAA;AAAoB,gBAAA,GAAGb,QAAQa;AAAQ,aAAA;YAClEC,IAAAA,EAAMC,IAAAA,CAAKC,SAAS,CAAChB,OAAAA,CAAQc,IAAI,GAAGd,OAAAA,CAAQc,IAAI,CAACR,IAAAA,CAAAA,GAAQ;AAAEA,gBAAAA;AAAK,aAAA;AACpE,SAAA,CAAA;QACA,IAAI,CAACG,QAAAA,CAASQ,EAAE,EAAE;YACd,MAAM,IAAIC,MAAM,CAAC,4BAA4B,EAAET,QAAAA,CAASU,MAAM,CAAC,CAAC,CAAC,CAAA;AACrE,QAAA;AACA,QAAA,OAAOV,SAASW,IAAI,EAAA;AACxB,IAAA,CAAA;AAEA,IAAA,MAAMC,SAAS,CAACf,IAAAA,GAAAA;QACZ,MAAMgB,KAAAA,GAAQrB,KAAAA,CAAMsB,GAAG,CAACjB,IAAAA,CAAAA;AACxB,QAAA,IAAIgB,KAAAA,EAAO;YACP,OAAOA,KAAAA;AACX,QAAA;AAEA,QAAA,MAAME,OAAOnB,OAAAA,CAAQC,IAAAA,CAAAA;QACrBL,KAAAA,CAAMwB,GAAG,CAACnB,IAAAA,EAAMkB,IAAAA,CAAAA;AAChBA,QAAAA,IAAAA,CAAKE,KAAK,CAAC,IAAA;AACP,YAAA,IAAIzB,KAAAA,CAAMsB,GAAG,CAACjB,IAAAA,CAAAA,KAAUkB,IAAAA,EAAM;AAC1BvB,gBAAAA,KAAAA,CAAM0B,MAAM,CAACrB,IAAAA,CAAAA;AACjB,YAAA;AACJ,QAAA,CAAA,CAAA;QACA,MAAOL,KAAAA,CAAM2B,IAAI,GAAGzB,KAAAA,CAAO;AACvBF,YAAAA,KAAAA,CAAM0B,MAAM,CAAC1B,KAAAA,CAAM4B,IAAI,EAAA,CAAGC,IAAI,GAAGC,KAAK,CAAA;AAC1C,QAAA;QACA,OAAOP,IAAAA;AACX,IAAA,CAAA;IAEA,OAAO;AACHH,QAAAA,MAAAA;AACAW,QAAAA,QAAAA,EAAU1B,CAAAA,IAAAA,GAAAA;YAAUe,MAAAA,CAAOf,IAAAA,CAAAA,CAAMoB,KAAK,CAAC,IAAMO,SAAAA,CAAAA;AAAY,QAAA;AAC7D,KAAA;AACJ;;"}
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import type { TourAnchorSpace } from './TourAnchorSpace.js';
3
+ import { type BoardTransform } from './tourGeometry.js';
4
+ export interface TourAnchorProps {
5
+ x: number;
6
+ y: number;
7
+ space?: TourAnchorSpace;
8
+ transformRef: React.RefObject<BoardTransform>;
9
+ glideMs?: number;
10
+ className?: string;
11
+ children: React.ReactNode;
12
+ }
13
+ export declare const TourAnchor: ({ x, y, space, transformRef, glideMs, className, children }: TourAnchorProps) => React.JSX.Element;
14
+ //# sourceMappingURL=TourAnchor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TourAnchor.d.ts","sourceRoot":"","sources":["../../TourAnchor.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,KAAK,cAAc,EAA8F,MAAM,mBAAmB,CAAC;AAkBpJ,MAAM,WAAW,eAAe;IAE5B,CAAC,EAAE,MAAM,CAAC;IAGV,CAAC,EAAE,MAAM,CAAC;IAGV,KAAK,CAAC,EAAE,eAAe,CAAC;IAGxB,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAO9C,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAeD,eAAO,MAAM,UAAU,GAAI,6DAA2E,eAAe,sBAiGpH,CAAC"}
@@ -0,0 +1,148 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useRef, useLayoutEffect, useEffect } from 'react';
3
+ import { createSelfSuspendingFrameLoop, canvasTransformActivity } from '@cratis/components/Canvas';
4
+ import { projectToolbarPointToScreen, projectEditorPointToScreen, projectToScreen } from './tourGeometry.js';
5
+
6
+ /**
7
+ * Where a target currently sits on screen, whatever space it is expressed in. Editor-space targets project
8
+ * against the live viewport size, so the anchor keeps sitting on its spot in the panel through a resize.
9
+ */ function projectTarget(target, transform) {
10
+ switch(target.space){
11
+ case 'world':
12
+ return projectToScreen(target.x, target.y, transform);
13
+ case 'editor':
14
+ return projectEditorPointToScreen(target.x, target.y, window.innerWidth, window.innerHeight);
15
+ case 'toolbar':
16
+ return projectToolbarPointToScreen(target.x, target.y, window.innerHeight);
17
+ case 'screen':
18
+ return {
19
+ x: target.x,
20
+ y: target.y
21
+ };
22
+ }
23
+ }
24
+ // How close, in screen pixels, a glide has to get before it counts as arrived and the loop suspends.
25
+ const GLIDE_SETTLE_DISTANCE = 0.5;
26
+ /**
27
+ * Holds its children at a place on the board — or on the tour's own chrome — and, when asked, takes its time
28
+ * getting to a new one.
29
+ *
30
+ * The travel is eased in screen space, against where the target currently sits on screen, rather than in
31
+ * board space. This is what keeps the pointer's movement its own: while the camera pans, a board-space glide
32
+ * would compose with the camera and sweep the pointer across the screen, whereas the screen-space easing lets
33
+ * it drift calmly after its target no matter what the camera is doing underneath.
34
+ *
35
+ * The position is written straight to the DOM on every animation frame rather than held in React state: the
36
+ * camera glides for the best part of a second on every step, and re-rendering the tour's overlay at frame
37
+ * rate for the whole of it would compete with the board's own per-frame transform writes.
38
+ */ const TourAnchor = ({ x, y, space = 'world', transformRef, glideMs = 0, className, children })=>{
39
+ const anchorRef = useRef(null);
40
+ const targetRef = useRef({
41
+ x,
42
+ y,
43
+ space
44
+ });
45
+ const currentRef = useRef(null);
46
+ targetRef.current = {
47
+ x,
48
+ y,
49
+ space
50
+ };
51
+ // The follower below only places the element from the first animation frame on — without this, the
52
+ // element would be visible at the board's top-left corner for the frames before that, which is exactly
53
+ // where a freshly appeared callout was seen flashing. Place it where it belongs before the first paint.
54
+ useLayoutEffect(()=>{
55
+ const anchor = anchorRef.current;
56
+ if (!anchor) return;
57
+ const target = targetRef.current;
58
+ const onScreen = projectTarget(target, transformRef.current);
59
+ currentRef.current = onScreen;
60
+ anchor.style.transform = `translate3d(${onScreen.x}px, ${onScreen.y}px, 0)`;
61
+ // Mount-only by design: every later placement belongs to the follower.
62
+ }, []);
63
+ // The follower runs as a self-suspending loop rather than a permanent per-frame one: it glides while there is travel left, then stops, and wakes again whenever
64
+ // the camera applies a transform frame, the window resizes (editor/toolbar spaces project against
65
+ // the viewport), or the target itself moves to a new spot.
66
+ const previousRef = useRef(performance.now());
67
+ const step = (now)=>{
68
+ const elapsed = now - previousRef.current;
69
+ previousRef.current = now;
70
+ const target = targetRef.current;
71
+ const onScreen = projectTarget(target, transformRef.current);
72
+ // Exponential easing toward the target's current screen position, so the travel is smooth at any
73
+ // frame rate and settles rather than arriving abruptly. The first placement is not traveled to —
74
+ // there is nowhere to have come from.
75
+ const current = currentRef.current;
76
+ let traveling = false;
77
+ if (current === null || glideMs <= 0) {
78
+ currentRef.current = onScreen;
79
+ } else {
80
+ const factor = 1 - Math.exp(-elapsed / (glideMs / 3));
81
+ const next = {
82
+ x: current.x + (onScreen.x - current.x) * factor,
83
+ y: current.y + (onScreen.y - current.y) * factor
84
+ };
85
+ // Within a hair of the target the glide has visually arrived — rest exactly on it so the
86
+ // loop can suspend instead of easing asymptotically forever.
87
+ traveling = Math.abs(next.x - onScreen.x) >= GLIDE_SETTLE_DISTANCE || Math.abs(next.y - onScreen.y) >= GLIDE_SETTLE_DISTANCE;
88
+ currentRef.current = traveling ? next : onScreen;
89
+ }
90
+ const anchor = anchorRef.current;
91
+ if (anchor) {
92
+ anchor.style.transform = `translate3d(${currentRef.current.x}px, ${currentRef.current.y}px, 0)`;
93
+ }
94
+ return traveling;
95
+ };
96
+ const stepRef = useRef(step);
97
+ stepRef.current = step;
98
+ const loopRef = useRef(null);
99
+ loopRef.current ??= createSelfSuspendingFrameLoop((now)=>stepRef.current(now));
100
+ const loop = loopRef.current;
101
+ useEffect(()=>{
102
+ const wake = ()=>{
103
+ // A suspended loop's elapsed time restarts at its wake — measured from the frame it last
104
+ // ran, the first glide step after a pause would leap most of the way in one jump.
105
+ if (!loop.isRunning) {
106
+ previousRef.current = performance.now();
107
+ }
108
+ loop.wake();
109
+ };
110
+ wake();
111
+ const unsubscribe = canvasTransformActivity.subscribe(wake);
112
+ window.addEventListener('resize', wake);
113
+ return ()=>{
114
+ unsubscribe();
115
+ window.removeEventListener('resize', wake);
116
+ loop.stop();
117
+ };
118
+ }, [
119
+ loop
120
+ ]);
121
+ // A new target (or glide behavior) has to restart a suspended glide.
122
+ useEffect(()=>{
123
+ if (!loop.isRunning) {
124
+ previousRef.current = performance.now();
125
+ }
126
+ loop.wake();
127
+ }, [
128
+ loop,
129
+ x,
130
+ y,
131
+ space,
132
+ glideMs
133
+ ]);
134
+ return /*#__PURE__*/ jsx("div", {
135
+ ref: anchorRef,
136
+ className: className,
137
+ style: {
138
+ position: 'absolute',
139
+ top: 0,
140
+ left: 0,
141
+ willChange: 'transform'
142
+ },
143
+ children: children
144
+ });
145
+ };
146
+
147
+ export { TourAnchor };
148
+ //# sourceMappingURL=TourAnchor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TourAnchor.js","sources":["../../TourAnchor.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport React, { useEffect, useLayoutEffect, useRef } from 'react';\nimport { canvasTransformActivity, createSelfSuspendingFrameLoop, type SelfSuspendingFrameLoop } from '@cratis/components/Canvas';\nimport type { TourAnchorSpace } from './TourAnchorSpace.js';\nimport { type BoardTransform, type ScreenPoint, projectEditorPointToScreen, projectToScreen, projectToolbarPointToScreen } from './tourGeometry.js';\n\n/**\n * Where a target currently sits on screen, whatever space it is expressed in. Editor-space targets project\n * against the live viewport size, so the anchor keeps sitting on its spot in the panel through a resize.\n */\nfunction projectTarget(target: { x: number; y: number; space: TourAnchorSpace }, transform: BoardTransform): ScreenPoint {\n switch (target.space) {\n case 'world': return projectToScreen(target.x, target.y, transform);\n case 'editor': return projectEditorPointToScreen(target.x, target.y, window.innerWidth, window.innerHeight);\n case 'toolbar': return projectToolbarPointToScreen(target.x, target.y, window.innerHeight);\n case 'screen': return { x: target.x, y: target.y };\n }\n}\n\n// How close, in screen pixels, a glide has to get before it counts as arrived and the loop suspends.\nconst GLIDE_SETTLE_DISTANCE = 0.5;\n\nexport interface TourAnchorProps {\n /** The horizontal coordinate to sit at, in the anchor's space. */\n x: number;\n\n /** The vertical coordinate to sit at, in the anchor's space. */\n y: number;\n\n /** The space the coordinates are expressed in. Board coordinates when omitted. */\n space?: TourAnchorSpace;\n\n /** The board's live pan and zoom. */\n transformRef: React.RefObject<BoardTransform>;\n\n /**\n * How long to take travelling to where the target currently is on screen. Left out, the anchor is simply\n * placed there every frame — which is what a label wants, where gliding would only look like the label\n * had come loose from the board.\n */\n glideMs?: number;\n\n /** A class applied to the anchored element. */\n className?: string;\n\n /** What to draw at that place. */\n children: React.ReactNode;\n}\n\n/**\n * Holds its children at a place on the board — or on the tour's own chrome — and, when asked, takes its time\n * getting to a new one.\n *\n * The travel is eased in screen space, against where the target currently sits on screen, rather than in\n * board space. This is what keeps the pointer's movement its own: while the camera pans, a board-space glide\n * would compose with the camera and sweep the pointer across the screen, whereas the screen-space easing lets\n * it drift calmly after its target no matter what the camera is doing underneath.\n *\n * The position is written straight to the DOM on every animation frame rather than held in React state: the\n * camera glides for the best part of a second on every step, and re-rendering the tour's overlay at frame\n * rate for the whole of it would compete with the board's own per-frame transform writes.\n */\nexport const TourAnchor = ({ x, y, space = 'world', transformRef, glideMs = 0, className, children }: TourAnchorProps) => {\n const anchorRef = useRef<HTMLDivElement>(null);\n const targetRef = useRef({ x, y, space });\n const currentRef = useRef<{ x: number; y: number } | null>(null);\n targetRef.current = { x, y, space };\n\n // The follower below only places the element from the first animation frame on — without this, the\n // element would be visible at the board's top-left corner for the frames before that, which is exactly\n // where a freshly appeared callout was seen flashing. Place it where it belongs before the first paint.\n useLayoutEffect(() => {\n const anchor = anchorRef.current;\n if (!anchor) return;\n\n const target = targetRef.current;\n const onScreen = projectTarget(target, transformRef.current);\n currentRef.current = onScreen;\n anchor.style.transform = `translate3d(${onScreen.x}px, ${onScreen.y}px, 0)`;\n // Mount-only by design: every later placement belongs to the follower.\n }, []);\n\n // The follower runs as a self-suspending loop rather than a permanent per-frame one: it glides while there is travel left, then stops, and wakes again whenever\n // the camera applies a transform frame, the window resizes (editor/toolbar spaces project against\n // the viewport), or the target itself moves to a new spot.\n const previousRef = useRef(performance.now());\n const step = (now: number): boolean => {\n const elapsed = now - previousRef.current;\n previousRef.current = now;\n\n const target = targetRef.current;\n const onScreen = projectTarget(target, transformRef.current);\n\n // Exponential easing toward the target's current screen position, so the travel is smooth at any\n // frame rate and settles rather than arriving abruptly. The first placement is not traveled to —\n // there is nowhere to have come from.\n const current = currentRef.current;\n let traveling = false;\n if (current === null || glideMs <= 0) {\n currentRef.current = onScreen;\n } else {\n const factor = 1 - Math.exp(-elapsed / (glideMs / 3));\n const next = {\n x: current.x + (onScreen.x - current.x) * factor,\n y: current.y + (onScreen.y - current.y) * factor,\n };\n // Within a hair of the target the glide has visually arrived — rest exactly on it so the\n // loop can suspend instead of easing asymptotically forever.\n traveling = Math.abs(next.x - onScreen.x) >= GLIDE_SETTLE_DISTANCE || Math.abs(next.y - onScreen.y) >= GLIDE_SETTLE_DISTANCE;\n currentRef.current = traveling ? next : onScreen;\n }\n\n const anchor = anchorRef.current;\n if (anchor) {\n anchor.style.transform = `translate3d(${currentRef.current.x}px, ${currentRef.current.y}px, 0)`;\n }\n\n return traveling;\n };\n const stepRef = useRef(step);\n stepRef.current = step;\n\n const loopRef = useRef<SelfSuspendingFrameLoop | null>(null);\n loopRef.current ??= createSelfSuspendingFrameLoop(now => stepRef.current(now));\n const loop = loopRef.current;\n\n useEffect(() => {\n const wake = () => {\n // A suspended loop's elapsed time restarts at its wake — measured from the frame it last\n // ran, the first glide step after a pause would leap most of the way in one jump.\n if (!loop.isRunning) {\n previousRef.current = performance.now();\n }\n loop.wake();\n };\n\n wake();\n const unsubscribe = canvasTransformActivity.subscribe(wake);\n window.addEventListener('resize', wake);\n return () => {\n unsubscribe();\n window.removeEventListener('resize', wake);\n loop.stop();\n };\n }, [loop]);\n\n // A new target (or glide behavior) has to restart a suspended glide.\n useEffect(() => {\n if (!loop.isRunning) {\n previousRef.current = performance.now();\n }\n loop.wake();\n }, [loop, x, y, space, glideMs]);\n\n return (\n <div ref={anchorRef} className={className} style={{ position: 'absolute', top: 0, left: 0, willChange: 'transform' }}>\n {children}\n </div>\n );\n};\n"],"names":["projectTarget","target","transform","space","projectToScreen","x","y","projectEditorPointToScreen","window","innerWidth","innerHeight","projectToolbarPointToScreen","GLIDE_SETTLE_DISTANCE","TourAnchor","transformRef","glideMs","className","children","anchorRef","useRef","targetRef","currentRef","current","useLayoutEffect","anchor","onScreen","style","previousRef","performance","now","step","elapsed","traveling","factor","Math","exp","next","abs","stepRef","loopRef","createSelfSuspendingFrameLoop","loop","useEffect","wake","isRunning","unsubscribe","canvasTransformActivity","subscribe","addEventListener","removeEventListener","stop","_jsx","div","ref","position","top","left","willChange"],"mappings":";;;;;AAQA;;;AAGC,IACD,SAASA,aAAAA,CAAcC,MAAwD,EAAEC,SAAyB,EAAA;AACtG,IAAA,OAAQD,OAAOE,KAAK;QAChB,KAAK,OAAA;AAAS,YAAA,OAAOC,gBAAgBH,MAAAA,CAAOI,CAAC,EAAEJ,MAAAA,CAAOK,CAAC,EAAEJ,SAAAA,CAAAA;QACzD,KAAK,QAAA;YAAU,OAAOK,0BAAAA,CAA2BN,MAAAA,CAAOI,CAAC,EAAEJ,MAAAA,CAAOK,CAAC,EAAEE,MAAAA,CAAOC,UAAU,EAAED,MAAAA,CAAOE,WAAW,CAAA;QAC1G,KAAK,SAAA;YAAW,OAAOC,2BAAAA,CAA4BV,OAAOI,CAAC,EAAEJ,OAAOK,CAAC,EAAEE,OAAOE,WAAW,CAAA;QACzF,KAAK,QAAA;YAAU,OAAO;AAAEL,gBAAAA,CAAAA,EAAGJ,OAAOI,CAAC;AAAEC,gBAAAA,CAAAA,EAAGL,OAAOK;AAAE,aAAA;AACrD;AACJ;AAEA;AACA,MAAMM,qBAAAA,GAAwB,GAAA;AA6B9B;;;;;;;;;;;;UAaaC,UAAAA,GAAa,CAAC,EAAER,CAAC,EAAEC,CAAC,EAAEH,KAAAA,GAAQ,OAAO,EAAEW,YAAY,EAAEC,OAAAA,GAA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H,QAAAA,KAAAA;AAAOY,QAAAA;AAAQ,KAAA,CAAA;AAE/B,IAAA,qBACIoC,GAAA,CAACC,KAAAA,EAAAA;QAAIC,GAAAA,EAAKnC,SAAAA;QAAWF,SAAAA,EAAWA,SAAAA;QAAWU,KAAAA,EAAO;YAAE4B,QAAAA,EAAU,UAAA;YAAYC,GAAAA,EAAK,CAAA;YAAGC,IAAAA,EAAM,CAAA;YAAGC,UAAAA,EAAY;AAAY,SAAA;AAC9GxC,QAAAA,QAAAA,EAAAA;;AAGb;;"}
@@ -0,0 +1,2 @@
1
+ export type TourAnchorSpace = 'world' | 'screen' | 'editor' | 'toolbar';
2
+ //# sourceMappingURL=TourAnchorSpace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TourAnchorSpace.d.ts","sourceRoot":"","sources":["../../TourAnchorSpace.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TourAnchorSpace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TourAnchorSpace.js","sourceRoot":"","sources":["../../TourAnchorSpace.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import type { TourAnchorSpace } from './TourAnchorSpace.js';
2
+ export interface TourCallout {
3
+ x: number;
4
+ y: number;
5
+ text: string;
6
+ space?: TourAnchorSpace;
7
+ }
8
+ //# sourceMappingURL=TourCallout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TourCallout.d.ts","sourceRoot":"","sources":["../../TourCallout.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAM5D,MAAM,WAAW,WAAW;IAExB,CAAC,EAAE,MAAM,CAAC;IAGV,CAAC,EAAE,MAAM,CAAC;IAGV,IAAI,EAAE,MAAM,CAAC;IAGb,KAAK,CAAC,EAAE,eAAe,CAAC;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TourCallout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TourCallout.js","sourceRoot":"","sources":["../../TourCallout.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { BoardTransform } from './tourGeometry.js';
3
+ import type { TourCallout } from './TourCallout.js';
4
+ export interface TourCalloutBubbleProps {
5
+ callout: TourCallout | undefined;
6
+ transformRef: React.RefObject<BoardTransform>;
7
+ }
8
+ export declare const TourCalloutBubble: ({ callout, transformRef }: TourCalloutBubbleProps) => React.JSX.Element | null;
9
+ //# sourceMappingURL=TourCalloutBubble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TourCalloutBubble.d.ts","sourceRoot":"","sources":["../../TourCalloutBubble.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD,MAAM,WAAW,sBAAsB;IAEnC,OAAO,EAAE,WAAW,GAAG,SAAS,CAAC;IAGjC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;CACjD;AAOD,eAAO,MAAM,iBAAiB,GAAI,2BAA2B,sBAAsB,6BAgBlF,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import 'react';
3
+ import { TourAnchor } from './TourAnchor.js';
4
+
5
+ /**
6
+ * Names the thing the narration is talking about, pinned just above it on the board with its caret pointing
7
+ * down at it. The script is responsible for anchoring callouts above their subjects — the bubble always
8
+ * renders upward from its anchor.
9
+ */ const TourCalloutBubble = ({ callout, transformRef })=>{
10
+ if (!callout) return null;
11
+ return /*#__PURE__*/ jsx(TourAnchor, {
12
+ x: callout.x,
13
+ y: callout.y,
14
+ space: callout.space,
15
+ transformRef: transformRef,
16
+ className: "cue-callout",
17
+ children: /*#__PURE__*/ jsx("div", {
18
+ className: "cue-callout__bubble",
19
+ children: callout.text
20
+ })
21
+ }, callout.text);
22
+ };
23
+
24
+ export { TourCalloutBubble };
25
+ //# sourceMappingURL=TourCalloutBubble.js.map