dbf-mirador 4.2.3

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 (384) hide show
  1. package/LICENSE +203 -0
  2. package/README.md +133 -0
  3. package/dist/CommentSharp-B0J_-jEq.js +325 -0
  4. package/dist/CommentSharp-B0J_-jEq.js.map +1 -0
  5. package/dist/FailedImageContext-aQXnWSHN.js +318 -0
  6. package/dist/FailedImageContext-aQXnWSHN.js.map +1 -0
  7. package/dist/PluginHook-CFw_6P5c.js +54 -0
  8. package/dist/PluginHook-CFw_6P5c.js.map +1 -0
  9. package/dist/WindowCanvasNavigationControls-CUX723BQ.js +242 -0
  10. package/dist/WindowCanvasNavigationControls-CUX723BQ.js.map +1 -0
  11. package/dist/action-types-DjIbTE-A.js +74 -0
  12. package/dist/action-types-DjIbTE-A.js.map +1 -0
  13. package/dist/canvas-C8oHvXFN.js +41 -0
  14. package/dist/canvas-C8oHvXFN.js.map +1 -0
  15. package/dist/canvases-gRqhr-IH.js +3154 -0
  16. package/dist/canvases-gRqhr-IH.js.map +1 -0
  17. package/dist/createSvgIcon-Cwt8YPfm.js +2 -0
  18. package/dist/getters-COus7Mvg.js +2066 -0
  19. package/dist/getters-COus7Mvg.js.map +1 -0
  20. package/dist/index.module-CbBRf_R8.js +403 -0
  21. package/dist/index.module-CbBRf_R8.js.map +1 -0
  22. package/dist/mirador.es.js +39600 -0
  23. package/dist/mirador.es.js.map +1 -0
  24. package/dist/mirador.min.js +334 -0
  25. package/dist/mirador.min.js.map +1 -0
  26. package/dist/react-error-boundary.esm-B_pT-oCS.js +67 -0
  27. package/dist/react-error-boundary.esm-B_pT-oCS.js.map +1 -0
  28. package/dist/visuallyHidden-DmYvwNdU.js +98 -0
  29. package/dist/visuallyHidden-DmYvwNdU.js.map +1 -0
  30. package/dist/window-zelwU7wz.js +138 -0
  31. package/dist/window-zelwU7wz.js.map +1 -0
  32. package/package.json +138 -0
  33. package/src/components/AccessTokenSender.jsx +34 -0
  34. package/src/components/AnnotationSettings.jsx +31 -0
  35. package/src/components/AnnotationsOverlay.jsx +328 -0
  36. package/src/components/App.jsx +34 -0
  37. package/src/components/AppProviders.jsx +129 -0
  38. package/src/components/AttributionPanel.jsx +78 -0
  39. package/src/components/AudioViewer.jsx +39 -0
  40. package/src/components/BackgroundPluginArea.jsx +9 -0
  41. package/src/components/Branding.jsx +33 -0
  42. package/src/components/CanvasAnnotations.jsx +125 -0
  43. package/src/components/CanvasInfo.jsx +46 -0
  44. package/src/components/CanvasLayers.jsx +367 -0
  45. package/src/components/ChangeThemeDialog.jsx +65 -0
  46. package/src/components/CollapsibleSection.jsx +53 -0
  47. package/src/components/CollectionDialog.jsx +236 -0
  48. package/src/components/CollectionInfo.jsx +48 -0
  49. package/src/components/CompanionArea.jsx +140 -0
  50. package/src/components/CompanionWindow.jsx +228 -0
  51. package/src/components/CompanionWindowFactory.jsx +38 -0
  52. package/src/components/CompanionWindowSection.jsx +11 -0
  53. package/src/components/CustomPanel.jsx +22 -0
  54. package/src/components/ErrorContent.jsx +65 -0
  55. package/src/components/ErrorDialog.jsx +47 -0
  56. package/src/components/FullScreenButton.jsx +47 -0
  57. package/src/components/GalleryView.jsx +36 -0
  58. package/src/components/GalleryViewThumbnail.jsx +160 -0
  59. package/src/components/IIIFAuthentication.jsx +144 -0
  60. package/src/components/IIIFDropTarget.jsx +168 -0
  61. package/src/components/IIIFIFrameCommunication.jsx +45 -0
  62. package/src/components/IIIFResourceLabel.jsx +26 -0
  63. package/src/components/IIIFThumbnail.jsx +214 -0
  64. package/src/components/ImageFailureMessage.jsx +42 -0
  65. package/src/components/LabelValueMetadata.jsx +46 -0
  66. package/src/components/LanguageSettings.jsx +46 -0
  67. package/src/components/LayersPanel.jsx +24 -0
  68. package/src/components/LocalePicker.jsx +56 -0
  69. package/src/components/ManifestForm.jsx +79 -0
  70. package/src/components/ManifestInfo.jsx +67 -0
  71. package/src/components/ManifestListItem.jsx +209 -0
  72. package/src/components/ManifestListItemError.jsx +53 -0
  73. package/src/components/ManifestRelatedLinks.jsx +154 -0
  74. package/src/components/MinimalWindow.jsx +104 -0
  75. package/src/components/MiradorMenuButton.jsx +71 -0
  76. package/src/components/MosaicRenderPreview.jsx +16 -0
  77. package/src/components/NestedMenu.jsx +42 -0
  78. package/src/components/NewBrowserWindow.jsx +34 -0
  79. package/src/components/OpenSeadragonComponent.jsx +258 -0
  80. package/src/components/OpenSeadragonTileSource.jsx +105 -0
  81. package/src/components/OpenSeadragonViewer.jsx +161 -0
  82. package/src/components/PluginHook.jsx +27 -0
  83. package/src/components/PrimaryWindow.jsx +115 -0
  84. package/src/components/SanitizedHtml.jsx +37 -0
  85. package/src/components/ScrollIndicatedDialogContent.jsx +60 -0
  86. package/src/components/ScrollTo.jsx +61 -0
  87. package/src/components/SearchHit.jsx +220 -0
  88. package/src/components/SearchPanel.jsx +80 -0
  89. package/src/components/SearchPanelControls.jsx +174 -0
  90. package/src/components/SearchPanelNavigation.jsx +84 -0
  91. package/src/components/SearchResults.jsx +138 -0
  92. package/src/components/SelectCollection.jsx +44 -0
  93. package/src/components/SidebarIndexItem.jsx +11 -0
  94. package/src/components/SidebarIndexList.jsx +73 -0
  95. package/src/components/SidebarIndexTableOfContents.jsx +170 -0
  96. package/src/components/SidebarIndexThumbnail.jsx +22 -0
  97. package/src/components/TextViewer.jsx +37 -0
  98. package/src/components/ThumbnailCanvasGrouping.jsx +122 -0
  99. package/src/components/ThumbnailNavigation.jsx +231 -0
  100. package/src/components/VideoViewer.jsx +35 -0
  101. package/src/components/ViewerInfo.jsx +55 -0
  102. package/src/components/ViewerNavigation.jsx +72 -0
  103. package/src/components/Window.jsx +150 -0
  104. package/src/components/WindowAuthenticationBar.jsx +176 -0
  105. package/src/components/WindowCanvasNavigationControls.jsx +91 -0
  106. package/src/components/WindowList.jsx +71 -0
  107. package/src/components/WindowListButton.jsx +57 -0
  108. package/src/components/WindowSideBar.jsx +48 -0
  109. package/src/components/WindowSideBarAnnotationsPanel.jsx +51 -0
  110. package/src/components/WindowSideBarButtons.jsx +151 -0
  111. package/src/components/WindowSideBarCanvasPanel.jsx +165 -0
  112. package/src/components/WindowSideBarCollectionPanel.jsx +179 -0
  113. package/src/components/WindowSideBarInfoPanel.jsx +67 -0
  114. package/src/components/WindowThumbnailSettings.jsx +130 -0
  115. package/src/components/WindowTopBar.jsx +125 -0
  116. package/src/components/WindowTopBarPluginArea.jsx +8 -0
  117. package/src/components/WindowTopBarPluginMenu.jsx +78 -0
  118. package/src/components/WindowTopBarTitle.jsx +73 -0
  119. package/src/components/WindowTopMenu.jsx +81 -0
  120. package/src/components/WindowTopMenuButton.jsx +49 -0
  121. package/src/components/WindowViewSettings.jsx +95 -0
  122. package/src/components/WindowViewer.jsx +26 -0
  123. package/src/components/Workspace.jsx +124 -0
  124. package/src/components/WorkspaceAdd.jsx +221 -0
  125. package/src/components/WorkspaceAddButton.jsx +73 -0
  126. package/src/components/WorkspaceArea.jsx +66 -0
  127. package/src/components/WorkspaceControlPanel.jsx +85 -0
  128. package/src/components/WorkspaceControlPanelButtons.jsx +20 -0
  129. package/src/components/WorkspaceDialog.jsx +11 -0
  130. package/src/components/WorkspaceElastic.jsx +88 -0
  131. package/src/components/WorkspaceElasticWindow.jsx +79 -0
  132. package/src/components/WorkspaceExport.jsx +99 -0
  133. package/src/components/WorkspaceImport.jsx +89 -0
  134. package/src/components/WorkspaceMenu.jsx +126 -0
  135. package/src/components/WorkspaceMenuButton.jsx +42 -0
  136. package/src/components/WorkspaceMosaic.jsx +149 -0
  137. package/src/components/WorkspaceOptionsButton.jsx +35 -0
  138. package/src/components/WorkspaceOptionsMenu.jsx +112 -0
  139. package/src/components/WorkspaceSelectionDialog.jsx +165 -0
  140. package/src/components/ZoomControls.jsx +57 -0
  141. package/src/components/icons/BookViewIcon.jsx +14 -0
  142. package/src/components/icons/CanvasIndexIcon.jsx +14 -0
  143. package/src/components/icons/GalleryViewIcon.jsx +17 -0
  144. package/src/components/icons/MiradorIcon.jsx +14 -0
  145. package/src/components/icons/RestoreZoomIcon.jsx +15 -0
  146. package/src/components/icons/ThumbnailNavigationBottomIcon.jsx +15 -0
  147. package/src/components/icons/ThumbnailNavigationRightIcon.jsx +16 -0
  148. package/src/components/icons/WindowMaxIcon.jsx +15 -0
  149. package/src/components/icons/WindowMinIcon.jsx +15 -0
  150. package/src/components/icons/WindowOptionsIcon.jsx +16 -0
  151. package/src/components/icons/WorkspaceTypeElasticIcon.jsx +157 -0
  152. package/src/components/icons/WorkspaceTypeMosaicIcon.jsx +162 -0
  153. package/src/components/icons/index.js +27 -0
  154. package/src/components/index.js +108 -0
  155. package/src/config/css-ns.js +10 -0
  156. package/src/config/index.js +2 -0
  157. package/src/config/settings.js +607 -0
  158. package/src/containers/AnnotationSettings.js +27 -0
  159. package/src/containers/AnnotationsOverlay.js +51 -0
  160. package/src/containers/AppProviders.js +20 -0
  161. package/src/containers/AttributionPanel.js +20 -0
  162. package/src/containers/AudioViewer.js +16 -0
  163. package/src/containers/BackgroundPluginArea.js +4 -0
  164. package/src/containers/Branding.js +4 -0
  165. package/src/containers/CanvasAnnotations.js +32 -0
  166. package/src/containers/CanvasInfo.js +20 -0
  167. package/src/containers/CanvasLayers.js +25 -0
  168. package/src/containers/ChangeThemeDialog.js +29 -0
  169. package/src/containers/CollapsibleSection.js +3 -0
  170. package/src/containers/CollectionDialog.js +48 -0
  171. package/src/containers/CollectionInfo.js +29 -0
  172. package/src/containers/CompanionArea.js +22 -0
  173. package/src/containers/CompanionWindow.js +40 -0
  174. package/src/containers/CompanionWindowFactory.js +23 -0
  175. package/src/containers/CustomPanel.js +13 -0
  176. package/src/containers/ErrorContent.js +20 -0
  177. package/src/containers/ErrorDialog.js +28 -0
  178. package/src/containers/FullScreenButton.js +22 -0
  179. package/src/containers/GalleryView.js +23 -0
  180. package/src/containers/GalleryViewThumbnail.js +51 -0
  181. package/src/containers/IIIFAuthentication.js +86 -0
  182. package/src/containers/IIIFThumbnail.js +17 -0
  183. package/src/containers/LabelValueMetadata.js +14 -0
  184. package/src/containers/LanguageSettings.js +26 -0
  185. package/src/containers/LayersPanel.js +16 -0
  186. package/src/containers/LocalePicker.js +3 -0
  187. package/src/containers/ManifestForm.js +16 -0
  188. package/src/containers/ManifestInfo.js +29 -0
  189. package/src/containers/ManifestListItem.js +52 -0
  190. package/src/containers/ManifestListItemError.js +15 -0
  191. package/src/containers/ManifestRelatedLinks.js +28 -0
  192. package/src/containers/MinimalWindow.js +25 -0
  193. package/src/containers/MiradorMenuButton.js +7 -0
  194. package/src/containers/MosaicRenderPreview.js +14 -0
  195. package/src/containers/OpenSeadragonViewer.js +59 -0
  196. package/src/containers/PrimaryWindow.js +27 -0
  197. package/src/containers/SanitizedHtml.js +3 -0
  198. package/src/containers/ScrollIndicatedDialogContent.js +3 -0
  199. package/src/containers/SearchHit.js +71 -0
  200. package/src/containers/SearchPanel.js +23 -0
  201. package/src/containers/SearchPanelControls.js +36 -0
  202. package/src/containers/SearchPanelNavigation.js +39 -0
  203. package/src/containers/SearchResults.js +38 -0
  204. package/src/containers/SelectCollection.js +24 -0
  205. package/src/containers/SidebarIndexItem.js +8 -0
  206. package/src/containers/SidebarIndexList.js +28 -0
  207. package/src/containers/SidebarIndexTableOfContents.js +31 -0
  208. package/src/containers/SidebarIndexThumbnail.js +18 -0
  209. package/src/containers/TextViewer.js +19 -0
  210. package/src/containers/ThumbnailCanvasGrouping.js +29 -0
  211. package/src/containers/ThumbnailNavigation.js +48 -0
  212. package/src/containers/VideoViewer.js +16 -0
  213. package/src/containers/ViewerInfo.js +30 -0
  214. package/src/containers/ViewerNavigation.js +31 -0
  215. package/src/containers/Window.js +45 -0
  216. package/src/containers/WindowAuthenticationBar.js +7 -0
  217. package/src/containers/WindowCanvasNavigationControls.js +15 -0
  218. package/src/containers/WindowList.js +30 -0
  219. package/src/containers/WindowListButton.js +15 -0
  220. package/src/containers/WindowSideBar.js +20 -0
  221. package/src/containers/WindowSideBarAnnotationsPanel.js +23 -0
  222. package/src/containers/WindowSideBarButtons.js +75 -0
  223. package/src/containers/WindowSideBarCanvasPanel.js +50 -0
  224. package/src/containers/WindowSideBarCollectionPanel.js +48 -0
  225. package/src/containers/WindowSideBarInfoPanel.js +35 -0
  226. package/src/containers/WindowThumbnailSettings.js +31 -0
  227. package/src/containers/WindowTopBar.js +39 -0
  228. package/src/containers/WindowTopBarPluginArea.js +8 -0
  229. package/src/containers/WindowTopBarPluginMenu.js +7 -0
  230. package/src/containers/WindowTopBarTitle.js +17 -0
  231. package/src/containers/WindowTopMenu.js +28 -0
  232. package/src/containers/WindowTopMenuButton.js +7 -0
  233. package/src/containers/WindowViewSettings.js +30 -0
  234. package/src/containers/WindowViewer.js +10 -0
  235. package/src/containers/Workspace.js +36 -0
  236. package/src/containers/WorkspaceAdd.js +27 -0
  237. package/src/containers/WorkspaceAddButton.js +30 -0
  238. package/src/containers/WorkspaceArea.js +21 -0
  239. package/src/containers/WorkspaceControlPanel.js +10 -0
  240. package/src/containers/WorkspaceControlPanelButtons.js +7 -0
  241. package/src/containers/WorkspaceElastic.js +41 -0
  242. package/src/containers/WorkspaceElasticWindow.js +36 -0
  243. package/src/containers/WorkspaceExport.js +18 -0
  244. package/src/containers/WorkspaceImport.js +19 -0
  245. package/src/containers/WorkspaceMenu.js +30 -0
  246. package/src/containers/WorkspaceMenuButton.js +10 -0
  247. package/src/containers/WorkspaceMosaic.js +32 -0
  248. package/src/containers/WorkspaceOptionsButton.js +7 -0
  249. package/src/containers/WorkspaceOptionsMenu.js +3 -0
  250. package/src/containers/WorkspaceSelectionDialog.js +26 -0
  251. package/src/containers/ZoomControls.js +26 -0
  252. package/src/containers/index.js +94 -0
  253. package/src/contexts/FailedImageContext.js +8 -0
  254. package/src/contexts/FailedImageProvider.jsx +34 -0
  255. package/src/contexts/FullScreenContext.js +5 -0
  256. package/src/contexts/LocaleContext.js +5 -0
  257. package/src/contexts/OpenSeadragonViewerContext.js +5 -0
  258. package/src/contexts/WorkspaceContext.js +5 -0
  259. package/src/contexts/index.js +4 -0
  260. package/src/extend/PluginContext.js +5 -0
  261. package/src/extend/PluginProvider.jsx +22 -0
  262. package/src/extend/index.js +9 -0
  263. package/src/extend/pluginMapping.js +44 -0
  264. package/src/extend/pluginPreprocessing.js +45 -0
  265. package/src/extend/pluginValidation.js +58 -0
  266. package/src/extend/usePlugins.js +13 -0
  267. package/src/extend/withPlugins.jsx +46 -0
  268. package/src/hooks/index.js +4 -0
  269. package/src/hooks/useCanvasWorldService.js +10 -0
  270. package/src/hooks/useThumbnailService.js +8 -0
  271. package/src/i18n.js +71 -0
  272. package/src/index.js +18 -0
  273. package/src/init.js +20 -0
  274. package/src/lib/AnnotationFactory.js +23 -0
  275. package/src/lib/AnnotationItem.js +123 -0
  276. package/src/lib/AnnotationList.js +31 -0
  277. package/src/lib/AnnotationPage.js +41 -0
  278. package/src/lib/AnnotationResource.js +122 -0
  279. package/src/lib/CanvasAnnotationDisplay.js +148 -0
  280. package/src/lib/CanvasGroupings.js +55 -0
  281. package/src/lib/CanvasWorld.js +214 -0
  282. package/src/lib/CompanionWindowRegistry.js +23 -0
  283. package/src/lib/FullScreenHandle.jsx +76 -0
  284. package/src/lib/MiradorCanvas.js +211 -0
  285. package/src/lib/MiradorManifest.js +44 -0
  286. package/src/lib/MiradorViewer.jsx +53 -0
  287. package/src/lib/MosaicLayout.js +77 -0
  288. package/src/lib/OpenSeadragonCanvasOverlay.js +114 -0
  289. package/src/lib/ThumbnailFactory.js +310 -0
  290. package/src/lib/TruncatedHit.js +34 -0
  291. package/src/lib/asArray.js +11 -0
  292. package/src/lib/htmlRules.js +28 -0
  293. package/src/lib/iiif.js +12 -0
  294. package/src/lib/index.js +23 -0
  295. package/src/lib/readImageMetadata.js +21 -0
  296. package/src/lib/svgShapesToPath.js +49 -0
  297. package/src/locales/README.md +60 -0
  298. package/src/locales/ar/translation.json +141 -0
  299. package/src/locales/bg/translation.json +164 -0
  300. package/src/locales/de/translation.json +169 -0
  301. package/src/locales/en/translation.json +170 -0
  302. package/src/locales/et/translation.json +164 -0
  303. package/src/locales/fa/translation.json +164 -0
  304. package/src/locales/fr/translation.json +158 -0
  305. package/src/locales/hr/translation.json +164 -0
  306. package/src/locales/hu/translation.json +166 -0
  307. package/src/locales/it/translation.json +162 -0
  308. package/src/locales/ja/translation.json +156 -0
  309. package/src/locales/kr/translation.json +162 -0
  310. package/src/locales/lt/translation.json +153 -0
  311. package/src/locales/nbNo/translation.json +162 -0
  312. package/src/locales/nl/translation.json +139 -0
  313. package/src/locales/pl/translation.json +162 -0
  314. package/src/locales/ptBr/translation.json +133 -0
  315. package/src/locales/sr/translation.json +155 -0
  316. package/src/locales/sv/translation.json +157 -0
  317. package/src/locales/ta/translation.json +167 -0
  318. package/src/locales/vi/translation.json +156 -0
  319. package/src/locales/zhCn/translation.json +163 -0
  320. package/src/locales/zhTw/translation.json +163 -0
  321. package/src/plugins/OSDReferences.js +15 -0
  322. package/src/plugins/index.js +1 -0
  323. package/src/state/actions/action-types.js +76 -0
  324. package/src/state/actions/annotation.js +123 -0
  325. package/src/state/actions/auth.js +109 -0
  326. package/src/state/actions/canvas.js +65 -0
  327. package/src/state/actions/catalog.js +22 -0
  328. package/src/state/actions/companionWindow.js +107 -0
  329. package/src/state/actions/config.js +49 -0
  330. package/src/state/actions/elasticLayout.js +10 -0
  331. package/src/state/actions/errors.js +22 -0
  332. package/src/state/actions/index.js +19 -0
  333. package/src/state/actions/infoResponse.js +90 -0
  334. package/src/state/actions/layers.js +14 -0
  335. package/src/state/actions/manifest.js +65 -0
  336. package/src/state/actions/search.js +97 -0
  337. package/src/state/actions/window.js +209 -0
  338. package/src/state/actions/workspace.js +84 -0
  339. package/src/state/createPluggableStore.js +24 -0
  340. package/src/state/createStore.js +33 -0
  341. package/src/state/index.js +21 -0
  342. package/src/state/reducers/accessTokens.js +59 -0
  343. package/src/state/reducers/annotations.js +48 -0
  344. package/src/state/reducers/auth.js +43 -0
  345. package/src/state/reducers/catalog.js +30 -0
  346. package/src/state/reducers/companionWindows.js +49 -0
  347. package/src/state/reducers/config.js +39 -0
  348. package/src/state/reducers/elasticLayout.js +29 -0
  349. package/src/state/reducers/errors.js +51 -0
  350. package/src/state/reducers/index.js +15 -0
  351. package/src/state/reducers/infoResponses.js +61 -0
  352. package/src/state/reducers/layers.js +23 -0
  353. package/src/state/reducers/manifests.js +52 -0
  354. package/src/state/reducers/rootReducer.js +44 -0
  355. package/src/state/reducers/search.js +145 -0
  356. package/src/state/reducers/utils.js +45 -0
  357. package/src/state/reducers/viewers.js +42 -0
  358. package/src/state/reducers/windows.js +185 -0
  359. package/src/state/reducers/workspace.js +111 -0
  360. package/src/state/sagas/annotations.js +48 -0
  361. package/src/state/sagas/app.js +56 -0
  362. package/src/state/sagas/auth.js +151 -0
  363. package/src/state/sagas/iiif.js +233 -0
  364. package/src/state/sagas/index.js +30 -0
  365. package/src/state/sagas/windows.js +293 -0
  366. package/src/state/selectors/annotations.js +138 -0
  367. package/src/state/selectors/auth.js +100 -0
  368. package/src/state/selectors/canvases.js +260 -0
  369. package/src/state/selectors/companionWindows.js +182 -0
  370. package/src/state/selectors/config.js +100 -0
  371. package/src/state/selectors/getters.js +90 -0
  372. package/src/state/selectors/index.js +17 -0
  373. package/src/state/selectors/layers.js +79 -0
  374. package/src/state/selectors/manifests.js +433 -0
  375. package/src/state/selectors/ranges.js +147 -0
  376. package/src/state/selectors/searches.js +249 -0
  377. package/src/state/selectors/sequences.js +134 -0
  378. package/src/state/selectors/thumbnails.js +28 -0
  379. package/src/state/selectors/utils.js +18 -0
  380. package/src/state/selectors/viewer.js +19 -0
  381. package/src/state/selectors/windows.js +98 -0
  382. package/src/state/selectors/workspace.js +52 -0
  383. package/src/state/selectors/wrappers.js +15 -0
  384. package/src/styles/react-mosaic-component.js +288 -0
@@ -0,0 +1,211 @@
1
+ import { Canvas, AnnotationPage, Annotation } from 'manifesto.js';
2
+ import { getIiifResourceImageService } from './iiif';
3
+
4
+ /**
5
+ * MiradorCanvas - adds additional, testable logic around Manifesto's Canvas
6
+ * https://iiif-commons.github.io/manifesto/classes/_canvas_.manifesto.canvas.html
7
+ */
8
+ export default class MiradorCanvas {
9
+ /**
10
+ * @param {MiradorCanvas} canvas
11
+ */
12
+ constructor(canvas) {
13
+ this.canvas = canvas;
14
+ }
15
+
16
+ /** */
17
+ get id() {
18
+ return this.canvas.id;
19
+ }
20
+
21
+ /** */
22
+ getWidth() {
23
+ return this.canvas.getWidth();
24
+ }
25
+
26
+ /** */
27
+ getHeight() {
28
+ return this.canvas.getHeight();
29
+ }
30
+
31
+ /**
32
+ */
33
+ get aspectRatio() {
34
+ return this.canvas.getWidth() / this.canvas.getHeight();
35
+ }
36
+
37
+ /**
38
+ * Fetches AnnotationList URIs from canvas's otherContent property
39
+ *
40
+ * Supported otherContent types:
41
+ * - Objects having @type property of "sc:AnnotationList" and URI in @id
42
+ * - Strings being the URIs
43
+ */
44
+ get annotationListUris() {
45
+ return new Array(this.canvas.__jsonld.otherContent)
46
+ .flat()
47
+ .filter(
48
+ (otherContent) => otherContent && (typeof otherContent === 'string' || otherContent['@type'] === 'sc:AnnotationList'),
49
+ )
50
+ .map((otherContent) => (typeof otherContent === 'string' ? otherContent : otherContent['@id']));
51
+ }
52
+
53
+ /** */
54
+ get canvasAnnotationPages() {
55
+ return new Array(this.canvas.__jsonld.annotations)
56
+ .flat()
57
+ .filter((annotations) => annotations && annotations.type === 'AnnotationPage');
58
+ }
59
+
60
+ /**
61
+ * Will negotiate a v2 or v3 type of resource
62
+ */
63
+ get imageResource() {
64
+ return this.imageResources[0];
65
+ }
66
+
67
+ /** */
68
+ get imageResources() {
69
+ // TODO Clean up the following hack as soon as manifesto.js provides any information if an annotation body is a Choice option, and if so, whether it is the preferred one.
70
+ const resources = [
71
+ this.canvas.getImages().map((i) => i.getResource()),
72
+ this.canvas.getContent().map((i) => (i.__jsonld.body.type === 'Choice' ? i.__jsonld.body : i.getBody())),
73
+ ].flat(Infinity);
74
+
75
+ return resources.flatMap((resource) => {
76
+ const type = resource.type || resource.getProperty('type');
77
+ switch (type) {
78
+ case 'Choice': {
79
+ return new Canvas({ images: resource.items.map((r) => ({ resource: r })) }, this.canvas.options)
80
+ .getImages()
81
+ .map((img, index) => {
82
+ const r = img.getResource();
83
+ if (r) {
84
+ r.preferred = !index;
85
+ }
86
+ return r;
87
+ });
88
+ }
89
+ case 'oa:Choice': {
90
+ return new Canvas(
91
+ {
92
+ images: [resource.getProperty('default'), resource.getProperty('item')].flat(Infinity).map((r) => ({
93
+ resource: r,
94
+ })),
95
+ },
96
+ this.canvas.options,
97
+ )
98
+ .getImages()
99
+ .map((img, index) => {
100
+ const r = img.getResource();
101
+ if (r) {
102
+ r.preferred = !index;
103
+ }
104
+ return r;
105
+ });
106
+ }
107
+ default: {
108
+ const r = resource;
109
+ r.preferred = true;
110
+ return r;
111
+ }
112
+ }
113
+ });
114
+ }
115
+
116
+ /** */
117
+ get textResources() {
118
+ const resources = [this.canvas.getContent().map((i) => i.getBody())].flat(Infinity);
119
+ return resources.filter((resource) => resource.getProperty('type') === 'Text').flat();
120
+ }
121
+
122
+ /** */
123
+ get videoResources() {
124
+ const resources = [this.canvas.getContent().map((i) => i.getBody())].flat(Infinity);
125
+ return resources.filter((resource) => resource.getProperty('type') === 'Video').flat();
126
+ }
127
+
128
+ /** */
129
+ get audioResources() {
130
+ const resources = [this.canvas.getContent().map((i) => i.getBody())].flat(Infinity);
131
+
132
+ return resources.filter((resource) => resource.getProperty('type') === 'Sound').flat();
133
+ }
134
+
135
+ /** */
136
+ get v2VttContent() {
137
+ const resources = [this.canvas.getContent().map((i) => i.getBody())].flat(Infinity);
138
+
139
+ return resources.filter((resource) => resource.getProperty('format') === 'text/vtt').flat();
140
+ }
141
+
142
+ /** IIIF v3 captions are stored as 'supplementing' Annotations rather than in the resource content itself */
143
+ get v3VttContent() {
144
+ const resources = this.canvasAnnotationPages
145
+ .map((annoPage) => {
146
+ const manifestoAnnoPage = new AnnotationPage(annoPage, this.canvas.options);
147
+ return manifestoAnnoPage.getItems().map((item) => {
148
+ const manifestoAnnotation = new Annotation(item, this.canvas.options);
149
+ return manifestoAnnotation.getBody();
150
+ });
151
+ })
152
+ .flat(Infinity);
153
+
154
+ return resources.filter((resource) => resource.getProperty('format') === 'text/vtt').flat();
155
+ }
156
+
157
+ /** */
158
+ get resourceAnnotations() {
159
+ return [this.canvas.getImages(), this.canvas.getContent()].flat(Infinity);
160
+ }
161
+
162
+ /**
163
+ * Returns a given resource Annotation, based on a contained resource or body
164
+ * id
165
+ */
166
+ resourceAnnotation(id) {
167
+ return this.resourceAnnotations.find(
168
+ (anno) => anno.getResource().id === id || new Array(anno.getBody()).flat().some((body) => body.id === id),
169
+ );
170
+ }
171
+
172
+ /**
173
+ * Returns the fragment placement values if a resourceAnnotation is placed on
174
+ * a canvas somewhere besides the full extent
175
+ */
176
+ onFragment(id) {
177
+ const resourceAnnotation = this.resourceAnnotation(id);
178
+ if (!resourceAnnotation) return undefined;
179
+ // IIIF v2
180
+ const on = resourceAnnotation.getProperty('on');
181
+ // IIIF v3
182
+ const target = resourceAnnotation.getProperty('target');
183
+ const fragmentMatch = (on || target).match(/xywh=(.*)$/);
184
+ if (!fragmentMatch) return undefined;
185
+ return fragmentMatch[1].split(',').map((str) => parseInt(str, 10));
186
+ }
187
+
188
+ /** */
189
+ get iiifImageResources() {
190
+ return this.imageResources.filter((r) => r && getIiifResourceImageService(r)?.id);
191
+ }
192
+
193
+ /** */
194
+ get imageServiceIds() {
195
+ return this.iiifImageResources.map((r) => r && getIiifResourceImageService(r)?.id);
196
+ }
197
+
198
+ /**
199
+ * Get the canvas service
200
+ */
201
+ get service() {
202
+ return this.canvas.__jsonld.service;
203
+ }
204
+
205
+ /**
206
+ * Get the canvas label
207
+ */
208
+ getLabel(locale = undefined) {
209
+ return this.canvas.getLabel().length > 0 ? this.canvas.getLabel().getValue(locale) : String(this.canvas.index + 1);
210
+ }
211
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * MiradorManifest - adds additional, testable logic around Manifesto's Manifest
3
+ * https://iiif-commons.github.io/manifesto/classes/_canvas_.manifesto.canvas.html
4
+ */
5
+ export default class MiradorManifest {
6
+ /** */
7
+ constructor(manifest) {
8
+ this.manifest = manifest;
9
+ }
10
+
11
+ /**
12
+ * Returns the starting canvas specified in the manifest
13
+ * @param {object} manifest manifesto instance
14
+ * @param {number} canvasIndexFromState
15
+ * @return {Canvas}
16
+ */
17
+ get startCanvas() {
18
+ let canvasId;
19
+
20
+ const sequence = this.manifest.getSequences()[0];
21
+
22
+ if (!sequence) return undefined;
23
+
24
+ // IIIF v2
25
+ canvasId = sequence.getProperty('startCanvas');
26
+
27
+ if (!canvasId) {
28
+ // IIIF v3
29
+ const start = this.manifest.getProperty('start') || sequence.getProperty('start');
30
+
31
+ canvasId = start && (start.id || start.source);
32
+ }
33
+
34
+ return (canvasId && sequence.getCanvasById(canvasId)) || undefined;
35
+ }
36
+
37
+ /** */
38
+ canvasAt(index) {
39
+ const sequence = this.manifest.getSequences()[0];
40
+ const canvases = sequence && sequence.getCanvases();
41
+
42
+ return canvases && canvases[index];
43
+ }
44
+ }
@@ -0,0 +1,53 @@
1
+ import { createRoot } from 'react-dom/client';
2
+ import { Provider } from 'react-redux';
3
+ import HotApp from '../components/App';
4
+ import { filterValidPlugins } from '../extend/pluginPreprocessing';
5
+ import createPluggableStore from '../state/createPluggableStore';
6
+
7
+ /**
8
+ * Default Mirador instantiation
9
+ */
10
+ class MiradorViewer {
11
+ /**
12
+ */
13
+ constructor(config, viewerConfig = {}) {
14
+ this.plugins = filterValidPlugins(viewerConfig.plugins || []);
15
+ this.config = config;
16
+ this.store = viewerConfig.store || createPluggableStore(this.config, this.plugins);
17
+
18
+ if (config.id) this.renderInto(document.getElementById(config.id));
19
+ }
20
+
21
+ /**
22
+ * @private
23
+ * @param {*} container
24
+ */
25
+ renderInto(container) {
26
+ this.container = container;
27
+ this.root = createRoot(this.container);
28
+
29
+ this.root.render(this.render());
30
+ }
31
+
32
+ /**
33
+ * Render the mirador viewer
34
+ */
35
+ render(props = {}) {
36
+ return (
37
+ <Provider store={this.store}>
38
+ <HotApp plugins={this.plugins} {...props} />
39
+ </Provider>
40
+ );
41
+ }
42
+
43
+ /**
44
+ * Cleanup method to unmount Mirador from the dom
45
+ */
46
+ unmount() {
47
+ if (!this.root) return;
48
+
49
+ this.root.unmount();
50
+ }
51
+ }
52
+
53
+ export default MiradorViewer;
@@ -0,0 +1,77 @@
1
+ import {
2
+ createRemoveUpdate,
3
+ updateTree,
4
+ getNodeAtPath,
5
+ getOtherDirection,
6
+ getPathToCorner,
7
+ Corner,
8
+ } from 'react-mosaic-component';
9
+ import dropRight from 'lodash/dropRight';
10
+
11
+ /** */
12
+ export default class MosaicLayout {
13
+ /** */
14
+ constructor(layout) {
15
+ this.layout = layout;
16
+ }
17
+
18
+ /** */
19
+ pathToCorner(corner = Corner.TOP_RIGHT) {
20
+ return getPathToCorner(this.layout, corner);
21
+ }
22
+
23
+ /** */
24
+ pathToParent(path) {
25
+ return getNodeAtPath(this.layout, dropRight(path));
26
+ }
27
+
28
+ /** */
29
+ nodeAtPath(path) {
30
+ return getNodeAtPath(this.layout, path);
31
+ }
32
+
33
+ /**
34
+ * addWindows - updates the layout with new windows using an algorithm ported
35
+ * from the react-mosaic-components examples. Will always add to the Top Right
36
+ * https://github.com/nomcopter/react-mosaic/blob/5081df8d1528d4c3b83a72763a46a30b3048fe95/demo/ExampleApp.tsx#L119-L154
37
+ * @param {Array} addedWindowIds [description]
38
+ */
39
+ addWindows(addedWindowIds) {
40
+ addedWindowIds.forEach((windowId, i) => {
41
+ const path = this.pathToCorner();
42
+ const parent = this.pathToParent(path);
43
+ const destination = this.nodeAtPath(path);
44
+ const direction = parent ? getOtherDirection(parent.direction) : 'row';
45
+ let children;
46
+ if (direction === 'row') {
47
+ children = [destination, addedWindowIds[i]];
48
+ } else {
49
+ children = [addedWindowIds[i], destination];
50
+ }
51
+ const update = {
52
+ path,
53
+ spec: {
54
+ $set: {
55
+ type: 'split',
56
+ direction,
57
+ children,
58
+ },
59
+ },
60
+ };
61
+ // We cannot batch the updates together because we need to recalculate
62
+ // the new location for each new window
63
+ this.layout = updateTree(this.layout, [update]);
64
+ });
65
+ }
66
+
67
+ /**
68
+ * removeWindows - Generate a set of "removeUpdates" to update layout binary
69
+ * tree. Then update the layout.
70
+ * @param {Array} removedWindowIds
71
+ * @param {Object} windowPaths - a lookup table for window paths
72
+ */
73
+ removeWindows(removedWindowIds, windowPaths) {
74
+ const removeUpdates = removedWindowIds.map((windowId) => createRemoveUpdate(this.layout, windowPaths[windowId]));
75
+ this.layout = updateTree(this.layout, removeUpdates);
76
+ }
77
+ }
@@ -0,0 +1,114 @@
1
+ import OpenSeadragon from 'openseadragon';
2
+
3
+ /**
4
+ * OpenSeadragonCanvasOverlay - adapted from https://github.com/altert/OpenSeadragonCanvasOverlay
5
+ * used rather than an "onRedraw" function we tap into our own method. Existing
6
+ * repository is not published as an npm package.
7
+ * Code ported from https://github.com/altert/OpenSeadragonCanvasOverlay
8
+ * carries a BSD 3-Clause license originally authored by @altert from
9
+ * https://github.com/altert/OpenseadragonFabricjsOverlay
10
+ */
11
+ export default class OpenSeadragonCanvasOverlay {
12
+ /**
13
+ * constructor - sets up the Canvas overlay container
14
+ */
15
+ constructor(viewer, ref) {
16
+ this.viewer = viewer;
17
+ this.ref = ref;
18
+
19
+ this.containerWidth = 0;
20
+ this.containerHeight = 0;
21
+ this.imgAspectRatio = 1;
22
+ }
23
+
24
+ /** */
25
+ get canvas() {
26
+ return this.canvasDiv.firstElementChild;
27
+ }
28
+
29
+ /** */
30
+ get canvasDiv() {
31
+ return this.ref.current;
32
+ }
33
+
34
+ /** */
35
+ get context2d() {
36
+ return this.canvas.getContext('2d');
37
+ }
38
+
39
+ /** */
40
+ clear() {
41
+ if (!this.context2d) return;
42
+
43
+ this.context2d.clearRect(0, 0, this.containerWidth, this.containerHeight);
44
+ }
45
+
46
+ /**
47
+ * resize - resizes the added Canvas overlay.
48
+ */
49
+ resize() {
50
+ if (this.containerWidth !== this.viewer.container.clientWidth) {
51
+ this.containerWidth = this.viewer.container.clientWidth;
52
+ this.canvasDiv.setAttribute('width', this.containerWidth);
53
+ this.canvas.setAttribute('width', this.containerWidth);
54
+ }
55
+
56
+ if (this.containerHeight !== this.viewer.container.clientHeight) {
57
+ this.containerHeight = this.viewer.container.clientHeight;
58
+ this.canvasDiv.setAttribute('height', this.containerHeight);
59
+ this.canvas.setAttribute('height', this.containerHeight);
60
+ }
61
+
62
+ this.viewportOrigin = new OpenSeadragon.Point(0, 0);
63
+ const boundsRect = this.viewer.viewport.getBoundsNoRotateWithMargins(true);
64
+ this.viewportOrigin.x = boundsRect.x;
65
+ this.viewportOrigin.y = boundsRect.y * this.imgAspectRatio;
66
+
67
+ this.viewportWidth = boundsRect.width;
68
+ this.viewportHeight = boundsRect.height * this.imgAspectRatio;
69
+ const image1 = this.viewer.world.getItemAt(0);
70
+ if (!image1) return;
71
+ this.imgWidth = image1.source.dimensions.x;
72
+ this.imgHeight = image1.source.dimensions.y;
73
+ this.imgAspectRatio = this.imgWidth / this.imgHeight;
74
+ }
75
+
76
+ /**
77
+ * canvasUpdate - sets up the dimensions for the canvas update to mimick image
78
+ * 0 dimensions. Then call provided update function.
79
+ * @param {Function} update
80
+ */
81
+ canvasUpdate(update) {
82
+ if (!this.context2d) return;
83
+
84
+ const viewportZoom = this.viewer.viewport.getZoom(true);
85
+ const image1 = this.viewer.world.getItemAt(0);
86
+ if (!image1) return;
87
+ const zoom = image1.viewportToImageZoom(viewportZoom);
88
+
89
+ const x = ((this.viewportOrigin.x / this.imgWidth - this.viewportOrigin.x) / this.viewportWidth) * this.containerWidth;
90
+ const y = ((this.viewportOrigin.y / this.imgHeight - this.viewportOrigin.y) / this.viewportHeight) * this.containerHeight;
91
+
92
+ if (this.clearBeforeRedraw) this.clear();
93
+ this.context2d.translate(x, y);
94
+ this.context2d.scale(zoom, zoom);
95
+
96
+ const center = this.viewer.viewport.getCenter();
97
+
98
+ const flip = this.viewer.viewport.getFlip();
99
+ if (flip) {
100
+ this.context2d.translate(center.x * 2, 0);
101
+ this.context2d.scale(-1, 1);
102
+ }
103
+
104
+ const rotation = this.viewer.viewport.getRotation();
105
+ if (rotation !== 0) {
106
+ this.context2d.translate(center.x, center.y);
107
+ this.context2d.rotate((rotation * Math.PI) / 180);
108
+ this.context2d.translate(-1 * center.x, -1 * center.y);
109
+ }
110
+ update();
111
+
112
+ this.context2d.setTransform(1, 0, 0, 1, 0, 0);
113
+ }
114
+ }