@docmentis/udoc-viewer 0.7.20 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,1383 +0,0 @@
1
- /**
2
- * Slide transition animations for PPTX spread-mode navigation.
3
- *
4
- * IMPORTANT: Effects must NEVER set `transform` on the incoming element.
5
- * The incoming element is the real spread — transforms on it would change
6
- * its layout position, causing scrollbar flicker, resize-observer loops,
7
- * and page-jump bugs. Only use `opacity` and `clip-path` on incoming.
8
- * The outgoing element is a disposable snapshot overlay, so `transform`
9
- * and `opacity` are safe on it.
10
- */
11
- import { tryRunGLTransition } from "./transition-gl.js";
12
- /**
13
- * Run a slide transition animation between two spread elements.
14
- *
15
- * @param outgoing The snapshot overlay (will be removed on complete)
16
- * @param incoming The real spread element (already mounted and positioned)
17
- * @param transition Transition descriptor from PageInfo
18
- * @param forward Navigation direction (true = forward, false = backward)
19
- * @param onComplete Called when the transition finishes (or is cancelled)
20
- */
21
- export function runTransition(outgoing, incoming, transition, forward, onComplete) {
22
- const durationMs = transition.durationMs ?? 500;
23
- // Try the WebGL-accelerated backend first. It returns null when the
24
- // effect isn't GL-backed or when GL setup fails, in which case we fall
25
- // through to the CSS path below.
26
- if (durationMs > 0) {
27
- const glHandle = tryRunGLTransition(outgoing, incoming, transition, forward, durationMs, onComplete);
28
- if (glHandle)
29
- return glHandle;
30
- }
31
- const apply = resolveEffect(transition.effect, forward);
32
- // Instant transitions
33
- if (durationMs <= 0 || !apply) {
34
- onComplete();
35
- return { cancel() { } };
36
- }
37
- // Prepare elements for animation.
38
- // No will-change on either element — it creates a new compositing layer
39
- // with different sub-pixel alignment, causing a visible 1px shift.
40
- // Modern browsers handle short transform/opacity animations efficiently
41
- // without the hint.
42
- outgoing.style.pointerEvents = "none";
43
- // The snapshot is inserted before the spread in the DOM, so the spread
44
- // (incoming) naturally paints on top. Effects that need the snapshot on
45
- // top set outgoing.style.zIndex = "1". We never set zIndex on the
46
- // incoming element to avoid creating a stacking context (causes 1px shift).
47
- // Set initial frame
48
- apply(0, outgoing, incoming);
49
- let rafId = 0;
50
- let done = false;
51
- const startTime = performance.now();
52
- function tick(now) {
53
- if (done)
54
- return;
55
- const elapsed = now - startTime;
56
- const raw = Math.min(elapsed / durationMs, 1);
57
- const t = easeInOut(raw);
58
- apply(t, outgoing, incoming);
59
- if (raw < 1) {
60
- rafId = requestAnimationFrame(tick);
61
- }
62
- else {
63
- finish();
64
- }
65
- }
66
- function finish() {
67
- if (done)
68
- return;
69
- done = true;
70
- cancelAnimationFrame(rafId);
71
- resetOutgoing(outgoing);
72
- resetIncoming(incoming);
73
- onComplete();
74
- }
75
- rafId = requestAnimationFrame(tick);
76
- return {
77
- cancel() {
78
- finish();
79
- },
80
- };
81
- }
82
- // ---------------------------------------------------------------------------
83
- // Easing
84
- // ---------------------------------------------------------------------------
85
- function easeInOut(t) {
86
- return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;
87
- }
88
- // ---------------------------------------------------------------------------
89
- // Style helpers
90
- // ---------------------------------------------------------------------------
91
- /** Reset the outgoing snapshot — about to be removed from DOM anyway. */
92
- function resetOutgoing(el) {
93
- el.style.pointerEvents = "";
94
- el.style.zIndex = "";
95
- el.style.opacity = "";
96
- el.style.clipPath = "";
97
- el.style.transform = "none";
98
- el.style.filter = "";
99
- }
100
- /** Reset the incoming spread — only clear opacity/clip-path. NEVER touch transform or zIndex. */
101
- function resetIncoming(el) {
102
- el.style.opacity = "";
103
- el.style.clipPath = "";
104
- el.style.maskImage = "";
105
- el.style.setProperty("-webkit-mask-image", "");
106
- }
107
- // ---------------------------------------------------------------------------
108
- // Direction helpers
109
- // ---------------------------------------------------------------------------
110
- function sideToTranslate(dir, progress) {
111
- const p = progress * 100;
112
- switch (dir) {
113
- case "left":
114
- return `translateX(${-p}%)`;
115
- case "right":
116
- return `translateX(${p}%)`;
117
- case "up":
118
- return `translateY(${-p}%)`;
119
- case "down":
120
- return `translateY(${p}%)`;
121
- }
122
- }
123
- function oppositeSide(dir) {
124
- switch (dir) {
125
- case "left":
126
- return "right";
127
- case "right":
128
- return "left";
129
- case "up":
130
- return "down";
131
- case "down":
132
- return "up";
133
- }
134
- }
135
- function eightDirToTranslate(dir, progress) {
136
- const p = progress * 100;
137
- const x = dir === "left" || dir === "leftUp" || dir === "leftDown"
138
- ? -p
139
- : dir === "right" || dir === "rightUp" || dir === "rightDown"
140
- ? p
141
- : 0;
142
- const y = dir === "up" || dir === "leftUp" || dir === "rightUp"
143
- ? -p
144
- : dir === "down" || dir === "leftDown" || dir === "rightDown"
145
- ? p
146
- : 0;
147
- return `translate(${x}%, ${y}%)`;
148
- }
149
- function oppositeEightDir(dir) {
150
- const map = {
151
- left: "right",
152
- right: "left",
153
- up: "down",
154
- down: "up",
155
- leftUp: "rightDown",
156
- rightUp: "leftDown",
157
- leftDown: "rightUp",
158
- rightDown: "leftUp",
159
- };
160
- return map[dir];
161
- }
162
- function eightDirToRevealInset(dir, t) {
163
- const p = (1 - t) * 100;
164
- let top = 0, right = 0, bottom = 0, left = 0;
165
- if (dir === "left" || dir === "leftUp" || dir === "leftDown")
166
- right = p;
167
- if (dir === "right" || dir === "rightUp" || dir === "rightDown")
168
- left = p;
169
- if (dir === "up" || dir === "leftUp" || dir === "rightUp")
170
- bottom = p;
171
- if (dir === "down" || dir === "leftDown" || dir === "rightDown")
172
- top = p;
173
- return `inset(${top}% ${right}% ${bottom}% ${left}%)`;
174
- }
175
- function resolveEffect(effect, forward) {
176
- switch (effect.type) {
177
- case "replace":
178
- return null;
179
- case "fade":
180
- return effect.throughBlack ? fadeThroughBlack : crossfade;
181
- case "cut":
182
- return effect.throughBlack ? cutThroughBlack : null;
183
- case "dissolve":
184
- return dissolveEffect();
185
- case "push":
186
- return pushEffect(effect.direction);
187
- case "wipe":
188
- return wipeEffect(effect.direction);
189
- case "cover":
190
- return coverEffect(oppositeEightDir(effect.direction));
191
- case "uncover":
192
- return uncoverEffect(effect.direction);
193
- case "pull":
194
- return pullEffect(effect.direction);
195
- case "split":
196
- return splitEffect(effect.orientation, effect.inOut);
197
- case "zoom":
198
- case "box":
199
- return effect.inOut === "in" ? shrinkToCenter : expandFromCenter;
200
- case "fly": {
201
- const dir = forward ? effect.direction : oppositeSide(effect.direction);
202
- return flyEffect(dir);
203
- }
204
- case "glitter": {
205
- const dir = forward ? effect.direction : oppositeSide(effect.direction);
206
- return wipeEffect(dir);
207
- }
208
- case "circle":
209
- return circleEffect;
210
- case "diamond":
211
- return diamondEffect;
212
- case "plus":
213
- return plusEffect;
214
- case "wedge":
215
- return wedgeEffect;
216
- case "wheel":
217
- return wheelSweepEffect(effect.spokes, true);
218
- case "newsflash":
219
- return newsflashEffect;
220
- case "blinds":
221
- return blindsEffect(effect.orientation);
222
- case "checker":
223
- return checkerEffect(effect.orientation);
224
- case "comb":
225
- return combEffect(effect.orientation);
226
- case "strips":
227
- return stripsEffect(effect.direction);
228
- case "random": {
229
- const options = [
230
- crossfade,
231
- fadeThroughBlack,
232
- wipeEffect("left"),
233
- wipeEffect("right"),
234
- wipeEffect("up"),
235
- wipeEffect("down"),
236
- pushEffect("left"),
237
- pushEffect("right"),
238
- blindsEffect("horizontal"),
239
- blindsEffect("vertical"),
240
- circleEffect,
241
- diamondEffect,
242
- plusEffect,
243
- splitEffect("horizontal", "out"),
244
- splitEffect("vertical", "out"),
245
- ];
246
- return options[Math.floor(Math.random() * options.length)];
247
- }
248
- case "randomBar":
249
- return randomBarEffect(effect.orientation);
250
- // PPTX 2010+ effects (p14)
251
- case "vortex":
252
- return vortexEffect(effect.direction);
253
- case "switch":
254
- case "flip":
255
- case "gallery":
256
- case "conveyor":
257
- return flyEffect(effect.direction);
258
- case "ripple":
259
- return circleEffect;
260
- case "honeycomb":
261
- return crossfade;
262
- case "prism":
263
- return wipeEffect(effect.direction);
264
- case "doors":
265
- return splitEffect(effect.orientation, "out");
266
- case "window":
267
- return splitEffect(effect.orientation, "in");
268
- case "ferris":
269
- return flyEffect(effect.direction);
270
- case "pan": {
271
- const dir = forward ? effect.direction : oppositeSide(effect.direction);
272
- return pushEffect(dir);
273
- }
274
- case "warp":
275
- case "flythrough":
276
- return effect.inOut === "in" ? shrinkToCenter : expandFromCenter;
277
- case "flash":
278
- return fadeThroughBlack;
279
- case "shred":
280
- return effect.inOut === "in" ? shrinkToCenter : expandFromCenter;
281
- case "reveal":
282
- return effect.throughBlack ? fadeThroughBlack : wipeEffect(effect.direction);
283
- case "wheelReverse":
284
- return wheelSweepEffect(effect.spokes, false);
285
- case "morph":
286
- return crossfade;
287
- default:
288
- return crossfade;
289
- }
290
- }
291
- // ---------------------------------------------------------------------------
292
- // Effect implementations
293
- //
294
- // Rules:
295
- // outgoing (snapshot): transform + opacity OK
296
- // incoming (real spread): opacity + clip-path ONLY, NO transform
297
- // ---------------------------------------------------------------------------
298
- // All effects below follow the z-order convention:
299
- // - Snapshot (outgoing) is inserted BEFORE the spread in the DOM,
300
- // so the spread (incoming) naturally paints on top.
301
- // - Effects where the snapshot must be on top set outgoing.style.zIndex = "1".
302
- // - We NEVER set zIndex on the incoming element.
303
- /** Simple crossfade — outgoing on top, faded out to reveal incoming below. */
304
- function crossfade(t, outgoing, _incoming) {
305
- outgoing.style.zIndex = "1";
306
- outgoing.style.opacity = `${1 - t}`;
307
- }
308
- /**
309
- * Fade through black: outgoing dims to solid black, then black fades out
310
- * to reveal incoming. Uses CSS brightness filter so the "black" is real,
311
- * not dependent on the viewer background color.
312
- */
313
- function fadeThroughBlack(t, outgoing, _incoming) {
314
- outgoing.style.zIndex = "1";
315
- if (t < 0.5) {
316
- // Outgoing content dims to black
317
- outgoing.style.filter = `brightness(${1 - t * 2})`;
318
- outgoing.style.opacity = "1";
319
- }
320
- else {
321
- // Black overlay fades out, revealing incoming below
322
- outgoing.style.filter = "brightness(0)";
323
- outgoing.style.opacity = `${1 - (t - 0.5) * 2}`;
324
- }
325
- }
326
- /**
327
- * Hard cut through black: instant switch to black, then instant switch
328
- * to new slide. Uses brightness(0) for actual black.
329
- */
330
- function cutThroughBlack(t, outgoing, _incoming) {
331
- outgoing.style.zIndex = "1";
332
- if (t < 0.5) {
333
- // Show solid black (outgoing rendered as black)
334
- outgoing.style.filter = "brightness(0)";
335
- outgoing.style.opacity = "1";
336
- }
337
- else {
338
- // Remove outgoing entirely, incoming visible below
339
- outgoing.style.opacity = "0";
340
- }
341
- }
342
- /**
343
- * Push: snapshot slides away on top, incoming revealed via clip-path underneath.
344
- */
345
- function pushEffect(dir) {
346
- const opp = oppositeSide(dir);
347
- return (t, outgoing, incoming) => {
348
- if (t >= 1) {
349
- incoming.style.transform = "";
350
- return;
351
- }
352
- outgoing.style.zIndex = "1";
353
- outgoing.style.transform = sideToTranslate(dir, t);
354
- incoming.style.transform = sideToTranslate(opp, 1 - t);
355
- };
356
- }
357
- /**
358
- * Wipe: incoming revealed via clip-path on top of static snapshot.
359
- */
360
- function wipeEffect(dir) {
361
- return (t, _outgoing, incoming) => {
362
- if (t >= 1) {
363
- clearMask(incoming);
364
- return;
365
- }
366
- const p = (1 - t) * 100;
367
- const blur = Math.max(0.5, t * 50 * 0.08);
368
- // Extend the rect well beyond the viewBox on all non-moving edges so
369
- // the Gaussian blur feathers only the leading (moving) edge. The SVG
370
- // viewBox clips the overflow, keeping the other edges crisp.
371
- const E = 50; // extension beyond viewBox
372
- let rect;
373
- switch (dir) {
374
- case "right":
375
- // Moving edge: left side at x=p
376
- rect = `<rect x="${p}" y="${-E}" width="${100 - p + E}" height="${100 + 2 * E}" fill="white" filter="url(#b)"/>`;
377
- break;
378
- case "left":
379
- // Moving edge: right side at x=(100-p)
380
- rect = `<rect x="${-E}" y="${-E}" width="${100 - p + E}" height="${100 + 2 * E}" fill="white" filter="url(#b)"/>`;
381
- break;
382
- case "down":
383
- // Moving edge: bottom side of rect
384
- rect = `<rect x="${-E}" y="${-E}" width="${100 + 2 * E}" height="${100 - p + E}" fill="white" filter="url(#b)"/>`;
385
- break;
386
- case "up":
387
- // Moving edge: top side of rect at y=p
388
- rect = `<rect x="${-E}" y="${p}" width="${100 + 2 * E}" height="${100 - p + E}" fill="white" filter="url(#b)"/>`;
389
- break;
390
- }
391
- applyMask(incoming, svgMask(rect, blur));
392
- };
393
- }
394
- /**
395
- * Cover: incoming revealed via clip-path on top of static snapshot.
396
- */
397
- function coverEffect(dir) {
398
- return (t, _outgoing, incoming) => {
399
- incoming.style.clipPath = eightDirToRevealInset(dir, t);
400
- };
401
- }
402
- /**
403
- * Uncover: snapshot slides away on top, revealing incoming underneath.
404
- */
405
- function uncoverEffect(dir) {
406
- return (t, outgoing, _incoming) => {
407
- outgoing.style.zIndex = "1";
408
- outgoing.style.transform = eightDirToTranslate(dir, t);
409
- };
410
- }
411
- /**
412
- * Pull: snapshot slides away on top while incoming is revealed via clip-path.
413
- */
414
- function pullEffect(dir) {
415
- return (t, outgoing, _incoming) => {
416
- outgoing.style.zIndex = "1";
417
- outgoing.style.transform = eightDirToTranslate(dir, t);
418
- };
419
- }
420
- /**
421
- * Split "out": incoming revealed from center outward — clip-path on incoming.
422
- * Split "in": incoming revealed from edges inward — clip-path on snapshot (outgoing).
423
- */
424
- function splitEffect(orientation, inOut) {
425
- const isH = orientation === "horizontal";
426
- const E = 50; // extension beyond viewBox for non-moving edges
427
- if (inOut === "out") {
428
- // Center outward: incoming starts fully clipped, opens from center.
429
- // Two moving edges (top+bottom or left+right); extend perpendicular edges.
430
- return (t, _outgoing, incoming) => {
431
- if (t >= 1) {
432
- clearMask(incoming);
433
- return;
434
- }
435
- const p = (1 - t) * 50;
436
- const blur = Math.max(0.5, t * 50 * 0.08);
437
- const rect = isH
438
- ? `<rect x="${-E}" y="${p}" width="${100 + 2 * E}" height="${100 - 2 * p}" fill="white" filter="url(#b)"/>`
439
- : `<rect x="${p}" y="${-E}" width="${100 - 2 * p}" height="${100 + 2 * E}" fill="white" filter="url(#b)"/>`;
440
- applyMask(incoming, svgMask(rect, blur));
441
- };
442
- }
443
- else {
444
- // Edges inward: snapshot collapses toward center, revealing incoming at edges.
445
- // Two moving edges; extend perpendicular edges.
446
- return (t, outgoing, _incoming) => {
447
- if (t >= 1) {
448
- clearMask(outgoing);
449
- return;
450
- }
451
- outgoing.style.zIndex = "1";
452
- const p = t * 50;
453
- const blur = Math.max(0.5, p * 0.08);
454
- const rect = isH
455
- ? `<rect x="${-E}" y="${p}" width="${100 + 2 * E}" height="${100 - 2 * p}" fill="white" filter="url(#b)"/>`
456
- : `<rect x="${p}" y="${-E}" width="${100 - 2 * p}" height="${100 + 2 * E}" fill="white" filter="url(#b)"/>`;
457
- applyMask(outgoing, svgMask(rect, blur));
458
- };
459
- }
460
- }
461
- /**
462
- * Zoom/box in: outgoing slide clips inward from edges to center, revealing incoming underneath.
463
- * Uses SVG mask with Gaussian blur for a feathered edge.
464
- */
465
- function shrinkToCenter(t, outgoing, _incoming) {
466
- outgoing.style.zIndex = "1";
467
- if (t <= 0) {
468
- clearMask(outgoing);
469
- return;
470
- }
471
- const p = t * 50;
472
- const blur = Math.max(0.5, p * 0.08);
473
- // White rect with an inverted (black) inset rect — masks away the center, keeping the outer ring.
474
- // As p grows the outer ring shrinks toward the edges, revealing incoming underneath.
475
- applyMask(outgoing, svgMask(`<rect x="${p}" y="${p}" width="${100 - 2 * p}" height="${100 - 2 * p}" fill="white" filter="url(#b)"/>`, blur));
476
- }
477
- /**
478
- * Zoom/box out: incoming slide expands from center via feathered SVG mask clip.
479
- */
480
- function expandFromCenter(t, _outgoing, incoming) {
481
- if (t >= 1) {
482
- clearMask(incoming);
483
- return;
484
- }
485
- const p = (1 - t) * 50;
486
- const blur = Math.max(0.5, p * 0.08);
487
- applyMask(incoming, svgMask(`<rect x="${p}" y="${p}" width="${100 - 2 * p}" height="${100 - 2 * p}" fill="white" filter="url(#b)"/>`, blur));
488
- }
489
- /**
490
- * Fly: snapshot slides and fades out on top, incoming fades in underneath.
491
- */
492
- function flyEffect(dir) {
493
- return (t, outgoing, incoming) => {
494
- outgoing.style.zIndex = "1";
495
- outgoing.style.transform = `${sideToTranslate(dir, t)} scale(${1 - t * 0.5})`;
496
- outgoing.style.opacity = `${1 - t}`;
497
- incoming.style.opacity = `${t}`;
498
- };
499
- }
500
- /**
501
- * Circle reveal from center with soft/feathered edge.
502
- * Uses mask-image radial gradient for a blurred boundary like PowerPoint.
503
- * Radius 71% ≈ sqrt(50² + 50²) to fully cover rectangular corners.
504
- */
505
- function circleEffect(t, _outgoing, incoming) {
506
- if (t >= 1) {
507
- incoming.style.maskImage = "";
508
- incoming.style.setProperty("-webkit-mask-image", "");
509
- return;
510
- }
511
- if (t <= 0) {
512
- const mask = "radial-gradient(circle at 50% 50%, #000 0%, transparent 0%)";
513
- incoming.style.maskImage = mask;
514
- incoming.style.setProperty("-webkit-mask-image", mask);
515
- return;
516
- }
517
- // Color stops are relative to the gradient ray (farthest-corner by default),
518
- // so r must reach 100% to fully cover the slide at t=1.
519
- const r = t * 100;
520
- const edge = Math.max(1, r * 0.15);
521
- const inner = Math.max(0, r - edge);
522
- const mask = `radial-gradient(circle at 50% 50%, #000 ${inner}%, transparent ${r + 0.5}%)`;
523
- incoming.style.maskImage = mask;
524
- incoming.style.setProperty("-webkit-mask-image", mask);
525
- }
526
- /** Diamond reveal from center with feathered edge via SVG mask + blur. */
527
- function diamondEffect(t, _outgoing, incoming) {
528
- if (t >= 1) {
529
- clearMask(incoming);
530
- return;
531
- }
532
- const p = t * 100;
533
- const blur = Math.max(0.5, p * 0.08);
534
- applyMask(incoming, diamondMaskSvg(p, blur));
535
- }
536
- /** Shared helper: wrap SVG shape content into a blurred mask data-URI. */
537
- function svgMask(shapeContent, blur) {
538
- const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none">` +
539
- `<defs><filter id="b" x="-50%" y="-50%" width="200%" height="200%">` +
540
- `<feGaussianBlur stdDeviation="${blur}"/></filter></defs>` +
541
- shapeContent +
542
- `</svg>`;
543
- return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
544
- }
545
- function applyMask(el, mask) {
546
- el.style.maskImage = mask;
547
- el.style.maskSize = "100% 100%";
548
- el.style.setProperty("-webkit-mask-image", mask);
549
- el.style.setProperty("-webkit-mask-size", "100% 100%");
550
- }
551
- function clearMask(el) {
552
- el.style.maskImage = "";
553
- el.style.setProperty("-webkit-mask-image", "");
554
- }
555
- function diamondMaskSvg(p, blur) {
556
- return svgMask(`<polygon points="50,${50 - p} ${50 + p},50 50,${50 + p} ${50 - p},50" fill="white" filter="url(#b)"/>`, blur);
557
- }
558
- /** Plus/cross reveal from center with feathered edge via SVG mask + blur. */
559
- function plusEffect(t, _outgoing, incoming) {
560
- if (t >= 1) {
561
- clearMask(incoming);
562
- return;
563
- }
564
- const p = t * 50;
565
- const blur = Math.max(0.5, p * 0.08);
566
- applyMask(incoming, plusMaskSvg(p, blur));
567
- }
568
- function plusMaskSvg(p, blur) {
569
- // Plus shape: a cross centered at (50,50) with arm half-widths of p.
570
- // Arms extend beyond the viewBox (-E / 100+E) so only the inner concave
571
- // corners get feathered, not the outer edges touching the slide boundary.
572
- const E = 50;
573
- const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none">` +
574
- `<defs><filter id="b" x="-50%" y="-50%" width="200%" height="200%">` +
575
- `<feGaussianBlur stdDeviation="${blur}"/></filter></defs>` +
576
- `<polygon points="${50 - p},${-E} ${50 + p},${-E} ${50 + p},${50 - p} ${100 + E},${50 - p} ` +
577
- `${100 + E},${50 + p} ${50 + p},${50 + p} ${50 + p},${100 + E} ${50 - p},${100 + E} ` +
578
- `${50 - p},${50 + p} ${-E},${50 + p} ${-E},${50 - p} ${50 - p},${50 - p}" ` +
579
- `fill="white" filter="url(#b)"/></svg>`;
580
- return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
581
- }
582
- /** Newsflash: incoming slide expands from a single pixel at center while rotating 360°. */
583
- function newsflashEffect(t, _outgoing, incoming) {
584
- if (t >= 1) {
585
- incoming.style.transform = "";
586
- incoming.style.opacity = "";
587
- return;
588
- }
589
- // Scale from near-zero to 1, rotate a full 360°.
590
- const scale = Math.max(0.01, t);
591
- const deg = -t * 360;
592
- incoming.style.transform = `scale(${scale}) rotate(${deg}deg)`;
593
- incoming.style.transformOrigin = "50% 50%";
594
- incoming.style.opacity = String(t);
595
- }
596
- /**
597
- * Strips: diagonal wipe that reveals the incoming slide from a corner.
598
- * The reveal starts at the corner and sweeps diagonally across.
599
- */
600
- function stripsEffect(dir) {
601
- // Extend polygon edges that lie on the viewport boundary beyond the
602
- // viewBox so only the diagonal (moving) edge gets feathered.
603
- const E = 50;
604
- return (t, _outgoing, incoming) => {
605
- if (t >= 1) {
606
- clearMask(incoming);
607
- return;
608
- }
609
- if (t <= 0) {
610
- applyMask(incoming, svgMask(`<polygon points="0,0 0,0 0,0" fill="white" filter="url(#b)"/>`, 0));
611
- return;
612
- }
613
- const d = t * 200;
614
- const blur = Math.max(0.5, t * 50 * 0.08);
615
- let points;
616
- if (d <= 100) {
617
- switch (dir) {
618
- case "rightDown":
619
- points = `${-E},${-E} ${d},${-E} ${d},0 0,${d} ${-E},${d}`;
620
- break;
621
- case "leftDown":
622
- points = `${100 + E},${-E} ${100 - d},${-E} ${100 - d},0 100,${d} ${100 + E},${d}`;
623
- break;
624
- case "rightUp":
625
- points = `${-E},${100 + E} ${d},${100 + E} ${d},100 0,${100 - d} ${-E},${100 - d}`;
626
- break;
627
- case "leftUp":
628
- points = `${100 + E},${100 + E} ${100 - d},${100 + E} ${100 - d},100 100,${100 - d} ${100 + E},${100 - d}`;
629
- break;
630
- }
631
- }
632
- else {
633
- const e = d - 100;
634
- switch (dir) {
635
- case "rightDown":
636
- points = `${-E},${-E} ${100 + E},${-E} ${100 + E},${e} ${e},${100 + E} ${-E},${100 + E}`;
637
- break;
638
- case "leftDown":
639
- points = `${100 + E},${-E} ${-E},${-E} ${-E},${e} ${100 - e},${100 + E} ${100 + E},${100 + E}`;
640
- break;
641
- case "rightUp":
642
- points = `${-E},${100 + E} ${100 + E},${100 + E} ${100 + E},${100 - e} ${e},${-E} ${-E},${-E}`;
643
- break;
644
- case "leftUp":
645
- points = `${100 + E},${100 + E} ${-E},${100 + E} ${-E},${100 - e} ${100 - e},${-E} ${100 + E},${-E}`;
646
- break;
647
- }
648
- }
649
- applyMask(incoming, svgMask(`<polygon points="${points}" fill="white" filter="url(#b)"/>`, blur));
650
- };
651
- }
652
- // ---------------------------------------------------------------------------
653
- // Blinds / Comb
654
- // ---------------------------------------------------------------------------
655
- const BLIND_STRIPS = 14;
656
- /**
657
- * Blinds: CSS 3D box-rotation effect matching PowerPoint.
658
- *
659
- * Each strip is modelled as a 3D box whose cross-section is a square
660
- * (depth === strip height). The front face shows the outgoing slide and the
661
- * bottom face shows the incoming slide. All boxes rotate 90° around the X
662
- * axis (horizontal) or Y axis (vertical) at the box centre, so the bottom
663
- * face rolls into view like a real window blind.
664
- *
665
- * All faces share a single `preserve-3d` context rooted on the outgoing
666
- * snapshot element, so the browser z-sorts faces across strips correctly.
667
- */
668
- function blindsEffect(orientation) {
669
- const N = BLIND_STRIPS;
670
- const isH = orientation === "horizontal";
671
- let setup = null;
672
- return (t, outgoing, incoming) => {
673
- if (t >= 1) {
674
- incoming.style.opacity = "";
675
- incoming.style.clipPath = "none";
676
- // outgoing (now containing strips) is removed by onComplete
677
- return;
678
- }
679
- // Lazy init: build 3D strip DOM on first frame
680
- if (!setup) {
681
- setup = setupBlinds3D(outgoing, incoming, N, isH);
682
- }
683
- // Fallback to crossfade if 3D setup failed (no canvases)
684
- if (!setup || setup.flippers.length === 0) {
685
- outgoing.style.zIndex = "1";
686
- outgoing.style.opacity = `${1 - t}`;
687
- return;
688
- }
689
- // Staggered rotation: center strips start first, edges start last.
690
- // Each strip's local progress is derived from its distance to center.
691
- const hd = setup.halfDepth;
692
- const stagger = 0.7; // fraction of total duration used for stagger spread
693
- const center = (N - 1) / 2;
694
- for (let i = 0; i < setup.flippers.length; i++) {
695
- const dist = Math.abs(i - center) / center; // 0 at center, 1 at edges
696
- const delay = dist * stagger;
697
- const stripT = Math.max(0, Math.min(1, (t - delay) / (1 - stagger)));
698
- const angle = stripT * 90;
699
- setup.flippers[i].style.transform = isH
700
- ? `translateZ(-${hd}px) rotateX(${angle}deg)`
701
- : `translateZ(-${hd}px) rotateY(-${angle}deg)`;
702
- }
703
- };
704
- }
705
- /**
706
- * Build N 3D box-strip elements inside the outgoing snapshot.
707
- *
708
- * DOM structure (horizontal example):
709
- * outgoing [perspective, preserve-3d]
710
- * ├── flipper-0 [preserve-3d, position: absolute, rotateX(angle)]
711
- * │ ├── front [canvas, translateZ(d/2)]
712
- * │ └── bottom [canvas, rotateX(-90deg) translateZ(d/2)]
713
- * ├── flipper-1 ...
714
- * └── ...
715
- */
716
- function setupBlinds3D(outgoing, incoming, N, isH) {
717
- // The outgoing snapshot is a div (positioned at the slot area) containing a canvas.
718
- // The incoming is the real spread — find its main canvas.
719
- const outCanvas = outgoing.querySelector("canvas");
720
- const inCanvas = incoming.querySelector(".udoc-spread__canvas") ??
721
- incoming.querySelector("canvas");
722
- if (!outCanvas || !inCanvas || outCanvas.width === 0 || inCanvas.width === 0) {
723
- return { flippers: [], halfDepth: 0 };
724
- }
725
- // Derive CSS dimensions from the canvas physical size / DPR so they are
726
- // on exact device-pixel boundaries (the snapshot is built this way).
727
- const dpr = window.devicePixelRatio || 1;
728
- const slideW = outCanvas.width / dpr;
729
- const slideH = outCanvas.height / dpr;
730
- const d = isH ? slideH / N : slideW / N; // box depth = strip size (square cross-section)
731
- // Repurpose the disposable snapshot as the container.
732
- // Since the snapshot is now a canvas positioned at the slot area,
733
- // all children are placed at (0,0) relative to it — no offset needed.
734
- outgoing.innerHTML = "";
735
- outgoing.style.overflow = "visible";
736
- outgoing.style.zIndex = "1";
737
- // Hide the real spread during animation (resetIncoming restores on cancel)
738
- incoming.style.opacity = "0";
739
- // Black backdrop — flat 2D element, NOT inside the preserve-3d context.
740
- // Sits behind the 3D scene in normal stacking order (DOM before scene).
741
- const backdrop = document.createElement("div");
742
- backdrop.style.position = "absolute";
743
- backdrop.style.left = "0";
744
- backdrop.style.top = "0";
745
- backdrop.style.width = `${slideW}px`;
746
- backdrop.style.height = `${slideH}px`;
747
- backdrop.style.background = "#000";
748
- outgoing.appendChild(backdrop);
749
- // 3D scene container — preserve-3d + perspective live here,
750
- // separate from the flat backdrop so it doesn't interfere.
751
- const scene = document.createElement("div");
752
- scene.style.position = "absolute";
753
- scene.style.left = "0";
754
- scene.style.top = "0";
755
- scene.style.width = `${slideW}px`;
756
- scene.style.height = `${slideH}px`;
757
- scene.style.perspective = `${(isH ? slideH : slideW) * 2}px`;
758
- scene.style.transformStyle = "preserve-3d";
759
- outgoing.appendChild(scene);
760
- const flippers = [];
761
- for (let i = 0; i < N; i++) {
762
- // Flipper — the rotating 3D box for this strip
763
- const flipper = document.createElement("div");
764
- flipper.style.position = "absolute";
765
- flipper.style.transformStyle = "preserve-3d";
766
- const pad = 0.5; // half-pixel overlap to hide sub-pixel seams
767
- if (isH) {
768
- flipper.style.left = "0";
769
- flipper.style.top = `${i * d - pad}px`;
770
- flipper.style.width = `${slideW}px`;
771
- flipper.style.height = `${d + pad * 2}px`;
772
- }
773
- else {
774
- flipper.style.top = "0";
775
- flipper.style.left = `${i * d - pad}px`;
776
- flipper.style.width = `${d + pad * 2}px`;
777
- flipper.style.height = `${slideH}px`;
778
- }
779
- // transform-origin defaults to center — correct for box-centre rotation
780
- // Front face: outgoing content, pushed forward by d/2
781
- const front = createBlindFace(outCanvas, i, N, isH, pad);
782
- front.style.backfaceVisibility = "hidden";
783
- front.style.transform = `translateZ(${d / 2}px)`;
784
- // Bottom/right face: incoming content, rotated into position then pushed out
785
- const bottom = createBlindFace(inCanvas, i, N, isH, pad);
786
- bottom.style.backfaceVisibility = "hidden";
787
- bottom.style.transform = isH
788
- ? `rotateX(-90deg) translateZ(${d / 2}px)`
789
- : `rotateY(90deg) translateZ(${d / 2}px)`;
790
- flipper.appendChild(front);
791
- flipper.appendChild(bottom);
792
- scene.appendChild(flipper);
793
- flippers.push(flipper);
794
- }
795
- return { flippers, halfDepth: d / 2 };
796
- }
797
- /** Create a canvas element showing one strip slice of a source canvas.
798
- * The slice includes `pad` CSS-pixel overlap on each side so that
799
- * `width:100%; height:100%` fills the padded flipper without scaling. */
800
- function createBlindFace(source, index, total, isHorizontal, pad) {
801
- const dpr = window.devicePixelRatio || 1;
802
- const padPx = Math.ceil(pad * dpr); // padding in device pixels
803
- const canvas = document.createElement("canvas");
804
- canvas.style.position = "absolute";
805
- canvas.style.top = "0";
806
- canvas.style.left = "0";
807
- canvas.style.width = "100%";
808
- canvas.style.height = "100%";
809
- canvas.style.display = "block";
810
- if (isHorizontal) {
811
- const stripTop = Math.round((index * source.height) / total);
812
- const stripBot = Math.round(((index + 1) * source.height) / total);
813
- const sy = Math.max(0, stripTop - padPx);
814
- const syEnd = Math.min(source.height, stripBot + padPx);
815
- const sh = syEnd - sy;
816
- canvas.width = source.width;
817
- canvas.height = sh;
818
- const ctx = canvas.getContext("2d");
819
- if (ctx)
820
- ctx.drawImage(source, 0, sy, source.width, sh, 0, 0, source.width, sh);
821
- }
822
- else {
823
- const stripLeft = Math.round((index * source.width) / total);
824
- const stripRight = Math.round(((index + 1) * source.width) / total);
825
- const sx = Math.max(0, stripLeft - padPx);
826
- const sxEnd = Math.min(source.width, stripRight + padPx);
827
- const sw = sxEnd - sx;
828
- canvas.width = sw;
829
- canvas.height = source.height;
830
- const ctx = canvas.getContext("2d");
831
- if (ctx)
832
- ctx.drawImage(source, sx, 0, sw, source.height, 0, 0, sw, source.height);
833
- }
834
- return canvas;
835
- }
836
- /**
837
- * Comb: N strips revealed from alternating directions.
838
- * Horizontal = even strips from left, odd from right.
839
- * Vertical = even strips from top, odd from bottom.
840
- */
841
- function combEffect(orientation) {
842
- const N = BLIND_STRIPS;
843
- return (t, _outgoing, incoming) => {
844
- if (t >= 1) {
845
- incoming.style.clipPath = "none";
846
- return;
847
- }
848
- // Each rectangle is anchored through the origin (0% 0%) so that
849
- // bridges between non-adjacent strips retrace and produce zero
850
- // net winding — no visible triangles between strips.
851
- const points = [];
852
- if (orientation === "horizontal") {
853
- const stripH = 100 / N;
854
- for (let i = 0; i < N; i++) {
855
- const top = i * stripH;
856
- const bot = (i + 1) * stripH;
857
- points.push("0% 0%");
858
- if (i % 2 === 0) {
859
- const r = t * 100;
860
- points.push(`0% ${top}%`, `${r}% ${top}%`, `${r}% ${bot}%`, `0% ${bot}%`, `0% ${top}%`);
861
- }
862
- else {
863
- const l = (1 - t) * 100;
864
- points.push(`${l}% ${top}%`, `100% ${top}%`, `100% ${bot}%`, `${l}% ${bot}%`, `${l}% ${top}%`);
865
- }
866
- points.push("0% 0%");
867
- }
868
- }
869
- else {
870
- const stripW = 100 / N;
871
- for (let i = 0; i < N; i++) {
872
- const left = i * stripW;
873
- const right = (i + 1) * stripW;
874
- points.push("0% 0%");
875
- if (i % 2 === 0) {
876
- const b = t * 100;
877
- points.push(`${left}% 0%`, `${right}% 0%`, `${right}% ${b}%`, `${left}% ${b}%`, `${left}% 0%`);
878
- }
879
- else {
880
- const tp = (1 - t) * 100;
881
- points.push(`${left}% ${tp}%`, `${right}% ${tp}%`, `${right}% 100%`, `${left}% 100%`, `${left}% ${tp}%`);
882
- }
883
- points.push("0% 0%");
884
- }
885
- }
886
- incoming.style.clipPath = `polygon(${points.join(", ")})`;
887
- };
888
- }
889
- // ---------------------------------------------------------------------------
890
- // Wheel / Wedge
891
- // ---------------------------------------------------------------------------
892
- /** Arc resolution for wheel/wedge polygon approximation. */
893
- const ARC_STEPS = 12;
894
- /** Radius large enough to fully cover a rectangular element from center. */
895
- const SWEEP_RADIUS = 75;
896
- /**
897
- * Wheel: N spokes sweep from 12 o'clock, revealing N sectors simultaneously.
898
- * @param clockwise true = clockwise (wheel), false = counter-clockwise (wheelReverse)
899
- */
900
- function wheelSweepEffect(spokes, clockwise) {
901
- const n = Math.max(1, spokes);
902
- const dir = clockwise ? 1 : -1;
903
- return (t, _outgoing, incoming) => {
904
- if (t >= 1) {
905
- clearMask(incoming);
906
- return;
907
- }
908
- if (t <= 0) {
909
- applyMask(incoming, svgMask(`<polygon points="50,50 50,50 50,50" fill="white" filter="url(#b)"/>`, 0));
910
- return;
911
- }
912
- const blur = Math.max(0.1, t * 50 * 0.01);
913
- const sectorAngle = 360 / n;
914
- const sweep = t * sectorAngle;
915
- let path = "";
916
- for (let s = 0; s < n; s++) {
917
- const startDeg = -90 + s * sectorAngle;
918
- path += "M50,50 ";
919
- for (let j = 0; j <= ARC_STEPS; j++) {
920
- const deg = startDeg + dir * (j / ARC_STEPS) * sweep;
921
- const rad = (deg * Math.PI) / 180;
922
- path += `L${50 + SWEEP_RADIUS * Math.cos(rad)},${50 + SWEEP_RADIUS * Math.sin(rad)} `;
923
- }
924
- path += "Z ";
925
- }
926
- applyMask(incoming, svgMask(`<path d="${path}" fill="white" filter="url(#b)"/>`, blur));
927
- };
928
- }
929
- /**
930
- * Wedge: two sectors expand symmetrically from 12 o'clock (one CW, one CCW).
931
- */
932
- function wedgeEffect(t, _outgoing, incoming) {
933
- if (t >= 1) {
934
- clearMask(incoming);
935
- return;
936
- }
937
- if (t <= 0) {
938
- applyMask(incoming, svgMask(`<polygon points="50,50 50,50 50,50" fill="white" filter="url(#b)"/>`, 0));
939
- return;
940
- }
941
- const blur = Math.max(0.3, t * 50 * 0.06);
942
- const sweep = t * 180;
943
- let path = "M50,50 ";
944
- // Counter-clockwise half
945
- for (let j = ARC_STEPS; j >= 0; j--) {
946
- const deg = -90 - (j / ARC_STEPS) * sweep;
947
- const rad = (deg * Math.PI) / 180;
948
- path += `L${50 + SWEEP_RADIUS * Math.cos(rad)},${50 + SWEEP_RADIUS * Math.sin(rad)} `;
949
- }
950
- // Clockwise half
951
- for (let j = 0; j <= ARC_STEPS; j++) {
952
- const deg = -90 + (j / ARC_STEPS) * sweep;
953
- const rad = (deg * Math.PI) / 180;
954
- path += `L${50 + SWEEP_RADIUS * Math.cos(rad)},${50 + SWEEP_RADIUS * Math.sin(rad)} `;
955
- }
956
- path += "Z";
957
- applyMask(incoming, svgMask(`<path d="${path}" fill="white" filter="url(#b)"/>`, blur));
958
- }
959
- // ---------------------------------------------------------------------------
960
- // Checker / Random Bar
961
- // ---------------------------------------------------------------------------
962
- const CHECKER_COLS = 8;
963
- const CHECKER_ROWS = 6;
964
- /**
965
- * Checker: 3D tile-flip effect in a checkerboard pattern.
966
- *
967
- * The slide is divided into a grid of tiles. Each tile is a 3D object
968
- * with the outgoing slide on the front face and the incoming slide on
969
- * the back face. Tiles flip 180° around the X axis (across/horizontal)
970
- * or Y axis (down/vertical), staggered in a checkerboard sweep pattern.
971
- */
972
- function checkerEffect(orientation) {
973
- const isH = orientation === "horizontal";
974
- const cols = CHECKER_COLS;
975
- const rows = CHECKER_ROWS;
976
- let setup = null;
977
- // Sweep across columns (horizontal) or down rows (vertical),
978
- // with checkerboard phase offset.
979
- const sweepLen = (isH ? cols : rows) + 1;
980
- const flipDur = 3; // each tile takes 3 sweep-units to flip
981
- const totalLen = sweepLen + flipDur;
982
- return (t, outgoing, incoming) => {
983
- if (t >= 1) {
984
- incoming.style.opacity = "";
985
- incoming.style.clipPath = "none";
986
- return;
987
- }
988
- if (!setup) {
989
- setup = setupChecker3D(outgoing, incoming, cols, rows, isH);
990
- }
991
- const sweep = t * totalLen;
992
- for (let r = 0; r < rows; r++) {
993
- for (let c = 0; c < cols; c++) {
994
- const idx = r * cols + c;
995
- const pos = isH ? c : r;
996
- const phase = (r + c) % 2;
997
- const cellStart = pos + phase;
998
- const cellT = Math.max(0, Math.min(1, (sweep - cellStart) / flipDur));
999
- const angle = cellT * 180;
1000
- setup.flippers[idx].style.transform = isH ? `rotateY(-${angle}deg)` : `rotateX(${angle}deg)`;
1001
- }
1002
- }
1003
- };
1004
- }
1005
- /**
1006
- * Build a grid of 3D flipper tiles for the checker transition.
1007
- *
1008
- * DOM structure:
1009
- * outgoing [container]
1010
- * ├── backdrop [black background]
1011
- * └── scene [perspective, preserve-3d]
1012
- * ├── flipper-0,0 [preserve-3d, rotateX/Y]
1013
- * │ ├── front [canvas tile of outgoing]
1014
- * │ └── back [canvas tile of incoming, rotated 180°]
1015
- * ├── flipper-0,1 ...
1016
- * └── ...
1017
- */
1018
- function setupChecker3D(outgoing, incoming, cols, rows, isH) {
1019
- const outCanvas = outgoing.querySelector("canvas");
1020
- const inCanvas = incoming.querySelector(".udoc-spread__canvas") ??
1021
- incoming.querySelector("canvas");
1022
- if (!outCanvas || !inCanvas || outCanvas.width === 0 || inCanvas.width === 0) {
1023
- return { flippers: [] };
1024
- }
1025
- // Derive CSS dimensions from the canvas physical size / DPR so they are
1026
- // on exact device-pixel boundaries (the snapshot is built this way).
1027
- const dpr = window.devicePixelRatio || 1;
1028
- const slideW = outCanvas.width / dpr;
1029
- const slideH = outCanvas.height / dpr;
1030
- const tileW = slideW / cols;
1031
- const tileH = slideH / rows;
1032
- outgoing.innerHTML = "";
1033
- outgoing.style.overflow = "visible";
1034
- outgoing.style.zIndex = "1";
1035
- incoming.style.opacity = "0";
1036
- const backdrop = document.createElement("div");
1037
- backdrop.style.position = "absolute";
1038
- backdrop.style.left = "0";
1039
- backdrop.style.top = "0";
1040
- backdrop.style.width = `${slideW}px`;
1041
- backdrop.style.height = `${slideH}px`;
1042
- backdrop.style.background = "#000";
1043
- outgoing.appendChild(backdrop);
1044
- const scene = document.createElement("div");
1045
- scene.style.position = "absolute";
1046
- scene.style.left = "0";
1047
- scene.style.top = "0";
1048
- scene.style.width = `${slideW}px`;
1049
- scene.style.height = `${slideH}px`;
1050
- scene.style.perspective = `${Math.max(slideW, slideH) * 2}px`;
1051
- scene.style.transformStyle = "preserve-3d";
1052
- outgoing.appendChild(scene);
1053
- const flippers = [];
1054
- for (let r = 0; r < rows; r++) {
1055
- for (let c = 0; c < cols; c++) {
1056
- const flipper = document.createElement("div");
1057
- flipper.style.position = "absolute";
1058
- flipper.style.transformStyle = "preserve-3d";
1059
- const pad = 0.5; // half-pixel overlap to hide sub-pixel seams
1060
- flipper.style.left = `${c * tileW - pad}px`;
1061
- flipper.style.top = `${r * tileH - pad}px`;
1062
- flipper.style.width = `${tileW + pad * 2}px`;
1063
- flipper.style.height = `${tileH + pad * 2}px`;
1064
- const front = createCheckerFace(outCanvas, c, r, cols, rows, pad);
1065
- front.style.backfaceVisibility = "hidden";
1066
- const back = createCheckerFace(inCanvas, c, r, cols, rows, pad);
1067
- back.style.backfaceVisibility = "hidden";
1068
- back.style.transform = isH ? "rotateY(-180deg)" : "rotateX(180deg)";
1069
- flipper.appendChild(front);
1070
- flipper.appendChild(back);
1071
- scene.appendChild(flipper);
1072
- flippers.push(flipper);
1073
- }
1074
- }
1075
- return { flippers };
1076
- }
1077
- /** Create a canvas element showing one tile of a source canvas.
1078
- * The slice includes `pad` CSS-pixel overlap on each side so that
1079
- * `width:100%; height:100%` fills the padded flipper without scaling. */
1080
- function createCheckerFace(source, col, row, cols, rows, pad) {
1081
- const dpr = window.devicePixelRatio || 1;
1082
- const padPx = Math.ceil(pad * dpr);
1083
- const canvas = document.createElement("canvas");
1084
- canvas.style.position = "absolute";
1085
- canvas.style.top = "0";
1086
- canvas.style.left = "0";
1087
- canvas.style.width = "100%";
1088
- canvas.style.height = "100%";
1089
- canvas.style.display = "block";
1090
- const tileLeft = Math.round((col * source.width) / cols);
1091
- const tileRight = Math.round(((col + 1) * source.width) / cols);
1092
- const tileTop = Math.round((row * source.height) / rows);
1093
- const tileBot = Math.round(((row + 1) * source.height) / rows);
1094
- const sx = Math.max(0, tileLeft - padPx);
1095
- const sxEnd = Math.min(source.width, tileRight + padPx);
1096
- const sy = Math.max(0, tileTop - padPx);
1097
- const syEnd = Math.min(source.height, tileBot + padPx);
1098
- const sw = sxEnd - sx;
1099
- const sh = syEnd - sy;
1100
- canvas.width = sw;
1101
- canvas.height = sh;
1102
- const ctx = canvas.getContext("2d");
1103
- if (ctx)
1104
- ctx.drawImage(source, sx, sy, sw, sh, 0, 0, sw, sh);
1105
- return canvas;
1106
- }
1107
- // ---------------------------------------------------------------------------
1108
- // Vortex
1109
- // ---------------------------------------------------------------------------
1110
- const VORTEX_COLS = 40;
1111
- const VORTEX_ROWS = 22;
1112
- /**
1113
- * Vortex: 3D tile-orbit effect around the slide center.
1114
- *
1115
- * The slide is divided into a fine grid of tiles. Two independent sets are
1116
- * created (outgoing and incoming). Each tile orbits around the screen
1117
- * center's Y axis (horizontal direction) or X axis (vertical direction)
1118
- * using CSS 3D transforms with perspective and preserve-3d.
1119
- *
1120
- * Outgoing tiles rotate from 0° to 180° (going behind the screen);
1121
- * incoming tiles rotate from -180° to 0° (emerging from behind).
1122
- * backface-visibility:hidden provides natural tile visibility.
1123
- * Stagger by direction creates a wave-like vortex sweep.
1124
- *
1125
- * The orbit is achieved via the translate-rotate-translate trick:
1126
- * translateX(dx) rotateY(θ) translateX(-dx)
1127
- * where dx = distance from tile center to slide center. This orbits
1128
- * each tile around the slide center at its own radius.
1129
- */
1130
- function vortexEffect(dir) {
1131
- let setup = null;
1132
- const isH = dir === "left" || dir === "right";
1133
- // Rotation sign determines which side goes behind the screen first.
1134
- const rotSign = dir === "right" || dir === "up" ? 1 : -1;
1135
- return (t, outgoing, incoming) => {
1136
- if (t >= 1) {
1137
- incoming.style.opacity = "";
1138
- incoming.style.clipPath = "none";
1139
- return;
1140
- }
1141
- if (!setup) {
1142
- setup = setupVortex(outgoing, incoming, VORTEX_COLS, VORTEX_ROWS, dir);
1143
- }
1144
- if (!setup) {
1145
- outgoing.style.zIndex = "1";
1146
- outgoing.style.opacity = `${1 - t}`;
1147
- return;
1148
- }
1149
- const { outTiles, inTiles, tileData } = setup;
1150
- for (let i = 0; i < tileData.length; i++) {
1151
- const { dx, dy, outStagger, inStagger, zSign, zRand, driftRand } = tileData[i];
1152
- // Outgoing: orbit 0° → 180° (backface hides past 90°)
1153
- const outLocalT = vortexClamp01((t - outStagger * 0.4) / 0.55);
1154
- const outDeg = rotSign * outLocalT * 180;
1155
- const outZ = zSign * Math.sin(outLocalT * Math.PI) * 200 * zRand;
1156
- const outDrift = Math.sin(outLocalT * Math.PI) * (isH ? dy * 0.5 : dx * 0.5) * driftRand;
1157
- outTiles[i].style.transform = isH
1158
- ? `translate3d(${dx}px,${outDrift}px,${outZ}px) rotateY(${outDeg}deg) translateX(${-dx}px)`
1159
- : `translate3d(${outDrift}px,${dy}px,${outZ}px) rotateX(${outDeg}deg) translateY(${-dy}px)`;
1160
- // Incoming: orbit -180° → 0° (assembles from opposite side)
1161
- const inLocalT = vortexClamp01((t - 0.1 - inStagger * 0.4) / 0.55);
1162
- if (inLocalT >= 1) {
1163
- inTiles[i].style.transform = "none";
1164
- }
1165
- else {
1166
- const inDeg = rotSign * (-180 + inLocalT * 180);
1167
- const inZ = zSign * Math.sin(inLocalT * Math.PI) * 200 * zRand;
1168
- const inDrift = Math.sin(inLocalT * Math.PI) * (isH ? dy * 0.5 : dx * 0.5) * driftRand;
1169
- inTiles[i].style.transform = isH
1170
- ? `translate3d(${dx}px,${inDrift}px,${inZ}px) rotateY(${inDeg}deg) translateX(${-dx}px)`
1171
- : `translate3d(${inDrift}px,${dy}px,${inZ}px) rotateX(${inDeg}deg) translateY(${-dy}px)`;
1172
- }
1173
- }
1174
- };
1175
- }
1176
- function vortexClamp01(v) {
1177
- return v < 0 ? 0 : v > 1 ? 1 : v;
1178
- }
1179
- function setupVortex(outgoing, incoming, cols, rows, dir) {
1180
- const outCanvas = outgoing.querySelector("canvas");
1181
- const inCanvas = incoming.querySelector(".udoc-spread__canvas") ??
1182
- incoming.querySelector("canvas");
1183
- if (!outCanvas || !inCanvas || outCanvas.width === 0 || inCanvas.width === 0) {
1184
- return null;
1185
- }
1186
- const dpr = window.devicePixelRatio || 1;
1187
- const slideW = outCanvas.width / dpr;
1188
- const slideH = outCanvas.height / dpr;
1189
- const tileW = slideW / cols;
1190
- const tileH = slideH / rows;
1191
- const cx = slideW / 2;
1192
- const cy = slideH / 2;
1193
- const isH = dir === "left" || dir === "right";
1194
- const rotSign = dir === "right" || dir === "up" ? 1 : -1;
1195
- outgoing.innerHTML = "";
1196
- outgoing.style.overflow = "visible";
1197
- outgoing.style.zIndex = "1";
1198
- incoming.style.opacity = "0";
1199
- // Black backdrop (flat, outside the 3D context)
1200
- const backdrop = document.createElement("div");
1201
- backdrop.style.position = "absolute";
1202
- backdrop.style.left = "0";
1203
- backdrop.style.top = "0";
1204
- backdrop.style.width = `${slideW}px`;
1205
- backdrop.style.height = `${slideH}px`;
1206
- backdrop.style.background = "#000";
1207
- outgoing.appendChild(backdrop);
1208
- // 3D scene container
1209
- const scene = document.createElement("div");
1210
- scene.style.position = "absolute";
1211
- scene.style.left = "0";
1212
- scene.style.top = "0";
1213
- scene.style.width = `${slideW}px`;
1214
- scene.style.height = `${slideH}px`;
1215
- scene.style.perspective = `${Math.max(slideW, slideH) * 2}px`;
1216
- scene.style.transformStyle = "preserve-3d";
1217
- outgoing.appendChild(scene);
1218
- const outTiles = [];
1219
- const inTiles = [];
1220
- const tileData = [];
1221
- for (let r = 0; r < rows; r++) {
1222
- for (let c = 0; c < cols; c++) {
1223
- const tileX = (c + 0.5) * tileW;
1224
- const tileY = (r + 0.5) * tileH;
1225
- const dx = cx - tileX;
1226
- const dy = cy - tileY;
1227
- // Outgoing stagger: break direction (right = left side first).
1228
- // Incoming stagger: reversed (right = right side assembles last).
1229
- const colN = c / Math.max(1, cols - 1);
1230
- const rowN = r / Math.max(1, rows - 1);
1231
- let outSt;
1232
- let inSt;
1233
- switch (dir) {
1234
- case "right":
1235
- outSt = colN * 0.7 + rowN * 0.3;
1236
- inSt = (1 - colN) * 0.7 + (1 - rowN) * 0.3;
1237
- break;
1238
- case "left":
1239
- outSt = (1 - colN) * 0.7 + rowN * 0.3;
1240
- inSt = colN * 0.7 + (1 - rowN) * 0.3;
1241
- break;
1242
- case "down":
1243
- outSt = rowN * 0.7 + colN * 0.3;
1244
- inSt = (1 - rowN) * 0.7 + (1 - colN) * 0.3;
1245
- break;
1246
- case "up":
1247
- outSt = (1 - rowN) * 0.7 + colN * 0.3;
1248
- inSt = rowN * 0.7 + (1 - colN) * 0.3;
1249
- break;
1250
- }
1251
- // Per-tile randomness so the vortex looks organic
1252
- const jitter = (Math.random() - 0.5) * 0.15;
1253
- tileData.push({
1254
- dx,
1255
- dy,
1256
- outStagger: Math.max(0, Math.min(1, outSt + jitter)),
1257
- inStagger: Math.max(0, Math.min(1, inSt + jitter)),
1258
- zSign: Math.random() < 0.5 ? -1 : 1, // half toward camera, half away
1259
- zRand: 0.5 + Math.random(),
1260
- driftRand: 0.3 + Math.random() * 1.4,
1261
- });
1262
- // Outgoing tile (starts at grid position, no initial rotation)
1263
- const outTile = createCheckerFace(outCanvas, c, r, cols, rows, 0);
1264
- outTile.style.left = `${c * tileW}px`;
1265
- outTile.style.top = `${r * tileH}px`;
1266
- outTile.style.width = `${tileW}px`;
1267
- outTile.style.height = `${tileH}px`;
1268
- outTile.style.backfaceVisibility = "hidden";
1269
- outTile.style.setProperty("-webkit-backface-visibility", "hidden");
1270
- scene.appendChild(outTile);
1271
- outTiles.push(outTile);
1272
- // Incoming tile (starts rotated 180°, hidden by backface-visibility)
1273
- const inTile = createCheckerFace(inCanvas, c, r, cols, rows, 0);
1274
- inTile.style.left = `${c * tileW}px`;
1275
- inTile.style.top = `${r * tileH}px`;
1276
- inTile.style.width = `${tileW}px`;
1277
- inTile.style.height = `${tileH}px`;
1278
- inTile.style.backfaceVisibility = "hidden";
1279
- inTile.style.setProperty("-webkit-backface-visibility", "hidden");
1280
- const initDeg = rotSign * -180;
1281
- inTile.style.transform = isH
1282
- ? `translate3d(${dx}px,0px,0px) rotateY(${initDeg}deg) translateX(${-dx}px)`
1283
- : `translate3d(0px,${dy}px,0px) rotateX(${initDeg}deg) translateY(${-dy}px)`;
1284
- scene.appendChild(inTile);
1285
- inTiles.push(inTile);
1286
- }
1287
- }
1288
- return { outTiles, inTiles, tileData };
1289
- }
1290
- // ---------------------------------------------------------------------------
1291
- // Dissolve
1292
- // ---------------------------------------------------------------------------
1293
- const DISSOLVE_COLS = 60;
1294
- const DISSOLVE_ROWS = 40;
1295
- /**
1296
- * Dissolve: random grid cells appear progressively, approximating PowerPoint's
1297
- * pixelated dissolve pattern. Cells snap fully visible in shuffled order.
1298
- */
1299
- function dissolveEffect() {
1300
- const total = DISSOLVE_COLS * DISSOLVE_ROWS;
1301
- // Fisher-Yates shuffle — computed once per transition
1302
- const order = Array.from({ length: total }, (_, i) => i);
1303
- for (let i = total - 1; i > 0; i--) {
1304
- const j = Math.floor(Math.random() * (i + 1));
1305
- [order[i], order[j]] = [order[j], order[i]];
1306
- }
1307
- return (t, _outgoing, incoming) => {
1308
- if (t >= 1) {
1309
- incoming.style.clipPath = "none";
1310
- return;
1311
- }
1312
- const revealed = Math.ceil(t * total);
1313
- if (revealed <= 0) {
1314
- incoming.style.clipPath = "polygon(0% 0%, 0% 0%, 0% 0%)";
1315
- return;
1316
- }
1317
- const cellW = 100 / DISSOLVE_COLS;
1318
- const cellH = 100 / DISSOLVE_ROWS;
1319
- const points = [];
1320
- for (let k = 0; k < revealed; k++) {
1321
- const idx = order[k];
1322
- const c = idx % DISSOLVE_COLS;
1323
- const r = Math.floor(idx / DISSOLVE_COLS);
1324
- const left = c * cellW;
1325
- const top = r * cellH;
1326
- points.push("0% 0%", `${left}% ${top}%`, `${left + cellW}% ${top}%`, `${left + cellW}% ${top + cellH}%`, `${left}% ${top + cellH}%`, `${left}% ${top}%`, "0% 0%");
1327
- }
1328
- incoming.style.clipPath = `polygon(${points.join(", ")})`;
1329
- };
1330
- }
1331
- // ---------------------------------------------------------------------------
1332
- // Random Bar
1333
- // ---------------------------------------------------------------------------
1334
- const RANDOM_BAR_COUNT = 10;
1335
- /**
1336
- * Random Bar: bars revealed in shuffled order.
1337
- * Each bar fully appears before the next starts, creating a staggered wipe.
1338
- */
1339
- function randomBarEffect(orientation) {
1340
- const N = RANDOM_BAR_COUNT;
1341
- // Fisher-Yates shuffle — computed once per transition
1342
- const order = Array.from({ length: N }, (_, i) => i);
1343
- for (let i = N - 1; i > 0; i--) {
1344
- const j = Math.floor(Math.random() * (i + 1));
1345
- [order[i], order[j]] = [order[j], order[i]];
1346
- }
1347
- return (t, _outgoing, incoming) => {
1348
- if (t >= 1) {
1349
- incoming.style.clipPath = "none";
1350
- return;
1351
- }
1352
- // How many bars are fully or partially revealed
1353
- const progress = t * N;
1354
- const revealed = Math.floor(progress);
1355
- const partial = progress - revealed;
1356
- const points = [];
1357
- for (let k = 0; k <= revealed && k < N; k++) {
1358
- const barIndex = order[k];
1359
- const barT = k < revealed ? 1 : partial;
1360
- if (barT <= 0)
1361
- continue;
1362
- if (orientation === "horizontal") {
1363
- const stripH = 100 / N;
1364
- const top = barIndex * stripH;
1365
- const right = barT * 100;
1366
- points.push(`0% ${top}%`, `${right}% ${top}%`, `${right}% ${top + stripH}%`, `0% ${top + stripH}%`, `0% ${top}%`);
1367
- }
1368
- else {
1369
- const stripW = 100 / N;
1370
- const left = barIndex * stripW;
1371
- const bot = barT * 100;
1372
- points.push(`${left}% 0%`, `${left + stripW}% 0%`, `${left + stripW}% ${bot}%`, `${left}% ${bot}%`, `${left}% 0%`);
1373
- }
1374
- }
1375
- if (points.length === 0) {
1376
- incoming.style.clipPath = "polygon(0% 0%, 0% 0%, 0% 0%)";
1377
- }
1378
- else {
1379
- incoming.style.clipPath = `polygon(${points.join(", ")})`;
1380
- }
1381
- };
1382
- }
1383
- //# sourceMappingURL=transition.js.map