@canonical/motion-control 0.0.0-stage → 0.48.0

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 (311) hide show
  1. package/LICENSE +166 -0
  2. package/README.md +300 -2
  3. package/cast.schema.json +101 -0
  4. package/dist/esm/cli.js +30 -0
  5. package/dist/esm/cli.js.map +1 -0
  6. package/dist/esm/global.js +7 -0
  7. package/dist/esm/global.js.map +1 -0
  8. package/dist/esm/index.js +2 -0
  9. package/dist/esm/index.js.map +1 -0
  10. package/dist/esm/lib/cast/checkCasts.js +34 -0
  11. package/dist/esm/lib/cast/checkCasts.js.map +1 -0
  12. package/dist/esm/lib/cast/checkScene.js +58 -0
  13. package/dist/esm/lib/cast/checkScene.js.map +1 -0
  14. package/dist/esm/lib/cast/checkStep.js +73 -0
  15. package/dist/esm/lib/cast/checkStep.js.map +1 -0
  16. package/dist/esm/lib/cast/constants.js +53 -0
  17. package/dist/esm/lib/cast/constants.js.map +1 -0
  18. package/dist/esm/lib/cast/formatReport.js +22 -0
  19. package/dist/esm/lib/cast/formatReport.js.map +1 -0
  20. package/dist/esm/lib/cast/index.js +10 -0
  21. package/dist/esm/lib/cast/index.js.map +1 -0
  22. package/dist/esm/lib/cast/listFrameNames.js +19 -0
  23. package/dist/esm/lib/cast/listFrameNames.js.map +1 -0
  24. package/dist/esm/lib/cast/measureScene.js +11 -0
  25. package/dist/esm/lib/cast/measureScene.js.map +1 -0
  26. package/dist/esm/lib/cast/measureStep.js +21 -0
  27. package/dist/esm/lib/cast/measureStep.js.map +1 -0
  28. package/dist/esm/lib/cast/measureTyping.js +13 -0
  29. package/dist/esm/lib/cast/measureTyping.js.map +1 -0
  30. package/dist/esm/lib/cast/types.js +2 -0
  31. package/dist/esm/lib/cast/types.js.map +1 -0
  32. package/dist/esm/lib/gif/compressLzw.js +61 -0
  33. package/dist/esm/lib/gif/compressLzw.js.map +1 -0
  34. package/dist/esm/lib/gif/constants.js +9 -0
  35. package/dist/esm/lib/gif/constants.js.map +1 -0
  36. package/dist/esm/lib/gif/encodeGif.js +45 -0
  37. package/dist/esm/lib/gif/encodeGif.js.map +1 -0
  38. package/dist/esm/lib/gif/index.js +6 -0
  39. package/dist/esm/lib/gif/index.js.map +1 -0
  40. package/dist/esm/lib/gif/mergeStills.js +32 -0
  41. package/dist/esm/lib/gif/mergeStills.js.map +1 -0
  42. package/dist/esm/lib/gif/quantizePictures.js +75 -0
  43. package/dist/esm/lib/gif/quantizePictures.js.map +1 -0
  44. package/dist/esm/lib/gif/types.js +2 -0
  45. package/dist/esm/lib/gif/types.js.map +1 -0
  46. package/dist/esm/lib/index.js +3 -0
  47. package/dist/esm/lib/index.js.map +1 -0
  48. package/dist/esm/lib/moment/constants.js +33 -0
  49. package/dist/esm/lib/moment/constants.js.map +1 -0
  50. package/dist/esm/lib/moment/describeAction.js +20 -0
  51. package/dist/esm/lib/moment/describeAction.js.map +1 -0
  52. package/dist/esm/lib/moment/describeKeyRun.js +53 -0
  53. package/dist/esm/lib/moment/describeKeyRun.js.map +1 -0
  54. package/dist/esm/lib/moment/describeMoment.js +323 -0
  55. package/dist/esm/lib/moment/describeMoment.js.map +1 -0
  56. package/dist/esm/lib/moment/easeInOut.js +12 -0
  57. package/dist/esm/lib/moment/easeInOut.js.map +1 -0
  58. package/dist/esm/lib/moment/index.js +8 -0
  59. package/dist/esm/lib/moment/index.js.map +1 -0
  60. package/dist/esm/lib/moment/resolveStates.js +82 -0
  61. package/dist/esm/lib/moment/resolveStates.js.map +1 -0
  62. package/dist/esm/lib/moment/takeSpan.js +12 -0
  63. package/dist/esm/lib/moment/takeSpan.js.map +1 -0
  64. package/dist/esm/lib/moment/types.js +2 -0
  65. package/dist/esm/lib/moment/types.js.map +1 -0
  66. package/dist/esm/lib/player/Player.js +498 -0
  67. package/dist/esm/lib/player/Player.js.map +1 -0
  68. package/dist/esm/lib/player/announceHeight.js +30 -0
  69. package/dist/esm/lib/player/announceHeight.js.map +1 -0
  70. package/dist/esm/lib/player/applyMoment.js +155 -0
  71. package/dist/esm/lib/player/applyMoment.js.map +1 -0
  72. package/dist/esm/lib/player/assertPresent.js +14 -0
  73. package/dist/esm/lib/player/assertPresent.js.map +1 -0
  74. package/dist/esm/lib/player/collectFrames.js +30 -0
  75. package/dist/esm/lib/player/collectFrames.js.map +1 -0
  76. package/dist/esm/lib/player/collectStyles.js +24 -0
  77. package/dist/esm/lib/player/collectStyles.js.map +1 -0
  78. package/dist/esm/lib/player/constants.js +101 -0
  79. package/dist/esm/lib/player/constants.js.map +1 -0
  80. package/dist/esm/lib/player/defaultProfile.js +50 -0
  81. package/dist/esm/lib/player/defaultProfile.js.map +1 -0
  82. package/dist/esm/lib/player/drawMarkup.js +36 -0
  83. package/dist/esm/lib/player/drawMarkup.js.map +1 -0
  84. package/dist/esm/lib/player/drawScene.js +32 -0
  85. package/dist/esm/lib/player/drawScene.js.map +1 -0
  86. package/dist/esm/lib/player/drawSprites.js +122 -0
  87. package/dist/esm/lib/player/drawSprites.js.map +1 -0
  88. package/dist/esm/lib/player/fitEmbeds.js +42 -0
  89. package/dist/esm/lib/player/fitEmbeds.js.map +1 -0
  90. package/dist/esm/lib/player/fitSlide.js +27 -0
  91. package/dist/esm/lib/player/fitSlide.js.map +1 -0
  92. package/dist/esm/lib/player/formatKey.js +13 -0
  93. package/dist/esm/lib/player/formatKey.js.map +1 -0
  94. package/dist/esm/lib/player/formatKeySign.js +12 -0
  95. package/dist/esm/lib/player/formatKeySign.js.map +1 -0
  96. package/dist/esm/lib/player/formatSpeed.js +11 -0
  97. package/dist/esm/lib/player/formatSpeed.js.map +1 -0
  98. package/dist/esm/lib/player/formatTime.js +18 -0
  99. package/dist/esm/lib/player/formatTime.js.map +1 -0
  100. package/dist/esm/lib/player/index.js +30 -0
  101. package/dist/esm/lib/player/index.js.map +1 -0
  102. package/dist/esm/lib/player/installStateRules.js +25 -0
  103. package/dist/esm/lib/player/installStateRules.js.map +1 -0
  104. package/dist/esm/lib/player/listHidden.js +24 -0
  105. package/dist/esm/lib/player/listHidden.js.map +1 -0
  106. package/dist/esm/lib/player/makeElement.js +15 -0
  107. package/dist/esm/lib/player/makeElement.js.map +1 -0
  108. package/dist/esm/lib/player/mergeProfile.js +17 -0
  109. package/dist/esm/lib/player/mergeProfile.js.map +1 -0
  110. package/dist/esm/lib/player/mirrorStates.js +23 -0
  111. package/dist/esm/lib/player/mirrorStates.js.map +1 -0
  112. package/dist/esm/lib/player/mountScenes.js +100 -0
  113. package/dist/esm/lib/player/mountScenes.js.map +1 -0
  114. package/dist/esm/lib/player/readLayerBox.js +20 -0
  115. package/dist/esm/lib/player/readLayerBox.js.map +1 -0
  116. package/dist/esm/lib/player/recordGif.js +63 -0
  117. package/dist/esm/lib/player/recordGif.js.map +1 -0
  118. package/dist/esm/lib/player/recordVideo.js +114 -0
  119. package/dist/esm/lib/player/recordVideo.js.map +1 -0
  120. package/dist/esm/lib/player/renderLegend.js +27 -0
  121. package/dist/esm/lib/player/renderLegend.js.map +1 -0
  122. package/dist/esm/lib/player/saveFile.js +22 -0
  123. package/dist/esm/lib/player/saveFile.js.map +1 -0
  124. package/dist/esm/lib/player/serializeElement.js +36 -0
  125. package/dist/esm/lib/player/serializeElement.js.map +1 -0
  126. package/dist/esm/lib/player/types.js +2 -0
  127. package/dist/esm/lib/player/types.js.map +1 -0
  128. package/dist/esm/lib/player/wrapSlide.js +28 -0
  129. package/dist/esm/lib/player/wrapSlide.js.map +1 -0
  130. package/dist/esm/lib/timeline/advanceClock.js +24 -0
  131. package/dist/esm/lib/timeline/advanceClock.js.map +1 -0
  132. package/dist/esm/lib/timeline/buildTimeline.js +47 -0
  133. package/dist/esm/lib/timeline/buildTimeline.js.map +1 -0
  134. package/dist/esm/lib/timeline/constants.js +3 -0
  135. package/dist/esm/lib/timeline/constants.js.map +1 -0
  136. package/dist/esm/lib/timeline/findKeyframe.js +11 -0
  137. package/dist/esm/lib/timeline/findKeyframe.js.map +1 -0
  138. package/dist/esm/lib/timeline/index.js +7 -0
  139. package/dist/esm/lib/timeline/index.js.map +1 -0
  140. package/dist/esm/lib/timeline/locateTime.js +21 -0
  141. package/dist/esm/lib/timeline/locateTime.js.map +1 -0
  142. package/dist/esm/lib/timeline/stepKeyframe.js +20 -0
  143. package/dist/esm/lib/timeline/stepKeyframe.js.map +1 -0
  144. package/dist/esm/lib/timeline/types.js +2 -0
  145. package/dist/esm/lib/timeline/types.js.map +1 -0
  146. package/dist/esm/lib/video/constants.js +7 -0
  147. package/dist/esm/lib/video/constants.js.map +1 -0
  148. package/dist/esm/lib/video/index.js +4 -0
  149. package/dist/esm/lib/video/index.js.map +1 -0
  150. package/dist/esm/lib/video/types.js +2 -0
  151. package/dist/esm/lib/video/types.js.map +1 -0
  152. package/dist/esm/lib/video/writeBox.js +21 -0
  153. package/dist/esm/lib/video/writeBox.js.map +1 -0
  154. package/dist/esm/lib/video/writeMp4.js +45 -0
  155. package/dist/esm/lib/video/writeMp4.js.map +1 -0
  156. package/dist/motion.css +581 -0
  157. package/dist/motion.global.js +1502 -0
  158. package/dist/types/cli.d.ts +3 -0
  159. package/dist/types/cli.d.ts.map +1 -0
  160. package/dist/types/global.d.ts +2 -0
  161. package/dist/types/global.d.ts.map +1 -0
  162. package/dist/types/index.d.ts +17 -0
  163. package/dist/types/index.d.ts.map +1 -0
  164. package/dist/types/lib/cast/checkCasts.d.ts +15 -0
  165. package/dist/types/lib/cast/checkCasts.d.ts.map +1 -0
  166. package/dist/types/lib/cast/checkScene.d.ts +11 -0
  167. package/dist/types/lib/cast/checkScene.d.ts.map +1 -0
  168. package/dist/types/lib/cast/checkStep.d.ts +12 -0
  169. package/dist/types/lib/cast/checkStep.d.ts.map +1 -0
  170. package/dist/types/lib/cast/constants.d.ts +20 -0
  171. package/dist/types/lib/cast/constants.d.ts.map +1 -0
  172. package/dist/types/lib/cast/formatReport.d.ts +11 -0
  173. package/dist/types/lib/cast/formatReport.d.ts.map +1 -0
  174. package/dist/types/lib/cast/index.d.ts +11 -0
  175. package/dist/types/lib/cast/index.d.ts.map +1 -0
  176. package/dist/types/lib/cast/listFrameNames.d.ts +8 -0
  177. package/dist/types/lib/cast/listFrameNames.d.ts.map +1 -0
  178. package/dist/types/lib/cast/measureScene.d.ts +9 -0
  179. package/dist/types/lib/cast/measureScene.d.ts.map +1 -0
  180. package/dist/types/lib/cast/measureStep.d.ts +13 -0
  181. package/dist/types/lib/cast/measureStep.d.ts.map +1 -0
  182. package/dist/types/lib/cast/measureTyping.d.ts +12 -0
  183. package/dist/types/lib/cast/measureTyping.d.ts.map +1 -0
  184. package/dist/types/lib/cast/types.d.ts +87 -0
  185. package/dist/types/lib/cast/types.d.ts.map +1 -0
  186. package/dist/types/lib/gif/compressLzw.d.ts +9 -0
  187. package/dist/types/lib/gif/compressLzw.d.ts.map +1 -0
  188. package/dist/types/lib/gif/constants.d.ts +9 -0
  189. package/dist/types/lib/gif/constants.d.ts.map +1 -0
  190. package/dist/types/lib/gif/encodeGif.d.ts +13 -0
  191. package/dist/types/lib/gif/encodeGif.d.ts.map +1 -0
  192. package/dist/types/lib/gif/index.d.ts +7 -0
  193. package/dist/types/lib/gif/index.d.ts.map +1 -0
  194. package/dist/types/lib/gif/mergeStills.d.ts +12 -0
  195. package/dist/types/lib/gif/mergeStills.d.ts.map +1 -0
  196. package/dist/types/lib/gif/quantizePictures.d.ts +13 -0
  197. package/dist/types/lib/gif/quantizePictures.d.ts.map +1 -0
  198. package/dist/types/lib/gif/types.d.ts +22 -0
  199. package/dist/types/lib/gif/types.d.ts.map +1 -0
  200. package/dist/types/lib/index.d.ts +3 -0
  201. package/dist/types/lib/index.d.ts.map +1 -0
  202. package/dist/types/lib/moment/constants.d.ts +33 -0
  203. package/dist/types/lib/moment/constants.d.ts.map +1 -0
  204. package/dist/types/lib/moment/describeAction.d.ts +9 -0
  205. package/dist/types/lib/moment/describeAction.d.ts.map +1 -0
  206. package/dist/types/lib/moment/describeKeyRun.d.ts +18 -0
  207. package/dist/types/lib/moment/describeKeyRun.d.ts.map +1 -0
  208. package/dist/types/lib/moment/describeMoment.d.ts +16 -0
  209. package/dist/types/lib/moment/describeMoment.d.ts.map +1 -0
  210. package/dist/types/lib/moment/easeInOut.d.ts +8 -0
  211. package/dist/types/lib/moment/easeInOut.d.ts.map +1 -0
  212. package/dist/types/lib/moment/index.d.ts +9 -0
  213. package/dist/types/lib/moment/index.d.ts.map +1 -0
  214. package/dist/types/lib/moment/resolveStates.d.ts +18 -0
  215. package/dist/types/lib/moment/resolveStates.d.ts.map +1 -0
  216. package/dist/types/lib/moment/takeSpan.d.ts +10 -0
  217. package/dist/types/lib/moment/takeSpan.d.ts.map +1 -0
  218. package/dist/types/lib/moment/types.d.ts +187 -0
  219. package/dist/types/lib/moment/types.d.ts.map +1 -0
  220. package/dist/types/lib/player/Player.d.ts +134 -0
  221. package/dist/types/lib/player/Player.d.ts.map +1 -0
  222. package/dist/types/lib/player/announceHeight.d.ts +12 -0
  223. package/dist/types/lib/player/announceHeight.d.ts.map +1 -0
  224. package/dist/types/lib/player/applyMoment.d.ts +21 -0
  225. package/dist/types/lib/player/applyMoment.d.ts.map +1 -0
  226. package/dist/types/lib/player/assertPresent.d.ts +10 -0
  227. package/dist/types/lib/player/assertPresent.d.ts.map +1 -0
  228. package/dist/types/lib/player/collectFrames.d.ts +11 -0
  229. package/dist/types/lib/player/collectFrames.d.ts.map +1 -0
  230. package/dist/types/lib/player/collectStyles.d.ts +12 -0
  231. package/dist/types/lib/player/collectStyles.d.ts.map +1 -0
  232. package/dist/types/lib/player/constants.d.ts +80 -0
  233. package/dist/types/lib/player/constants.d.ts.map +1 -0
  234. package/dist/types/lib/player/defaultProfile.d.ts +8 -0
  235. package/dist/types/lib/player/defaultProfile.d.ts.map +1 -0
  236. package/dist/types/lib/player/drawMarkup.d.ts +15 -0
  237. package/dist/types/lib/player/drawMarkup.d.ts.map +1 -0
  238. package/dist/types/lib/player/drawScene.d.ts +23 -0
  239. package/dist/types/lib/player/drawScene.d.ts.map +1 -0
  240. package/dist/types/lib/player/drawSprites.d.ts +35 -0
  241. package/dist/types/lib/player/drawSprites.d.ts.map +1 -0
  242. package/dist/types/lib/player/fitEmbeds.d.ts +13 -0
  243. package/dist/types/lib/player/fitEmbeds.d.ts.map +1 -0
  244. package/dist/types/lib/player/fitSlide.d.ts +24 -0
  245. package/dist/types/lib/player/fitSlide.d.ts.map +1 -0
  246. package/dist/types/lib/player/formatKey.d.ts +9 -0
  247. package/dist/types/lib/player/formatKey.d.ts.map +1 -0
  248. package/dist/types/lib/player/formatKeySign.d.ts +9 -0
  249. package/dist/types/lib/player/formatKeySign.d.ts.map +1 -0
  250. package/dist/types/lib/player/formatSpeed.d.ts +9 -0
  251. package/dist/types/lib/player/formatSpeed.d.ts.map +1 -0
  252. package/dist/types/lib/player/formatTime.d.ts +12 -0
  253. package/dist/types/lib/player/formatTime.d.ts.map +1 -0
  254. package/dist/types/lib/player/index.d.ts +31 -0
  255. package/dist/types/lib/player/index.d.ts.map +1 -0
  256. package/dist/types/lib/player/installStateRules.d.ts +12 -0
  257. package/dist/types/lib/player/installStateRules.d.ts.map +1 -0
  258. package/dist/types/lib/player/listHidden.d.ts +12 -0
  259. package/dist/types/lib/player/listHidden.d.ts.map +1 -0
  260. package/dist/types/lib/player/makeElement.d.ts +10 -0
  261. package/dist/types/lib/player/makeElement.d.ts.map +1 -0
  262. package/dist/types/lib/player/mergeProfile.d.ts +9 -0
  263. package/dist/types/lib/player/mergeProfile.d.ts.map +1 -0
  264. package/dist/types/lib/player/mirrorStates.d.ts +12 -0
  265. package/dist/types/lib/player/mirrorStates.d.ts.map +1 -0
  266. package/dist/types/lib/player/mountScenes.d.ts +25 -0
  267. package/dist/types/lib/player/mountScenes.d.ts.map +1 -0
  268. package/dist/types/lib/player/readLayerBox.d.ts +23 -0
  269. package/dist/types/lib/player/readLayerBox.d.ts.map +1 -0
  270. package/dist/types/lib/player/recordGif.d.ts +16 -0
  271. package/dist/types/lib/player/recordGif.d.ts.map +1 -0
  272. package/dist/types/lib/player/recordVideo.d.ts +19 -0
  273. package/dist/types/lib/player/recordVideo.d.ts.map +1 -0
  274. package/dist/types/lib/player/renderLegend.d.ts +8 -0
  275. package/dist/types/lib/player/renderLegend.d.ts.map +1 -0
  276. package/dist/types/lib/player/saveFile.d.ts +13 -0
  277. package/dist/types/lib/player/saveFile.d.ts.map +1 -0
  278. package/dist/types/lib/player/serializeElement.d.ts +14 -0
  279. package/dist/types/lib/player/serializeElement.d.ts.map +1 -0
  280. package/dist/types/lib/player/types.d.ts +321 -0
  281. package/dist/types/lib/player/types.d.ts.map +1 -0
  282. package/dist/types/lib/player/wrapSlide.d.ts +17 -0
  283. package/dist/types/lib/player/wrapSlide.d.ts.map +1 -0
  284. package/dist/types/lib/timeline/advanceClock.d.ts +16 -0
  285. package/dist/types/lib/timeline/advanceClock.d.ts.map +1 -0
  286. package/dist/types/lib/timeline/buildTimeline.d.ts +15 -0
  287. package/dist/types/lib/timeline/buildTimeline.d.ts.map +1 -0
  288. package/dist/types/lib/timeline/constants.d.ts +3 -0
  289. package/dist/types/lib/timeline/constants.d.ts.map +1 -0
  290. package/dist/types/lib/timeline/findKeyframe.d.ts +10 -0
  291. package/dist/types/lib/timeline/findKeyframe.d.ts.map +1 -0
  292. package/dist/types/lib/timeline/index.d.ts +8 -0
  293. package/dist/types/lib/timeline/index.d.ts.map +1 -0
  294. package/dist/types/lib/timeline/locateTime.d.ts +10 -0
  295. package/dist/types/lib/timeline/locateTime.d.ts.map +1 -0
  296. package/dist/types/lib/timeline/stepKeyframe.d.ts +12 -0
  297. package/dist/types/lib/timeline/stepKeyframe.d.ts.map +1 -0
  298. package/dist/types/lib/timeline/types.d.ts +40 -0
  299. package/dist/types/lib/timeline/types.d.ts.map +1 -0
  300. package/dist/types/lib/video/constants.d.ts +5 -0
  301. package/dist/types/lib/video/constants.d.ts.map +1 -0
  302. package/dist/types/lib/video/index.d.ts +5 -0
  303. package/dist/types/lib/video/index.d.ts.map +1 -0
  304. package/dist/types/lib/video/types.d.ts +21 -0
  305. package/dist/types/lib/video/types.d.ts.map +1 -0
  306. package/dist/types/lib/video/writeBox.d.ts +9 -0
  307. package/dist/types/lib/video/writeBox.d.ts.map +1 -0
  308. package/dist/types/lib/video/writeMp4.d.ts +10 -0
  309. package/dist/types/lib/video/writeMp4.d.ts.map +1 -0
  310. package/package.json +106 -4
  311. package/skills/design-motion-frames/SKILL.md +183 -0
@@ -0,0 +1,498 @@
1
+ import { describeAction, describeMoment, } from "../moment/index.js";
2
+ import { advanceClock, buildTimeline, findKeyframe, locateTime, stepKeyframe, } from "../timeline/index.js";
3
+ import applyMoment from "./applyMoment.js";
4
+ import assertPresent from "./assertPresent.js";
5
+ import { PAUSE_SIGN, PLAY_SIGN, PRACTICE_AT, SPEEDS, TIME_MODES, } from "./constants.js";
6
+ import drawSprites from "./drawSprites.js";
7
+ import formatSpeed from "./formatSpeed.js";
8
+ import formatTime from "./formatTime.js";
9
+ import listHidden from "./listHidden.js";
10
+ import makeElement from "./makeElement.js";
11
+ import readLayerBox from "./readLayerBox.js";
12
+ import recordGif from "./recordGif.js";
13
+ import saveFile from "./saveFile.js";
14
+ /**
15
+ * Plays one scene: a figure with a screen, a layer for the symbols of interactions, a strip that names what is
16
+ * in view, and a bar to play, step and scrub.
17
+ *
18
+ * Every step is drawn from its progress alone. `pose` rebuilds the screen from the frame in view and draws the
19
+ * step at a fraction of its duration, so playing, pausing, stepping and scrubbing are one operation, and any
20
+ * moment can be shown directly.
21
+ *
22
+ * What a moment holds is worked out by `describeMoment`, and when each step happens by the timeline; this
23
+ * class draws the one on the page and runs the clock of the other.
24
+ *
25
+ * @note Impure: it builds and changes elements of the page, and listens to the reader.
26
+ */
27
+ export default class Player {
28
+ /** The scene being played. */
29
+ scene;
30
+ /** The figure put on the page. */
31
+ root;
32
+ /** The element that shows the frame in view. */
33
+ screen;
34
+ /** The scene laid out in time. */
35
+ timeline;
36
+ /** How long each step lasts, in milliseconds. */
37
+ durations;
38
+ /** How long the scene lasts, in milliseconds. */
39
+ total;
40
+ /** Whether the scene is playing. */
41
+ playing = false;
42
+ /** The step in view. */
43
+ at = 0;
44
+ /** The moment in view, in milliseconds from the start. */
45
+ clock = 0;
46
+ /** How fast the clock runs. */
47
+ speed = 1;
48
+ /** The speeds a press of the speed goes through, slowest first. */
49
+ speeds;
50
+ /** Whether the scene starts again at its end; `setLoop` changes it. */
51
+ loop;
52
+ /** What the time under the clip reads: how far in, how long in all, or how much is left. */
53
+ timeMode = "elapsed";
54
+ /** The step that waits for the reader to do it themselves, when one does. */
55
+ awaiting;
56
+ frames;
57
+ profile;
58
+ context;
59
+ layer;
60
+ bar;
61
+ playButton;
62
+ timeButton;
63
+ moment = 0;
64
+ strip;
65
+ run = 0;
66
+ practised = -1;
67
+ /**
68
+ * @param scene - The scene to play. Its first step must show a frame.
69
+ * @param into - The element that receives the figure.
70
+ * @param context - The frames by name, the profile of the page, where the title stands (in a bar above the
71
+ * screen, which is the default, or in the panel below it), the speeds a scene can be played at, what the
72
+ * figure shows beside its screen, whether steps marked for practice wait for the reader, and what to call
73
+ * when the step in view changes or the scene ends.
74
+ * @throws When the scene has no steps or does not start on a frame.
75
+ */
76
+ constructor(scene, into, context) {
77
+ this.scene = scene;
78
+ this.frames = context.frames;
79
+ this.profile = context.profile;
80
+ this.context = context;
81
+ this.timeline = buildTimeline(scene, (name) => this.readLineOf(name));
82
+ this.durations = this.timeline.durations;
83
+ this.total = this.timeline.total;
84
+ this.loop = context.loop ?? this.timeline.loop;
85
+ const device = scene.device ?? "phone";
86
+ const words = this.profile.words;
87
+ const about = scene.about
88
+ ? ` · ${scene.about.kind}: ${scene.about.name}`
89
+ : "";
90
+ // One framed object: the screen, and under it a panel on one grid of three columns. Each row of the panel
91
+ // puts a short token first, what it is about second, and a value at the end: the title, the frame in view,
92
+ // the caption, the controls. The name of an interaction can be long, so it shares the frame's cell and
93
+ // keeps to its end, where the third column's values end too.
94
+ //
95
+ // The title row stands over the screen, as a bar on the same grid, unless the page asks for it below.
96
+ //
97
+ // The row of the title ends with three dots: the menu of what else a reader can do with the scene. The
98
+ // controls are the last row, on the same columns: back, play and forward in the first, the timeline in the
99
+ // second, and at the timeline's end what is read off it: the speed and the time.
100
+ const above = context.title !== "below";
101
+ // A scene starts as written, so that speed is always among the ones offered.
102
+ this.speeds = [...new Set([1, ...(context.speeds ?? SPEEDS)])].sort((one, other) => one - other);
103
+ const title = `<span class="mo-kind">${scene.clip ? words.clip : words.scene}</span><span class="mo-head"><a class="mo-title" href="#${scene.id}">${scene.title}</a><span class="mo-about">${about}</span></span><span class="mo-opt"><button type="button" class="mo-more" title="${words.more}" aria-label="${words.more}" aria-expanded="false">⋮</button><span class="mo-menu" hidden><button type="button" class="mo-gif">${words.gif}</button><button type="button" class="mo-loop" aria-pressed="${this.loop}">${words.loop}</button></span></span>`;
104
+ const frame = '<span class="mo-code"></span><span class="mo-frame"><span class="mo-name"></span><span class="mo-pat"></span></span>';
105
+ const caption = '<span class="mo-count"></span><span class="mo-say"></span>';
106
+ const controls = `<span class="mo-nav"><button type="button" class="mo-st" data-d="-1" title="${words.back}" aria-label="${words.back}">←</button><button type="button" class="mo-pp" title="${words.play}" aria-label="${words.play}">${PLAY_SIGN}</button><button type="button" class="mo-st" data-d="1" title="${words.forward}" aria-label="${words.forward}">→</button></span><span class="mo-tl"></span><span class="mo-read"><button type="button" class="mo-speed" title="${words.speed}">${formatSpeed(this.speed)}</button><button type="button" class="mo-time"></button></span>`;
107
+ const rule = '<i class="mo-rule"></i>';
108
+ const foot = '<i class="mo-rule mo-foot"></i>';
109
+ const shell = `<div class="mo-stage">${this.profile.shells[device] ?? this.profile.shells.phone}</div>`;
110
+ this.root = makeElement("figure", `motion-figure mo-${device}${scene.clip ? " mo-clip" : ""}${above ? " mo-title-above" : ""}${listHidden(context.show)
111
+ .map((hidden) => ` ${hidden}`)
112
+ .join("")}`, above
113
+ ? `<div class="mo-meta mo-top">${title}</div>${shell}<figcaption class="mo-meta">${frame}${caption}${foot}${controls}</figcaption>`
114
+ : `${shell}<figcaption class="mo-meta">${title}${rule}${frame}${caption}${foot}${controls}</figcaption>`);
115
+ this.root.id = scene.id;
116
+ into.appendChild(this.root);
117
+ this.screen = this.part(".mo-screen");
118
+ this.layer = makeElement("div", "mo-layer");
119
+ const stage = assertPresent(this.screen.parentElement, "the shell");
120
+ stage.style.position = "relative";
121
+ stage.appendChild(this.layer);
122
+ this.bar = this.part(".mo-tl");
123
+ this.playButton = this.part(".mo-pp");
124
+ this.strip = {
125
+ code: this.part(".mo-code"),
126
+ name: this.part(".mo-name"),
127
+ pattern: this.part(".mo-pat"),
128
+ count: this.part(".mo-count"),
129
+ say: this.part(".mo-say"),
130
+ };
131
+ this.timeButton = this.part(".mo-time");
132
+ this.timeline.steps.forEach((step, index) => {
133
+ const segment = makeElement("span", `mo-seg${step.chapter ? " mo-ch" : ""}`, "<i></i>");
134
+ segment.style.flexGrow = String(this.durations.at(index));
135
+ segment.title = "frame" in step ? step.frame : describeAction(step);
136
+ this.bar.appendChild(segment);
137
+ });
138
+ this.listen();
139
+ this.fit();
140
+ this.pose(0, 0);
141
+ }
142
+ /**
143
+ * Gives the screen one height for the whole scene, that of its tallest frame, so nothing jumps between frames.
144
+ * Call it again when fonts arrive or the page changes width.
145
+ */
146
+ fit() {
147
+ this.screen.style.height = "auto";
148
+ let tallest = 0;
149
+ for (const index of this.timeline.keyframes) {
150
+ const frame = this.frames[this.timeline.steps[index].frame];
151
+ if (frame === undefined)
152
+ continue;
153
+ this.screen.innerHTML = frame.html;
154
+ tallest = Math.max(tallest, this.screen.offsetHeight);
155
+ }
156
+ this.screen.style.height = `${tallest}px`;
157
+ }
158
+ /**
159
+ * Shows one step at a fraction of its duration.
160
+ *
161
+ * @param index - The step.
162
+ * @param progress - From 0, its start, to 1, its end.
163
+ */
164
+ pose(index, progress) {
165
+ assertPresent(this.timeline.steps.at(index), `step ${index + 1}`);
166
+ const key = this.timeline.steps[findKeyframe(this.timeline, index)];
167
+ // The frame first: where a step's symbols land is measured on it.
168
+ this.render(key.frame);
169
+ const moment = describeMoment(index, progress, this.describing());
170
+ const applied = applyMoment(this.screen, moment, this.profile, this.context.outline);
171
+ this.screen.style.opacity = String(moment.fade);
172
+ drawSprites(this.layer, moment.sprites, {
173
+ typing: applied.typing,
174
+ strokes: applied.strokes,
175
+ outlined: applied.outlined,
176
+ keys: this.context.keys,
177
+ line: applied.line,
178
+ });
179
+ Array.from(this.bar.children).forEach((segment, position) => {
180
+ const done = position < index ? 100 : position === index ? progress * 100 : 0;
181
+ segment.firstElementChild.style.width = `${done}%`;
182
+ });
183
+ this.strip.code.textContent = moment.strip.code;
184
+ this.strip.name.textContent = moment.strip.name;
185
+ this.strip.count.textContent = moment.strip.count;
186
+ this.strip.say.textContent = moment.strip.say;
187
+ this.strip.pattern.textContent =
188
+ this.awaiting === index
189
+ ? `${this.profile.words.turn} · ${moment.strip.pattern}`
190
+ : moment.strip.pattern;
191
+ this.strip.pattern.style.opacity = String(moment.strip.patternOpacity);
192
+ this.moment = moment.time;
193
+ this.writeTime();
194
+ if (index !== this.at) {
195
+ this.at = index;
196
+ this.context.onStep?.(index);
197
+ }
198
+ }
199
+ /**
200
+ * Shows the moment at a time from the start of the scene.
201
+ *
202
+ * @param time - In milliseconds. Past the end, the last moment is shown.
203
+ */
204
+ poseAt(time) {
205
+ const { index, progress } = locateTime(this.timeline, time);
206
+ this.pose(index, progress);
207
+ this.clock =
208
+ this.timeline.starts[index] +
209
+ progress * this.durations[index];
210
+ }
211
+ /** Starts the clock. At the end the scene starts again, unless it is set not to loop. */
212
+ play() {
213
+ if (this.playing)
214
+ return;
215
+ this.playing = true;
216
+ this.showPlaying();
217
+ this.run += 1;
218
+ const run = this.run;
219
+ let last = performance.now();
220
+ const tick = (now) => {
221
+ if (run !== this.run)
222
+ return;
223
+ const ticked = advanceClock({ ...this.timeline, loop: this.loop }, this.clock, now - last, this.speed);
224
+ last = now;
225
+ if (ticked.ended || ticked.looped) {
226
+ this.practised = -1;
227
+ this.context.onEnd?.();
228
+ }
229
+ if (ticked.ended) {
230
+ this.poseAt(ticked.clock);
231
+ this.pause();
232
+ return;
233
+ }
234
+ if (this.waitsAt(ticked.clock))
235
+ return;
236
+ this.poseAt(ticked.clock);
237
+ requestAnimationFrame(tick);
238
+ };
239
+ requestAnimationFrame(tick);
240
+ }
241
+ /**
242
+ * Makes the scene start again at its end, or stop there, from now on. The menu's entry says which.
243
+ *
244
+ * @param on - Whether the scene starts again at its end.
245
+ */
246
+ setLoop(on) {
247
+ this.loop = on;
248
+ this.part(".mo-loop").setAttribute("aria-pressed", String(on));
249
+ }
250
+ /** Stops the clock where it is. */
251
+ pause() {
252
+ this.playing = false;
253
+ this.run += 1;
254
+ this.showPlaying();
255
+ }
256
+ /**
257
+ * Goes to the next or the previous keyframe, shown settled, and pauses.
258
+ *
259
+ * @param direction - 1 for the next frame of the sequence, -1 for the previous one. Going back from the middle
260
+ * of an interaction returns first to the frame it started from. Both wrap at the ends.
261
+ */
262
+ goToKeyframe(direction) {
263
+ this.pause();
264
+ this.release();
265
+ const index = stepKeyframe(this.timeline, this.at, direction);
266
+ this.pose(index, 1);
267
+ this.clock =
268
+ this.timeline.starts[index] +
269
+ this.durations[index] * 0.999;
270
+ }
271
+ /**
272
+ * Finds what the scene points at that is not there.
273
+ *
274
+ * @returns One sentence per frame that does not exist, and per interaction whose target matches nothing in the
275
+ * frame it acts on.
276
+ */
277
+ audit() {
278
+ const found = [];
279
+ this.timeline.steps.forEach((step, index) => {
280
+ const where = `${this.scene.id}, step ${index + 1}`;
281
+ if ("frame" in step) {
282
+ if (this.frames[step.frame] === undefined) {
283
+ found.push(`${where}: no frame is named ${step.frame}.`);
284
+ }
285
+ return;
286
+ }
287
+ if (step.on === undefined)
288
+ return;
289
+ const key = this.timeline.steps[findKeyframe(this.timeline, index)];
290
+ this.render(key.frame);
291
+ if (this.screen.querySelector(step.on) === null) {
292
+ found.push(`${where}: ${step.on} matches nothing in ${key.frame}.`);
293
+ }
294
+ });
295
+ this.poseAt(this.clock);
296
+ return found;
297
+ }
298
+ /**
299
+ * Stops the scene and takes its figure off the page. The player is of no use afterwards.
300
+ */
301
+ destroy() {
302
+ this.pause();
303
+ this.root.remove();
304
+ }
305
+ /**
306
+ * Records the scene as an animated GIF, from its first moment to its last, and leaves the player paused where
307
+ * it was.
308
+ *
309
+ * @param onProgress - Called with how far the recording is, from 0 to 1.
310
+ * @returns The bytes of the GIF.
311
+ */
312
+ async exportGif(onProgress) {
313
+ const moment = this.clock;
314
+ this.pause();
315
+ try {
316
+ return await recordGif(this, { onProgress });
317
+ }
318
+ finally {
319
+ this.poseAt(moment);
320
+ }
321
+ }
322
+ part(selector) {
323
+ return assertPresent(this.root.querySelector(selector), selector);
324
+ }
325
+ /** What describing a moment needs to know about this page, as it stands now. */
326
+ describing() {
327
+ // Places are measured on the page and drawn in the layer, which something round the figure may scale.
328
+ const measure = (aim, fallback = [0.5, 0.5]) => {
329
+ const layer = readLayerBox(this.layer);
330
+ const target = (aim.on ? this.screen.querySelector(aim.on) : null) ??
331
+ this.screen;
332
+ const box = target.getBoundingClientRect();
333
+ const [fx, fy] = aim.at ?? fallback;
334
+ return {
335
+ x: (box.left - layer.left + box.width * fx) / layer.scale,
336
+ y: (box.top - layer.top + box.height * fy) / layer.scale,
337
+ width: layer.width,
338
+ height: layer.height,
339
+ };
340
+ };
341
+ return {
342
+ timeline: this.timeline,
343
+ measure,
344
+ rightToLeft: getComputedStyle(this.screen).direction === "rtl",
345
+ scroll: this.profile.scroll,
346
+ label: (name) => {
347
+ const frame = this.frames[name] ?? { id: name, state: "" };
348
+ const later = "later" in frame && frame.later;
349
+ return {
350
+ code: "code" in frame ? frame.code : "",
351
+ name: this.profile.describe(frame) +
352
+ (later ? ` · ${this.profile.laterText}` : ""),
353
+ };
354
+ },
355
+ };
356
+ }
357
+ // A step marked for practice waits for the reader: the scene stops where the symbol shows what to do, and goes
358
+ // on when the reader does it on the frame.
359
+ waitsAt(clock) {
360
+ const { index } = locateTime(this.timeline, clock);
361
+ const step = this.timeline.steps[index];
362
+ if (!this.context.practice ||
363
+ step === undefined ||
364
+ "frame" in step ||
365
+ !step.practice ||
366
+ index <= this.practised) {
367
+ return false;
368
+ }
369
+ this.awaiting = index;
370
+ this.root.classList.add("mo-awaiting");
371
+ this.pause();
372
+ this.pose(index, PRACTICE_AT);
373
+ this.clock =
374
+ this.timeline.starts[index] +
375
+ this.durations[index] * PRACTICE_AT;
376
+ return true;
377
+ }
378
+ /** Lets go of a step that was waiting for the reader. */
379
+ release() {
380
+ this.awaiting = undefined;
381
+ this.root.classList.remove("mo-awaiting");
382
+ }
383
+ /** Makes the play button say what a press of it does now. */
384
+ showPlaying() {
385
+ const word = this.playing
386
+ ? this.profile.words.pause
387
+ : this.profile.words.play;
388
+ this.playButton.innerHTML = this.playing ? PAUSE_SIGN : PLAY_SIGN;
389
+ this.playButton.title = word;
390
+ this.playButton.setAttribute("aria-label", word);
391
+ }
392
+ listen() {
393
+ // The menu: one more thing a reader can do with a scene, behind three dots so the bar stays plain.
394
+ const more = this.part(".mo-more");
395
+ const menu = this.part(".mo-menu");
396
+ const gif = this.part(".mo-gif");
397
+ const loop = this.part(".mo-loop");
398
+ const open = (shown) => {
399
+ menu.hidden = !shown;
400
+ more.setAttribute("aria-expanded", String(shown));
401
+ };
402
+ more.addEventListener("click", () => open(menu.hidden !== false));
403
+ // The menu stays open, so the reader sees the entry change.
404
+ loop.addEventListener("click", () => this.setLoop(!this.loop));
405
+ gif.addEventListener("click", () => {
406
+ open(false);
407
+ const words = this.profile.words;
408
+ more.textContent = "0%";
409
+ more.title = words.recording;
410
+ void this.exportGif((done) => {
411
+ more.textContent = `${Math.round(done * 100)}%`;
412
+ })
413
+ .then((bytes) => saveFile(bytes, `${this.scene.id}.gif`, "image/gif"))
414
+ // A recording can fail where a page may not draw to a canvas. The reader gets the dots back; whoever
415
+ // looks at the console gets the reason.
416
+ .catch((error) => {
417
+ console.error("motion: the scene could not be recorded.", error);
418
+ })
419
+ .finally(() => {
420
+ more.textContent = "⋮";
421
+ more.title = words.more;
422
+ });
423
+ });
424
+ this.playButton.addEventListener("click", () => {
425
+ if (this.playing)
426
+ this.pause();
427
+ else
428
+ this.play();
429
+ });
430
+ for (const button of this.root.querySelectorAll(".mo-st")) {
431
+ button.addEventListener("click", () => this.goToKeyframe(button.dataset.d === "1" ? 1 : -1));
432
+ }
433
+ // The time reads elapsed first; a press goes on to total, then remaining, then round again.
434
+ this.timeButton.addEventListener("click", () => {
435
+ const next = (TIME_MODES.indexOf(this.timeMode) + 1) % TIME_MODES.length;
436
+ this.timeMode = assertPresent(TIME_MODES.at(next), "a reading of time");
437
+ this.writeTime();
438
+ });
439
+ // The speed reads beside the time; a press goes on to the next one offered, then round again.
440
+ const speed = this.part(".mo-speed");
441
+ speed.addEventListener("click", () => {
442
+ const next = (this.speeds.indexOf(this.speed) + 1) % this.speeds.length;
443
+ this.speed = assertPresent(this.speeds.at(next), "a speed");
444
+ speed.textContent = formatSpeed(this.speed);
445
+ });
446
+ // A press on the frame is the reader doing a step that waits for them, when it lands on what the step aims
447
+ // at; a step that aims at nothing takes a press anywhere.
448
+ this.screen.addEventListener("click", (event) => {
449
+ const index = this.awaiting;
450
+ if (index === undefined)
451
+ return;
452
+ const step = this.timeline.steps[index];
453
+ const pressed = event.target;
454
+ if (step.on !== undefined && pressed.closest(step.on) === null)
455
+ return;
456
+ this.practised = index;
457
+ this.release();
458
+ this.play();
459
+ });
460
+ // The bar is a scrubber: press or drag anywhere on it.
461
+ const scrub = (event) => {
462
+ const box = this.bar.getBoundingClientRect();
463
+ const fraction = (event.clientX - box.left) / (box.width || 1);
464
+ this.poseAt(Math.max(0, Math.min(0.9999, fraction)) * this.total);
465
+ };
466
+ this.bar.addEventListener("pointerdown", (event) => {
467
+ this.pause();
468
+ this.release();
469
+ this.bar.setPointerCapture(event.pointerId);
470
+ scrub(event);
471
+ this.bar.onpointermove = scrub;
472
+ });
473
+ this.bar.addEventListener("pointerup", () => {
474
+ this.bar.onpointermove = null;
475
+ });
476
+ }
477
+ readLineOf(frameName) {
478
+ const frame = this.frames[frameName];
479
+ if (frame === undefined)
480
+ return "";
481
+ const line = makeElement("div", "", frame.html).querySelector(this.profile.line);
482
+ return line === null ? "" : this.profile.readLine(line);
483
+ }
484
+ render(frameName) {
485
+ const frame = this.frames[frameName];
486
+ this.screen.innerHTML =
487
+ frame === undefined
488
+ ? `<p style="padding: 16px">${this.profile.words.missing} ${frameName}.</p>`
489
+ : frame.html;
490
+ this.screen.classList.toggle(this.profile.laterClass, frame?.later === true);
491
+ this.profile.settle(this.screen);
492
+ }
493
+ writeTime() {
494
+ this.timeButton.textContent = formatTime(this.timeMode, this.moment, this.total);
495
+ this.timeButton.title = this.profile.words.time[this.timeMode];
496
+ }
497
+ }
498
+ //# sourceMappingURL=Player.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Player.js","sourceRoot":"","sources":["../../../../src/lib/player/Player.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,cAAc,GAGf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,GAEb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,UAAU,EACV,SAAS,EACT,WAAW,EACX,MAAM,EACN,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,SAAS,MAAM,gBAAgB,CAAC;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AAO,CAAC,UAAU,EACvB,KAAK,EAAE,KAAK,KAAK,IAAI,CACtB,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAEO,SAAS;QACf,IAAI,CAAC,UAAU,CAAC,WAAW,GAAG,UAAU,CACtC,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,KAAK,CACX,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjE,CAAC;CACF"}
@@ -0,0 +1,30 @@
1
+ import { HEIGHT_MESSAGE, MEASURE_MESSAGE } from "./constants.js";
2
+ /**
3
+ * Tells the page that embeds this one how tall its content is: now, whenever that changes, and whenever the
4
+ * embedding page asks. The embedding page can then give its iframe the right height. The other side is
5
+ * `fitEmbeds`, which asks when it starts, so it does not matter which of the two pages is ready first.
6
+ *
7
+ * @param element - The element whose height is the content's; the document's root, usually.
8
+ * @param target - The window to tell; the parent, usually.
9
+ * @returns A function that stops telling.
10
+ * @note Impure: it observes the element, listens to the window, and posts messages to another window.
11
+ */
12
+ export default function announceHeight(element, target = window.parent) {
13
+ const tell = () => {
14
+ target.postMessage({ type: HEIGHT_MESSAGE, height: element.scrollHeight }, "*");
15
+ };
16
+ const answer = (event) => {
17
+ const data = event.data;
18
+ if (data?.type === MEASURE_MESSAGE)
19
+ tell();
20
+ };
21
+ const observer = new ResizeObserver(tell);
22
+ observer.observe(element);
23
+ addEventListener("message", answer);
24
+ tell();
25
+ return () => {
26
+ observer.disconnect();
27
+ removeEventListener("message", answer);
28
+ };
29
+ }
30
+ //# sourceMappingURL=announceHeight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"announceHeight.js","sourceRoot":"","sources":["../../../../src/lib/player/announceHeight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjE;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAoB,EACpB,MAAM,GAAW,MAAM,CAAC,MAAM;IAE9B,MAAM,IAAI,GAAG,GAAS,EAAE;QACtB,MAAM,CAAC,WAAW,CAChB,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE,EACtD,GAAG,CACJ,CAAC;IACJ,CAAC,CAAC;IACF,MAAM,MAAM,GAAG,CAAC,KAAmB,EAAQ,EAAE;QAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAiC,CAAC;QACrD,IAAI,IAAI,EAAE,IAAI,KAAK,eAAe;YAAE,IAAI,EAAE,CAAC;IAC7C,CAAC,CAAC;IACF,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;IAC1C,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1B,gBAAgB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACpC,IAAI,EAAE,CAAC;IACP,OAAO,GAAG,EAAE;QACV,QAAQ,CAAC,UAAU,EAAE,CAAC;QACtB,mBAAmB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC,CAAC;AACJ,CAAC"}