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,310 @@
1
+ import { Utils } from 'manifesto.js';
2
+ import MiradorManifest from './MiradorManifest';
3
+ import MiradorCanvas from './MiradorCanvas';
4
+ import asArray from './asArray';
5
+
6
+ /** */
7
+ function isLevel0ImageProfile(service) {
8
+ const profile = service.getProfile();
9
+
10
+ // work around a bug in manifesto with normalized urls that strip # values.
11
+ if (profile.endsWith('#level1') || profile.endsWith('#level2')) return false;
12
+
13
+ // support IIIF v3-style profiles
14
+ if (profile === 'level0') return true;
15
+
16
+ return Utils.isLevel0ImageProfile(profile);
17
+ }
18
+
19
+ /** */
20
+ function isLevel2ImageProfile(service) {
21
+ const profile = service.getProfile();
22
+
23
+ // work around a bug in manifesto with normalized urls that strip # values.
24
+ if (profile.endsWith('#level0') || profile.endsWith('#level1')) return false;
25
+
26
+ // support IIIF v3-style profiles
27
+ if (profile === 'level2') return true;
28
+
29
+ return Utils.isLevel2ImageProfile(profile);
30
+ }
31
+
32
+ /** */
33
+ function iiifv3ImageServiceType(service) {
34
+ const type = service.getProperty('type') || [];
35
+
36
+ return asArray(type).some((v) => v.startsWith('ImageService'));
37
+ }
38
+
39
+ /** */
40
+ function iiifImageService(resource) {
41
+ const service =
42
+ resource && resource.getServices().find((s) => iiifv3ImageServiceType(s) || Utils.isImageProfile(s.getProfile()));
43
+
44
+ if (!service) return undefined;
45
+
46
+ return service;
47
+ }
48
+
49
+ /** */
50
+ class ThumbnailFactory {
51
+ /** */
52
+ constructor(iiifOpts = {}, { getMiradorCanvas, getMiradorManifest }) {
53
+ this.iiifOpts = iiifOpts;
54
+ this.getMiradorCanvas = getMiradorCanvas;
55
+ this.getMiradorManifest = getMiradorManifest;
56
+ }
57
+
58
+ /** */
59
+ static staticImageUrl(resource) {
60
+ return {
61
+ height: resource.getProperty('height'),
62
+ url: resource.id,
63
+ width: resource.getProperty('width'),
64
+ };
65
+ }
66
+
67
+ /**
68
+ * Selects the image resource that is representative of the given canvas.
69
+ * @param {Object} canvas A Manifesto Canvas
70
+ * @return {Object} A Manifesto Image Resource
71
+ */
72
+ static getPreferredImage(miradorCanvas) {
73
+ return miradorCanvas.iiifImageResources[0] || miradorCanvas.imageResource;
74
+ }
75
+
76
+ /**
77
+ * Chooses the best available image size based on a target area (w x h) value.
78
+ * @param {Object} service A IIIF Image API service that has a `sizes` array
79
+ * @param {Number} targetArea The target area value to compare potential sizes against
80
+ * @return {Object|undefined} The best size, or undefined if none are acceptable
81
+ */
82
+ static selectBestImageSize(service, targetArea) {
83
+ const sizes = asArray(service.getProperty('sizes'));
84
+
85
+ let closestSize = {
86
+ default: true,
87
+ height: service.getProperty('height') || Number.MAX_SAFE_INTEGER,
88
+ width: service.getProperty('width') || Number.MAX_SAFE_INTEGER,
89
+ };
90
+
91
+ /** Compare the total image area to our target */
92
+ const imageFitness = (test) => test.width * test.height - targetArea;
93
+
94
+ /** Look for the size that's just bigger than we prefer... */
95
+ closestSize = sizes.reduce((best, test) => {
96
+ const score = imageFitness(test);
97
+
98
+ if (score < 0) return best;
99
+
100
+ return Math.abs(score) < Math.abs(imageFitness(best)) ? test : best;
101
+ }, closestSize);
102
+
103
+ /** .... but not "too" big; we'd rather scale up an image than download too much */
104
+ if (closestSize.width * closestSize.height > targetArea * 6) {
105
+ closestSize = sizes.reduce(
106
+ (best, test) => (Math.abs(imageFitness(test)) < Math.abs(imageFitness(best)) ? test : best),
107
+ closestSize,
108
+ );
109
+ }
110
+
111
+ if (closestSize.default) return undefined;
112
+
113
+ return closestSize;
114
+ }
115
+
116
+ /**
117
+ * Determines the appropriate thumbnail to use to represent an Image Resource.
118
+ * @param {Object} resource The Image Resource from which to derive a thumbnail
119
+ * @return {Object} The thumbnail URL and any spatial dimensions that can be determined
120
+ */
121
+ // eslint-disable-next-line complexity
122
+ iiifThumbnailUrl(resource) {
123
+ let size;
124
+ let width;
125
+ let height;
126
+ const minDimension = 120;
127
+ let maxHeight = minDimension;
128
+ let maxWidth = minDimension;
129
+ const { maxHeight: requestedMaxHeight, maxWidth: requestedMaxWidth } = this.iiifOpts;
130
+
131
+ if (requestedMaxHeight) maxHeight = Math.max(requestedMaxHeight, minDimension);
132
+ if (requestedMaxWidth) maxWidth = Math.max(requestedMaxWidth, minDimension);
133
+
134
+ const service = iiifImageService(resource);
135
+
136
+ if (!service) return ThumbnailFactory.staticImageUrl(resource);
137
+
138
+ const aspectRatio = resource.getWidth() && resource.getHeight() && resource.getWidth() / resource.getHeight();
139
+ const target = requestedMaxWidth && requestedMaxHeight ? requestedMaxWidth * requestedMaxHeight : maxHeight * maxWidth;
140
+ const closestSize = ThumbnailFactory.selectBestImageSize(service, target);
141
+
142
+ if (closestSize) {
143
+ // Embedded service advertises an appropriate size
144
+ width = closestSize.width;
145
+ height = closestSize.height;
146
+ size = `${width},${height}`;
147
+ } else if (isLevel0ImageProfile(service)) {
148
+ /** Bail if the best available size is the full size.. maybe we'll get lucky with the @id */
149
+ if (!service.getProperty('height') && !service.getProperty('width')) {
150
+ return ThumbnailFactory.staticImageUrl(resource);
151
+ }
152
+ } else if (requestedMaxHeight && requestedMaxWidth) {
153
+ // IIIF level 2, no problem.
154
+ if (isLevel2ImageProfile(service)) {
155
+ size = `!${maxWidth},${maxHeight}`;
156
+ width = maxWidth;
157
+ height = maxHeight;
158
+
159
+ if (aspectRatio && aspectRatio > 1) height = Math.round(maxWidth / aspectRatio);
160
+ if (aspectRatio && aspectRatio < 1) width = Math.round(maxHeight * aspectRatio);
161
+ } else if (maxWidth / maxHeight < aspectRatio) {
162
+ size = `${maxWidth},`;
163
+ width = maxWidth;
164
+ if (aspectRatio) height = Math.round(maxWidth / aspectRatio);
165
+ } else {
166
+ size = `,${maxHeight}`;
167
+ height = maxHeight;
168
+ if (aspectRatio) width = Math.round(maxHeight * aspectRatio);
169
+ }
170
+ } else if (requestedMaxHeight && !requestedMaxWidth) {
171
+ size = `,${maxHeight}`;
172
+ height = maxHeight;
173
+ if (aspectRatio) width = Math.round(maxHeight * aspectRatio);
174
+ } else if (!requestedMaxHeight && requestedMaxWidth) {
175
+ size = `${maxWidth},`;
176
+ width = maxWidth;
177
+ if (aspectRatio) height = Math.round(maxWidth / aspectRatio);
178
+ } else {
179
+ size = `,${minDimension}`;
180
+ height = minDimension;
181
+ if (aspectRatio) width = Math.round(height * aspectRatio);
182
+ }
183
+
184
+ const region = 'full';
185
+ const quality = Utils.getImageQuality(service.getProfile());
186
+ const id = service.id.replace(/\/+$/, '');
187
+ const format = this.getFormat(service);
188
+ return {
189
+ height,
190
+ url: [id, region, size, 0, `${quality}.${format}`].join('/'),
191
+ width,
192
+ };
193
+ }
194
+
195
+ /**
196
+ * Figure out what format thumbnail to use by looking at the preferred formats
197
+ * on offer, and selecting a format shared in common with the application's
198
+ * preferred format list.
199
+ *
200
+ * Fall back to jpg, which is required to work for all IIIF services.
201
+ */
202
+ getFormat(service) {
203
+ const { preferredFormats = [] } = this.iiifOpts;
204
+ const servicePreferredFormats = service.getProperty('preferredFormats');
205
+
206
+ if (!servicePreferredFormats) return 'jpg';
207
+
208
+ const filteredFormats = servicePreferredFormats.filter((value) => preferredFormats.includes(value));
209
+
210
+ // this is a format found in common between the preferred formats of the service
211
+ // and the application
212
+ if (filteredFormats[0]) return filteredFormats[0];
213
+
214
+ // IIIF Image API guarantees jpg support; if it wasn't provided by the service
215
+ // but the application is fine with it, we might as well try it.
216
+ if (!servicePreferredFormats.includes('jpg') && preferredFormats.includes('jpg')) {
217
+ return 'jpg';
218
+ }
219
+
220
+ // there were no formats in common, and the application didn't want jpg... so
221
+ // just trust that the IIIF service is advertising something useful?
222
+ if (servicePreferredFormats[0]) return servicePreferredFormats[0];
223
+
224
+ // JPG support is guaranteed by the spec, so it's a good worst-case fallback
225
+ return 'jpg';
226
+ }
227
+
228
+ /**
229
+ * Determines the content resource from which to derive a thumbnail to represent a given resource.
230
+ * This method is recursive.
231
+ * @param {Object} resource A IIIF resource to derive a thumbnail from
232
+ * @return {Object|undefined} The Image Resource to derive a thumbnail from, or undefined
233
+ * if no appropriate resource exists
234
+ */
235
+ getSourceContentResource(resource) {
236
+ const thumbnail = resource.getThumbnail();
237
+
238
+ // Any resource type may have a thumbnail
239
+ if (thumbnail) {
240
+ if (typeof thumbnail.__jsonld === 'string') return thumbnail.__jsonld;
241
+
242
+ // Prefer an image's ImageService over its image's thumbnail
243
+ // Note that Collection, Manifest, and Canvas don't have `getType()`
244
+ if (!resource.isCollection() && !resource.isManifest() && !resource.isCanvas()) {
245
+ if (resource.getType() === 'image' && iiifImageService(resource) && !iiifImageService(thumbnail)) {
246
+ return resource;
247
+ }
248
+ }
249
+
250
+ return thumbnail;
251
+ }
252
+
253
+ if (resource.isCollection()) {
254
+ const firstManifest = resource.getManifests()[0];
255
+ if (firstManifest) return this.getSourceContentResource(firstManifest);
256
+
257
+ return undefined;
258
+ }
259
+
260
+ if (resource.isManifest()) {
261
+ const miradorManifest = this.getMiradorManifest(resource);
262
+ const canvas = miradorManifest.startCanvas || miradorManifest.canvasAt(0);
263
+ if (canvas) return this.getSourceContentResource(canvas);
264
+
265
+ return undefined;
266
+ }
267
+
268
+ if (resource.isCanvas()) {
269
+ const image = ThumbnailFactory.getPreferredImage(this.getMiradorCanvas(resource));
270
+ if (image) return this.getSourceContentResource(image);
271
+
272
+ return undefined;
273
+ }
274
+
275
+ if (resource.getType() === 'image') {
276
+ return resource;
277
+ }
278
+
279
+ return undefined;
280
+ }
281
+
282
+ /**
283
+ * Gets a thumbnail representing the resource.
284
+ * @return {Object|undefined} A thumbnail representing the resource, or undefined if none could
285
+ * be determined
286
+ */
287
+ get(resource) {
288
+ if (!resource) return undefined;
289
+
290
+ // Determine which content resource we should use to derive a thumbnail
291
+ const sourceContentResource = this.getSourceContentResource(resource);
292
+ if (!sourceContentResource) return undefined;
293
+
294
+ // Special treatment for external resources
295
+ if (typeof sourceContentResource === 'string') return { url: sourceContentResource };
296
+
297
+ return this.iiifThumbnailUrl(sourceContentResource);
298
+ }
299
+ }
300
+
301
+ /** */
302
+ function getBestThumbnail(resource, iiifOpts = {}) {
303
+ return new ThumbnailFactory(iiifOpts, {
304
+ getMiradorCanvas: (r) => new MiradorCanvas(r),
305
+ getMiradorManifest: (r) => new MiradorManifest(r),
306
+ }).get(resource);
307
+ }
308
+
309
+ export { ThumbnailFactory };
310
+ export default getBestThumbnail;
@@ -0,0 +1,34 @@
1
+ /** */
2
+ export default class TruncatedHit {
3
+ /** */
4
+ constructor(hit, annotation = undefined, { maxChars = 200, minimum = 20 } = {}) {
5
+ this.hit = hit;
6
+ this.annotation = annotation;
7
+ this.maxChars = maxChars || 200;
8
+ this.minimum = minimum || 20;
9
+ }
10
+
11
+ /** */
12
+ get match() {
13
+ return this.hit.match || (this.annotation && this.annotation.resource.resource.chars) || '-';
14
+ }
15
+
16
+ /** */
17
+ get charsOnSide() {
18
+ const resultingChars = (this.maxChars - this.match.length) / 2;
19
+ const measured = [(this.hit.before || '').length, (this.hit.after || '').length].filter((length) => length > 0);
20
+ return Math.max(Math.min(resultingChars, ...measured), this.minimum);
21
+ }
22
+
23
+ /** */
24
+ get before() {
25
+ if (!this.hit.before) return '';
26
+ return this.hit.before.substring(this.hit.before.length - this.charsOnSide, this.hit.before.length);
27
+ }
28
+
29
+ /** */
30
+ get after() {
31
+ if (!this.hit.after) return '';
32
+ return this.hit.after.substring(0, Math.min(this.hit.after.length, this.charsOnSide));
33
+ }
34
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ */
3
+ export default function asArray(value) {
4
+ if (value === undefined) return [];
5
+
6
+ if (!Array.isArray(value)) {
7
+ return [value];
8
+ }
9
+
10
+ return value;
11
+ }
@@ -0,0 +1,28 @@
1
+ // Only remove security related tags and attributes. Allow each other.
2
+ const liberal = {};
3
+
4
+ // No html at all. Only text will remain.
5
+ const noHtml = {
6
+ ALLOWED_TAGS: [],
7
+ };
8
+
9
+ // Presentation API 2 suggestion.
10
+ const iiif = {
11
+ ALLOWED_ATTR: ['href', 'src', 'alt'],
12
+ ALLOWED_TAGS: ['a', 'b', 'br', 'i', 'img', 'p', 'span'],
13
+ };
14
+
15
+ // Rule set that is used in Mirador 2.
16
+ const mirador2 = {
17
+ ALLOWED_ATTR: ['href', 'target', 'src', 'alt', 'dir'],
18
+ ALLOWED_TAGS: ['a', 'b', 'br', 'i', 'img', 'p', 'span', 'strong', 'em', 'ul', 'ol', 'li'],
19
+ };
20
+
21
+ const htmlRules = {
22
+ iiif,
23
+ liberal,
24
+ mirador2,
25
+ noHtml,
26
+ };
27
+
28
+ export default htmlRules;
@@ -0,0 +1,12 @@
1
+ import { Utils } from 'manifesto.js';
2
+
3
+ /** @returns an IIIF image service for the given resource */
4
+ export function getIiifResourceImageService(resource) {
5
+ return resource
6
+ .getServices()
7
+ .find(
8
+ (service) =>
9
+ (service.getProfile && Utils.isImageProfile(service.getProfile() || '')) ||
10
+ Utils.isImageServiceType(service.getIIIFResourceType() || ''),
11
+ );
12
+ }
@@ -0,0 +1,23 @@
1
+ import getBestThumbnail, { ThumbnailFactory } from './ThumbnailFactory';
2
+
3
+ export { getBestThumbnail, ThumbnailFactory };
4
+
5
+ export { default as AnnotationFactory } from './AnnotationFactory';
6
+ export { default as AnnotationItem } from './AnnotationItem';
7
+ export { default as AnnotationList } from './AnnotationList';
8
+ export { default as AnnotationPage } from './AnnotationPage';
9
+ export { default as AnnotationResource } from './AnnotationResource';
10
+ export { default as CanvasAnnotationDisplay } from './CanvasAnnotationDisplay';
11
+ export { default as CanvasGroupings } from './CanvasGroupings';
12
+ export { default as CanvasWorld } from './CanvasWorld';
13
+ export { default as CompanionWindowRegistry } from './CompanionWindowRegistry';
14
+ export { default as MiradorCanvas } from './MiradorCanvas';
15
+ export { default as MiradorManifest } from './MiradorManifest';
16
+ export { default as MiradorViewer } from './MiradorViewer';
17
+ export { default as MosaicLayout } from './MosaicLayout';
18
+ export { default as OpenSeadragonCanvasOverlay } from './OpenSeadragonCanvasOverlay';
19
+
20
+ export { default as TruncatedHit } from './TruncatedHit';
21
+ export { default as asArray } from './asArray';
22
+ export { default as htmlRules } from './htmlRules';
23
+ export * from './readImageMetadata';
@@ -0,0 +1,21 @@
1
+ /** Extract metadata from an image File */
2
+ export function readImageMetadata(file) {
3
+ return new Promise((resolve, reject) => {
4
+ const reader = new FileReader();
5
+
6
+ reader.addEventListener('load', () => {
7
+ const image = new Image();
8
+ image.addEventListener('load', () => {
9
+ resolve({
10
+ height: image.height,
11
+ name: file.name,
12
+ type: file.type,
13
+ url: reader.result,
14
+ width: image.width,
15
+ });
16
+ });
17
+ image.src = reader.result;
18
+ });
19
+ reader.readAsDataURL(file);
20
+ });
21
+ }
@@ -0,0 +1,49 @@
1
+ export function buildPath2D(element) {
2
+ const tag = element.tagName.toLowerCase();
3
+ const num = (attr) => parseFloat(element.getAttribute(attr)) || 0;
4
+
5
+ if (tag === 'path') return new Path2D(element.getAttribute('d'));
6
+
7
+ const path = new Path2D();
8
+ SHAPE_BUILDERS[tag]?.(path, element, num);
9
+ return path;
10
+ }
11
+
12
+ const SHAPE_BUILDERS = {
13
+ circle: (path, el, num) => {
14
+ path.arc(num('cx'), num('cy'), num('r'), 0, 2 * Math.PI);
15
+ },
16
+ ellipse: (path, el, num) => {
17
+ path.ellipse(num('cx'), num('cy'), num('rx'), num('ry'), 0, 0, 2 * Math.PI);
18
+ },
19
+ rect: (path, el, num) => {
20
+ path.rect(num('x'), num('y'), num('width'), num('height'));
21
+ },
22
+ line: (path, el, num) => {
23
+ path.moveTo(num('x1'), num('y1'));
24
+ path.lineTo(num('x2'), num('y2'));
25
+ },
26
+ polygon: (path, el) => pointElementPath(path, el, true),
27
+ polyline: (path, el) => pointElementPath(path, el, false),
28
+ };
29
+
30
+ function pointElementPath(path, element, closed) {
31
+ const points = parsePoints(element.getAttribute('points'));
32
+ points.forEach(([x, y], i) => {
33
+ if (i === 0) path.moveTo(x, y);
34
+ else path.lineTo(x, y);
35
+ });
36
+ if (closed) path.closePath();
37
+ }
38
+
39
+ function parsePoints(points) {
40
+ const nums = points
41
+ .trim()
42
+ .split(/[\s,]+/)
43
+ .map(Number);
44
+ const pointsList = [];
45
+ for (let i = 0; i < nums.length - 1; i += 2) {
46
+ pointsList.push([nums[i], nums[i + 1]]);
47
+ }
48
+ return pointsList;
49
+ }
@@ -0,0 +1,60 @@
1
+ # Contributing a Mirador translation
2
+
3
+ Mirador is built with internationalization and translation support. It uses a translation file and [react-i18next](https://react.i18next.com/) to provide translations in user interface elements.
4
+
5
+ ## Getting started
6
+ To contribute a new language to Mirador, you will need to convert the strings contained in [en/translation.json](en/translation.json) to the target language.
7
+
8
+ So we would want to create a directory for the target language using the iso language code that copies from the `en/translation.json` file. e.g. `fr/translation.json`.
9
+
10
+ ```sh
11
+ $ mkdir src/locales/fr && cp src/locales/en/translation.json src/locales/fr/translation.json
12
+ ```
13
+
14
+ For example, this subset of the English file:
15
+
16
+ ```javascript
17
+ // src/locales/en/translation.json
18
+ {
19
+ "translation": {
20
+ "aboutThisItem": "About this item",
21
+ "addedFromUrl": "(Added from URL)",
22
+ "addManifestUrl": "Resource location",
23
+ "addManifestUrlHelp": "The URL of a IIIF resource",
24
+ "addResource": "Add resource",
25
+ "annotationCanvasLabel_1/1": "Item: [{{label}}]",
26
+ ...
27
+ ```
28
+
29
+ Would look like this in French.
30
+
31
+ ```javascript
32
+ // src/locales/fr/translation.json
33
+ {
34
+ "translation": {
35
+ "aboutThisItem": "A propos de cet item",
36
+ "addedFromUrl": "(Ajouté depuis une URL)",
37
+ "addManifestUrl": "Emplacement de la ressource",
38
+ "addManifestUrlHelp": "L'URL de la ressource IIIF",
39
+ "addResource": "Ajouter une ressource",
40
+ "annotationCanvasLabel_1/1": "Item: [{{label}}]",
41
+ ...
42
+ ```
43
+
44
+ Strings contained in double curly braces `{{}}` should not be changed.
45
+
46
+ The [`i18n.js`](../i18n.js) file should also be updated for the new language.
47
+
48
+ Lastly, you'll want to add the new locale and native language to the `availableLanguages` section in the [settings file](/src/config/settings.js).
49
+
50
+ ```javascript
51
+ // src/config/settings.js
52
+ ...
53
+ availableLanguages: {
54
+ de: 'Deutsch',
55
+ en: 'English',
56
+ fr: 'Français',
57
+ ...
58
+ ```
59
+
60
+ This will add the new language to the Language selection drop down as well as allow Mirador implementers to opt-out of including the language in their installation.