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.
- package/LICENSE +203 -0
- package/README.md +133 -0
- package/dist/CommentSharp-B0J_-jEq.js +325 -0
- package/dist/CommentSharp-B0J_-jEq.js.map +1 -0
- package/dist/FailedImageContext-aQXnWSHN.js +318 -0
- package/dist/FailedImageContext-aQXnWSHN.js.map +1 -0
- package/dist/PluginHook-CFw_6P5c.js +54 -0
- package/dist/PluginHook-CFw_6P5c.js.map +1 -0
- package/dist/WindowCanvasNavigationControls-CUX723BQ.js +242 -0
- package/dist/WindowCanvasNavigationControls-CUX723BQ.js.map +1 -0
- package/dist/action-types-DjIbTE-A.js +74 -0
- package/dist/action-types-DjIbTE-A.js.map +1 -0
- package/dist/canvas-C8oHvXFN.js +41 -0
- package/dist/canvas-C8oHvXFN.js.map +1 -0
- package/dist/canvases-gRqhr-IH.js +3154 -0
- package/dist/canvases-gRqhr-IH.js.map +1 -0
- package/dist/createSvgIcon-Cwt8YPfm.js +2 -0
- package/dist/getters-COus7Mvg.js +2066 -0
- package/dist/getters-COus7Mvg.js.map +1 -0
- package/dist/index.module-CbBRf_R8.js +403 -0
- package/dist/index.module-CbBRf_R8.js.map +1 -0
- package/dist/mirador.es.js +39600 -0
- package/dist/mirador.es.js.map +1 -0
- package/dist/mirador.min.js +334 -0
- package/dist/mirador.min.js.map +1 -0
- package/dist/react-error-boundary.esm-B_pT-oCS.js +67 -0
- package/dist/react-error-boundary.esm-B_pT-oCS.js.map +1 -0
- package/dist/visuallyHidden-DmYvwNdU.js +98 -0
- package/dist/visuallyHidden-DmYvwNdU.js.map +1 -0
- package/dist/window-zelwU7wz.js +138 -0
- package/dist/window-zelwU7wz.js.map +1 -0
- package/package.json +138 -0
- package/src/components/AccessTokenSender.jsx +34 -0
- package/src/components/AnnotationSettings.jsx +31 -0
- package/src/components/AnnotationsOverlay.jsx +328 -0
- package/src/components/App.jsx +34 -0
- package/src/components/AppProviders.jsx +129 -0
- package/src/components/AttributionPanel.jsx +78 -0
- package/src/components/AudioViewer.jsx +39 -0
- package/src/components/BackgroundPluginArea.jsx +9 -0
- package/src/components/Branding.jsx +33 -0
- package/src/components/CanvasAnnotations.jsx +125 -0
- package/src/components/CanvasInfo.jsx +46 -0
- package/src/components/CanvasLayers.jsx +367 -0
- package/src/components/ChangeThemeDialog.jsx +65 -0
- package/src/components/CollapsibleSection.jsx +53 -0
- package/src/components/CollectionDialog.jsx +236 -0
- package/src/components/CollectionInfo.jsx +48 -0
- package/src/components/CompanionArea.jsx +140 -0
- package/src/components/CompanionWindow.jsx +228 -0
- package/src/components/CompanionWindowFactory.jsx +38 -0
- package/src/components/CompanionWindowSection.jsx +11 -0
- package/src/components/CustomPanel.jsx +22 -0
- package/src/components/ErrorContent.jsx +65 -0
- package/src/components/ErrorDialog.jsx +47 -0
- package/src/components/FullScreenButton.jsx +47 -0
- package/src/components/GalleryView.jsx +36 -0
- package/src/components/GalleryViewThumbnail.jsx +160 -0
- package/src/components/IIIFAuthentication.jsx +144 -0
- package/src/components/IIIFDropTarget.jsx +168 -0
- package/src/components/IIIFIFrameCommunication.jsx +45 -0
- package/src/components/IIIFResourceLabel.jsx +26 -0
- package/src/components/IIIFThumbnail.jsx +214 -0
- package/src/components/ImageFailureMessage.jsx +42 -0
- package/src/components/LabelValueMetadata.jsx +46 -0
- package/src/components/LanguageSettings.jsx +46 -0
- package/src/components/LayersPanel.jsx +24 -0
- package/src/components/LocalePicker.jsx +56 -0
- package/src/components/ManifestForm.jsx +79 -0
- package/src/components/ManifestInfo.jsx +67 -0
- package/src/components/ManifestListItem.jsx +209 -0
- package/src/components/ManifestListItemError.jsx +53 -0
- package/src/components/ManifestRelatedLinks.jsx +154 -0
- package/src/components/MinimalWindow.jsx +104 -0
- package/src/components/MiradorMenuButton.jsx +71 -0
- package/src/components/MosaicRenderPreview.jsx +16 -0
- package/src/components/NestedMenu.jsx +42 -0
- package/src/components/NewBrowserWindow.jsx +34 -0
- package/src/components/OpenSeadragonComponent.jsx +258 -0
- package/src/components/OpenSeadragonTileSource.jsx +105 -0
- package/src/components/OpenSeadragonViewer.jsx +161 -0
- package/src/components/PluginHook.jsx +27 -0
- package/src/components/PrimaryWindow.jsx +115 -0
- package/src/components/SanitizedHtml.jsx +37 -0
- package/src/components/ScrollIndicatedDialogContent.jsx +60 -0
- package/src/components/ScrollTo.jsx +61 -0
- package/src/components/SearchHit.jsx +220 -0
- package/src/components/SearchPanel.jsx +80 -0
- package/src/components/SearchPanelControls.jsx +174 -0
- package/src/components/SearchPanelNavigation.jsx +84 -0
- package/src/components/SearchResults.jsx +138 -0
- package/src/components/SelectCollection.jsx +44 -0
- package/src/components/SidebarIndexItem.jsx +11 -0
- package/src/components/SidebarIndexList.jsx +73 -0
- package/src/components/SidebarIndexTableOfContents.jsx +170 -0
- package/src/components/SidebarIndexThumbnail.jsx +22 -0
- package/src/components/TextViewer.jsx +37 -0
- package/src/components/ThumbnailCanvasGrouping.jsx +122 -0
- package/src/components/ThumbnailNavigation.jsx +231 -0
- package/src/components/VideoViewer.jsx +35 -0
- package/src/components/ViewerInfo.jsx +55 -0
- package/src/components/ViewerNavigation.jsx +72 -0
- package/src/components/Window.jsx +150 -0
- package/src/components/WindowAuthenticationBar.jsx +176 -0
- package/src/components/WindowCanvasNavigationControls.jsx +91 -0
- package/src/components/WindowList.jsx +71 -0
- package/src/components/WindowListButton.jsx +57 -0
- package/src/components/WindowSideBar.jsx +48 -0
- package/src/components/WindowSideBarAnnotationsPanel.jsx +51 -0
- package/src/components/WindowSideBarButtons.jsx +151 -0
- package/src/components/WindowSideBarCanvasPanel.jsx +165 -0
- package/src/components/WindowSideBarCollectionPanel.jsx +179 -0
- package/src/components/WindowSideBarInfoPanel.jsx +67 -0
- package/src/components/WindowThumbnailSettings.jsx +130 -0
- package/src/components/WindowTopBar.jsx +125 -0
- package/src/components/WindowTopBarPluginArea.jsx +8 -0
- package/src/components/WindowTopBarPluginMenu.jsx +78 -0
- package/src/components/WindowTopBarTitle.jsx +73 -0
- package/src/components/WindowTopMenu.jsx +81 -0
- package/src/components/WindowTopMenuButton.jsx +49 -0
- package/src/components/WindowViewSettings.jsx +95 -0
- package/src/components/WindowViewer.jsx +26 -0
- package/src/components/Workspace.jsx +124 -0
- package/src/components/WorkspaceAdd.jsx +221 -0
- package/src/components/WorkspaceAddButton.jsx +73 -0
- package/src/components/WorkspaceArea.jsx +66 -0
- package/src/components/WorkspaceControlPanel.jsx +85 -0
- package/src/components/WorkspaceControlPanelButtons.jsx +20 -0
- package/src/components/WorkspaceDialog.jsx +11 -0
- package/src/components/WorkspaceElastic.jsx +88 -0
- package/src/components/WorkspaceElasticWindow.jsx +79 -0
- package/src/components/WorkspaceExport.jsx +99 -0
- package/src/components/WorkspaceImport.jsx +89 -0
- package/src/components/WorkspaceMenu.jsx +126 -0
- package/src/components/WorkspaceMenuButton.jsx +42 -0
- package/src/components/WorkspaceMosaic.jsx +149 -0
- package/src/components/WorkspaceOptionsButton.jsx +35 -0
- package/src/components/WorkspaceOptionsMenu.jsx +112 -0
- package/src/components/WorkspaceSelectionDialog.jsx +165 -0
- package/src/components/ZoomControls.jsx +57 -0
- package/src/components/icons/BookViewIcon.jsx +14 -0
- package/src/components/icons/CanvasIndexIcon.jsx +14 -0
- package/src/components/icons/GalleryViewIcon.jsx +17 -0
- package/src/components/icons/MiradorIcon.jsx +14 -0
- package/src/components/icons/RestoreZoomIcon.jsx +15 -0
- package/src/components/icons/ThumbnailNavigationBottomIcon.jsx +15 -0
- package/src/components/icons/ThumbnailNavigationRightIcon.jsx +16 -0
- package/src/components/icons/WindowMaxIcon.jsx +15 -0
- package/src/components/icons/WindowMinIcon.jsx +15 -0
- package/src/components/icons/WindowOptionsIcon.jsx +16 -0
- package/src/components/icons/WorkspaceTypeElasticIcon.jsx +157 -0
- package/src/components/icons/WorkspaceTypeMosaicIcon.jsx +162 -0
- package/src/components/icons/index.js +27 -0
- package/src/components/index.js +108 -0
- package/src/config/css-ns.js +10 -0
- package/src/config/index.js +2 -0
- package/src/config/settings.js +607 -0
- package/src/containers/AnnotationSettings.js +27 -0
- package/src/containers/AnnotationsOverlay.js +51 -0
- package/src/containers/AppProviders.js +20 -0
- package/src/containers/AttributionPanel.js +20 -0
- package/src/containers/AudioViewer.js +16 -0
- package/src/containers/BackgroundPluginArea.js +4 -0
- package/src/containers/Branding.js +4 -0
- package/src/containers/CanvasAnnotations.js +32 -0
- package/src/containers/CanvasInfo.js +20 -0
- package/src/containers/CanvasLayers.js +25 -0
- package/src/containers/ChangeThemeDialog.js +29 -0
- package/src/containers/CollapsibleSection.js +3 -0
- package/src/containers/CollectionDialog.js +48 -0
- package/src/containers/CollectionInfo.js +29 -0
- package/src/containers/CompanionArea.js +22 -0
- package/src/containers/CompanionWindow.js +40 -0
- package/src/containers/CompanionWindowFactory.js +23 -0
- package/src/containers/CustomPanel.js +13 -0
- package/src/containers/ErrorContent.js +20 -0
- package/src/containers/ErrorDialog.js +28 -0
- package/src/containers/FullScreenButton.js +22 -0
- package/src/containers/GalleryView.js +23 -0
- package/src/containers/GalleryViewThumbnail.js +51 -0
- package/src/containers/IIIFAuthentication.js +86 -0
- package/src/containers/IIIFThumbnail.js +17 -0
- package/src/containers/LabelValueMetadata.js +14 -0
- package/src/containers/LanguageSettings.js +26 -0
- package/src/containers/LayersPanel.js +16 -0
- package/src/containers/LocalePicker.js +3 -0
- package/src/containers/ManifestForm.js +16 -0
- package/src/containers/ManifestInfo.js +29 -0
- package/src/containers/ManifestListItem.js +52 -0
- package/src/containers/ManifestListItemError.js +15 -0
- package/src/containers/ManifestRelatedLinks.js +28 -0
- package/src/containers/MinimalWindow.js +25 -0
- package/src/containers/MiradorMenuButton.js +7 -0
- package/src/containers/MosaicRenderPreview.js +14 -0
- package/src/containers/OpenSeadragonViewer.js +59 -0
- package/src/containers/PrimaryWindow.js +27 -0
- package/src/containers/SanitizedHtml.js +3 -0
- package/src/containers/ScrollIndicatedDialogContent.js +3 -0
- package/src/containers/SearchHit.js +71 -0
- package/src/containers/SearchPanel.js +23 -0
- package/src/containers/SearchPanelControls.js +36 -0
- package/src/containers/SearchPanelNavigation.js +39 -0
- package/src/containers/SearchResults.js +38 -0
- package/src/containers/SelectCollection.js +24 -0
- package/src/containers/SidebarIndexItem.js +8 -0
- package/src/containers/SidebarIndexList.js +28 -0
- package/src/containers/SidebarIndexTableOfContents.js +31 -0
- package/src/containers/SidebarIndexThumbnail.js +18 -0
- package/src/containers/TextViewer.js +19 -0
- package/src/containers/ThumbnailCanvasGrouping.js +29 -0
- package/src/containers/ThumbnailNavigation.js +48 -0
- package/src/containers/VideoViewer.js +16 -0
- package/src/containers/ViewerInfo.js +30 -0
- package/src/containers/ViewerNavigation.js +31 -0
- package/src/containers/Window.js +45 -0
- package/src/containers/WindowAuthenticationBar.js +7 -0
- package/src/containers/WindowCanvasNavigationControls.js +15 -0
- package/src/containers/WindowList.js +30 -0
- package/src/containers/WindowListButton.js +15 -0
- package/src/containers/WindowSideBar.js +20 -0
- package/src/containers/WindowSideBarAnnotationsPanel.js +23 -0
- package/src/containers/WindowSideBarButtons.js +75 -0
- package/src/containers/WindowSideBarCanvasPanel.js +50 -0
- package/src/containers/WindowSideBarCollectionPanel.js +48 -0
- package/src/containers/WindowSideBarInfoPanel.js +35 -0
- package/src/containers/WindowThumbnailSettings.js +31 -0
- package/src/containers/WindowTopBar.js +39 -0
- package/src/containers/WindowTopBarPluginArea.js +8 -0
- package/src/containers/WindowTopBarPluginMenu.js +7 -0
- package/src/containers/WindowTopBarTitle.js +17 -0
- package/src/containers/WindowTopMenu.js +28 -0
- package/src/containers/WindowTopMenuButton.js +7 -0
- package/src/containers/WindowViewSettings.js +30 -0
- package/src/containers/WindowViewer.js +10 -0
- package/src/containers/Workspace.js +36 -0
- package/src/containers/WorkspaceAdd.js +27 -0
- package/src/containers/WorkspaceAddButton.js +30 -0
- package/src/containers/WorkspaceArea.js +21 -0
- package/src/containers/WorkspaceControlPanel.js +10 -0
- package/src/containers/WorkspaceControlPanelButtons.js +7 -0
- package/src/containers/WorkspaceElastic.js +41 -0
- package/src/containers/WorkspaceElasticWindow.js +36 -0
- package/src/containers/WorkspaceExport.js +18 -0
- package/src/containers/WorkspaceImport.js +19 -0
- package/src/containers/WorkspaceMenu.js +30 -0
- package/src/containers/WorkspaceMenuButton.js +10 -0
- package/src/containers/WorkspaceMosaic.js +32 -0
- package/src/containers/WorkspaceOptionsButton.js +7 -0
- package/src/containers/WorkspaceOptionsMenu.js +3 -0
- package/src/containers/WorkspaceSelectionDialog.js +26 -0
- package/src/containers/ZoomControls.js +26 -0
- package/src/containers/index.js +94 -0
- package/src/contexts/FailedImageContext.js +8 -0
- package/src/contexts/FailedImageProvider.jsx +34 -0
- package/src/contexts/FullScreenContext.js +5 -0
- package/src/contexts/LocaleContext.js +5 -0
- package/src/contexts/OpenSeadragonViewerContext.js +5 -0
- package/src/contexts/WorkspaceContext.js +5 -0
- package/src/contexts/index.js +4 -0
- package/src/extend/PluginContext.js +5 -0
- package/src/extend/PluginProvider.jsx +22 -0
- package/src/extend/index.js +9 -0
- package/src/extend/pluginMapping.js +44 -0
- package/src/extend/pluginPreprocessing.js +45 -0
- package/src/extend/pluginValidation.js +58 -0
- package/src/extend/usePlugins.js +13 -0
- package/src/extend/withPlugins.jsx +46 -0
- package/src/hooks/index.js +4 -0
- package/src/hooks/useCanvasWorldService.js +10 -0
- package/src/hooks/useThumbnailService.js +8 -0
- package/src/i18n.js +71 -0
- package/src/index.js +18 -0
- package/src/init.js +20 -0
- package/src/lib/AnnotationFactory.js +23 -0
- package/src/lib/AnnotationItem.js +123 -0
- package/src/lib/AnnotationList.js +31 -0
- package/src/lib/AnnotationPage.js +41 -0
- package/src/lib/AnnotationResource.js +122 -0
- package/src/lib/CanvasAnnotationDisplay.js +148 -0
- package/src/lib/CanvasGroupings.js +55 -0
- package/src/lib/CanvasWorld.js +214 -0
- package/src/lib/CompanionWindowRegistry.js +23 -0
- package/src/lib/FullScreenHandle.jsx +76 -0
- package/src/lib/MiradorCanvas.js +211 -0
- package/src/lib/MiradorManifest.js +44 -0
- package/src/lib/MiradorViewer.jsx +53 -0
- package/src/lib/MosaicLayout.js +77 -0
- package/src/lib/OpenSeadragonCanvasOverlay.js +114 -0
- package/src/lib/ThumbnailFactory.js +310 -0
- package/src/lib/TruncatedHit.js +34 -0
- package/src/lib/asArray.js +11 -0
- package/src/lib/htmlRules.js +28 -0
- package/src/lib/iiif.js +12 -0
- package/src/lib/index.js +23 -0
- package/src/lib/readImageMetadata.js +21 -0
- package/src/lib/svgShapesToPath.js +49 -0
- package/src/locales/README.md +60 -0
- package/src/locales/ar/translation.json +141 -0
- package/src/locales/bg/translation.json +164 -0
- package/src/locales/de/translation.json +169 -0
- package/src/locales/en/translation.json +170 -0
- package/src/locales/et/translation.json +164 -0
- package/src/locales/fa/translation.json +164 -0
- package/src/locales/fr/translation.json +158 -0
- package/src/locales/hr/translation.json +164 -0
- package/src/locales/hu/translation.json +166 -0
- package/src/locales/it/translation.json +162 -0
- package/src/locales/ja/translation.json +156 -0
- package/src/locales/kr/translation.json +162 -0
- package/src/locales/lt/translation.json +153 -0
- package/src/locales/nbNo/translation.json +162 -0
- package/src/locales/nl/translation.json +139 -0
- package/src/locales/pl/translation.json +162 -0
- package/src/locales/ptBr/translation.json +133 -0
- package/src/locales/sr/translation.json +155 -0
- package/src/locales/sv/translation.json +157 -0
- package/src/locales/ta/translation.json +167 -0
- package/src/locales/vi/translation.json +156 -0
- package/src/locales/zhCn/translation.json +163 -0
- package/src/locales/zhTw/translation.json +163 -0
- package/src/plugins/OSDReferences.js +15 -0
- package/src/plugins/index.js +1 -0
- package/src/state/actions/action-types.js +76 -0
- package/src/state/actions/annotation.js +123 -0
- package/src/state/actions/auth.js +109 -0
- package/src/state/actions/canvas.js +65 -0
- package/src/state/actions/catalog.js +22 -0
- package/src/state/actions/companionWindow.js +107 -0
- package/src/state/actions/config.js +49 -0
- package/src/state/actions/elasticLayout.js +10 -0
- package/src/state/actions/errors.js +22 -0
- package/src/state/actions/index.js +19 -0
- package/src/state/actions/infoResponse.js +90 -0
- package/src/state/actions/layers.js +14 -0
- package/src/state/actions/manifest.js +65 -0
- package/src/state/actions/search.js +97 -0
- package/src/state/actions/window.js +209 -0
- package/src/state/actions/workspace.js +84 -0
- package/src/state/createPluggableStore.js +24 -0
- package/src/state/createStore.js +33 -0
- package/src/state/index.js +21 -0
- package/src/state/reducers/accessTokens.js +59 -0
- package/src/state/reducers/annotations.js +48 -0
- package/src/state/reducers/auth.js +43 -0
- package/src/state/reducers/catalog.js +30 -0
- package/src/state/reducers/companionWindows.js +49 -0
- package/src/state/reducers/config.js +39 -0
- package/src/state/reducers/elasticLayout.js +29 -0
- package/src/state/reducers/errors.js +51 -0
- package/src/state/reducers/index.js +15 -0
- package/src/state/reducers/infoResponses.js +61 -0
- package/src/state/reducers/layers.js +23 -0
- package/src/state/reducers/manifests.js +52 -0
- package/src/state/reducers/rootReducer.js +44 -0
- package/src/state/reducers/search.js +145 -0
- package/src/state/reducers/utils.js +45 -0
- package/src/state/reducers/viewers.js +42 -0
- package/src/state/reducers/windows.js +185 -0
- package/src/state/reducers/workspace.js +111 -0
- package/src/state/sagas/annotations.js +48 -0
- package/src/state/sagas/app.js +56 -0
- package/src/state/sagas/auth.js +151 -0
- package/src/state/sagas/iiif.js +233 -0
- package/src/state/sagas/index.js +30 -0
- package/src/state/sagas/windows.js +293 -0
- package/src/state/selectors/annotations.js +138 -0
- package/src/state/selectors/auth.js +100 -0
- package/src/state/selectors/canvases.js +260 -0
- package/src/state/selectors/companionWindows.js +182 -0
- package/src/state/selectors/config.js +100 -0
- package/src/state/selectors/getters.js +90 -0
- package/src/state/selectors/index.js +17 -0
- package/src/state/selectors/layers.js +79 -0
- package/src/state/selectors/manifests.js +433 -0
- package/src/state/selectors/ranges.js +147 -0
- package/src/state/selectors/searches.js +249 -0
- package/src/state/selectors/sequences.js +134 -0
- package/src/state/selectors/thumbnails.js +28 -0
- package/src/state/selectors/utils.js +18 -0
- package/src/state/selectors/viewer.js +19 -0
- package/src/state/selectors/windows.js +98 -0
- package/src/state/selectors/workspace.js +52 -0
- package/src/state/selectors/wrappers.js +15 -0
- package/src/styles/react-mosaic-component.js +288 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import deepmerge from 'deepmerge';
|
|
2
|
+
import settings from '../../config/settings';
|
|
3
|
+
import ActionTypes from '../actions/action-types';
|
|
4
|
+
|
|
5
|
+
const initialState = { ...settings };
|
|
6
|
+
|
|
7
|
+
/** Overwrite arrays when deep merging */
|
|
8
|
+
const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* configReducer - does a deep merge of the config
|
|
12
|
+
*/
|
|
13
|
+
export const configReducer = (state = initialState, action) => {
|
|
14
|
+
switch (action.type) {
|
|
15
|
+
case ActionTypes.UPDATE_CONFIG:
|
|
16
|
+
case ActionTypes.IMPORT_CONFIG:
|
|
17
|
+
return deepmerge(state, action.config, { arrayMerge: overwriteMerge });
|
|
18
|
+
case ActionTypes.SET_CONFIG:
|
|
19
|
+
return action.config;
|
|
20
|
+
case ActionTypes.IMPORT_MIRADOR_STATE:
|
|
21
|
+
return {
|
|
22
|
+
...(action.state.config || {}),
|
|
23
|
+
export: deepmerge(state.export || {}, action.state.config?.export || {}, {
|
|
24
|
+
arrayMerge: overwriteMerge,
|
|
25
|
+
}),
|
|
26
|
+
requests: deepmerge(state.requests || {}, action.state.config?.requests || {}, {
|
|
27
|
+
arrayMerge: overwriteMerge,
|
|
28
|
+
}),
|
|
29
|
+
theme: deepmerge(state.theme || {}, action.state.config?.theme || {}, {
|
|
30
|
+
arrayMerge: overwriteMerge,
|
|
31
|
+
}),
|
|
32
|
+
themes: deepmerge(state.themes || {}, action.state.config?.themes || {}, {
|
|
33
|
+
arrayMerge: overwriteMerge,
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
default:
|
|
37
|
+
return state;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import update from 'lodash/fp/update';
|
|
2
|
+
import omit from 'lodash/omit';
|
|
3
|
+
import ActionTypes from '../actions/action-types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* elasticLayoutReducer
|
|
7
|
+
*/
|
|
8
|
+
export const elasticLayoutReducer = (state = {}, action) => {
|
|
9
|
+
switch (action.type) {
|
|
10
|
+
case ActionTypes.ADD_WINDOW:
|
|
11
|
+
return {
|
|
12
|
+
...state,
|
|
13
|
+
[action.window.id]: {
|
|
14
|
+
windowId: action.window.id,
|
|
15
|
+
...action.elasticLayout,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
case ActionTypes.UPDATE_ELASTIC_WINDOW_LAYOUT:
|
|
20
|
+
return update([action.windowId], (orig) => ({ ...(orig || {}), ...action.payload }), state);
|
|
21
|
+
|
|
22
|
+
case ActionTypes.REMOVE_WINDOW:
|
|
23
|
+
return omit(state, action.windowId);
|
|
24
|
+
case ActionTypes.IMPORT_MIRADOR_STATE:
|
|
25
|
+
return action.state.elasticLayout || {};
|
|
26
|
+
default:
|
|
27
|
+
return state;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import without from 'lodash/without';
|
|
2
|
+
import ActionTypes from '../actions/action-types';
|
|
3
|
+
|
|
4
|
+
const defaultState = { items: [] };
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* errorsReducer
|
|
8
|
+
*/
|
|
9
|
+
export const errorsReducer = (state = defaultState, action) => {
|
|
10
|
+
let ret;
|
|
11
|
+
switch (action.type) {
|
|
12
|
+
case ActionTypes.ADD_ERROR:
|
|
13
|
+
return {
|
|
14
|
+
...state,
|
|
15
|
+
[action.id]: { id: action.id, message: action.message },
|
|
16
|
+
items: [...state.items, action.id],
|
|
17
|
+
};
|
|
18
|
+
case ActionTypes.RECEIVE_INFO_RESPONSE_FAILURE:
|
|
19
|
+
return {
|
|
20
|
+
...state,
|
|
21
|
+
[action.infoId]: {
|
|
22
|
+
id: action.infoId,
|
|
23
|
+
message: action.error,
|
|
24
|
+
},
|
|
25
|
+
items: [...state.items, action.infoId],
|
|
26
|
+
};
|
|
27
|
+
case ActionTypes.RECEIVE_SEARCH_FAILURE:
|
|
28
|
+
return {
|
|
29
|
+
...state,
|
|
30
|
+
[action.searchId]: {
|
|
31
|
+
id: action.searchId,
|
|
32
|
+
message: action.error,
|
|
33
|
+
},
|
|
34
|
+
items: [...state.items, action.searchId],
|
|
35
|
+
};
|
|
36
|
+
case ActionTypes.REMOVE_ERROR:
|
|
37
|
+
ret = Object.keys(state).reduce((object, key) => {
|
|
38
|
+
if (key !== action.id) {
|
|
39
|
+
// eslint-disable-next-line no-param-reassign
|
|
40
|
+
object[key] = state[key];
|
|
41
|
+
}
|
|
42
|
+
return object;
|
|
43
|
+
}, {});
|
|
44
|
+
ret.items = without(ret.items, action.id);
|
|
45
|
+
return ret;
|
|
46
|
+
case ActionTypes.IMPORT_MIRADOR_STATE:
|
|
47
|
+
return defaultState;
|
|
48
|
+
default:
|
|
49
|
+
return state;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './accessTokens';
|
|
2
|
+
export * from './companionWindows';
|
|
3
|
+
export * from './errors';
|
|
4
|
+
export * from './workspace';
|
|
5
|
+
export * from './windows';
|
|
6
|
+
export * from './manifests';
|
|
7
|
+
export * from './infoResponses';
|
|
8
|
+
export * from './config';
|
|
9
|
+
export * from './viewers';
|
|
10
|
+
export * from './annotations';
|
|
11
|
+
export * from './auth';
|
|
12
|
+
export * from './elasticLayout';
|
|
13
|
+
export * from './search';
|
|
14
|
+
export * from './layers';
|
|
15
|
+
export * from './catalog';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import ActionTypes from '../actions/action-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* infoResponsesReducer
|
|
5
|
+
*/
|
|
6
|
+
export const infoResponsesReducer = (state = {}, action) => {
|
|
7
|
+
switch (action.type) {
|
|
8
|
+
case ActionTypes.REQUEST_INFO_RESPONSE:
|
|
9
|
+
return {
|
|
10
|
+
...state,
|
|
11
|
+
[action.infoId]: {
|
|
12
|
+
id: action.infoId,
|
|
13
|
+
isFetching: true,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
case ActionTypes.RECEIVE_INFO_RESPONSE:
|
|
17
|
+
return {
|
|
18
|
+
...state,
|
|
19
|
+
[action.infoId]: {
|
|
20
|
+
degraded: false,
|
|
21
|
+
id: action.infoId,
|
|
22
|
+
isFetching: false,
|
|
23
|
+
json: action.infoJson,
|
|
24
|
+
tokenServiceId: action.tokenServiceId,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
case ActionTypes.RECEIVE_DEGRADED_INFO_RESPONSE:
|
|
28
|
+
return {
|
|
29
|
+
...state,
|
|
30
|
+
[action.infoId]: {
|
|
31
|
+
degraded: true,
|
|
32
|
+
id: action.infoId,
|
|
33
|
+
isFetching: false,
|
|
34
|
+
json: action.infoJson,
|
|
35
|
+
tokenServiceId: action.tokenServiceId,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
case ActionTypes.RECEIVE_INFO_RESPONSE_FAILURE:
|
|
39
|
+
return {
|
|
40
|
+
...state,
|
|
41
|
+
[action.infoId]: {
|
|
42
|
+
error: action.error,
|
|
43
|
+
id: action.infoId,
|
|
44
|
+
isFetching: false,
|
|
45
|
+
tokenServiceId: action.tokenServiceId,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
case ActionTypes.REMOVE_INFO_RESPONSE:
|
|
49
|
+
return Object.keys(state).reduce((object, key) => {
|
|
50
|
+
if (key !== action.infoId) {
|
|
51
|
+
// eslint-disable-next-line no-param-reassign
|
|
52
|
+
object[key] = state[key];
|
|
53
|
+
}
|
|
54
|
+
return object;
|
|
55
|
+
}, {});
|
|
56
|
+
case ActionTypes.IMPORT_MIRADOR_STATE:
|
|
57
|
+
return {};
|
|
58
|
+
default:
|
|
59
|
+
return state;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import omit from 'lodash/omit';
|
|
2
|
+
import deepmerge from 'deepmerge';
|
|
3
|
+
import ActionTypes from '../actions/action-types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* configReducer - does a deep merge of the config
|
|
7
|
+
*/
|
|
8
|
+
export const layersReducer = (state = {}, action) => {
|
|
9
|
+
switch (action.type) {
|
|
10
|
+
case ActionTypes.UPDATE_LAYERS:
|
|
11
|
+
return {
|
|
12
|
+
...state,
|
|
13
|
+
[action.windowId]: {
|
|
14
|
+
...state[action.windowId],
|
|
15
|
+
[action.canvasId]: deepmerge((state[action.windowId] || {})[action.canvasId] || {}, action.payload),
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
case ActionTypes.REMOVE_WINDOW:
|
|
19
|
+
return omit(state, [action.windowId]);
|
|
20
|
+
default:
|
|
21
|
+
return state;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import omit from 'lodash/omit';
|
|
2
|
+
import ActionTypes from '../actions/action-types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* manifestsReducer
|
|
6
|
+
*/
|
|
7
|
+
export const manifestsReducer = (state = {}, action) => {
|
|
8
|
+
switch (action.type) {
|
|
9
|
+
case ActionTypes.REQUEST_MANIFEST:
|
|
10
|
+
return {
|
|
11
|
+
[action.manifestId]: {
|
|
12
|
+
...state[action.manifestId],
|
|
13
|
+
...action.properties,
|
|
14
|
+
id: action.manifestId,
|
|
15
|
+
},
|
|
16
|
+
...omit(state, action.manifestId),
|
|
17
|
+
};
|
|
18
|
+
case ActionTypes.RECEIVE_MANIFEST:
|
|
19
|
+
return {
|
|
20
|
+
...state,
|
|
21
|
+
[action.manifestId]: {
|
|
22
|
+
...state[action.manifestId],
|
|
23
|
+
error: null, // Explicitly set the error to null in case this is a re-fetch
|
|
24
|
+
id: action.manifestId,
|
|
25
|
+
isFetching: false,
|
|
26
|
+
json: action.manifestJson,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
case ActionTypes.RECEIVE_MANIFEST_FAILURE:
|
|
30
|
+
return {
|
|
31
|
+
...state,
|
|
32
|
+
[action.manifestId]: {
|
|
33
|
+
...state[action.manifestId],
|
|
34
|
+
error: action.error,
|
|
35
|
+
id: action.manifestId,
|
|
36
|
+
isFetching: false,
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
case ActionTypes.REMOVE_MANIFEST:
|
|
40
|
+
return Object.keys(state).reduce((object, key) => {
|
|
41
|
+
if (key !== action.manifestId) {
|
|
42
|
+
// eslint-disable-next-line no-param-reassign
|
|
43
|
+
object[key] = state[key];
|
|
44
|
+
}
|
|
45
|
+
return object;
|
|
46
|
+
}, {});
|
|
47
|
+
case ActionTypes.IMPORT_MIRADOR_STATE:
|
|
48
|
+
return action.state.manifests || {};
|
|
49
|
+
default:
|
|
50
|
+
return state;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { combineReducers } from 'redux';
|
|
2
|
+
import {
|
|
3
|
+
accessTokensReducer,
|
|
4
|
+
authReducer,
|
|
5
|
+
companionWindowsReducer,
|
|
6
|
+
configReducer,
|
|
7
|
+
elasticLayoutReducer,
|
|
8
|
+
errorsReducer,
|
|
9
|
+
infoResponsesReducer,
|
|
10
|
+
manifestsReducer,
|
|
11
|
+
viewersReducer,
|
|
12
|
+
windowsReducer,
|
|
13
|
+
workspaceReducer,
|
|
14
|
+
annotationsReducer,
|
|
15
|
+
searchesReducer,
|
|
16
|
+
layersReducer,
|
|
17
|
+
catalogReducer,
|
|
18
|
+
} from '.';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Function to create root reducer
|
|
22
|
+
* from plugin reducers.
|
|
23
|
+
* @namespace CreateRootReducer
|
|
24
|
+
*/
|
|
25
|
+
export default function createRootReducer(pluginReducers) {
|
|
26
|
+
return combineReducers({
|
|
27
|
+
accessTokens: accessTokensReducer,
|
|
28
|
+
annotations: annotationsReducer,
|
|
29
|
+
auth: authReducer,
|
|
30
|
+
catalog: catalogReducer,
|
|
31
|
+
companionWindows: companionWindowsReducer,
|
|
32
|
+
config: configReducer,
|
|
33
|
+
elasticLayout: elasticLayoutReducer,
|
|
34
|
+
errors: errorsReducer,
|
|
35
|
+
infoResponses: infoResponsesReducer,
|
|
36
|
+
layers: layersReducer,
|
|
37
|
+
manifests: manifestsReducer,
|
|
38
|
+
searches: searchesReducer,
|
|
39
|
+
viewers: viewersReducer,
|
|
40
|
+
windows: windowsReducer,
|
|
41
|
+
workspace: workspaceReducer,
|
|
42
|
+
...pluginReducers,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import omit from 'lodash/omit';
|
|
2
|
+
import ActionTypes from '../actions/action-types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* searchReducer
|
|
6
|
+
*/
|
|
7
|
+
export const searchesReducer = (state = {}, action) => {
|
|
8
|
+
const searchStruct = (state[action.windowId] || {})[action.companionWindowId] || {};
|
|
9
|
+
switch (action.type) {
|
|
10
|
+
case ActionTypes.REQUEST_SEARCH:
|
|
11
|
+
if (searchStruct.query !== action.query) {
|
|
12
|
+
// new query
|
|
13
|
+
return {
|
|
14
|
+
...state,
|
|
15
|
+
[action.windowId]: {
|
|
16
|
+
...state[action.windowId],
|
|
17
|
+
[action.companionWindowId]: {
|
|
18
|
+
...searchStruct,
|
|
19
|
+
data: {
|
|
20
|
+
[action.searchId]: {
|
|
21
|
+
isFetching: true,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
query: action.query,
|
|
25
|
+
selectedContentSearchAnnotation: [],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// paginating through a query
|
|
32
|
+
return {
|
|
33
|
+
...state,
|
|
34
|
+
[action.windowId]: {
|
|
35
|
+
...state[action.windowId],
|
|
36
|
+
[action.companionWindowId]: {
|
|
37
|
+
...searchStruct,
|
|
38
|
+
data: {
|
|
39
|
+
...searchStruct.data,
|
|
40
|
+
[action.searchId]: {
|
|
41
|
+
isFetching: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
case ActionTypes.RECEIVE_SEARCH:
|
|
48
|
+
return {
|
|
49
|
+
...state,
|
|
50
|
+
[action.windowId]: {
|
|
51
|
+
...state[action.windowId],
|
|
52
|
+
[action.companionWindowId]: {
|
|
53
|
+
...searchStruct,
|
|
54
|
+
data: {
|
|
55
|
+
...searchStruct.data,
|
|
56
|
+
[action.searchId]: {
|
|
57
|
+
isFetching: false,
|
|
58
|
+
json: action.searchJson,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
case ActionTypes.RECEIVE_SEARCH_FAILURE:
|
|
65
|
+
return {
|
|
66
|
+
...state,
|
|
67
|
+
[action.windowId]: {
|
|
68
|
+
...state[action.windowId],
|
|
69
|
+
[action.companionWindowId]: {
|
|
70
|
+
...searchStruct,
|
|
71
|
+
data: {
|
|
72
|
+
...searchStruct.data,
|
|
73
|
+
[action.searchId]: {
|
|
74
|
+
error: action.error,
|
|
75
|
+
isFetching: false,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
case ActionTypes.REMOVE_SEARCH:
|
|
82
|
+
return {
|
|
83
|
+
...state,
|
|
84
|
+
[action.windowId]: Object.keys(state[action.windowId]).reduce((object, key) => {
|
|
85
|
+
if (key !== action.companionWindowId) {
|
|
86
|
+
// eslint-disable-next-line no-param-reassign
|
|
87
|
+
object[key] = state[action.windowId][key];
|
|
88
|
+
}
|
|
89
|
+
return object;
|
|
90
|
+
}, {}),
|
|
91
|
+
};
|
|
92
|
+
case ActionTypes.SET_CONTENT_SEARCH_CURRENT_ANNOTATIONS:
|
|
93
|
+
return {
|
|
94
|
+
...state,
|
|
95
|
+
[action.windowId]: {
|
|
96
|
+
...state[action.windowId],
|
|
97
|
+
[action.companionWindowId]: {
|
|
98
|
+
...searchStruct,
|
|
99
|
+
selectedContentSearchAnnotationIds: action.annotationIds,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
case ActionTypes.SELECT_ANNOTATION:
|
|
104
|
+
if (!state[action.windowId]) return state;
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
...state,
|
|
108
|
+
[action.windowId]: Object.keys(state[action.windowId]).reduce((object, key) => {
|
|
109
|
+
const search = state[action.windowId][key];
|
|
110
|
+
const searchHasAnnotation =
|
|
111
|
+
search.data &&
|
|
112
|
+
Object.values(search.data)
|
|
113
|
+
.filter((resp) => resp.json && resp.json.resources)
|
|
114
|
+
.some((resp) => [resp.json.resources].flat().some((r) => r['@id'] === action.annotationId));
|
|
115
|
+
|
|
116
|
+
if (searchHasAnnotation) {
|
|
117
|
+
// eslint-disable-next-line no-param-reassign
|
|
118
|
+
object[key] = {
|
|
119
|
+
...search,
|
|
120
|
+
selectedContentSearchAnnotationIds: [action.annotationId],
|
|
121
|
+
};
|
|
122
|
+
} else {
|
|
123
|
+
// eslint-disable-next-line no-param-reassign
|
|
124
|
+
object[key] = search;
|
|
125
|
+
}
|
|
126
|
+
return object;
|
|
127
|
+
}, {}),
|
|
128
|
+
};
|
|
129
|
+
case ActionTypes.IMPORT_MIRADOR_STATE:
|
|
130
|
+
return {};
|
|
131
|
+
case ActionTypes.REMOVE_WINDOW:
|
|
132
|
+
return omit(state, action.windowId);
|
|
133
|
+
case ActionTypes.REMOVE_COMPANION_WINDOW:
|
|
134
|
+
if (!state[action.windowId]) return state;
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
...state,
|
|
138
|
+
[action.windowId]: {
|
|
139
|
+
...omit(state[action.windowId], action.id),
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
default:
|
|
143
|
+
return state;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _set from 'lodash/fp/set';
|
|
2
|
+
import _update from 'lodash/fp/update';
|
|
3
|
+
import _unset from 'lodash/fp/unset';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Sets the value at path of object.
|
|
7
|
+
* If a portion of `path` doesn't exist, it's created.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object} object
|
|
10
|
+
* @param {String|String[]} path
|
|
11
|
+
* @param {any} value
|
|
12
|
+
* @return {Object}
|
|
13
|
+
*/
|
|
14
|
+
export function set(object, path, value) {
|
|
15
|
+
return _set(path, value, object);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Updates the value at path of object.
|
|
20
|
+
* If a portion of `path` doesn't exist, it's created.
|
|
21
|
+
* If `value` is a function it should have this signature: (currentValue) => newValue.
|
|
22
|
+
* If `value` is an object it is assumed that the current value is also an object
|
|
23
|
+
* and the new value will crated by: { ...currentValue, ...value }.
|
|
24
|
+
*
|
|
25
|
+
* @param {Object} object
|
|
26
|
+
* @param {String|String[]} path
|
|
27
|
+
* @param {Object|Function} value
|
|
28
|
+
* @return {Object}
|
|
29
|
+
*/
|
|
30
|
+
export function update(object, path, value) {
|
|
31
|
+
return typeof value === 'function'
|
|
32
|
+
? _update(path, value, object)
|
|
33
|
+
: _update(path, (current) => ({ ...current, ...value }), object);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Removes the property at path of object.
|
|
38
|
+
*
|
|
39
|
+
* @param {Object} object
|
|
40
|
+
* @param {String|String[]} path
|
|
41
|
+
* @param {Object}
|
|
42
|
+
*/
|
|
43
|
+
export function unset(object, path) {
|
|
44
|
+
return _unset(path, object);
|
|
45
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import set from 'lodash/fp/set';
|
|
2
|
+
import omit from 'lodash/omit';
|
|
3
|
+
import ActionTypes from '../actions/action-types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* viewersReducer
|
|
7
|
+
*/
|
|
8
|
+
export const viewersReducer = (state = {}, action) => {
|
|
9
|
+
switch (action.type) {
|
|
10
|
+
case ActionTypes.UPDATE_VIEWPORT:
|
|
11
|
+
return {
|
|
12
|
+
...state,
|
|
13
|
+
[action.windowId]: {
|
|
14
|
+
...state[action.windowId],
|
|
15
|
+
...action.payload,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
case ActionTypes.ADD_WINDOW:
|
|
19
|
+
if (!action.window.initialViewerConfig) return state;
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
...state,
|
|
23
|
+
[action.window.id]: {
|
|
24
|
+
...state[action.window.id],
|
|
25
|
+
...action.window.initialViewerConfig,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
case ActionTypes.REMOVE_WINDOW:
|
|
29
|
+
return omit(state, action.windowId);
|
|
30
|
+
case ActionTypes.SET_WINDOW_VIEW_TYPE:
|
|
31
|
+
return set([action.windowId], null, state);
|
|
32
|
+
case ActionTypes.SET_CANVAS:
|
|
33
|
+
if (!action.preserveViewport) {
|
|
34
|
+
return set([action.windowId], null, state);
|
|
35
|
+
}
|
|
36
|
+
return state;
|
|
37
|
+
case ActionTypes.IMPORT_MIRADOR_STATE:
|
|
38
|
+
return action.state.viewers || {};
|
|
39
|
+
default:
|
|
40
|
+
return state;
|
|
41
|
+
}
|
|
42
|
+
};
|