@docmentis/udoc-viewer 0.7.20 → 0.8.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 (386) hide show
  1. package/API-COMPARISON.md +441 -0
  2. package/LICENSE-APACHE +202 -0
  3. package/LICENSE-MIT +21 -0
  4. package/README.md +23 -1220
  5. package/dist/index.d.ts +40 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +52 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/version.d.ts +2 -0
  10. package/dist/version.d.ts.map +1 -0
  11. package/dist/version.js +7 -0
  12. package/dist/version.js.map +1 -0
  13. package/dist/worker/worker-source.d.ts +3 -0
  14. package/dist/worker/worker-source.d.ts.map +1 -0
  15. package/dist/worker/worker-source.js +11 -0
  16. package/dist/worker/worker.d.ts +2 -0
  17. package/dist/worker/worker.d.ts.map +1 -0
  18. package/dist/worker/worker.js +5 -0
  19. package/dist/worker/worker.js.map +1 -0
  20. package/package.json +48 -59
  21. package/dist/package.json +0 -79
  22. package/dist/src/UDocClient.d.ts +0 -730
  23. package/dist/src/UDocClient.d.ts.map +0 -1
  24. package/dist/src/UDocClient.js +0 -649
  25. package/dist/src/UDocClient.js.map +0 -1
  26. package/dist/src/UDocViewer.d.ts +0 -883
  27. package/dist/src/UDocViewer.d.ts.map +0 -1
  28. package/dist/src/UDocViewer.js +0 -2180
  29. package/dist/src/UDocViewer.js.map +0 -1
  30. package/dist/src/fonts.d.ts +0 -47
  31. package/dist/src/fonts.d.ts.map +0 -1
  32. package/dist/src/fonts.js +0 -49
  33. package/dist/src/fonts.js.map +0 -1
  34. package/dist/src/index.d.ts +0 -13
  35. package/dist/src/index.d.ts.map +0 -1
  36. package/dist/src/index.js +0 -5
  37. package/dist/src/index.js.map +0 -1
  38. package/dist/src/meta-url.d.ts +0 -2
  39. package/dist/src/meta-url.d.ts.map +0 -1
  40. package/dist/src/meta-url.js +0 -10
  41. package/dist/src/meta-url.js.map +0 -1
  42. package/dist/src/performance/PerformanceCounter.d.ts +0 -132
  43. package/dist/src/performance/PerformanceCounter.d.ts.map +0 -1
  44. package/dist/src/performance/PerformanceCounter.js +0 -129
  45. package/dist/src/performance/PerformanceCounter.js.map +0 -1
  46. package/dist/src/performance/index.d.ts +0 -2
  47. package/dist/src/performance/index.d.ts.map +0 -1
  48. package/dist/src/performance/index.js +0 -2
  49. package/dist/src/performance/index.js.map +0 -1
  50. package/dist/src/ui/framework/component.d.ts +0 -68
  51. package/dist/src/ui/framework/component.d.ts.map +0 -1
  52. package/dist/src/ui/framework/component.js +0 -97
  53. package/dist/src/ui/framework/component.js.map +0 -1
  54. package/dist/src/ui/framework/dom.d.ts +0 -19
  55. package/dist/src/ui/framework/dom.d.ts.map +0 -1
  56. package/dist/src/ui/framework/dom.js +0 -29
  57. package/dist/src/ui/framework/dom.js.map +0 -1
  58. package/dist/src/ui/framework/events.d.ts +0 -18
  59. package/dist/src/ui/framework/events.d.ts.map +0 -1
  60. package/dist/src/ui/framework/events.js +0 -23
  61. package/dist/src/ui/framework/events.js.map +0 -1
  62. package/dist/src/ui/framework/index.d.ts +0 -15
  63. package/dist/src/ui/framework/index.d.ts.map +0 -1
  64. package/dist/src/ui/framework/index.js +0 -15
  65. package/dist/src/ui/framework/index.js.map +0 -1
  66. package/dist/src/ui/framework/selectors.d.ts +0 -51
  67. package/dist/src/ui/framework/selectors.d.ts.map +0 -1
  68. package/dist/src/ui/framework/selectors.js +0 -28
  69. package/dist/src/ui/framework/selectors.js.map +0 -1
  70. package/dist/src/ui/framework/store.d.ts +0 -44
  71. package/dist/src/ui/framework/store.d.ts.map +0 -1
  72. package/dist/src/ui/framework/store.js +0 -79
  73. package/dist/src/ui/framework/store.js.map +0 -1
  74. package/dist/src/ui/viewer/a11y.d.ts +0 -26
  75. package/dist/src/ui/viewer/a11y.d.ts.map +0 -1
  76. package/dist/src/ui/viewer/a11y.js +0 -116
  77. package/dist/src/ui/viewer/a11y.js.map +0 -1
  78. package/dist/src/ui/viewer/actions.d.ts +0 -308
  79. package/dist/src/ui/viewer/actions.d.ts.map +0 -1
  80. package/dist/src/ui/viewer/actions.js +0 -2
  81. package/dist/src/ui/viewer/actions.js.map +0 -1
  82. package/dist/src/ui/viewer/animation-presets.d.ts +0 -37
  83. package/dist/src/ui/viewer/animation-presets.d.ts.map +0 -1
  84. package/dist/src/ui/viewer/animation-presets.js +0 -123
  85. package/dist/src/ui/viewer/animation-presets.js.map +0 -1
  86. package/dist/src/ui/viewer/animation.d.ts +0 -162
  87. package/dist/src/ui/viewer/animation.d.ts.map +0 -1
  88. package/dist/src/ui/viewer/animation.js +0 -506
  89. package/dist/src/ui/viewer/animation.js.map +0 -1
  90. package/dist/src/ui/viewer/annotation/LinkRenderer.d.ts +0 -9
  91. package/dist/src/ui/viewer/annotation/LinkRenderer.d.ts.map +0 -1
  92. package/dist/src/ui/viewer/annotation/LinkRenderer.js +0 -17
  93. package/dist/src/ui/viewer/annotation/LinkRenderer.js.map +0 -1
  94. package/dist/src/ui/viewer/annotation/MarkupRenderer.d.ts +0 -21
  95. package/dist/src/ui/viewer/annotation/MarkupRenderer.d.ts.map +0 -1
  96. package/dist/src/ui/viewer/annotation/MarkupRenderer.js +0 -136
  97. package/dist/src/ui/viewer/annotation/MarkupRenderer.js.map +0 -1
  98. package/dist/src/ui/viewer/annotation/ShapeRenderer.d.ts +0 -33
  99. package/dist/src/ui/viewer/annotation/ShapeRenderer.d.ts.map +0 -1
  100. package/dist/src/ui/viewer/annotation/ShapeRenderer.js +0 -379
  101. package/dist/src/ui/viewer/annotation/ShapeRenderer.js.map +0 -1
  102. package/dist/src/ui/viewer/annotation/TextRenderer.d.ts +0 -23
  103. package/dist/src/ui/viewer/annotation/TextRenderer.d.ts.map +0 -1
  104. package/dist/src/ui/viewer/annotation/TextRenderer.js +0 -196
  105. package/dist/src/ui/viewer/annotation/TextRenderer.js.map +0 -1
  106. package/dist/src/ui/viewer/annotation/index.d.ts +0 -9
  107. package/dist/src/ui/viewer/annotation/index.d.ts.map +0 -1
  108. package/dist/src/ui/viewer/annotation/index.js +0 -10
  109. package/dist/src/ui/viewer/annotation/index.js.map +0 -1
  110. package/dist/src/ui/viewer/annotation/propertyUtils.d.ts +0 -29
  111. package/dist/src/ui/viewer/annotation/propertyUtils.d.ts.map +0 -1
  112. package/dist/src/ui/viewer/annotation/propertyUtils.js +0 -151
  113. package/dist/src/ui/viewer/annotation/propertyUtils.js.map +0 -1
  114. package/dist/src/ui/viewer/annotation/render.d.ts +0 -24
  115. package/dist/src/ui/viewer/annotation/render.d.ts.map +0 -1
  116. package/dist/src/ui/viewer/annotation/render.js +0 -191
  117. package/dist/src/ui/viewer/annotation/render.js.map +0 -1
  118. package/dist/src/ui/viewer/annotation/types.d.ts +0 -309
  119. package/dist/src/ui/viewer/annotation/types.d.ts.map +0 -1
  120. package/dist/src/ui/viewer/annotation/types.js +0 -7
  121. package/dist/src/ui/viewer/annotation/types.js.map +0 -1
  122. package/dist/src/ui/viewer/annotation/utils.d.ts +0 -75
  123. package/dist/src/ui/viewer/annotation/utils.d.ts.map +0 -1
  124. package/dist/src/ui/viewer/annotation/utils.js +0 -250
  125. package/dist/src/ui/viewer/annotation/utils.js.map +0 -1
  126. package/dist/src/ui/viewer/components/AnnotationPanel.d.ts +0 -20
  127. package/dist/src/ui/viewer/components/AnnotationPanel.d.ts.map +0 -1
  128. package/dist/src/ui/viewer/components/AnnotationPanel.js +0 -276
  129. package/dist/src/ui/viewer/components/AnnotationPanel.js.map +0 -1
  130. package/dist/src/ui/viewer/components/AttachmentsPanel.d.ts +0 -8
  131. package/dist/src/ui/viewer/components/AttachmentsPanel.d.ts.map +0 -1
  132. package/dist/src/ui/viewer/components/AttachmentsPanel.js +0 -16
  133. package/dist/src/ui/viewer/components/AttachmentsPanel.js.map +0 -1
  134. package/dist/src/ui/viewer/components/BookmarksPanel.d.ts +0 -8
  135. package/dist/src/ui/viewer/components/BookmarksPanel.d.ts.map +0 -1
  136. package/dist/src/ui/viewer/components/BookmarksPanel.js +0 -16
  137. package/dist/src/ui/viewer/components/BookmarksPanel.js.map +0 -1
  138. package/dist/src/ui/viewer/components/Branding.d.ts +0 -49
  139. package/dist/src/ui/viewer/components/Branding.d.ts.map +0 -1
  140. package/dist/src/ui/viewer/components/Branding.js +0 -334
  141. package/dist/src/ui/viewer/components/Branding.js.map +0 -1
  142. package/dist/src/ui/viewer/components/ColorSelect.d.ts +0 -26
  143. package/dist/src/ui/viewer/components/ColorSelect.d.ts.map +0 -1
  144. package/dist/src/ui/viewer/components/ColorSelect.js +0 -120
  145. package/dist/src/ui/viewer/components/ColorSelect.js.map +0 -1
  146. package/dist/src/ui/viewer/components/FloatingToolbar.d.ts +0 -10
  147. package/dist/src/ui/viewer/components/FloatingToolbar.d.ts.map +0 -1
  148. package/dist/src/ui/viewer/components/FloatingToolbar.js +0 -396
  149. package/dist/src/ui/viewer/components/FloatingToolbar.js.map +0 -1
  150. package/dist/src/ui/viewer/components/FontsPanel.d.ts +0 -12
  151. package/dist/src/ui/viewer/components/FontsPanel.d.ts.map +0 -1
  152. package/dist/src/ui/viewer/components/FontsPanel.js +0 -141
  153. package/dist/src/ui/viewer/components/FontsPanel.js.map +0 -1
  154. package/dist/src/ui/viewer/components/LayersPanel.d.ts +0 -12
  155. package/dist/src/ui/viewer/components/LayersPanel.d.ts.map +0 -1
  156. package/dist/src/ui/viewer/components/LayersPanel.js +0 -139
  157. package/dist/src/ui/viewer/components/LayersPanel.js.map +0 -1
  158. package/dist/src/ui/viewer/components/LeftPanel.d.ts +0 -11
  159. package/dist/src/ui/viewer/components/LeftPanel.d.ts.map +0 -1
  160. package/dist/src/ui/viewer/components/LeftPanel.js +0 -296
  161. package/dist/src/ui/viewer/components/LeftPanel.js.map +0 -1
  162. package/dist/src/ui/viewer/components/LoadingOverlay.d.ts +0 -13
  163. package/dist/src/ui/viewer/components/LoadingOverlay.d.ts.map +0 -1
  164. package/dist/src/ui/viewer/components/LoadingOverlay.js +0 -146
  165. package/dist/src/ui/viewer/components/LoadingOverlay.js.map +0 -1
  166. package/dist/src/ui/viewer/components/NumberInput.d.ts +0 -32
  167. package/dist/src/ui/viewer/components/NumberInput.d.ts.map +0 -1
  168. package/dist/src/ui/viewer/components/NumberInput.js +0 -101
  169. package/dist/src/ui/viewer/components/NumberInput.js.map +0 -1
  170. package/dist/src/ui/viewer/components/OutlinePanel.d.ts +0 -11
  171. package/dist/src/ui/viewer/components/OutlinePanel.d.ts.map +0 -1
  172. package/dist/src/ui/viewer/components/OutlinePanel.js +0 -307
  173. package/dist/src/ui/viewer/components/OutlinePanel.js.map +0 -1
  174. package/dist/src/ui/viewer/components/PasswordDialog.d.ts +0 -16
  175. package/dist/src/ui/viewer/components/PasswordDialog.d.ts.map +0 -1
  176. package/dist/src/ui/viewer/components/PasswordDialog.js +0 -179
  177. package/dist/src/ui/viewer/components/PasswordDialog.js.map +0 -1
  178. package/dist/src/ui/viewer/components/PermitNoticeOverlay.d.ts +0 -27
  179. package/dist/src/ui/viewer/components/PermitNoticeOverlay.d.ts.map +0 -1
  180. package/dist/src/ui/viewer/components/PermitNoticeOverlay.js +0 -79
  181. package/dist/src/ui/viewer/components/PermitNoticeOverlay.js.map +0 -1
  182. package/dist/src/ui/viewer/components/PrintDialog.d.ts +0 -34
  183. package/dist/src/ui/viewer/components/PrintDialog.d.ts.map +0 -1
  184. package/dist/src/ui/viewer/components/PrintDialog.js +0 -317
  185. package/dist/src/ui/viewer/components/PrintDialog.js.map +0 -1
  186. package/dist/src/ui/viewer/components/RightPanel.d.ts +0 -10
  187. package/dist/src/ui/viewer/components/RightPanel.d.ts.map +0 -1
  188. package/dist/src/ui/viewer/components/RightPanel.js +0 -154
  189. package/dist/src/ui/viewer/components/RightPanel.js.map +0 -1
  190. package/dist/src/ui/viewer/components/SearchPanel.d.ts +0 -21
  191. package/dist/src/ui/viewer/components/SearchPanel.d.ts.map +0 -1
  192. package/dist/src/ui/viewer/components/SearchPanel.js +0 -323
  193. package/dist/src/ui/viewer/components/SearchPanel.js.map +0 -1
  194. package/dist/src/ui/viewer/components/SheetTabBar.d.ts +0 -9
  195. package/dist/src/ui/viewer/components/SheetTabBar.d.ts.map +0 -1
  196. package/dist/src/ui/viewer/components/SheetTabBar.js +0 -57
  197. package/dist/src/ui/viewer/components/SheetTabBar.js.map +0 -1
  198. package/dist/src/ui/viewer/components/Spread.d.ts +0 -85
  199. package/dist/src/ui/viewer/components/Spread.d.ts.map +0 -1
  200. package/dist/src/ui/viewer/components/Spread.js +0 -749
  201. package/dist/src/ui/viewer/components/Spread.js.map +0 -1
  202. package/dist/src/ui/viewer/components/SubToolbar.d.ts +0 -11
  203. package/dist/src/ui/viewer/components/SubToolbar.d.ts.map +0 -1
  204. package/dist/src/ui/viewer/components/SubToolbar.js +0 -722
  205. package/dist/src/ui/viewer/components/SubToolbar.js.map +0 -1
  206. package/dist/src/ui/viewer/components/ThumbnailPanel.d.ts +0 -12
  207. package/dist/src/ui/viewer/components/ThumbnailPanel.d.ts.map +0 -1
  208. package/dist/src/ui/viewer/components/ThumbnailPanel.js +0 -290
  209. package/dist/src/ui/viewer/components/ThumbnailPanel.js.map +0 -1
  210. package/dist/src/ui/viewer/components/Toolbar.d.ts +0 -12
  211. package/dist/src/ui/viewer/components/Toolbar.d.ts.map +0 -1
  212. package/dist/src/ui/viewer/components/Toolbar.js +0 -761
  213. package/dist/src/ui/viewer/components/Toolbar.js.map +0 -1
  214. package/dist/src/ui/viewer/components/ViewModeMenu.d.ts +0 -10
  215. package/dist/src/ui/viewer/components/ViewModeMenu.d.ts.map +0 -1
  216. package/dist/src/ui/viewer/components/ViewModeMenu.js +0 -206
  217. package/dist/src/ui/viewer/components/ViewModeMenu.js.map +0 -1
  218. package/dist/src/ui/viewer/components/Viewport.d.ts +0 -28
  219. package/dist/src/ui/viewer/components/Viewport.d.ts.map +0 -1
  220. package/dist/src/ui/viewer/components/Viewport.js +0 -1721
  221. package/dist/src/ui/viewer/components/Viewport.js.map +0 -1
  222. package/dist/src/ui/viewer/effects.d.ts +0 -8
  223. package/dist/src/ui/viewer/effects.d.ts.map +0 -1
  224. package/dist/src/ui/viewer/effects.js +0 -452
  225. package/dist/src/ui/viewer/effects.js.map +0 -1
  226. package/dist/src/ui/viewer/i18n/ar.d.ts +0 -3
  227. package/dist/src/ui/viewer/i18n/ar.d.ts.map +0 -1
  228. package/dist/src/ui/viewer/i18n/ar.js +0 -198
  229. package/dist/src/ui/viewer/i18n/ar.js.map +0 -1
  230. package/dist/src/ui/viewer/i18n/de.d.ts +0 -3
  231. package/dist/src/ui/viewer/i18n/de.d.ts.map +0 -1
  232. package/dist/src/ui/viewer/i18n/de.js +0 -198
  233. package/dist/src/ui/viewer/i18n/de.js.map +0 -1
  234. package/dist/src/ui/viewer/i18n/en.d.ts +0 -3
  235. package/dist/src/ui/viewer/i18n/en.d.ts.map +0 -1
  236. package/dist/src/ui/viewer/i18n/en.js +0 -200
  237. package/dist/src/ui/viewer/i18n/en.js.map +0 -1
  238. package/dist/src/ui/viewer/i18n/es.d.ts +0 -3
  239. package/dist/src/ui/viewer/i18n/es.d.ts.map +0 -1
  240. package/dist/src/ui/viewer/i18n/es.js +0 -198
  241. package/dist/src/ui/viewer/i18n/es.js.map +0 -1
  242. package/dist/src/ui/viewer/i18n/fr.d.ts +0 -3
  243. package/dist/src/ui/viewer/i18n/fr.d.ts.map +0 -1
  244. package/dist/src/ui/viewer/i18n/fr.js +0 -198
  245. package/dist/src/ui/viewer/i18n/fr.js.map +0 -1
  246. package/dist/src/ui/viewer/i18n/index.d.ts +0 -27
  247. package/dist/src/ui/viewer/i18n/index.d.ts.map +0 -1
  248. package/dist/src/ui/viewer/i18n/index.js +0 -88
  249. package/dist/src/ui/viewer/i18n/index.js.map +0 -1
  250. package/dist/src/ui/viewer/i18n/ja.d.ts +0 -3
  251. package/dist/src/ui/viewer/i18n/ja.d.ts.map +0 -1
  252. package/dist/src/ui/viewer/i18n/ja.js +0 -198
  253. package/dist/src/ui/viewer/i18n/ja.js.map +0 -1
  254. package/dist/src/ui/viewer/i18n/ko.d.ts +0 -3
  255. package/dist/src/ui/viewer/i18n/ko.d.ts.map +0 -1
  256. package/dist/src/ui/viewer/i18n/ko.js +0 -198
  257. package/dist/src/ui/viewer/i18n/ko.js.map +0 -1
  258. package/dist/src/ui/viewer/i18n/pt-BR.d.ts +0 -3
  259. package/dist/src/ui/viewer/i18n/pt-BR.d.ts.map +0 -1
  260. package/dist/src/ui/viewer/i18n/pt-BR.js +0 -198
  261. package/dist/src/ui/viewer/i18n/pt-BR.js.map +0 -1
  262. package/dist/src/ui/viewer/i18n/ru.d.ts +0 -3
  263. package/dist/src/ui/viewer/i18n/ru.d.ts.map +0 -1
  264. package/dist/src/ui/viewer/i18n/ru.js +0 -198
  265. package/dist/src/ui/viewer/i18n/ru.js.map +0 -1
  266. package/dist/src/ui/viewer/i18n/types.d.ts +0 -176
  267. package/dist/src/ui/viewer/i18n/types.d.ts.map +0 -1
  268. package/dist/src/ui/viewer/i18n/types.js +0 -2
  269. package/dist/src/ui/viewer/i18n/types.js.map +0 -1
  270. package/dist/src/ui/viewer/i18n/zh-CN.d.ts +0 -3
  271. package/dist/src/ui/viewer/i18n/zh-CN.d.ts.map +0 -1
  272. package/dist/src/ui/viewer/i18n/zh-CN.js +0 -198
  273. package/dist/src/ui/viewer/i18n/zh-CN.js.map +0 -1
  274. package/dist/src/ui/viewer/i18n/zh-TW.d.ts +0 -3
  275. package/dist/src/ui/viewer/i18n/zh-TW.d.ts.map +0 -1
  276. package/dist/src/ui/viewer/i18n/zh-TW.js +0 -198
  277. package/dist/src/ui/viewer/i18n/zh-TW.js.map +0 -1
  278. package/dist/src/ui/viewer/icons.d.ts +0 -77
  279. package/dist/src/ui/viewer/icons.d.ts.map +0 -1
  280. package/dist/src/ui/viewer/icons.js +0 -109
  281. package/dist/src/ui/viewer/icons.js.map +0 -1
  282. package/dist/src/ui/viewer/index.d.ts +0 -6
  283. package/dist/src/ui/viewer/index.d.ts.map +0 -1
  284. package/dist/src/ui/viewer/index.js +0 -6
  285. package/dist/src/ui/viewer/index.js.map +0 -1
  286. package/dist/src/ui/viewer/layout/index.d.ts +0 -3
  287. package/dist/src/ui/viewer/layout/index.d.ts.map +0 -1
  288. package/dist/src/ui/viewer/layout/index.js +0 -3
  289. package/dist/src/ui/viewer/layout/index.js.map +0 -1
  290. package/dist/src/ui/viewer/layout/pixelAlign.d.ts +0 -8
  291. package/dist/src/ui/viewer/layout/pixelAlign.d.ts.map +0 -1
  292. package/dist/src/ui/viewer/layout/pixelAlign.js +0 -42
  293. package/dist/src/ui/viewer/layout/pixelAlign.js.map +0 -1
  294. package/dist/src/ui/viewer/layout/spreadLayout.d.ts +0 -155
  295. package/dist/src/ui/viewer/layout/spreadLayout.d.ts.map +0 -1
  296. package/dist/src/ui/viewer/layout/spreadLayout.js +0 -574
  297. package/dist/src/ui/viewer/layout/spreadLayout.js.map +0 -1
  298. package/dist/src/ui/viewer/navigation.d.ts +0 -91
  299. package/dist/src/ui/viewer/navigation.d.ts.map +0 -1
  300. package/dist/src/ui/viewer/navigation.js +0 -59
  301. package/dist/src/ui/viewer/navigation.js.map +0 -1
  302. package/dist/src/ui/viewer/reducer.d.ts +0 -4
  303. package/dist/src/ui/viewer/reducer.d.ts.map +0 -1
  304. package/dist/src/ui/viewer/reducer.js +0 -841
  305. package/dist/src/ui/viewer/reducer.js.map +0 -1
  306. package/dist/src/ui/viewer/search/index.d.ts +0 -2
  307. package/dist/src/ui/viewer/search/index.d.ts.map +0 -1
  308. package/dist/src/ui/viewer/search/index.js +0 -2
  309. package/dist/src/ui/viewer/search/index.js.map +0 -1
  310. package/dist/src/ui/viewer/search/search.d.ts +0 -31
  311. package/dist/src/ui/viewer/search/search.d.ts.map +0 -1
  312. package/dist/src/ui/viewer/search/search.js +0 -446
  313. package/dist/src/ui/viewer/search/search.js.map +0 -1
  314. package/dist/src/ui/viewer/shell.d.ts +0 -65
  315. package/dist/src/ui/viewer/shell.d.ts.map +0 -1
  316. package/dist/src/ui/viewer/shell.js +0 -366
  317. package/dist/src/ui/viewer/shell.js.map +0 -1
  318. package/dist/src/ui/viewer/state.d.ts +0 -313
  319. package/dist/src/ui/viewer/state.d.ts.map +0 -1
  320. package/dist/src/ui/viewer/state.js +0 -157
  321. package/dist/src/ui/viewer/state.js.map +0 -1
  322. package/dist/src/ui/viewer/styles-inline.d.ts +0 -2
  323. package/dist/src/ui/viewer/styles-inline.d.ts.map +0 -1
  324. package/dist/src/ui/viewer/styles-inline.js +0 -3526
  325. package/dist/src/ui/viewer/styles-inline.js.map +0 -1
  326. package/dist/src/ui/viewer/text/index.d.ts +0 -6
  327. package/dist/src/ui/viewer/text/index.d.ts.map +0 -1
  328. package/dist/src/ui/viewer/text/index.js +0 -6
  329. package/dist/src/ui/viewer/text/index.js.map +0 -1
  330. package/dist/src/ui/viewer/text/render.d.ts +0 -18
  331. package/dist/src/ui/viewer/text/render.d.ts.map +0 -1
  332. package/dist/src/ui/viewer/text/render.js +0 -480
  333. package/dist/src/ui/viewer/text/render.js.map +0 -1
  334. package/dist/src/ui/viewer/text/selection.d.ts +0 -12
  335. package/dist/src/ui/viewer/text/selection.d.ts.map +0 -1
  336. package/dist/src/ui/viewer/text/selection.js +0 -69
  337. package/dist/src/ui/viewer/text/selection.js.map +0 -1
  338. package/dist/src/ui/viewer/tools/AnnotationDrawController.d.ts +0 -21
  339. package/dist/src/ui/viewer/tools/AnnotationDrawController.d.ts.map +0 -1
  340. package/dist/src/ui/viewer/tools/AnnotationDrawController.js +0 -410
  341. package/dist/src/ui/viewer/tools/AnnotationDrawController.js.map +0 -1
  342. package/dist/src/ui/viewer/tools/AnnotationSelectController.d.ts +0 -22
  343. package/dist/src/ui/viewer/tools/AnnotationSelectController.d.ts.map +0 -1
  344. package/dist/src/ui/viewer/tools/AnnotationSelectController.js +0 -378
  345. package/dist/src/ui/viewer/tools/AnnotationSelectController.js.map +0 -1
  346. package/dist/src/ui/viewer/tools/AnnotationUndoManager.d.ts +0 -29
  347. package/dist/src/ui/viewer/tools/AnnotationUndoManager.d.ts.map +0 -1
  348. package/dist/src/ui/viewer/tools/AnnotationUndoManager.js +0 -144
  349. package/dist/src/ui/viewer/tools/AnnotationUndoManager.js.map +0 -1
  350. package/dist/src/ui/viewer/tools/ViewToolController.d.ts +0 -20
  351. package/dist/src/ui/viewer/tools/ViewToolController.d.ts.map +0 -1
  352. package/dist/src/ui/viewer/tools/ViewToolController.js +0 -179
  353. package/dist/src/ui/viewer/tools/ViewToolController.js.map +0 -1
  354. package/dist/src/ui/viewer/transition-gl.d.ts +0 -25
  355. package/dist/src/ui/viewer/transition-gl.d.ts.map +0 -1
  356. package/dist/src/ui/viewer/transition-gl.js +0 -823
  357. package/dist/src/ui/viewer/transition-gl.js.map +0 -1
  358. package/dist/src/ui/viewer/transition.d.ts +0 -26
  359. package/dist/src/ui/viewer/transition.d.ts.map +0 -1
  360. package/dist/src/ui/viewer/transition.js +0 -1383
  361. package/dist/src/ui/viewer/transition.js.map +0 -1
  362. package/dist/src/wasm/LICENSE +0 -112
  363. package/dist/src/wasm/udoc.d.ts +0 -1338
  364. package/dist/src/wasm/udoc.js +0 -2645
  365. package/dist/src/wasm/udoc_bg.wasm +0 -0
  366. package/dist/src/wasm/udoc_bg.wasm.d.ts +0 -58
  367. package/dist/src/worker/WorkerClient.d.ts +0 -489
  368. package/dist/src/worker/WorkerClient.d.ts.map +0 -1
  369. package/dist/src/worker/WorkerClient.js +0 -1383
  370. package/dist/src/worker/WorkerClient.js.map +0 -1
  371. package/dist/src/worker/index.d.ts +0 -4
  372. package/dist/src/worker/index.d.ts.map +0 -1
  373. package/dist/src/worker/index.js +0 -2
  374. package/dist/src/worker/index.js.map +0 -1
  375. package/dist/src/worker/wasmError.d.ts +0 -17
  376. package/dist/src/worker/wasmError.d.ts.map +0 -1
  377. package/dist/src/worker/wasmError.js +0 -28
  378. package/dist/src/worker/wasmError.js.map +0 -1
  379. package/dist/src/worker/worker-inline.d.ts +0 -2
  380. package/dist/src/worker/worker-inline.d.ts.map +0 -1
  381. package/dist/src/worker/worker-inline.js +0 -2
  382. package/dist/src/worker/worker-inline.js.map +0 -1
  383. package/dist/src/worker/worker.d.ts +0 -530
  384. package/dist/src/worker/worker.d.ts.map +0 -1
  385. package/dist/src/worker/worker.js +0 -2935
  386. package/dist/src/worker/worker.js.map +0 -1
@@ -1,162 +0,0 @@
1
- /**
2
- * Slide build sequences for PPTX animations.
3
- *
4
- * The WASM side rasterizes a slide into z-ordered layers — one per animated
5
- * shape, plus one per run of static content between them — and hands over a
6
- * timeline of click steps. This module stacks those layers as DOM elements and
7
- * plays the steps with the Web Animations API, so compositing stays on the GPU
8
- * and no re-render is needed per frame.
9
- *
10
- * Paragraph builds clip a text shape's single layer to the band occupied by
11
- * the revealed paragraphs, derived from the page's text layout. Paragraphs
12
- * never overlap, so clipping is exact.
13
- */
14
- import type { AnimationLayer, LayoutPage, SlideAnimation, WorkerClient } from "../../worker/index.js";
15
- export interface SlideAnimationOptions {
16
- /** The build sequence to play. */
17
- animation: SlideAnimation;
18
- /** Rendered layers, back-to-front, as returned by `renderPageLayers`. */
19
- layers: AnimationLayer[];
20
- /** Device-pixel size the layers were rendered at. */
21
- renderWidth: number;
22
- renderHeight: number;
23
- /** Element the layer stack is mounted into; sized to the displayed page. */
24
- host: HTMLElement;
25
- /** Page text layout, used to locate paragraph bands. Optional. */
26
- layout?: LayoutPage;
27
- }
28
- /**
29
- * Plays one slide's build sequence over a stack of layer canvases.
30
- *
31
- * Step counting: `step` is the number of steps already played. At 0 nothing
32
- * has run, so entrance targets are hidden; at `stepCount` the build is
33
- * complete and the slide looks like a normal full-page render.
34
- */
35
- export declare class SlideAnimationController {
36
- private readonly animation;
37
- private readonly host;
38
- private readonly layers;
39
- private readonly running;
40
- /** Step at which each shape first enters, if it has an entrance effect. */
41
- private readonly entranceStep;
42
- /** Step at which each shape first leaves, if it has an exit effect. */
43
- private readonly exitStep;
44
- /** Paragraph bands per shape, for shapes built paragraph by paragraph. */
45
- private readonly paragraphBands;
46
- /** Step at which each paragraph of a shape is revealed. */
47
- private readonly paragraphStep;
48
- private currentStep;
49
- constructor(options: SlideAnimationOptions);
50
- /** Number of clicks this slide's build takes. */
51
- get stepCount(): number;
52
- /** Steps already played. */
53
- get step(): number;
54
- /** Whether every step has played. */
55
- get isComplete(): boolean;
56
- /**
57
- * Play the next step.
58
- *
59
- * Returns false when the build is already finished, which is the caller's
60
- * cue to advance the slide instead.
61
- */
62
- next(): boolean;
63
- /** Jump to a step's resting state without animating. */
64
- seek(step: number): void;
65
- /** Show the fully built slide, as when navigating backwards into it. */
66
- complete(): void;
67
- /**
68
- * Whether this build is still mounted in `host` and on screen.
69
- *
70
- * A viewer that was destroyed and recreated leaves the old controller
71
- * pointing at detached nodes; reusing it would show no layers at all.
72
- */
73
- isMountedIn(host: HTMLElement): boolean;
74
- /** Cancel in-flight animations and remove the layer stack. */
75
- destroy(): void;
76
- /** Record, per shape, the steps at which it enters, leaves and builds. */
77
- private indexEffects;
78
- /**
79
- * Derive each built shape's paragraph bands from the page text layout.
80
- *
81
- * Lines carry `isFirstLineOfPara`, so paragraphs are the runs between
82
- * those flags. Bands are stored as fractions of the page height so they
83
- * survive zoom without recomputation.
84
- */
85
- private indexParagraphBands;
86
- private mountLayers;
87
- /**
88
- * Put every layer into its state after `step` steps.
89
- *
90
- * When `animate` is set, shapes whose state changes during this step play
91
- * their effect; everything else snaps, which is what makes `seek` cheap.
92
- */
93
- private applyState;
94
- /** Effects belonging to a step, keyed by shape. */
95
- private effectsOfStep;
96
- private play;
97
- /** Whether a shape is on screen once `step` steps have played. */
98
- private isVisibleAt;
99
- /**
100
- * Clip a paragraph-built shape to the paragraphs revealed so far.
101
- *
102
- * Bands are page-relative, so they are rebased onto the layer's own box
103
- * before becoming an inset. Shapes without a build get no clip at all.
104
- */
105
- private applyParagraphClip;
106
- }
107
- /**
108
- * Whether a slide is known to animate, without waiting on the worker.
109
- *
110
- * `undefined` means "not asked yet" — the caller must not assume either way.
111
- */
112
- export declare function knownToAnimate(docId: string, pageIndex: number): boolean | undefined;
113
- /**
114
- * Warm the cache for a slide so arriving at it needs no worker round trip.
115
- *
116
- * Called for the slides on either side of the current one, which covers the
117
- * sequential stepping that presenting a deck actually consists of.
118
- */
119
- export declare function prefetchSlideAnimation(workerClient: WorkerClient, docId: string, pageIndex: number): void;
120
- /**
121
- * Drop cached build sequences, for one document or all of them.
122
- *
123
- * Document ids are recycled — a fresh client numbers from `doc_0` again — so a
124
- * stale entry would otherwise hand one document's timeline to another.
125
- */
126
- export declare function forgetSlideAnimations(docId?: string): void;
127
- /**
128
- * Advance the on-screen build by one step.
129
- *
130
- * Returns true when a step played, which means the caller must NOT turn the
131
- * page: the click belonged to the build, not to navigation.
132
- */
133
- export declare function advanceActiveSlideAnimation(): boolean;
134
- /** Steps played on the on-screen build, or null when none is mounted. */
135
- export declare function activeSlideAnimationStep(): number | null;
136
- /** Whether a build is on screen with steps still to play. */
137
- export declare function hasPendingSlideAnimation(): boolean;
138
- /** Tear down the on-screen build and restore the plain page canvas. */
139
- export declare function clearActiveSlideAnimation(): void;
140
- export interface MountSlideAnimationOptions {
141
- workerClient: WorkerClient;
142
- docId: string;
143
- /** Zero-based index of the slide being shown. */
144
- pageIndex: number;
145
- /** Element the layer stack mounts into, sized to the displayed page. */
146
- host: HTMLElement;
147
- /** The slide's plain canvas, hidden while the build is on screen. */
148
- pageCanvas: HTMLElement;
149
- /** Device-pixel size to rasterize the layers at. */
150
- renderWidth: number;
151
- renderHeight: number;
152
- /** Start on the fully built slide, as when navigating backwards into it. */
153
- startComplete?: boolean;
154
- }
155
- /**
156
- * Load and mount a slide's build sequence.
157
- *
158
- * Returns false — leaving the plain page canvas in place — when the slide has
159
- * no animation, which is the overwhelming majority of pages.
160
- */
161
- export declare function mountSlideAnimation(options: MountSlideAnimationOptions): Promise<boolean>;
162
- //# sourceMappingURL=animation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../../../src/ui/viewer/animation.ts"],"names":[],"mappings":"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"}
@@ -1,506 +0,0 @@
1
- /**
2
- * Slide build sequences for PPTX animations.
3
- *
4
- * The WASM side rasterizes a slide into z-ordered layers — one per animated
5
- * shape, plus one per run of static content between them — and hands over a
6
- * timeline of click steps. This module stacks those layers as DOM elements and
7
- * plays the steps with the Web Animations API, so compositing stays on the GPU
8
- * and no re-render is needed per frame.
9
- *
10
- * Paragraph builds clip a text shape's single layer to the band occupied by
11
- * the revealed paragraphs, derived from the page's text layout. Paragraphs
12
- * never overlap, so clipping is exact.
13
- */
14
- import { resolveEasing, resolveMotion } from "./animation-presets.js";
15
- /**
16
- * Plays one slide's build sequence over a stack of layer canvases.
17
- *
18
- * Step counting: `step` is the number of steps already played. At 0 nothing
19
- * has run, so entrance targets are hidden; at `stepCount` the build is
20
- * complete and the slide looks like a normal full-page render.
21
- */
22
- export class SlideAnimationController {
23
- animation;
24
- host;
25
- layers = [];
26
- running = new Set();
27
- /** Step at which each shape first enters, if it has an entrance effect. */
28
- entranceStep = new Map();
29
- /** Step at which each shape first leaves, if it has an exit effect. */
30
- exitStep = new Map();
31
- /** Paragraph bands per shape, for shapes built paragraph by paragraph. */
32
- paragraphBands = new Map();
33
- /** Step at which each paragraph of a shape is revealed. */
34
- paragraphStep = new Map();
35
- currentStep = 0;
36
- constructor(options) {
37
- this.animation = options.animation;
38
- this.host = options.host;
39
- this.indexEffects();
40
- this.indexParagraphBands(options.layout, options.renderHeight);
41
- this.mountLayers(options.layers, options.renderWidth, options.renderHeight);
42
- this.applyState(0, false);
43
- }
44
- /** Number of clicks this slide's build takes. */
45
- get stepCount() {
46
- return this.animation.steps.length;
47
- }
48
- /** Steps already played. */
49
- get step() {
50
- return this.currentStep;
51
- }
52
- /** Whether every step has played. */
53
- get isComplete() {
54
- return this.currentStep >= this.stepCount;
55
- }
56
- /**
57
- * Play the next step.
58
- *
59
- * Returns false when the build is already finished, which is the caller's
60
- * cue to advance the slide instead.
61
- */
62
- next() {
63
- if (this.isComplete)
64
- return false;
65
- this.currentStep += 1;
66
- this.applyState(this.currentStep, true);
67
- return true;
68
- }
69
- /** Jump to a step's resting state without animating. */
70
- seek(step) {
71
- this.currentStep = Math.min(Math.max(step, 0), this.stepCount);
72
- this.applyState(this.currentStep, false);
73
- }
74
- /** Show the fully built slide, as when navigating backwards into it. */
75
- complete() {
76
- this.seek(this.stepCount);
77
- }
78
- /**
79
- * Whether this build is still mounted in `host` and on screen.
80
- *
81
- * A viewer that was destroyed and recreated leaves the old controller
82
- * pointing at detached nodes; reusing it would show no layers at all.
83
- */
84
- isMountedIn(host) {
85
- return this.host === host && host.isConnected;
86
- }
87
- /** Cancel in-flight animations and remove the layer stack. */
88
- destroy() {
89
- for (const animation of this.running)
90
- animation.cancel();
91
- this.running.clear();
92
- for (const layer of this.layers)
93
- layer.element.remove();
94
- this.layers.length = 0;
95
- }
96
- // ── Indexing ──
97
- /** Record, per shape, the steps at which it enters, leaves and builds. */
98
- indexEffects() {
99
- this.animation.steps.forEach((step, index) => {
100
- for (const effect of step.effects) {
101
- const key = effect.shapeKey;
102
- if (effect.target.type === "paragraphs") {
103
- for (let p = effect.target.start; p < effect.target.end; p++) {
104
- const id = paragraphId(key, p);
105
- if (!this.paragraphStep.has(id))
106
- this.paragraphStep.set(id, index);
107
- }
108
- continue;
109
- }
110
- if (effect.class === "entrance" && !this.entranceStep.has(key)) {
111
- this.entranceStep.set(key, index);
112
- }
113
- else if (effect.class === "exit" && !this.exitStep.has(key)) {
114
- this.exitStep.set(key, index);
115
- }
116
- }
117
- });
118
- }
119
- /**
120
- * Derive each built shape's paragraph bands from the page text layout.
121
- *
122
- * Lines carry `isFirstLineOfPara`, so paragraphs are the runs between
123
- * those flags. Bands are stored as fractions of the page height so they
124
- * survive zoom without recomputation.
125
- */
126
- indexParagraphBands(layout, renderHeight) {
127
- if (!layout || renderHeight <= 0)
128
- return;
129
- const built = new Set();
130
- for (const id of this.paragraphStep.keys())
131
- built.add(shapeOfParagraphId(id));
132
- if (built.size === 0)
133
- return;
134
- for (const frame of layout.frames) {
135
- const key = frame.shapeKey;
136
- if (key === undefined || !built.has(key) || !frame.parcel)
137
- continue;
138
- // Parcel coordinates are frame-local; the frame transform places
139
- // it on the page, and layout units are points like page.height.
140
- const frameTop = frame.transform.translateY + frame.parcel.y;
141
- const bands = [];
142
- for (const line of frame.parcel.lines) {
143
- const top = (frameTop + line.y - line.height) / layout.height;
144
- const bottom = (frameTop + line.y) / layout.height;
145
- if (line.isFirstLineOfPara || bands.length === 0) {
146
- bands.push({ top, bottom });
147
- }
148
- else {
149
- const last = bands[bands.length - 1];
150
- last.top = Math.min(last.top, top);
151
- last.bottom = Math.max(last.bottom, bottom);
152
- }
153
- }
154
- if (bands.length > 0)
155
- this.paragraphBands.set(key, bands);
156
- }
157
- }
158
- // ── Mounting ──
159
- mountLayers(layers, renderWidth, renderHeight) {
160
- if (renderWidth <= 0 || renderHeight <= 0)
161
- return;
162
- for (const layer of layers) {
163
- if (layer.width === 0 || layer.height === 0)
164
- continue;
165
- const canvas = document.createElement("canvas");
166
- canvas.className = "udoc-spread__animation-layer";
167
- canvas.width = layer.width;
168
- canvas.height = layer.height;
169
- canvas.setAttribute("aria-hidden", "true");
170
- const context = canvas.getContext("2d");
171
- if (context) {
172
- // Copy rather than view the transferred buffer: ImageData
173
- // requires a plain ArrayBuffer, and the copy is one frame's
174
- // cost against a raster that is then reused for every step.
175
- const image = context.createImageData(layer.width, layer.height);
176
- image.data.set(layer.rgba);
177
- context.putImageData(image, 0, 0);
178
- }
179
- // Position as a percentage of the host so zooming needs no relayout.
180
- canvas.style.position = "absolute";
181
- canvas.style.left = `${(layer.x / renderWidth) * 100}%`;
182
- canvas.style.top = `${(layer.y / renderHeight) * 100}%`;
183
- canvas.style.width = `${(layer.width / renderWidth) * 100}%`;
184
- canvas.style.height = `${(layer.height / renderHeight) * 100}%`;
185
- canvas.style.transformOrigin = "center";
186
- this.host.appendChild(canvas);
187
- this.layers.push({
188
- shapeKey: layer.shapeKey,
189
- element: canvas,
190
- topFraction: layer.y / renderHeight,
191
- heightFraction: layer.height / renderHeight,
192
- });
193
- }
194
- }
195
- // ── Playback ──
196
- /**
197
- * Put every layer into its state after `step` steps.
198
- *
199
- * When `animate` is set, shapes whose state changes during this step play
200
- * their effect; everything else snaps, which is what makes `seek` cheap.
201
- */
202
- applyState(step, animate) {
203
- for (const animation of this.running)
204
- animation.cancel();
205
- this.running.clear();
206
- const playing = animate ? this.effectsOfStep(step - 1) : new Map();
207
- for (const layer of this.layers) {
208
- const key = layer.shapeKey;
209
- if (key === undefined) {
210
- layer.element.style.opacity = "1";
211
- continue;
212
- }
213
- this.applyParagraphClip(layer, key, step);
214
- const visible = this.isVisibleAt(key, step);
215
- const effect = playing.get(key);
216
- if (effect) {
217
- this.play(layer, effect, visible);
218
- }
219
- else {
220
- layer.element.style.opacity = visible ? "1" : "0";
221
- layer.element.style.transform = "";
222
- }
223
- }
224
- }
225
- /** Effects belonging to a step, keyed by shape. */
226
- effectsOfStep(index) {
227
- const effects = new Map();
228
- const step = this.animation.steps[index];
229
- if (!step)
230
- return effects;
231
- for (const effect of step.effects) {
232
- if (!effects.has(effect.shapeKey))
233
- effects.set(effect.shapeKey, effect);
234
- }
235
- return effects;
236
- }
237
- play(layer, effect, endsVisible) {
238
- const motion = resolveMotion(effect);
239
- if (!motion) {
240
- layer.element.style.opacity = endsVisible ? "1" : "0";
241
- return;
242
- }
243
- // A zero-length effect (Appear) still needs a frame to commit, so give
244
- // the animation a floor rather than special-casing instant effects.
245
- const duration = Math.max(effect.durationMs, 1);
246
- const animation = layer.element.animate(motion.keyframes, {
247
- duration,
248
- delay: effect.startMs,
249
- easing: resolveEasing(effect.accelerate, effect.decelerate),
250
- iterations: effect.repeatCount ?? Infinity,
251
- direction: effect.autoReverse ? "alternate" : "normal",
252
- fill: "both",
253
- });
254
- this.running.add(animation);
255
- animation.addEventListener("finish", () => {
256
- this.running.delete(animation);
257
- layer.element.style.opacity = motion.endsVisible ? "1" : "0";
258
- layer.element.style.transform = "";
259
- animation.cancel();
260
- });
261
- }
262
- /** Whether a shape is on screen once `step` steps have played. */
263
- isVisibleAt(shapeKey, step) {
264
- const entrance = this.entranceStep.get(shapeKey);
265
- if (entrance !== undefined && step <= entrance)
266
- return false;
267
- const exit = this.exitStep.get(shapeKey);
268
- if (exit !== undefined && step > exit)
269
- return false;
270
- return true;
271
- }
272
- /**
273
- * Clip a paragraph-built shape to the paragraphs revealed so far.
274
- *
275
- * Bands are page-relative, so they are rebased onto the layer's own box
276
- * before becoming an inset. Shapes without a build get no clip at all.
277
- */
278
- applyParagraphClip(layer, shapeKey, step) {
279
- const bands = this.paragraphBands.get(shapeKey);
280
- if (!bands || layer.heightFraction <= 0)
281
- return;
282
- let revealed = -1;
283
- for (let index = 0; index < bands.length; index++) {
284
- const at = this.paragraphStep.get(paragraphId(shapeKey, index));
285
- // A paragraph with no effect of its own is part of the base text.
286
- if (at === undefined || step > at)
287
- revealed = index;
288
- else
289
- break;
290
- }
291
- if (revealed < 0) {
292
- layer.element.style.clipPath = "inset(0 0 100% 0)";
293
- return;
294
- }
295
- if (revealed >= bands.length - 1) {
296
- layer.element.style.clipPath = "";
297
- return;
298
- }
299
- const cutoff = bands[revealed].bottom;
300
- const bottomInset = 1 - (cutoff - layer.topFraction) / layer.heightFraction;
301
- layer.element.style.clipPath = `inset(0 0 ${(bottomInset * 100).toFixed(3)}% 0)`;
302
- }
303
- }
304
- function paragraphId(shapeKey, paragraph) {
305
- return `${shapeKey}:${paragraph}`;
306
- }
307
- function shapeOfParagraphId(id) {
308
- return Number(id.slice(0, id.indexOf(":")));
309
- }
310
- // ── The build currently on screen ──
311
- //
312
- // Exactly one slide is presented at a time in spread mode, so the active
313
- // controller is shared rather than threaded through every component that can
314
- // advance the deck.
315
- let active = null;
316
- let activeRestore = null;
317
- /** Identity of the mounted build, so re-renders can skip or resume it. */
318
- let activeKey = null;
319
- /** Bumped by every mount attempt so a superseded one discards its result. */
320
- let mountGeneration = 0;
321
- /**
322
- * Build sequences already fetched, keyed `docId:pageIndex`.
323
- *
324
- * Knowing whether a slide animates *before* its layers are ready is what lets
325
- * the viewer avoid showing the finished slide and then rewinding it to step 0.
326
- * `null` records "asked, and it has none".
327
- */
328
- const animationCache = new Map();
329
- function cacheKey(docId, pageIndex) {
330
- return `${docId}:${pageIndex}`;
331
- }
332
- /** Fetch a slide's build sequence, reusing the cached answer when there is one. */
333
- async function loadAnimation(workerClient, docId, pageIndex) {
334
- const key = cacheKey(docId, pageIndex);
335
- const cached = animationCache.get(key);
336
- if (cached !== undefined)
337
- return cached;
338
- const animation = (await workerClient.getSlideAnimation(docId, pageIndex)) ?? null;
339
- animationCache.set(key, animation);
340
- return animation;
341
- }
342
- /**
343
- * Whether a slide is known to animate, without waiting on the worker.
344
- *
345
- * `undefined` means "not asked yet" — the caller must not assume either way.
346
- */
347
- export function knownToAnimate(docId, pageIndex) {
348
- const cached = animationCache.get(cacheKey(docId, pageIndex));
349
- if (cached === undefined)
350
- return undefined;
351
- return cached !== null && cached.steps.length > 0;
352
- }
353
- /**
354
- * Warm the cache for a slide so arriving at it needs no worker round trip.
355
- *
356
- * Called for the slides on either side of the current one, which covers the
357
- * sequential stepping that presenting a deck actually consists of.
358
- */
359
- export function prefetchSlideAnimation(workerClient, docId, pageIndex) {
360
- if (pageIndex < 0)
361
- return;
362
- if (animationCache.has(cacheKey(docId, pageIndex)))
363
- return;
364
- void loadAnimation(workerClient, docId, pageIndex).catch(() => {
365
- // A prefetch failure is not worth surfacing; the real mount retries.
366
- animationCache.delete(cacheKey(docId, pageIndex));
367
- });
368
- }
369
- /**
370
- * Drop cached build sequences, for one document or all of them.
371
- *
372
- * Document ids are recycled — a fresh client numbers from `doc_0` again — so a
373
- * stale entry would otherwise hand one document's timeline to another.
374
- */
375
- export function forgetSlideAnimations(docId) {
376
- if (docId === undefined) {
377
- animationCache.clear();
378
- return;
379
- }
380
- for (const key of [...animationCache.keys()]) {
381
- if (key.startsWith(`${docId}:`))
382
- animationCache.delete(key);
383
- }
384
- }
385
- /**
386
- * Advance the on-screen build by one step.
387
- *
388
- * Returns true when a step played, which means the caller must NOT turn the
389
- * page: the click belonged to the build, not to navigation.
390
- */
391
- export function advanceActiveSlideAnimation() {
392
- return active?.next() ?? false;
393
- }
394
- /** Steps played on the on-screen build, or null when none is mounted. */
395
- export function activeSlideAnimationStep() {
396
- return active?.step ?? null;
397
- }
398
- /** Whether a build is on screen with steps still to play. */
399
- export function hasPendingSlideAnimation() {
400
- return active !== null && !active.isComplete;
401
- }
402
- /** Tear down the on-screen build and restore the plain page canvas. */
403
- export function clearActiveSlideAnimation() {
404
- active?.destroy();
405
- active = null;
406
- activeKey = null;
407
- activeRestore?.();
408
- activeRestore = null;
409
- // The canvas may be hidden with no controller yet — a mount that was
410
- // abandoned between "this slide animates" and "its layers are ready".
411
- showPageCanvas(hiddenPageCanvas);
412
- }
413
- /**
414
- * Hide the plain page canvas while a build owns the slide.
415
- *
416
- * Tracked so an aborted mount can put it back: the canvas is hidden before the
417
- * layers exist, so every failure path after that point must restore it.
418
- */
419
- let hiddenPageCanvas = null;
420
- function hidePageCanvas(canvas) {
421
- if (hiddenPageCanvas === canvas)
422
- return;
423
- showPageCanvas(hiddenPageCanvas);
424
- hiddenPageCanvas = canvas;
425
- canvas.style.visibility = "hidden";
426
- }
427
- function showPageCanvas(canvas) {
428
- if (!canvas)
429
- return;
430
- canvas.style.visibility = "";
431
- if (hiddenPageCanvas === canvas)
432
- hiddenPageCanvas = null;
433
- }
434
- /**
435
- * Load and mount a slide's build sequence.
436
- *
437
- * Returns false — leaving the plain page canvas in place — when the slide has
438
- * no animation, which is the overwhelming majority of pages.
439
- */
440
- export async function mountSlideAnimation(options) {
441
- const { workerClient, docId, pageIndex, host, pageCanvas } = options;
442
- // Re-rendering the same slide at the same resolution — a scroll, or a
443
- // layout pass that changed nothing — must not restart the build.
444
- const key = `${docId}:${pageIndex}:${options.renderWidth}x${options.renderHeight}`;
445
- if (active && activeKey === key && active.isMountedIn(host))
446
- return true;
447
- // Everything below runs while the previous build stays live and clickable.
448
- // Tearing it down first would leave a window — several frames of worker
449
- // round-trips — in which an advance would turn the page instead of stepping
450
- // the build, and the layer stack would visibly flash.
451
- const generation = ++mountGeneration;
452
- const superseded = () => generation !== mountGeneration;
453
- const animation = await loadAnimation(workerClient, docId, pageIndex);
454
- if (superseded())
455
- return active !== null;
456
- if (!animation || animation.steps.length === 0) {
457
- clearActiveSlideAnimation();
458
- return false;
459
- }
460
- // Hide the finished slide the moment we know it builds, rather than after
461
- // its layers are ready: rasterizing them takes long enough that the viewer
462
- // would otherwise show the completed slide and then rewind it to step 0.
463
- hidePageCanvas(pageCanvas);
464
- const layers = await workerClient.renderPageLayers(docId, pageIndex, options.renderWidth, options.renderHeight);
465
- if (superseded())
466
- return active !== null;
467
- if (!layers || layers.length === 0) {
468
- clearActiveSlideAnimation();
469
- return false;
470
- }
471
- // Paragraph builds need the text layout to find their bands; a slide that
472
- // only animates whole shapes does not, so a failure here is not fatal.
473
- let layout;
474
- if (animation.steps.some((step) => step.effects.some((e) => e.target.type === "paragraphs"))) {
475
- layout = await workerClient.getLayoutPage(docId, pageIndex).catch(() => undefined);
476
- if (superseded())
477
- return active !== null;
478
- }
479
- // Zoom and rotation change the resolution, so the layers were rasterized
480
- // again; carry the step across so the build resumes where it was.
481
- const resumeStep = activeKey?.startsWith(`${docId}:${pageIndex}:`) ? (active?.step ?? null) : null;
482
- clearActiveSlideAnimation();
483
- const controller = new SlideAnimationController({
484
- animation,
485
- layers,
486
- renderWidth: options.renderWidth,
487
- renderHeight: options.renderHeight,
488
- host,
489
- layout,
490
- });
491
- if (resumeStep !== null)
492
- controller.seek(resumeStep);
493
- else if (options.startComplete)
494
- controller.complete();
495
- const previousHostDisplay = host.style.display;
496
- host.style.display = "block";
497
- hidePageCanvas(pageCanvas);
498
- active = controller;
499
- activeKey = key;
500
- activeRestore = () => {
501
- showPageCanvas(pageCanvas);
502
- host.style.display = previousHostDisplay;
503
- };
504
- return true;
505
- }
506
- //# sourceMappingURL=animation.js.map