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,27 @@
1
+ /* eslint-disable react/no-array-index-key */
2
+ import { forwardRef, isValidElement, cloneElement } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { usePlugins } from '../extend/usePlugins';
5
+
6
+ /** Renders plugins */
7
+ export const PluginHook = forwardRef(({ classes = {}, targetName, ...otherProps }, ref) => {
8
+ const { PluginComponents } = usePlugins(targetName);
9
+
10
+ return PluginComponents
11
+ ? PluginComponents.map((PluginComponent, index) =>
12
+ isValidElement(PluginComponent) ? (
13
+ cloneElement(PluginComponent, { ...otherProps, ref })
14
+ ) : (
15
+ <PluginComponent ref={ref} {...otherProps} key={index} />
16
+ ),
17
+ )
18
+ : null;
19
+ });
20
+
21
+ PluginHook.displayName = 'PluginHook';
22
+
23
+ PluginHook.propTypes = {
24
+ // eslint-disable-next-line react/require-default-props
25
+ classes: PropTypes.object,
26
+ targetName: PropTypes.string.isRequired,
27
+ };
@@ -0,0 +1,115 @@
1
+ import { lazy, Suspense } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { styled } from '@mui/material/styles';
4
+ import classNames from 'classnames';
5
+ import WindowSideBar from '../containers/WindowSideBar';
6
+ import CompanionArea from '../containers/CompanionArea';
7
+ import CollectionDialog from '../containers/CollectionDialog';
8
+ import ns from '../config/css-ns';
9
+
10
+ const AudioViewer = lazy(() => import('../containers/AudioViewer'));
11
+ const GalleryView = lazy(() => import('../containers/GalleryView'));
12
+ const SelectCollection = lazy(() => import('../containers/SelectCollection'));
13
+ const WindowViewer = lazy(() => import('../containers/WindowViewer'));
14
+ const VideoViewer = lazy(() => import('../containers/VideoViewer'));
15
+ const TextViewer = lazy(() => import('../containers/TextViewer'));
16
+
17
+ GalleryView.displayName = 'GalleryView';
18
+ SelectCollection.displayName = 'SelectCollection';
19
+ WindowViewer.displayName = 'WindowViewer';
20
+
21
+ const Root = styled('div', { name: 'PrimaryWindow', slot: 'root' })(() => ({
22
+ display: 'flex',
23
+ flex: 1,
24
+ position: 'relative',
25
+ }));
26
+
27
+ /** */
28
+ const TypeSpecificViewer = ({
29
+ audioResources = [],
30
+ isCollection = false,
31
+ isFetching = false,
32
+ textResources = [],
33
+ videoResources = [],
34
+ view = undefined,
35
+ windowId,
36
+ }) => {
37
+ if (isCollection) {
38
+ return <SelectCollection windowId={windowId} />;
39
+ }
40
+ if (isFetching === false) {
41
+ if (view === 'gallery') {
42
+ return <GalleryView windowId={windowId} />;
43
+ }
44
+ if (videoResources.length > 0) {
45
+ return <VideoViewer windowId={windowId} />;
46
+ }
47
+ if (audioResources.length > 0) {
48
+ return <AudioViewer windowId={windowId} />;
49
+ }
50
+ if (textResources.length > 0) {
51
+ return <TextViewer windowId={windowId} />;
52
+ }
53
+ return <WindowViewer windowId={windowId} />;
54
+ }
55
+ return null;
56
+ };
57
+
58
+ TypeSpecificViewer.propTypes = {
59
+ audioResources: PropTypes.arrayOf(PropTypes.object),
60
+ isCollection: PropTypes.bool,
61
+ isFetching: PropTypes.bool,
62
+ textResources: PropTypes.arrayOf(PropTypes.object),
63
+ videoResources: PropTypes.arrayOf(PropTypes.object),
64
+ view: PropTypes.string,
65
+ windowId: PropTypes.string.isRequired,
66
+ };
67
+
68
+ /**
69
+ * PrimaryWindow - component that renders the primary content of a Mirador
70
+ * window. Right now this differentiates between a Image, Video, or Audio viewer.
71
+ */
72
+ export function PrimaryWindow({
73
+ audioResources = undefined,
74
+ children = null,
75
+ className = undefined,
76
+ isCollection = false,
77
+ isCollectionDialogVisible = false,
78
+ isFetching = false,
79
+ textResources = undefined,
80
+ videoResources = undefined,
81
+ view = undefined,
82
+ windowId,
83
+ }) {
84
+ const viewerProps = {
85
+ audioResources,
86
+ isCollection,
87
+ isFetching,
88
+ textResources,
89
+ videoResources,
90
+ view,
91
+ windowId,
92
+ };
93
+
94
+ return (
95
+ <Root data-testid="test-window" className={classNames(ns('primary-window'), className)}>
96
+ <WindowSideBar windowId={windowId} />
97
+ <CompanionArea windowId={windowId} position="left" />
98
+ {isCollectionDialogVisible && <CollectionDialog windowId={windowId} />}
99
+ <Suspense fallback={<div />}>{children || <TypeSpecificViewer {...viewerProps} />}</Suspense>
100
+ </Root>
101
+ );
102
+ }
103
+
104
+ PrimaryWindow.propTypes = {
105
+ audioResources: PropTypes.arrayOf(PropTypes.object),
106
+ children: PropTypes.node,
107
+ className: PropTypes.string,
108
+ isCollection: PropTypes.bool,
109
+ isCollectionDialogVisible: PropTypes.bool,
110
+ isFetching: PropTypes.bool,
111
+ textResources: PropTypes.arrayOf(PropTypes.object),
112
+ videoResources: PropTypes.arrayOf(PropTypes.object),
113
+ view: PropTypes.string,
114
+ windowId: PropTypes.string.isRequired,
115
+ };
@@ -0,0 +1,37 @@
1
+ import PropTypes from 'prop-types';
2
+ import { styled } from '@mui/material/styles';
3
+ import DOMPurify from 'dompurify';
4
+ import ns from '../config/css-ns';
5
+ import htmlRules from '../lib/htmlRules';
6
+
7
+ const Root = styled('span', { name: 'IIIFHtmlContent', slot: 'root' })({});
8
+
9
+ // Add a hook to make all links open a new window
10
+ DOMPurify.addHook('afterSanitizeAttributes', (node) => {
11
+ // set all elements owning target to target=_blank
12
+ if ('target' in node) {
13
+ node.setAttribute('target', '_blank');
14
+ // prevent https://www.owasp.org/index.php/Reverse_Tabnabbing
15
+ node.setAttribute('rel', 'noopener noreferrer');
16
+ }
17
+ });
18
+
19
+ /**
20
+ */
21
+ export function SanitizedHtml({ classes = {}, htmlString, ruleSet, ...rest }) {
22
+ return (
23
+ <Root
24
+ className={[ns('third-party-html'), classes.root].join(' ')}
25
+ dangerouslySetInnerHTML={{
26
+ __html: DOMPurify.sanitize(htmlString, htmlRules[ruleSet]),
27
+ }}
28
+ {...rest}
29
+ />
30
+ );
31
+ }
32
+
33
+ SanitizedHtml.propTypes = {
34
+ classes: PropTypes.objectOf(PropTypes.string),
35
+ htmlString: PropTypes.string.isRequired,
36
+ ruleSet: PropTypes.string.isRequired,
37
+ };
@@ -0,0 +1,60 @@
1
+ import PropTypes from 'prop-types';
2
+ import DialogContent from '@mui/material/DialogContent';
3
+ import { alpha, styled } from '@mui/material/styles';
4
+
5
+ /**
6
+ * From https://github.com/mui/material-ui/blob/v5.15.0/packages/mui-material/src/styles/getOverlayAlpha.ts
7
+ */
8
+ const getOverlayAlpha = (elevation) => {
9
+ let alphaValue;
10
+ if (elevation < 1) {
11
+ alphaValue = 5.11916 * elevation ** 2;
12
+ } else {
13
+ alphaValue = 4.5 * Math.log(elevation + 1) + 2;
14
+ }
15
+ return (alphaValue / 100).toFixed(2);
16
+ };
17
+
18
+ const Root = styled(DialogContent, { name: 'ScrollIndicatedDialogContent', slot: 'root' })(({ ownerState, theme }) => {
19
+ // In dark mode, paper has a elevation-dependent background color:
20
+ // https://github.com/mui/material-ui/blob/v5.15.0/packages/mui-material/src/Paper/Paper.js#L55-L60
21
+ const bgcolor =
22
+ theme.palette.mode === 'dark'
23
+ ? {
24
+ backgroundImage: `linear-gradient(${alpha(
25
+ '#fff',
26
+ getOverlayAlpha(ownerState?.elevation || 24),
27
+ )}, ${alpha('#fff', getOverlayAlpha(ownerState?.elevation || 24))})`,
28
+ }
29
+ : theme.palette.background.paper;
30
+ return {
31
+ /* Shadow covers */
32
+ background:
33
+ `linear-gradient(${bgcolor} 30%, rgba(255, 255, 255, 0)), ` +
34
+ `linear-gradient(rgba(255, 255, 255, 0), ${bgcolor} 70%) 0 100%, ` +
35
+ // Shadows
36
+ 'radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0)), ' +
37
+ 'radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0)) 0 100%;',
38
+ backgroundAttachment: 'local, local, scroll, scroll',
39
+ backgroundRepeat: 'no-repeat',
40
+ backgroundSize: '100% 40px, 100% 40px, 100% 14px, 100% 14px',
41
+ overflowY: 'auto',
42
+ };
43
+ });
44
+
45
+ /**
46
+ * ScrollIndicatedDialogContent ~ Inject a style into the DialogContent component
47
+ * to indicate there is scrollable content
48
+ */
49
+ export function ScrollIndicatedDialogContent({ classes = {}, className = '', ...otherProps }) {
50
+ const ourClassName = [className, classes.shadowScrollDialog].join(' ');
51
+
52
+ return <Root className={ourClassName} {...otherProps} />;
53
+ }
54
+
55
+ ScrollIndicatedDialogContent.propTypes = {
56
+ classes: PropTypes.shape({
57
+ shadowScrollDialog: PropTypes.string,
58
+ }),
59
+ className: PropTypes.string,
60
+ };
@@ -0,0 +1,61 @@
1
+ import { cloneElement, useEffect, useRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import isEmpty from 'lodash/isEmpty';
4
+ import ns from '../config/css-ns';
5
+
6
+ /** */
7
+ function usePrevious(value) {
8
+ const ref = useRef();
9
+ useEffect(() => {
10
+ ref.current = value;
11
+ }, [value]);
12
+ return ref.current;
13
+ }
14
+
15
+ /**
16
+ * ScrollTo ~
17
+ */
18
+ export function ScrollTo({ children, containerRef, offsetTop = 0, scrollTo, ...otherProps }) {
19
+ const scrollToRef = useRef();
20
+ const prevScrollTo = usePrevious(scrollTo);
21
+
22
+ useEffect(() => {
23
+ if (!scrollTo || scrollTo === prevScrollTo) return;
24
+
25
+ const elementToScrollTo = scrollToRef?.current;
26
+ if (!elementToScrollTo) return;
27
+
28
+ const scrollableContainer = containerRef?.current?.querySelector(`.${ns('scrollto-scrollable')}`);
29
+ if (!scrollableContainer) return;
30
+
31
+ const containerBoundingRect = containerRef?.current?.getBoundingClientRect() || {};
32
+ const scrollToBoundingRect = elementToScrollTo?.getBoundingClientRect() || {};
33
+ const elementIsVisible = (() => {
34
+ if (scrollToBoundingRect.top < containerBoundingRect.top + offsetTop) {
35
+ return false;
36
+ }
37
+ if (scrollToBoundingRect.bottom > containerBoundingRect.bottom) {
38
+ return false;
39
+ }
40
+
41
+ return true;
42
+ })();
43
+
44
+ if (elementIsVisible) return;
45
+
46
+ const scrollBy = elementToScrollTo.offsetTop - containerBoundingRect.height / 2 + offsetTop;
47
+
48
+ scrollableContainer.scrollTo(0, scrollBy);
49
+ }, [containerRef, scrollToRef, scrollTo, prevScrollTo, offsetTop]);
50
+
51
+ if (!scrollTo && isEmpty(otherProps)) return children;
52
+
53
+ return cloneElement(children, { ref: scrollToRef, ...otherProps });
54
+ }
55
+
56
+ ScrollTo.propTypes = {
57
+ children: PropTypes.node.isRequired,
58
+ containerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.instanceOf(Element) })]).isRequired,
59
+ offsetTop: PropTypes.number,
60
+ scrollTo: PropTypes.bool.isRequired,
61
+ };
@@ -0,0 +1,220 @@
1
+ import { useEffect, useId, useMemo } from 'react';
2
+ import { useEffectEvent } from 'use-effect-event';
3
+ import PropTypes from 'prop-types';
4
+ import Button from '@mui/material/Button';
5
+ import ListItem from '@mui/material/ListItem';
6
+ import ListItemText from '@mui/material/ListItemText';
7
+ import ListItemButton from '@mui/material/ListItemButton';
8
+ import Typography from '@mui/material/Typography';
9
+ import Chip from '@mui/material/Chip';
10
+ import { styled } from '@mui/material/styles';
11
+ import { useTranslation } from 'react-i18next';
12
+ import SanitizedHtml from '../containers/SanitizedHtml';
13
+ import TruncatedHit from '../lib/TruncatedHit';
14
+ import { ScrollTo } from './ScrollTo';
15
+
16
+ const Root = styled(ListItem, { name: 'SearchHit', slot: 'root' })(({ ownerState, theme }) => ({
17
+ '&.Mui-focused': {
18
+ '&:hover': {
19
+ ...(ownerState.windowSelected && {
20
+ backgroundColor: 'inherit',
21
+ }),
22
+ },
23
+ ...(ownerState.windowSelected && {
24
+ backgroundColor: 'inherit',
25
+ }),
26
+ },
27
+ paddingRight: theme.spacing(1),
28
+ }));
29
+
30
+ const CanvasLabel = styled('h4', { name: 'SearchHit', slot: 'canvasLabel' })(({ theme }) => ({
31
+ display: 'inline',
32
+ marginBottom: theme.spacing(1.5),
33
+ }));
34
+
35
+ const Counter = styled(Chip, { name: 'SearchHit', slot: 'counter' })(({ ownerState, theme }) => ({
36
+ backgroundColor: theme.palette.hitCounter.default,
37
+ ...(ownerState.windowSelected && {
38
+ backgroundColor: theme.palette.highlights.primary,
39
+ }),
40
+ ...(ownerState.adjacent &&
41
+ !ownerState.windowSelected && {
42
+ backgroundColor: theme.palette.highlights.secondary,
43
+ }),
44
+ height: 30,
45
+ marginRight: theme.spacing(1),
46
+ typography: 'subtitle2',
47
+ verticalAlign: 'inherit',
48
+ }));
49
+
50
+ /** */
51
+ // eslint-disable-next-line complexity
52
+ export function SearchHit({
53
+ adjacent = false,
54
+ annotation = undefined,
55
+ annotationId = undefined,
56
+ annotationLabel = undefined,
57
+ announcer = undefined,
58
+ canvasLabel = undefined,
59
+ companionWindowId = undefined,
60
+ containerRef = undefined,
61
+ focused = false,
62
+ hit = undefined,
63
+ index = undefined,
64
+ selectAnnotation = () => {},
65
+ selected = false,
66
+ showDetails = () => {},
67
+ total = undefined,
68
+ windowId,
69
+ windowSelected = false,
70
+ }) {
71
+ const { t } = useTranslation();
72
+ useEffect(() => {
73
+ if (selected) {
74
+ announceHit();
75
+ }
76
+ // eslint-disable-next-line react-hooks/exhaustive-deps
77
+ }, [selected]);
78
+
79
+ /** */
80
+ const handleClick = () => {
81
+ if (annotation && annotationId) selectAnnotation(annotationId);
82
+ };
83
+
84
+ const truncatedHit = useMemo(() => hit && new TruncatedHit(hit, annotation), [hit, annotation]);
85
+
86
+ /**
87
+ * Pass content describing the hit to the announcer prop (intended for screen readers)
88
+ */
89
+ const announceHit = useEffectEvent(() => {
90
+ if (!announcer || !truncatedHit) return;
91
+
92
+ announcer(
93
+ [
94
+ t('pagination', { current: index + 1, total }),
95
+ canvasLabel,
96
+ annotationLabel,
97
+ truncatedHit.before,
98
+ truncatedHit.match,
99
+ truncatedHit.after,
100
+ ].join(' '),
101
+ 'polite',
102
+ );
103
+ });
104
+
105
+ const canvasLabelHtmlId = useId();
106
+
107
+ if (focused && !selected) return null;
108
+
109
+ const renderedHit = focused ? hit : hit && truncatedHit;
110
+ const truncated = hit && (renderedHit.before !== hit.before || renderedHit.after !== hit.after);
111
+ const ownerState = {
112
+ adjacent,
113
+ focused,
114
+ selected,
115
+ windowSelected,
116
+ };
117
+
118
+ const header = (
119
+ <>
120
+ <Counter component="span" ownerState={ownerState} label={index + 1} />
121
+ <CanvasLabel id={canvasLabelHtmlId}>
122
+ {canvasLabel}
123
+ {annotationLabel && (
124
+ <Typography component="span" sx={{ display: 'block', marginTop: 1 }}>
125
+ {annotationLabel}
126
+ </Typography>
127
+ )}
128
+ </CanvasLabel>
129
+ </>
130
+ );
131
+
132
+ return (
133
+ <ScrollTo
134
+ containerRef={containerRef}
135
+ offsetTop={96} // offset for the height of the form above
136
+ scrollTo={windowSelected && !focused}
137
+ >
138
+ <Root
139
+ ownerState={ownerState}
140
+ className={windowSelected ? 'windowSelected' : ''}
141
+ divider
142
+ component={selected ? 'li' : ListItemButton}
143
+ onClick={handleClick}
144
+ selected={selected}
145
+ >
146
+ <ListItemText
147
+ primary={header}
148
+ secondary={
149
+ <>
150
+ {hit && (
151
+ <>
152
+ <SanitizedHtml ruleSet="iiif" htmlString={renderedHit.before} />{' '}
153
+ <strong>
154
+ <SanitizedHtml ruleSet="iiif" htmlString={renderedHit.match} />
155
+ </strong>{' '}
156
+ <SanitizedHtml ruleSet="iiif" htmlString={renderedHit.after} />{' '}
157
+ {truncated && !focused && (
158
+ <Button
159
+ sx={{
160
+ '& span': {
161
+ lineHeight: '1.5em',
162
+ },
163
+ margin: 0,
164
+ padding: 0,
165
+ textTransform: 'none',
166
+ }}
167
+ onClick={showDetails}
168
+ color="secondary"
169
+ size="small"
170
+ aria-describedby={canvasLabelHtmlId}
171
+ >
172
+ {t('more')}
173
+ </Button>
174
+ )}
175
+ </>
176
+ )}
177
+ {!hit && annotation && <SanitizedHtml ruleSet="iiif" htmlString={annotation.chars} />}
178
+ </>
179
+ }
180
+ slotProps={{
181
+ primary: {
182
+ component: 'div',
183
+ sx: { marginBottom: 1 },
184
+ variant: 'subtitle2',
185
+ },
186
+
187
+ secondary: { variant: 'body1' },
188
+ }}
189
+ />
190
+ </Root>
191
+ </ScrollTo>
192
+ );
193
+ }
194
+
195
+ SearchHit.propTypes = {
196
+ adjacent: PropTypes.bool,
197
+ annotation: PropTypes.shape({
198
+ chars: PropTypes.string,
199
+ targetId: PropTypes.string,
200
+ }),
201
+ annotationId: PropTypes.string,
202
+ annotationLabel: PropTypes.string,
203
+ announcer: PropTypes.func,
204
+ canvasLabel: PropTypes.string,
205
+ companionWindowId: PropTypes.string,
206
+ containerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.instanceOf(Element) })]),
207
+ focused: PropTypes.bool,
208
+ hit: PropTypes.shape({
209
+ after: PropTypes.string,
210
+ before: PropTypes.string,
211
+ match: PropTypes.string,
212
+ }),
213
+ index: PropTypes.number,
214
+ selectAnnotation: PropTypes.func,
215
+ selected: PropTypes.bool,
216
+ showDetails: PropTypes.func,
217
+ total: PropTypes.number,
218
+ windowId: PropTypes.string.isRequired,
219
+ windowSelected: PropTypes.bool,
220
+ };
@@ -0,0 +1,80 @@
1
+ import { useRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Button from '@mui/material/Button';
4
+ import Chip from '@mui/material/Chip';
5
+ import Typography from '@mui/material/Typography';
6
+ import { useTranslation } from 'react-i18next';
7
+ import CompanionWindow from '../containers/CompanionWindow';
8
+ import SearchPanelControls from '../containers/SearchPanelControls';
9
+ import SearchResults from '../containers/SearchResults';
10
+
11
+ /** */
12
+ export function SearchPanel({
13
+ fetchSearch = undefined,
14
+ id,
15
+ query = '',
16
+ removeSearch,
17
+ searchService,
18
+ suggestedSearches = [],
19
+ windowId,
20
+ }) {
21
+ const { t } = useTranslation();
22
+ const containerRef = useRef(null);
23
+
24
+ return (
25
+ <CompanionWindow
26
+ ariaLabel={t('searchTitle')}
27
+ title={
28
+ <>
29
+ {t('searchTitle')}
30
+ {query && query !== '' && (
31
+ <Chip
32
+ aria-label={t('clearSearchAria')}
33
+ role="button"
34
+ sx={{ marginLeft: 1 }}
35
+ color="secondary"
36
+ label={t('clearSearch')}
37
+ onClick={removeSearch}
38
+ onDelete={removeSearch}
39
+ size="small"
40
+ tabIndex={0}
41
+ variant="outlined"
42
+ />
43
+ )}
44
+ </>
45
+ }
46
+ windowId={windowId}
47
+ id={id}
48
+ titleControls={<SearchPanelControls companionWindowId={id} windowId={windowId} />}
49
+ ref={containerRef}
50
+ >
51
+ <SearchResults containerRef={containerRef} companionWindowId={id} windowId={windowId} />
52
+ {fetchSearch &&
53
+ suggestedSearches &&
54
+ query === '' &&
55
+ suggestedSearches.map((search) => (
56
+ <Typography component="p" key={search} variant="body1" sx={{ margin: 2 }}>
57
+ <Button
58
+ variant="inlineText"
59
+ color="secondary"
60
+ onClick={() => fetchSearch(`${searchService.id}?${new URLSearchParams({ q: search })}`, search)}
61
+ >
62
+ {t('suggestSearch', { query: search })}
63
+ </Button>
64
+ </Typography>
65
+ ))}
66
+ </CompanionWindow>
67
+ );
68
+ }
69
+
70
+ SearchPanel.propTypes = {
71
+ fetchSearch: PropTypes.func,
72
+ id: PropTypes.string.isRequired,
73
+ query: PropTypes.string,
74
+ removeSearch: PropTypes.func.isRequired,
75
+ searchService: PropTypes.shape({
76
+ id: PropTypes.string,
77
+ }).isRequired,
78
+ suggestedSearches: PropTypes.arrayOf(PropTypes.string),
79
+ windowId: PropTypes.string.isRequired,
80
+ };