@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,41 @@
1
+ export type { TourAnchorSpace } from './TourAnchorSpace.js';
2
+ export type { TourCallout } from './TourCallout.js';
3
+ export type { TourCamera } from './TourCamera.js';
4
+ export type { TourChapter } from './TourChapter.js';
5
+ export type { TourGesture } from './TourGesture.js';
6
+ export type { TourSection } from './TourSection.js';
7
+ export type { TourStep } from './TourStep.js';
8
+ export { TourAnchor } from './TourAnchor.js';
9
+ export type { TourAnchorProps } from './TourAnchor.js';
10
+ export { TourCalloutBubble } from './TourCalloutBubble.js';
11
+ export type { TourCalloutBubbleProps } from './TourCalloutBubble.js';
12
+ export { TourChapterList } from './TourChapterList.js';
13
+ export type { TourChapterListProps } from './TourChapterList.js';
14
+ export { TourOverlayShell } from './TourOverlayShell.js';
15
+ export type { TourOverlayShellProps } from './TourOverlayShell.js';
16
+ export { TourPointer } from './TourPointer.js';
17
+ export type { TourPointerProps } from './TourPointer.js';
18
+ export { TourSelfPacedPanel } from './TourSelfPacedPanel.js';
19
+ export type { TourSelfPacedPanelProps } from './TourSelfPacedPanel.js';
20
+ export { TourSubtitles } from './TourSubtitles.js';
21
+ export type { TourSubtitlesProps } from './TourSubtitles.js';
22
+ export { TourTimelineBar } from './TourTimelineBar.js';
23
+ export type { TourTimelineBarProps } from './TourTimelineBar.js';
24
+ export { useTourPlayback } from './useTourPlayback.js';
25
+ export type { TourPlayback } from './useTourPlayback.js';
26
+ export { NARRATION_ADVANCE_BEAT_MS, NARRATION_HOLD_LIMIT_MS, advanceTourClock } from './tourClock.js';
27
+ export type { TourClockAdvance, TourClockNarration } from './tourClock.js';
28
+ export { hasSelfPacedContent, resolveTourMedia, selfPacedMarkdownFor, selfPacedViewFor } from './tourSelfPaced.js';
29
+ export type { TourSelfPacedContent, TourSelfPacedView } from './tourSelfPaced.js';
30
+ export { RESTART_CHAPTER_WINDOW_MS, buildTourTimeline, chapterIndexAtTime, chapterStartMs, formatTourTime, narrationDurationMs, nextChapterTargetMs, previousChapterTargetMs, sectionIndexAtTime, stepDurationMs, stepIndexAtTime, } from './tourTimeline.js';
31
+ export type { TimedTourChapter, TimedTourSection, TimedTourStep, TourTimeline } from './tourTimeline.js';
32
+ export { CHROME_INSETS, projectEditorPointToScreen, projectToScreen, projectToolbarPointToScreen, unobstructedCenter, } from './tourGeometry.js';
33
+ export type { BoardTransform, ScreenPoint } from './tourGeometry.js';
34
+ export * from './Configuration/index.js';
35
+ export * from './Labels/index.js';
36
+ export * from './Markdown/index.js';
37
+ export * from './Speech/index.js';
38
+ export * from './Tours/index.js';
39
+ export { CueIcon } from './Icons.js';
40
+ export type { CueIconName, CueIconProps } from './Icons.js';
41
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,u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f,2BAA2B,EAC3B,kBAAkB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErE,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,72 @@
1
+ 'use strict';
2
+
3
+ var TourAnchor = require('./TourAnchor.js');
4
+ var TourCalloutBubble = require('./TourCalloutBubble.js');
5
+ var TourChapterList = require('./TourChapterList.js');
6
+ var TourOverlayShell = require('./TourOverlayShell.js');
7
+ var TourPointer = require('./TourPointer.js');
8
+ var TourSelfPacedPanel = require('./TourSelfPacedPanel.js');
9
+ var TourSubtitles = require('./TourSubtitles.js');
10
+ var TourTimelineBar = require('./TourTimelineBar.js');
11
+ var useTourPlayback = require('./useTourPlayback.js');
12
+ var tourClock = require('./tourClock.js');
13
+ var tourSelfPaced = require('./tourSelfPaced.js');
14
+ var tourTimeline = require('./tourTimeline.js');
15
+ var tourGeometry = require('./tourGeometry.js');
16
+ var CueProvider = require('./Configuration/CueProvider.js');
17
+ var CueStageBoundary = require('./Configuration/CueStageBoundary.js');
18
+ var defaultCueLabels = require('./Labels/defaultCueLabels.js');
19
+ var resolveLabels = require('./Labels/resolveLabels.js');
20
+ var CueMarkdown = require('./Markdown/CueMarkdown.js');
21
+ var safeUrl = require('./Markdown/safeUrl.js');
22
+ var createHttpSpeech = require('./Speech/createHttpSpeech.js');
23
+ var useCueTours = require('./Tours/useCueTours.js');
24
+ var useTourNudge = require('./Tours/useTourNudge.js');
25
+ var Icons = require('./Icons.js');
26
+
27
+
28
+
29
+ exports.TourAnchor = TourAnchor.TourAnchor;
30
+ exports.TourCalloutBubble = TourCalloutBubble.TourCalloutBubble;
31
+ exports.TourChapterList = TourChapterList.TourChapterList;
32
+ exports.TourOverlayShell = TourOverlayShell.TourOverlayShell;
33
+ exports.TourPointer = TourPointer.TourPointer;
34
+ exports.TourSelfPacedPanel = TourSelfPacedPanel.TourSelfPacedPanel;
35
+ exports.TourSubtitles = TourSubtitles.TourSubtitles;
36
+ exports.TourTimelineBar = TourTimelineBar.TourTimelineBar;
37
+ exports.useTourPlayback = useTourPlayback.useTourPlayback;
38
+ exports.NARRATION_ADVANCE_BEAT_MS = tourClock.NARRATION_ADVANCE_BEAT_MS;
39
+ exports.NARRATION_HOLD_LIMIT_MS = tourClock.NARRATION_HOLD_LIMIT_MS;
40
+ exports.advanceTourClock = tourClock.advanceTourClock;
41
+ exports.hasSelfPacedContent = tourSelfPaced.hasSelfPacedContent;
42
+ exports.resolveTourMedia = tourSelfPaced.resolveTourMedia;
43
+ exports.selfPacedMarkdownFor = tourSelfPaced.selfPacedMarkdownFor;
44
+ exports.selfPacedViewFor = tourSelfPaced.selfPacedViewFor;
45
+ exports.RESTART_CHAPTER_WINDOW_MS = tourTimeline.RESTART_CHAPTER_WINDOW_MS;
46
+ exports.buildTourTimeline = tourTimeline.buildTourTimeline;
47
+ exports.chapterIndexAtTime = tourTimeline.chapterIndexAtTime;
48
+ exports.chapterStartMs = tourTimeline.chapterStartMs;
49
+ exports.formatTourTime = tourTimeline.formatTourTime;
50
+ exports.narrationDurationMs = tourTimeline.narrationDurationMs;
51
+ exports.nextChapterTargetMs = tourTimeline.nextChapterTargetMs;
52
+ exports.previousChapterTargetMs = tourTimeline.previousChapterTargetMs;
53
+ exports.sectionIndexAtTime = tourTimeline.sectionIndexAtTime;
54
+ exports.stepDurationMs = tourTimeline.stepDurationMs;
55
+ exports.stepIndexAtTime = tourTimeline.stepIndexAtTime;
56
+ exports.CHROME_INSETS = tourGeometry.CHROME_INSETS;
57
+ exports.projectEditorPointToScreen = tourGeometry.projectEditorPointToScreen;
58
+ exports.projectToScreen = tourGeometry.projectToScreen;
59
+ exports.projectToolbarPointToScreen = tourGeometry.projectToolbarPointToScreen;
60
+ exports.unobstructedCenter = tourGeometry.unobstructedCenter;
61
+ exports.CueProvider = CueProvider.CueProvider;
62
+ exports.useCueConfiguration = CueProvider.useCueConfiguration;
63
+ exports.CueStageBoundary = CueStageBoundary.CueStageBoundary;
64
+ exports.defaultCueLabels = defaultCueLabels.defaultCueLabels;
65
+ exports.resolveLabels = resolveLabels.resolveLabels;
66
+ exports.CueMarkdown = CueMarkdown.CueMarkdown;
67
+ exports.safeUrl = safeUrl.safeUrl;
68
+ exports.createHttpSpeech = createHttpSpeech.createHttpSpeech;
69
+ exports.useCueTours = useCueTours.useCueTours;
70
+ exports.useTourNudge = useTourNudge.useTourNudge;
71
+ exports.CueIcon = Icons.CueIcon;
72
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,19 @@
1
+ import { type TourTimeline } from './tourTimeline.js';
2
+ export declare const NARRATION_ADVANCE_BEAT_MS = 700;
3
+ export declare const NARRATION_HOLD_LIMIT_MS = 15000;
4
+ export interface TourClockNarration {
5
+ pendingStepIndex: number | null;
6
+ finished: {
7
+ stepIndex: number;
8
+ finishedAt: number;
9
+ } | null;
10
+ holdStartedAt: number | null;
11
+ }
12
+ export interface TourClockAdvance {
13
+ timeMs: number;
14
+ isPlaying: boolean;
15
+ holdStartedAt: number | null;
16
+ finishedConsumed: boolean;
17
+ }
18
+ export declare function advanceTourClock(timeline: TourTimeline, currentMs: number, elapsedMs: number, now: number, narration: TourClockNarration): TourClockAdvance;
19
+ //# sourceMappingURL=tourClock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tourClock.d.ts","sourceRoot":"","sources":["../../tourClock.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,YAAY,EAAmB,MAAM,mBAAmB,CAAC;AAQxF,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAQ7C,eAAO,MAAM,uBAAuB,QAAQ,CAAC;AAG7C,MAAM,WAAW,kBAAkB;IAE/B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGhC,QAAQ,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAG3D,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAGD,MAAM,WAAW,gBAAgB;IAE7B,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,EAAE,OAAO,CAAC;IAGnB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAG7B,gBAAgB,EAAE,OAAO,CAAC;CAC7B;AAkBD,wBAAgB,gBAAgB,CAC5B,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,kBAAkB,GAAG,gBAAgB,CAuDnD"}
@@ -0,0 +1,107 @@
1
+ 'use strict';
2
+
3
+ var tourTimeline = require('./tourTimeline.js');
4
+
5
+ // Copyright (c) Cratis. All rights reserved.
6
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
7
+ /**
8
+ * The breath between a narration finishing and the clock moving on. Step lengths are estimated from word
9
+ * count, and when the voice finishes ahead of the estimate the remainder would be dead air — the clock
10
+ * skips it after this short beat rather than sitting the estimate out. The same beat separates a line that
11
+ * ran past its estimate from the line that follows it, so held steps release calmly instead of abruptly.
12
+ */ const NARRATION_ADVANCE_BEAT_MS = 700;
13
+ /**
14
+ * How long the clock will wait at a step's end for its line to finish being said. Speech is synthesized and
15
+ * streamed, so a line regularly outlasts its word-count estimate — the clock holds the boundary rather than
16
+ * cutting the voice off mid-sentence. The limit only exists so a voice that never finishes — a stalled
17
+ * stream, a hung request — cannot stall the whole tour with it.
18
+ */ const NARRATION_HOLD_LIMIT_MS = 15000;
19
+ /**
20
+ * Advances the tour's clock by one tick, pacing it against the voice.
21
+ *
22
+ * The clock leads and the voice follows — with two adjustments at the boundary between them. When a line
23
+ * finishes ahead of its step's estimated length, the leftover is dead air: after a short beat the clock
24
+ * skips to the step's end instead of sitting the estimate out. When a line is still being said as its
25
+ * step's estimated length runs out, the clock holds just short of the boundary until the line finishes —
26
+ * crossing it would tear the voice down mid-sentence — released by the same beat, and bounded by
27
+ * {@link NARRATION_HOLD_LIMIT_MS} so a voice that never finishes cannot stall the tour.
28
+ * @param timeline The tour laid out on one clock.
29
+ * @param currentMs Where the clock is before the tick, in milliseconds.
30
+ * @param elapsedMs How much wall-clock time the tick spans, in milliseconds.
31
+ * @param now The wall clock at the moment of the tick, in milliseconds.
32
+ * @param narration What the voice is up to.
33
+ * @returns The {@link TourClockAdvance} the tick lands on.
34
+ */ function advanceTourClock(timeline, currentMs, elapsedMs, now, narration) {
35
+ const next = currentMs + elapsedMs;
36
+ // Hold the boundary while the current step's line is still being said, or has finished but not yet had
37
+ // its breath — the clock parks just short of the step's end so the step stays current and the voice
38
+ // keeps its stage.
39
+ const currentIndex = tourTimeline.stepIndexAtTime(timeline, currentMs);
40
+ const currentStep = currentIndex >= 0 ? timeline.steps[currentIndex] : undefined;
41
+ if (currentStep && next >= currentStep.endMs) {
42
+ const stillSpeaking = narration.pendingStepIndex === currentIndex;
43
+ const settling = narration.finished !== null && narration.finished.stepIndex === currentIndex && now - narration.finished.finishedAt < NARRATION_ADVANCE_BEAT_MS;
44
+ if (stillSpeaking || settling) {
45
+ const holdStartedAt = narration.holdStartedAt ?? now;
46
+ if (now - holdStartedAt < NARRATION_HOLD_LIMIT_MS) {
47
+ return {
48
+ timeMs: Math.max(currentMs, currentStep.endMs - 1),
49
+ isPlaying: true,
50
+ holdStartedAt,
51
+ finishedConsumed: false
52
+ };
53
+ }
54
+ }
55
+ }
56
+ // The line has already been said — the rest of the step's estimated length is dead air. After the
57
+ // breath, skip straight to the boundary instead of sitting the estimate out. The minimum play time
58
+ // keeps the pointer's travel and press from being cut short by a line spoken faster than the
59
+ // choreography.
60
+ let finishedConsumed = false;
61
+ const index = tourTimeline.stepIndexAtTime(timeline, next);
62
+ const timedStep = index >= 0 ? timeline.steps[index] : undefined;
63
+ const finished = narration.finished;
64
+ if (finished !== null) {
65
+ if (!timedStep || finished.stepIndex !== index) {
66
+ finishedConsumed = true;
67
+ } else {
68
+ const playedEnough = next >= timedStep.startMs + tourTimeline.MINIMUM_STEP_MS;
69
+ const breathed = now - finished.finishedAt >= NARRATION_ADVANCE_BEAT_MS;
70
+ if (playedEnough && breathed && next < timedStep.endMs) {
71
+ if (timedStep.endMs >= timeline.durationMs) {
72
+ return {
73
+ timeMs: timeline.durationMs,
74
+ isPlaying: false,
75
+ holdStartedAt: null,
76
+ finishedConsumed: true
77
+ };
78
+ }
79
+ return {
80
+ timeMs: timedStep.endMs,
81
+ isPlaying: true,
82
+ holdStartedAt: null,
83
+ finishedConsumed: true
84
+ };
85
+ }
86
+ }
87
+ }
88
+ if (next < timeline.durationMs) {
89
+ return {
90
+ timeMs: next,
91
+ isPlaying: true,
92
+ holdStartedAt: null,
93
+ finishedConsumed
94
+ };
95
+ }
96
+ return {
97
+ timeMs: timeline.durationMs,
98
+ isPlaying: false,
99
+ holdStartedAt: null,
100
+ finishedConsumed
101
+ };
102
+ }
103
+
104
+ exports.NARRATION_ADVANCE_BEAT_MS = NARRATION_ADVANCE_BEAT_MS;
105
+ exports.NARRATION_HOLD_LIMIT_MS = NARRATION_HOLD_LIMIT_MS;
106
+ exports.advanceTourClock = advanceTourClock;
107
+ //# sourceMappingURL=tourClock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tourClock.js","sources":["../../tourClock.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 { MINIMUM_STEP_MS, type TourTimeline, stepIndexAtTime } from './tourTimeline.js';\n\n/**\n * The breath between a narration finishing and the clock moving on. Step lengths are estimated from word\n * count, and when the voice finishes ahead of the estimate the remainder would be dead air — the clock\n * skips it after this short beat rather than sitting the estimate out. The same beat separates a line that\n * ran past its estimate from the line that follows it, so held steps release calmly instead of abruptly.\n */\nexport const NARRATION_ADVANCE_BEAT_MS = 700;\n\n/**\n * How long the clock will wait at a step's end for its line to finish being said. Speech is synthesized and\n * streamed, so a line regularly outlasts its word-count estimate — the clock holds the boundary rather than\n * cutting the voice off mid-sentence. The limit only exists so a voice that never finishes — a stalled\n * stream, a hung request — cannot stall the whole tour with it.\n */\nexport const NARRATION_HOLD_LIMIT_MS = 15000;\n\n/** What the voice is up to, as the clock needs to know it to pace itself. */\nexport interface TourClockNarration {\n /** The step whose line has been handed to the voice and not yet finished, or null when none has. */\n pendingStepIndex: number | null;\n\n /** The step whose line finished being said and when it did, or null when none just has. */\n finished: { stepIndex: number; finishedAt: number } | null;\n\n /** When the clock started holding a boundary for the voice, or null when it is not holding one. */\n holdStartedAt: number | null;\n}\n\n/** Where one tick of the tour's clock lands, and what it did to get there. */\nexport interface TourClockAdvance {\n /** Where the clock is after the tick, in milliseconds. */\n timeMs: number;\n\n /** Whether playback continues — false once the clock has reached the end of the tour. */\n isPlaying: boolean;\n\n /** When the in-progress boundary hold started, carried to the next tick, or null when not holding. */\n holdStartedAt: number | null;\n\n /** Whether the finished-narration marker was consumed by this tick and should be cleared. */\n finishedConsumed: boolean;\n}\n\n/**\n * Advances the tour's clock by one tick, pacing it against the voice.\n *\n * The clock leads and the voice follows — with two adjustments at the boundary between them. When a line\n * finishes ahead of its step's estimated length, the leftover is dead air: after a short beat the clock\n * skips to the step's end instead of sitting the estimate out. When a line is still being said as its\n * step's estimated length runs out, the clock holds just short of the boundary until the line finishes —\n * crossing it would tear the voice down mid-sentence — released by the same beat, and bounded by\n * {@link NARRATION_HOLD_LIMIT_MS} so a voice that never finishes cannot stall the tour.\n * @param timeline The tour laid out on one clock.\n * @param currentMs Where the clock is before the tick, in milliseconds.\n * @param elapsedMs How much wall-clock time the tick spans, in milliseconds.\n * @param now The wall clock at the moment of the tick, in milliseconds.\n * @param narration What the voice is up to.\n * @returns The {@link TourClockAdvance} the tick lands on.\n */\nexport function advanceTourClock(\n timeline: TourTimeline,\n currentMs: number,\n elapsedMs: number,\n now: number,\n narration: TourClockNarration): TourClockAdvance {\n const next = currentMs + elapsedMs;\n\n // Hold the boundary while the current step's line is still being said, or has finished but not yet had\n // its breath — the clock parks just short of the step's end so the step stays current and the voice\n // keeps its stage.\n const currentIndex = stepIndexAtTime(timeline, currentMs);\n const currentStep = currentIndex >= 0 ? timeline.steps[currentIndex] : undefined;\n if (currentStep && next >= currentStep.endMs) {\n const stillSpeaking = narration.pendingStepIndex === currentIndex;\n const settling = narration.finished !== null\n && narration.finished.stepIndex === currentIndex\n && now - narration.finished.finishedAt < NARRATION_ADVANCE_BEAT_MS;\n if (stillSpeaking || settling) {\n const holdStartedAt = narration.holdStartedAt ?? now;\n if (now - holdStartedAt < NARRATION_HOLD_LIMIT_MS) {\n return {\n timeMs: Math.max(currentMs, currentStep.endMs - 1),\n isPlaying: true,\n holdStartedAt,\n finishedConsumed: false,\n };\n }\n }\n }\n\n // The line has already been said — the rest of the step's estimated length is dead air. After the\n // breath, skip straight to the boundary instead of sitting the estimate out. The minimum play time\n // keeps the pointer's travel and press from being cut short by a line spoken faster than the\n // choreography.\n let finishedConsumed = false;\n const index = stepIndexAtTime(timeline, next);\n const timedStep = index >= 0 ? timeline.steps[index] : undefined;\n const finished = narration.finished;\n if (finished !== null) {\n if (!timedStep || finished.stepIndex !== index) {\n finishedConsumed = true;\n } else {\n const playedEnough = next >= timedStep.startMs + MINIMUM_STEP_MS;\n const breathed = now - finished.finishedAt >= NARRATION_ADVANCE_BEAT_MS;\n if (playedEnough && breathed && next < timedStep.endMs) {\n if (timedStep.endMs >= timeline.durationMs) {\n return { timeMs: timeline.durationMs, isPlaying: false, holdStartedAt: null, finishedConsumed: true };\n }\n\n return { timeMs: timedStep.endMs, isPlaying: true, holdStartedAt: null, finishedConsumed: true };\n }\n }\n }\n\n if (next < timeline.durationMs) {\n return { timeMs: next, isPlaying: true, holdStartedAt: null, finishedConsumed };\n }\n\n return { timeMs: timeline.durationMs, isPlaying: false, holdStartedAt: null, finishedConsumed };\n}\n"],"names":["NARRATION_ADVANCE_BEAT_MS","NARRATION_HOLD_LIMIT_MS","advanceTourClock","timeline","currentMs","elapsedMs","now","narration","next","currentIndex","stepIndexAtTime","currentStep","steps","undefined","endMs","stillSpeaking","pendingStepIndex","settling","finished","stepIndex","finishedAt","holdStartedAt","timeMs","Math","max","isPlaying","finishedConsumed","index","timedStep","playedEnough","startMs","MINIMUM_STEP_MS","breathed","durationMs"],"mappings":";;;;AAAA;AACA;AAIA;;;;;IAMO,MAAMA,yBAAAA,GAA4B;AAEzC;;;;;IAMO,MAAMC,uBAAAA,GAA0B;AA6BvC;;;;;;;;;;;;;;;IAgBO,SAASC,gBAAAA,CACZC,QAAsB,EACtBC,SAAiB,EACjBC,SAAiB,EACjBC,GAAW,EACXC,SAA6B,EAAA;AAC7B,IAAA,MAAMC,OAAOJ,SAAAA,GAAYC,SAAAA;;;;IAKzB,MAAMI,YAAAA,GAAeC,6BAAgBP,QAAAA,EAAUC,SAAAA,CAAAA;AAC/C,IAAA,MAAMO,cAAcF,YAAAA,IAAgB,CAAA,GAAIN,SAASS,KAAK,CAACH,aAAa,GAAGI,SAAAA;AACvE,IAAA,IAAIF,WAAAA,IAAeH,IAAAA,IAAQG,WAAAA,CAAYG,KAAK,EAAE;QAC1C,MAAMC,aAAAA,GAAgBR,SAAAA,CAAUS,gBAAgB,KAAKP,YAAAA;AACrD,QAAA,MAAMQ,WAAWV,SAAAA,CAAUW,QAAQ,KAAK,IAAA,IACjCX,UAAUW,QAAQ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CAAS8B,UAAU,EAAE;oBACxC,OAAO;AAAEX,wBAAAA,MAAAA,EAAQnB,SAAS8B,UAAU;wBAAER,SAAAA,EAAW,KAAA;wBAAOJ,aAAAA,EAAe,IAAA;wBAAMK,gBAAAA,EAAkB;AAAK,qBAAA;AACxG,gBAAA;gBAEA,OAAO;AAAEJ,oBAAAA,MAAAA,EAAQM,UAAUd,KAAK;oBAAEW,SAAAA,EAAW,IAAA;oBAAMJ,aAAAA,EAAe,IAAA;oBAAMK,gBAAAA,EAAkB;AAAK,iBAAA;AACnG,YAAA;AACJ,QAAA;AACJ,IAAA;IAEA,IAAIlB,IAAAA,GAAOL,QAAAA,CAAS8B,UAAU,EAAE;QAC5B,OAAO;YAAEX,MAAAA,EAAQd,IAAAA;YAAMiB,SAAAA,EAAW,IAAA;YAAMJ,aAAAA,EAAe,IAAA;AAAMK,YAAAA;AAAiB,SAAA;AAClF,IAAA;IAEA,OAAO;AAAEJ,QAAAA,MAAAA,EAAQnB,SAAS8B,UAAU;QAAER,SAAAA,EAAW,KAAA;QAAOJ,aAAAA,EAAe,IAAA;AAAMK,QAAAA;AAAiB,KAAA;AAClG;;;;"}
@@ -0,0 +1,18 @@
1
+ export interface ScreenPoint {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ export interface BoardTransform {
6
+ zoom: number;
7
+ pan: ScreenPoint;
8
+ }
9
+ export declare const CHROME_INSETS: {
10
+ readonly left: 72;
11
+ readonly right: 320;
12
+ readonly bottom: 136;
13
+ };
14
+ export declare function projectToScreen(worldX: number, worldY: number, transform: BoardTransform): ScreenPoint;
15
+ export declare function unobstructedCenter(viewportWidth: number, viewportHeight: number): ScreenPoint;
16
+ export declare function projectEditorPointToScreen(x: number, y: number, viewportWidth: number, viewportHeight: number): ScreenPoint;
17
+ export declare function projectToolbarPointToScreen(x: number, y: number, viewportHeight: number): ScreenPoint;
18
+ //# sourceMappingURL=tourGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tourGeometry.d.ts","sourceRoot":"","sources":["../../tourGeometry.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAExB,CAAC,EAAE,MAAM,CAAC;IAGV,CAAC,EAAE,MAAM,CAAC;CACb;AAGD,MAAM,WAAW,cAAc;IAE3B,IAAI,EAAE,MAAM,CAAC;IAGb,GAAG,EAAE,WAAW,CAAC;CACpB;AAUD,eAAO,MAAM,aAAa;;;;CAAiD,CAAC;AAa5E,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,WAAW,CAKtG;AAQD,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,WAAW,CAK7F;AAeD,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,WAAW,CAG3H;AAcD,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,WAAW,CAErG"}
@@ -0,0 +1,86 @@
1
+ 'use strict';
2
+
3
+ // Copyright (c) Cratis. All rights reserved.
4
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
5
+ /** A point on the screen, relative to the board's own box. */ /**
6
+ * How much of the viewport the tour's own chrome covers on each side, in pixels. The camera compensates by
7
+ * this much so a framed subject centers in the *unobstructed* part of the viewport instead of behind the
8
+ * chapter list or the transport, and the editor showcase centers its panel on the same point. Must be kept in
9
+ * sync with the chrome's stylesheets: the right inset is the chapter list (1rem margin + 19rem wide), the
10
+ * left inset is the tour toolbar's column, and the bottom inset is the subtitles' box (bottom 5.5rem plus its
11
+ * height) over the transport bar.
12
+ */ const CHROME_INSETS = {
13
+ left: 72,
14
+ right: 320,
15
+ bottom: 136
16
+ };
17
+ /**
18
+ * Projects a board coordinate to where it currently sits on screen.
19
+ * @param worldX The horizontal board coordinate.
20
+ * @param worldY The vertical board coordinate.
21
+ * @param transform The board's current pan and zoom.
22
+ * @returns The {@link ScreenPoint} relative to the board's box.
23
+ * @remarks
24
+ * This is the exact inverse of the screen-to-board mapping the canvas uses for collaborator presence, and it
25
+ * is what keeps the tour's pointer and callouts glued to the thing they are pointing at while the camera
26
+ * moves underneath them.
27
+ */ function projectToScreen(worldX, worldY, transform) {
28
+ return {
29
+ x: transform.pan.x + worldX * transform.zoom,
30
+ y: transform.pan.y + worldY * transform.zoom
31
+ };
32
+ }
33
+ /**
34
+ * The point the viewport's unobstructed part centers on — the middle of what the tour's chrome leaves open.
35
+ * @param viewportWidth The viewport's width in pixels.
36
+ * @param viewportHeight The viewport's height in pixels.
37
+ * @returns The {@link ScreenPoint} the camera aims subjects at and the editor showcase centers its panel on.
38
+ */ function unobstructedCenter(viewportWidth, viewportHeight) {
39
+ return {
40
+ x: viewportWidth / 2 - (CHROME_INSETS.right - CHROME_INSETS.left) / 2,
41
+ y: viewportHeight / 2 - CHROME_INSETS.bottom / 2
42
+ };
43
+ }
44
+ /**
45
+ * Projects an editor-space point — an offset from the center of the editor showcase's panel — to the screen.
46
+ * @param x The horizontal offset from the panel's center.
47
+ * @param y The vertical offset from the panel's center.
48
+ * @param viewportWidth The viewport's width in pixels.
49
+ * @param viewportHeight The viewport's height in pixels.
50
+ * @returns The {@link ScreenPoint} relative to the board's box.
51
+ * @remarks
52
+ * The showcase pins its panel on the unobstructed center whatever the viewport size, so offsets from that
53
+ * center are the one coordinate system in which a spot inside the panel — a button, a field, a tab — has the
54
+ * same coordinates on every screen. Measured offsets therefore stay valid everywhere, exactly like the
55
+ * toolbar's fixed screen coordinates.
56
+ */ function projectEditorPointToScreen(x, y, viewportWidth, viewportHeight) {
57
+ const center = unobstructedCenter(viewportWidth, viewportHeight);
58
+ return {
59
+ x: center.x + x,
60
+ y: center.y + y
61
+ };
62
+ }
63
+ /**
64
+ * Projects a toolbar-space point — a fixed offset from the left edge, and a vertical offset from the
65
+ * viewport's center — to the screen.
66
+ * @param x The horizontal offset from the board's left edge.
67
+ * @param y The vertical offset from the viewport's vertical center.
68
+ * @param viewportHeight The viewport's height in pixels.
69
+ * @returns The {@link ScreenPoint} relative to the board's box.
70
+ * @remarks
71
+ * The tour's toolbar centers itself vertically the way the editor's own toolbar does, so a spot on one of
72
+ * its buttons is a fixed distance from the vertical center on every viewport — this is the coordinate system
73
+ * in which those spots keep the same plain numbers everywhere.
74
+ */ function projectToolbarPointToScreen(x, y, viewportHeight) {
75
+ return {
76
+ x,
77
+ y: viewportHeight / 2 + y
78
+ };
79
+ }
80
+
81
+ exports.CHROME_INSETS = CHROME_INSETS;
82
+ exports.projectEditorPointToScreen = projectEditorPointToScreen;
83
+ exports.projectToScreen = projectToScreen;
84
+ exports.projectToolbarPointToScreen = projectToolbarPointToScreen;
85
+ exports.unobstructedCenter = unobstructedCenter;
86
+ //# sourceMappingURL=tourGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tourGeometry.js","sources":["../../tourGeometry.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\n/** A point on the screen, relative to the board's own box. */\nexport interface ScreenPoint {\n /** The horizontal offset in pixels. */\n x: number;\n\n /** The vertical offset in pixels. */\n y: number;\n}\n\n/** The board's current pan and zoom, as the canvas reports it. */\nexport interface BoardTransform {\n /** The zoom level, where 1 is actual size. */\n zoom: number;\n\n /** The pan offset in pixels. */\n pan: ScreenPoint;\n}\n\n/**\n * How much of the viewport the tour's own chrome covers on each side, in pixels. The camera compensates by\n * this much so a framed subject centers in the *unobstructed* part of the viewport instead of behind the\n * chapter list or the transport, and the editor showcase centers its panel on the same point. Must be kept in\n * sync with the chrome's stylesheets: the right inset is the chapter list (1rem margin + 19rem wide), the\n * left inset is the tour toolbar's column, and the bottom inset is the subtitles' box (bottom 5.5rem plus its\n * height) over the transport bar.\n */\nexport const CHROME_INSETS = { left: 72, right: 320, bottom: 136 } as const;\n\n/**\n * Projects a board coordinate to where it currently sits on screen.\n * @param worldX The horizontal board coordinate.\n * @param worldY The vertical board coordinate.\n * @param transform The board's current pan and zoom.\n * @returns The {@link ScreenPoint} relative to the board's box.\n * @remarks\n * This is the exact inverse of the screen-to-board mapping the canvas uses for collaborator presence, and it\n * is what keeps the tour's pointer and callouts glued to the thing they are pointing at while the camera\n * moves underneath them.\n */\nexport function projectToScreen(worldX: number, worldY: number, transform: BoardTransform): ScreenPoint {\n return {\n x: transform.pan.x + worldX * transform.zoom,\n y: transform.pan.y + worldY * transform.zoom,\n };\n}\n\n/**\n * The point the viewport's unobstructed part centers on — the middle of what the tour's chrome leaves open.\n * @param viewportWidth The viewport's width in pixels.\n * @param viewportHeight The viewport's height in pixels.\n * @returns The {@link ScreenPoint} the camera aims subjects at and the editor showcase centers its panel on.\n */\nexport function unobstructedCenter(viewportWidth: number, viewportHeight: number): ScreenPoint {\n return {\n x: viewportWidth / 2 - (CHROME_INSETS.right - CHROME_INSETS.left) / 2,\n y: viewportHeight / 2 - CHROME_INSETS.bottom / 2,\n };\n}\n\n/**\n * Projects an editor-space point — an offset from the center of the editor showcase's panel — to the screen.\n * @param x The horizontal offset from the panel's center.\n * @param y The vertical offset from the panel's center.\n * @param viewportWidth The viewport's width in pixels.\n * @param viewportHeight The viewport's height in pixels.\n * @returns The {@link ScreenPoint} relative to the board's box.\n * @remarks\n * The showcase pins its panel on the unobstructed center whatever the viewport size, so offsets from that\n * center are the one coordinate system in which a spot inside the panel — a button, a field, a tab — has the\n * same coordinates on every screen. Measured offsets therefore stay valid everywhere, exactly like the\n * toolbar's fixed screen coordinates.\n */\nexport function projectEditorPointToScreen(x: number, y: number, viewportWidth: number, viewportHeight: number): ScreenPoint {\n const center = unobstructedCenter(viewportWidth, viewportHeight);\n return { x: center.x + x, y: center.y + y };\n}\n\n/**\n * Projects a toolbar-space point — a fixed offset from the left edge, and a vertical offset from the\n * viewport's center — to the screen.\n * @param x The horizontal offset from the board's left edge.\n * @param y The vertical offset from the viewport's vertical center.\n * @param viewportHeight The viewport's height in pixels.\n * @returns The {@link ScreenPoint} relative to the board's box.\n * @remarks\n * The tour's toolbar centers itself vertically the way the editor's own toolbar does, so a spot on one of\n * its buttons is a fixed distance from the vertical center on every viewport — this is the coordinate system\n * in which those spots keep the same plain numbers everywhere.\n */\nexport function projectToolbarPointToScreen(x: number, y: number, viewportHeight: number): ScreenPoint {\n return { x, y: viewportHeight / 2 + y };\n}\n"],"names":["CHROME_INSETS","left","right","bottom","projectToScreen","worldX","worldY","transform","x","pan","zoom","y","unobstructedCenter","viewportWidth","viewportHeight","projectEditorPointToScreen","center","projectToolbarPointToScreen"],"mappings":";;AAAA;AACA;AAEA;;;;;;;UA0BaA,aAAAA,GAAgB;IAAEC,IAAAA,EAAM,EAAA;IAAIC,KAAAA,EAAO,GAAA;IAAKC,MAAAA,EAAQ;AAAI;AAEjE;;;;;;;;;;AAUC,IACM,SAASC,eAAAA,CAAgBC,MAAc,EAAEC,MAAc,EAAEC,SAAyB,EAAA;IACrF,OAAO;AACHC,QAAAA,CAAAA,EAAGD,UAAUE,GAAG,CAACD,CAAC,GAAGH,MAAAA,GAASE,UAAUG,IAAI;AAC5CC,QAAAA,CAAAA,EAAGJ,UAAUE,GAAG,CAACE,CAAC,GAAGL,MAAAA,GAASC,UAAUG;AAC5C,KAAA;AACJ;AAEA;;;;;AAKC,IACM,SAASE,kBAAAA,CAAmBC,aAAqB,EAAEC,cAAsB,EAAA;IAC5E,OAAO;QACHN,CAAAA,EAAGK,aAAAA,GAAgB,CAAA,GAAKb,CAAAA,aAAAA,CAAcE,KAAK,GAAGF,aAAAA,CAAcC,IAAG,IAAK,CAAA;AACpEU,QAAAA,CAAAA,EAAGG,cAAAA,GAAiB,CAAA,GAAId,aAAAA,CAAcG,MAAM,GAAG;AACnD,KAAA;AACJ;AAEA;;;;;;;;;;;;IAaO,SAASY,0BAAAA,CAA2BP,CAAS,EAAEG,CAAS,EAAEE,aAAqB,EAAEC,cAAsB,EAAA;IAC1G,MAAME,MAAAA,GAASJ,mBAAmBC,aAAAA,EAAeC,cAAAA,CAAAA;IACjD,OAAO;QAAEN,CAAAA,EAAGQ,MAAAA,CAAOR,CAAC,GAAGA,CAAAA;QAAGG,CAAAA,EAAGK,MAAAA,CAAOL,CAAC,GAAGA;AAAE,KAAA;AAC9C;AAEA;;;;;;;;;;;AAWC,IACM,SAASM,2BAAAA,CAA4BT,CAAS,EAAEG,CAAS,EAAEG,cAAsB,EAAA;IACpF,OAAO;AAAEN,QAAAA,CAAAA;AAAGG,QAAAA,CAAAA,EAAGG,iBAAiB,CAAA,GAAIH;AAAE,KAAA;AAC1C;;;;;;"}
@@ -0,0 +1,12 @@
1
+ export type TourSelfPacedContent = Readonly<Record<string, string>>;
2
+ export interface TourSelfPacedView {
3
+ isSelfPaced: boolean;
4
+ isMediaPlaybackEnabled: boolean;
5
+ areTimingsShown: boolean;
6
+ markdown: string;
7
+ }
8
+ export declare function hasSelfPacedContent(content: TourSelfPacedContent | undefined): boolean;
9
+ export declare function selfPacedMarkdownFor(content: TourSelfPacedContent | undefined, chapterId: string | undefined): string;
10
+ export declare function selfPacedViewFor(isSelfPaced: boolean, content: TourSelfPacedContent | undefined, chapterId: string | undefined): TourSelfPacedView;
11
+ export declare function resolveTourMedia(markdown: string, mediaUrls: Readonly<Record<string, string>>): string;
12
+ //# sourceMappingURL=tourSelfPaced.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tourSelfPaced.d.ts","sourceRoot":"","sources":["../../tourSelfPaced.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAGpE,MAAM,WAAW,iBAAiB;IAE9B,WAAW,EAAE,OAAO,CAAC;IAGrB,sBAAsB,EAAE,OAAO,CAAC;IAGhC,eAAe,EAAE,OAAO,CAAC;IAGzB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAQD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,SAAS,GAAG,OAAO,CAEtF;AAQD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAIrH;AAYD,wBAAgB,gBAAgB,CAC5B,WAAW,EAAE,OAAO,EACpB,OAAO,EAAE,oBAAoB,GAAG,SAAS,EACzC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,iBAAiB,CAWpD;AAgBD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAMtG"}
@@ -0,0 +1,69 @@
1
+ 'use strict';
2
+
3
+ // Copyright (c) Cratis. All rights reserved.
4
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
5
+ /**
6
+ * The markdown walkthroughs a tour offers for reading it self-paced, keyed by chapter id — the same ids the
7
+ * tour's script gives its chapters. A tour without content simply never offers the self-paced switch.
8
+ */ /**
9
+ * Gets whether a tour has any self-paced content to read at all, which is what decides whether the
10
+ * self-paced switch is offered.
11
+ * @param content The tour's content, or undefined when it has none.
12
+ * @returns True when there is at least one chapter's markdown to show.
13
+ */ function hasSelfPacedContent(content) {
14
+ return content !== undefined && Object.keys(content).length > 0;
15
+ }
16
+ /**
17
+ * Gets the markdown to read for a chapter.
18
+ * @param content The tour's content, or undefined when it has none.
19
+ * @param chapterId The chapter being read, or undefined when the tour has no chapters.
20
+ * @returns The chapter's markdown, or an empty string when there is nothing to show for it.
21
+ */ function selfPacedMarkdownFor(content, chapterId) {
22
+ if (content === undefined || chapterId === undefined) return '';
23
+ return content[chapterId] ?? '';
24
+ }
25
+ /**
26
+ * Decides how the tour's chrome behaves for the mode it is in: reading self-paced stops being a media
27
+ * player — the playback controls dim, the chapter timings disappear because there is no clock to time
28
+ * against, and the current chapter's walkthrough is shown — while narrated playback keeps all of it and
29
+ * shows no markdown.
30
+ * @param isSelfPaced Whether the viewer has switched to self-paced reading.
31
+ * @param content The tour's content, or undefined when it has none.
32
+ * @param chapterId The chapter currently reached, or undefined when the tour has no chapters.
33
+ * @returns The {@link TourSelfPacedView} the chrome draws from.
34
+ */ function selfPacedViewFor(isSelfPaced, content, chapterId) {
35
+ // Self-paced mode without anything to read would be a silent, frozen tour — so the mode only ever
36
+ // engages when there is content to show.
37
+ const isReading = isSelfPaced && hasSelfPacedContent(content);
38
+ return {
39
+ isSelfPaced: isReading,
40
+ isMediaPlaybackEnabled: !isReading,
41
+ areTimingsShown: !isReading,
42
+ markdown: isReading ? selfPacedMarkdownFor(content, chapterId) : ''
43
+ };
44
+ }
45
+ // Matches a markdown image (`![alt](url)` or `![alt](url "title")`) and captures the surrounding syntax so
46
+ // only the URL is rewritten — the same shape the release-notes rewriter uses.
47
+ const markdownImagePattern = /(!\[[^\]]*\]\()([^)\s]+)(\s*(?:"[^"]*")?\s*\))/g;
48
+ /**
49
+ * Resolves the media references in a chapter's markdown against the URLs the bundler gave the media files.
50
+ * Content references its screenshots and animations with paths relative to its own folder (`media/name.png`);
51
+ * at runtime those files live wherever the bundler put them, and this maps each reference to that URL. A
52
+ * reference to a file that does not exist (yet) is left untouched, so its alt text still tells the reader
53
+ * what belongs there.
54
+ * @param markdown The chapter's markdown.
55
+ * @param mediaUrls The bundled URL for each media file, keyed by the path the markdown references it with.
56
+ * @returns The markdown with every known media reference resolved.
57
+ */ function resolveTourMedia(markdown, mediaUrls) {
58
+ return markdown.replace(markdownImagePattern, (match, prefix, url, suffix)=>{
59
+ const normalized = url.replace(/^\.\//, '');
60
+ const resolved = mediaUrls[normalized];
61
+ return resolved === undefined ? match : `${prefix}${resolved}${suffix}`;
62
+ });
63
+ }
64
+
65
+ exports.hasSelfPacedContent = hasSelfPacedContent;
66
+ exports.resolveTourMedia = resolveTourMedia;
67
+ exports.selfPacedMarkdownFor = selfPacedMarkdownFor;
68
+ exports.selfPacedViewFor = selfPacedViewFor;
69
+ //# sourceMappingURL=tourSelfPaced.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tourSelfPaced.js","sources":["../../tourSelfPaced.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\n/**\n * The markdown walkthroughs a tour offers for reading it self-paced, keyed by chapter id — the same ids the\n * tour's script gives its chapters. A tour without content simply never offers the self-paced switch.\n */\nexport type TourSelfPacedContent = Readonly<Record<string, string>>;\n\n/** Everything the tour's chrome needs to draw itself in or out of self-paced reading mode. */\nexport interface TourSelfPacedView {\n /** Whether the tour is being read self-paced rather than played. */\n isSelfPaced: boolean;\n\n /** Whether the media playback controls — play, scrubbing, narration and subtitles — are usable. */\n isMediaPlaybackEnabled: boolean;\n\n /** Whether the chapter list shows where on the clock each chapter starts. */\n areTimingsShown: boolean;\n\n /** The markdown for the chapter being read, or an empty string when the chapter has none. */\n markdown: string;\n}\n\n/**\n * Gets whether a tour has any self-paced content to read at all, which is what decides whether the\n * self-paced switch is offered.\n * @param content The tour's content, or undefined when it has none.\n * @returns True when there is at least one chapter's markdown to show.\n */\nexport function hasSelfPacedContent(content: TourSelfPacedContent | undefined): boolean {\n return content !== undefined && Object.keys(content).length > 0;\n}\n\n/**\n * Gets the markdown to read for a chapter.\n * @param content The tour's content, or undefined when it has none.\n * @param chapterId The chapter being read, or undefined when the tour has no chapters.\n * @returns The chapter's markdown, or an empty string when there is nothing to show for it.\n */\nexport function selfPacedMarkdownFor(content: TourSelfPacedContent | undefined, chapterId: string | undefined): string {\n if (content === undefined || chapterId === undefined) return '';\n\n return content[chapterId] ?? '';\n}\n\n/**\n * Decides how the tour's chrome behaves for the mode it is in: reading self-paced stops being a media\n * player — the playback controls dim, the chapter timings disappear because there is no clock to time\n * against, and the current chapter's walkthrough is shown — while narrated playback keeps all of it and\n * shows no markdown.\n * @param isSelfPaced Whether the viewer has switched to self-paced reading.\n * @param content The tour's content, or undefined when it has none.\n * @param chapterId The chapter currently reached, or undefined when the tour has no chapters.\n * @returns The {@link TourSelfPacedView} the chrome draws from.\n */\nexport function selfPacedViewFor(\n isSelfPaced: boolean,\n content: TourSelfPacedContent | undefined,\n chapterId: string | undefined): TourSelfPacedView {\n // Self-paced mode without anything to read would be a silent, frozen tour — so the mode only ever\n // engages when there is content to show.\n const isReading = isSelfPaced && hasSelfPacedContent(content);\n\n return {\n isSelfPaced: isReading,\n isMediaPlaybackEnabled: !isReading,\n areTimingsShown: !isReading,\n markdown: isReading ? selfPacedMarkdownFor(content, chapterId) : '',\n };\n}\n\n// Matches a markdown image (`![alt](url)` or `![alt](url \"title\")`) and captures the surrounding syntax so\n// only the URL is rewritten — the same shape the release-notes rewriter uses.\nconst markdownImagePattern = /(!\\[[^\\]]*\\]\\()([^)\\s]+)(\\s*(?:\"[^\"]*\")?\\s*\\))/g;\n\n/**\n * Resolves the media references in a chapter's markdown against the URLs the bundler gave the media files.\n * Content references its screenshots and animations with paths relative to its own folder (`media/name.png`);\n * at runtime those files live wherever the bundler put them, and this maps each reference to that URL. A\n * reference to a file that does not exist (yet) is left untouched, so its alt text still tells the reader\n * what belongs there.\n * @param markdown The chapter's markdown.\n * @param mediaUrls The bundled URL for each media file, keyed by the path the markdown references it with.\n * @returns The markdown with every known media reference resolved.\n */\nexport function resolveTourMedia(markdown: string, mediaUrls: Readonly<Record<string, string>>): string {\n return markdown.replace(markdownImagePattern, (match, prefix, url, suffix) => {\n const normalized = (url as string).replace(/^\\.\\//, '');\n const resolved = mediaUrls[normalized];\n return resolved === undefined ? match : `${prefix}${resolved}${suffix}`;\n });\n}\n"],"names":["hasSelfPacedContent","content","undefined","Object","keys","length","selfPacedMarkdownFor","chapterId","selfPacedViewFor","isSelfPaced","isReading","isMediaPlaybackEnabled","areTimingsShown","markdown","markdownImagePattern","resolveTourMedia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GAAYgB,KAAAA,GAAQ,CAAA,EAAGC,MAAAA,CAAAA,EAASI,WAAWF,MAAAA,CAAAA,CAAQ;AAC3E,IAAA,CAAA,CAAA;AACJ;;;;;"}
@@ -0,0 +1,40 @@
1
+ import type { TourChapter } from './TourChapter.js';
2
+ import type { TourSection } from './TourSection.js';
3
+ import type { TourStep } from './TourStep.js';
4
+ export declare const MINIMUM_STEP_MS = 2200;
5
+ export declare const RESTART_CHAPTER_WINDOW_MS = 2000;
6
+ export interface TimedTourStep<TStep extends TourStep = TourStep> {
7
+ step: TStep;
8
+ chapterIndex: number;
9
+ startMs: number;
10
+ endMs: number;
11
+ }
12
+ export interface TimedTourChapter<TStep extends TourStep = TourStep> {
13
+ chapter: TourChapter<TStep>;
14
+ sectionIndex: number;
15
+ startMs: number;
16
+ endMs: number;
17
+ }
18
+ export interface TimedTourSection<TStep extends TourStep = TourStep> {
19
+ section: TourSection<TStep>;
20
+ startMs: number;
21
+ endMs: number;
22
+ }
23
+ export interface TourTimeline<TStep extends TourStep = TourStep> {
24
+ steps: TimedTourStep<TStep>[];
25
+ chapters: TimedTourChapter<TStep>[];
26
+ sections: TimedTourSection<TStep>[];
27
+ durationMs: number;
28
+ }
29
+ export declare function narrationDurationMs(narration: string): number;
30
+ export declare function stepDurationMs(step: TourStep): number;
31
+ export declare function buildTourTimeline<TStep extends TourStep>(sections: TourSection<TStep>[]): TourTimeline<TStep>;
32
+ export declare function stepIndexAtTime(timeline: TourTimeline, timeMs: number): number;
33
+ export declare function chapterIndexAtTime(timeline: TourTimeline, timeMs: number): number;
34
+ export declare function sectionIndexAtTime(timeline: TourTimeline, timeMs: number): number;
35
+ export declare function chapterStartMs(timeline: TourTimeline, chapterIndex: number): number;
36
+ export declare function previousChapterTargetMs(timeline: TourTimeline, timeMs: number): number;
37
+ export declare function nextChapterTargetMs(timeline: TourTimeline, timeMs: number): number;
38
+ export declare function narrationsAfter(timeline: TourTimeline, stepIndex: number, count: number): string[];
39
+ export declare function formatTourT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