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,97 @@
|
|
|
1
|
+
import ActionTypes from './action-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* requestSearch - action creator
|
|
5
|
+
*
|
|
6
|
+
* @param {String} windowId
|
|
7
|
+
* @param {String} searchId
|
|
8
|
+
* @param {String} query
|
|
9
|
+
* @memberof ActionCreators
|
|
10
|
+
*/
|
|
11
|
+
export function requestSearch(windowId, companionWindowId, searchId, query) {
|
|
12
|
+
return {
|
|
13
|
+
companionWindowId,
|
|
14
|
+
query,
|
|
15
|
+
searchId,
|
|
16
|
+
type: ActionTypes.REQUEST_SEARCH,
|
|
17
|
+
windowId,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* receiveSearch - action creator
|
|
23
|
+
*
|
|
24
|
+
* @param {String} windowId
|
|
25
|
+
* @param {String} searchId
|
|
26
|
+
* @param {Object} searchJson
|
|
27
|
+
* @memberof ActionCreators
|
|
28
|
+
*/
|
|
29
|
+
export function receiveSearch(windowId, companionWindowId, searchId, searchJson) {
|
|
30
|
+
return {
|
|
31
|
+
companionWindowId,
|
|
32
|
+
searchId,
|
|
33
|
+
searchJson,
|
|
34
|
+
type: ActionTypes.RECEIVE_SEARCH,
|
|
35
|
+
windowId,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* receiveSearchFailure - action creator
|
|
41
|
+
*
|
|
42
|
+
* @param {String} windowId
|
|
43
|
+
* @param {String} searchId
|
|
44
|
+
* @param {String} error
|
|
45
|
+
* @memberof ActionCreators
|
|
46
|
+
*/
|
|
47
|
+
export function receiveSearchFailure(windowId, companionWindowId, searchId, error) {
|
|
48
|
+
return {
|
|
49
|
+
companionWindowId,
|
|
50
|
+
error,
|
|
51
|
+
searchId,
|
|
52
|
+
type: ActionTypes.RECEIVE_SEARCH_FAILURE,
|
|
53
|
+
windowId,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* removeSearch - action creator
|
|
59
|
+
*
|
|
60
|
+
* @param {String} windowId
|
|
61
|
+
* @param {String} companionWindowId
|
|
62
|
+
* @memberof ActionCreators
|
|
63
|
+
*/
|
|
64
|
+
export function removeSearch(windowId, companionWindowId) {
|
|
65
|
+
return {
|
|
66
|
+
companionWindowId,
|
|
67
|
+
type: ActionTypes.REMOVE_SEARCH,
|
|
68
|
+
windowId,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* fetchSearch - action creator
|
|
74
|
+
*
|
|
75
|
+
* @param {String} searchId
|
|
76
|
+
* @param {String} query
|
|
77
|
+
* @memberof ActionCreators
|
|
78
|
+
*/
|
|
79
|
+
export function fetchSearch(windowId, companionWindowId, searchId, query) {
|
|
80
|
+
return requestSearch(windowId, companionWindowId, searchId, query);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* setContentSearchCurrentAnnotation - action creator
|
|
85
|
+
*
|
|
86
|
+
* @param {String} windowId
|
|
87
|
+
* @param {String} annotationId
|
|
88
|
+
* @memberof ActionCreators
|
|
89
|
+
*/
|
|
90
|
+
export function setContentSearchCurrentAnnotation(windowId, companionWindowId, annotationIds) {
|
|
91
|
+
return {
|
|
92
|
+
annotationIds,
|
|
93
|
+
companionWindowId,
|
|
94
|
+
type: ActionTypes.SET_CONTENT_SEARCH_CURRENT_ANNOTATIONS,
|
|
95
|
+
windowId,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { v4 as uuid } from 'uuid';
|
|
2
|
+
import ActionTypes from './action-types';
|
|
3
|
+
import { miradorSlice } from '../selectors/utils';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* focusWindow - action creator
|
|
7
|
+
*
|
|
8
|
+
* @param {String} windowId
|
|
9
|
+
* @memberof ActionCreators
|
|
10
|
+
*/
|
|
11
|
+
export function focusWindow(windowId, pan = false) {
|
|
12
|
+
return {
|
|
13
|
+
pan,
|
|
14
|
+
type: ActionTypes.FOCUS_WINDOW,
|
|
15
|
+
windowId,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* addWindow - action creator
|
|
21
|
+
*
|
|
22
|
+
* @param {Object} options
|
|
23
|
+
* @memberof ActionCreators
|
|
24
|
+
*/
|
|
25
|
+
export function addWindow({ companionWindows, manifest, ...options }) {
|
|
26
|
+
return (dispatch, getState) => {
|
|
27
|
+
const {
|
|
28
|
+
config,
|
|
29
|
+
workspace: { windowIds = [] },
|
|
30
|
+
} = miradorSlice(getState());
|
|
31
|
+
const numWindows = windowIds.length;
|
|
32
|
+
|
|
33
|
+
const windowId = options.id || `window-${uuid()}`;
|
|
34
|
+
const cwThumbs = `cw-${uuid()}`;
|
|
35
|
+
|
|
36
|
+
const defaultCompanionWindows = [
|
|
37
|
+
{
|
|
38
|
+
content: 'thumbnailNavigation',
|
|
39
|
+
default: true,
|
|
40
|
+
id: cwThumbs,
|
|
41
|
+
position: options.thumbnailNavigationPosition || config.thumbnailNavigation.defaultPosition,
|
|
42
|
+
windowId,
|
|
43
|
+
},
|
|
44
|
+
...(companionWindows || []).map((cw, i) => ({ ...cw, id: `cw-${uuid()}` })),
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
if (options.sideBarPanel || config.window.defaultSideBarPanel || config.window.sideBarPanel) {
|
|
48
|
+
defaultCompanionWindows.unshift({
|
|
49
|
+
content:
|
|
50
|
+
options.sideBarPanel ||
|
|
51
|
+
(options.defaultSearchQuery && 'search') ||
|
|
52
|
+
config.window.defaultSideBarPanel ||
|
|
53
|
+
config.window.sideBarPanel,
|
|
54
|
+
|
|
55
|
+
default: true,
|
|
56
|
+
id: `cw-${uuid()}`,
|
|
57
|
+
position: 'left',
|
|
58
|
+
windowId,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const defaultOptions = {
|
|
63
|
+
canvasId: undefined,
|
|
64
|
+
collectionIndex: 0,
|
|
65
|
+
companionAreaOpen: true,
|
|
66
|
+
companionWindowIds: defaultCompanionWindows.map((cw) => cw.id),
|
|
67
|
+
draggingEnabled: true,
|
|
68
|
+
highlightAllAnnotations: config.window.highlightAllAnnotations || false,
|
|
69
|
+
id: windowId,
|
|
70
|
+
manifestId: null,
|
|
71
|
+
maximized: false,
|
|
72
|
+
rangeId: null,
|
|
73
|
+
rotation: null,
|
|
74
|
+
selectedAnnotations: {},
|
|
75
|
+
sideBarOpen:
|
|
76
|
+
config.window.sideBarOpenByDefault !== undefined
|
|
77
|
+
? config.window.sideBarOpenByDefault || !!options.defaultSearchQuery
|
|
78
|
+
: config.window.sideBarOpen || !!options.defaultSearchQuery,
|
|
79
|
+
sideBarPanel: options.sideBarPanel || config.window.defaultSideBarPanel || config.window.sideBarPanel,
|
|
80
|
+
thumbnailNavigationId: cwThumbs,
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const elasticLayout = {
|
|
84
|
+
...(config.window.elastic || { height: 400, width: 480 }),
|
|
85
|
+
x: 200 + (Math.floor(numWindows / 10) * 50 + ((numWindows * 30) % 300)),
|
|
86
|
+
y: 200 + ((numWindows * 50) % 300),
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
dispatch({
|
|
90
|
+
companionWindows: defaultCompanionWindows,
|
|
91
|
+
elasticLayout,
|
|
92
|
+
manifest,
|
|
93
|
+
type: ActionTypes.ADD_WINDOW,
|
|
94
|
+
window: { ...defaultOptions, ...options },
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** */
|
|
100
|
+
export function updateWindow(id, payload) {
|
|
101
|
+
return {
|
|
102
|
+
id,
|
|
103
|
+
payload,
|
|
104
|
+
type: ActionTypes.UPDATE_WINDOW,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* maximizeWindow
|
|
110
|
+
* @param {String} windowId
|
|
111
|
+
* @memberof ActionCreators
|
|
112
|
+
*/
|
|
113
|
+
export function maximizeWindow(windowId) {
|
|
114
|
+
return { type: ActionTypes.MAXIMIZE_WINDOW, windowId };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* minimizeWindow
|
|
119
|
+
* @param {String} windowId
|
|
120
|
+
* @memberof ActionCreators
|
|
121
|
+
*/
|
|
122
|
+
export function minimizeWindow(windowId) {
|
|
123
|
+
return { type: ActionTypes.MINIMIZE_WINDOW, windowId };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** */
|
|
127
|
+
export function setCompanionAreaOpen(id, companionAreaOpen) {
|
|
128
|
+
return {
|
|
129
|
+
id,
|
|
130
|
+
payload: { companionAreaOpen },
|
|
131
|
+
type: ActionTypes.UPDATE_WINDOW,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* removeWindow - action creator
|
|
137
|
+
*
|
|
138
|
+
* @param {String} windowId
|
|
139
|
+
* @memberof ActionCreators
|
|
140
|
+
*/
|
|
141
|
+
export function removeWindow(windowId) {
|
|
142
|
+
return {
|
|
143
|
+
type: ActionTypes.REMOVE_WINDOW,
|
|
144
|
+
windowId,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* toggleWindowSideBar - action creator
|
|
150
|
+
*
|
|
151
|
+
* @param {String} windowId
|
|
152
|
+
* @memberof ActionCreators
|
|
153
|
+
*/
|
|
154
|
+
export function toggleWindowSideBar(windowId) {
|
|
155
|
+
return { type: ActionTypes.TOGGLE_WINDOW_SIDE_BAR, windowId };
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* setWindowThumbnailPosition - action creator
|
|
160
|
+
*
|
|
161
|
+
* @param {String} windowId
|
|
162
|
+
* @param {String} position
|
|
163
|
+
* @memberof ActionCreators
|
|
164
|
+
*/
|
|
165
|
+
export function setWindowThumbnailPosition(windowId, position) {
|
|
166
|
+
return (dispatch, getState) => {
|
|
167
|
+
const { windows } = getState();
|
|
168
|
+
const { thumbnailNavigationId } = windows[windowId];
|
|
169
|
+
|
|
170
|
+
dispatch({
|
|
171
|
+
id: thumbnailNavigationId,
|
|
172
|
+
payload: { position },
|
|
173
|
+
type: ActionTypes.UPDATE_COMPANION_WINDOW,
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* setWindowViewType - action creator
|
|
180
|
+
*
|
|
181
|
+
* @param {String} windowId
|
|
182
|
+
* @param {String} viewType
|
|
183
|
+
* @memberof ActionCreators
|
|
184
|
+
*/
|
|
185
|
+
export function setWindowViewType(windowId, viewType) {
|
|
186
|
+
return {
|
|
187
|
+
type: ActionTypes.SET_WINDOW_VIEW_TYPE,
|
|
188
|
+
viewType,
|
|
189
|
+
windowId,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** */
|
|
194
|
+
export function showCollectionDialog(manifestId, dialogCollectionPath = [], windowId) {
|
|
195
|
+
return {
|
|
196
|
+
dialogCollectionPath,
|
|
197
|
+
manifestId,
|
|
198
|
+
type: ActionTypes.SHOW_COLLECTION_DIALOG,
|
|
199
|
+
windowId,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** */
|
|
204
|
+
export function hideCollectionDialog(windowId) {
|
|
205
|
+
return {
|
|
206
|
+
type: ActionTypes.HIDE_COLLECTION_DIALOG,
|
|
207
|
+
windowId,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import ActionTypes from './action-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* updateWorkspace - action creator
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} config
|
|
7
|
+
*/
|
|
8
|
+
export function updateWorkspace(config) {
|
|
9
|
+
return { config, type: ActionTypes.UPDATE_WORKSPACE };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* toggleZoomControls - action creator
|
|
14
|
+
* @param {Boolean} showZoomControls
|
|
15
|
+
* @memberof ActionCreators
|
|
16
|
+
*/
|
|
17
|
+
export function toggleZoomControls(showZoomControls) {
|
|
18
|
+
return { showZoomControls, type: ActionTypes.TOGGLE_ZOOM_CONTROLS };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* updateWorkspaceMosaicLayout - action creator
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} layout
|
|
25
|
+
* @memberof ActionCreators
|
|
26
|
+
*/
|
|
27
|
+
export function updateWorkspaceMosaicLayout(layout) {
|
|
28
|
+
return { layout, type: ActionTypes.UPDATE_WORKSPACE_MOSAIC_LAYOUT };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* updateWorkspaceMosaicLayout - action creator
|
|
33
|
+
*
|
|
34
|
+
* @param {Object} isWorkspaceAddVisible
|
|
35
|
+
* @memberof ActionCreators
|
|
36
|
+
*/
|
|
37
|
+
export function setWorkspaceAddVisibility(isWorkspaceAddVisible) {
|
|
38
|
+
return { isWorkspaceAddVisible, type: ActionTypes.SET_WORKSPACE_ADD_VISIBILITY };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* setWorkspaceViewportPosition - action creator
|
|
43
|
+
*
|
|
44
|
+
* @param {Object} position
|
|
45
|
+
* @memberof ActionCreators
|
|
46
|
+
*/
|
|
47
|
+
export function setWorkspaceViewportPosition({ x, y }) {
|
|
48
|
+
return {
|
|
49
|
+
payload: {
|
|
50
|
+
position: {
|
|
51
|
+
x,
|
|
52
|
+
y,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
type: ActionTypes.SET_WORKSPACE_VIEWPORT_POSITION,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* setWorkspaceViewportDimensions - action creator
|
|
61
|
+
*
|
|
62
|
+
* @param {Object} position
|
|
63
|
+
* @memberof ActionCreators
|
|
64
|
+
*/
|
|
65
|
+
export function setWorkspaceViewportDimensions({ width, height }) {
|
|
66
|
+
return {
|
|
67
|
+
payload: {
|
|
68
|
+
position: {
|
|
69
|
+
height,
|
|
70
|
+
width,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
type: ActionTypes.SET_WORKSPACE_VIEWPORT_POSITION,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* toggleDraggingEnabled - action creator
|
|
79
|
+
*/
|
|
80
|
+
export function toggleDraggingEnabled() {
|
|
81
|
+
return {
|
|
82
|
+
type: ActionTypes.TOGGLE_DRAGGING,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import deepmerge from 'deepmerge';
|
|
2
|
+
import createStore from './createStore';
|
|
3
|
+
import { importConfig } from './actions/config';
|
|
4
|
+
import {
|
|
5
|
+
filterValidPlugins,
|
|
6
|
+
getConfigFromPlugins,
|
|
7
|
+
getReducersFromPlugins,
|
|
8
|
+
getSagasFromPlugins,
|
|
9
|
+
} from '../extend/pluginPreprocessing';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Configure Store
|
|
13
|
+
*/
|
|
14
|
+
function createPluggableStore(config, plugins = []) {
|
|
15
|
+
const filteredPlugins = filterValidPlugins(plugins);
|
|
16
|
+
|
|
17
|
+
const store = createStore(getReducersFromPlugins(filteredPlugins), getSagasFromPlugins(filteredPlugins));
|
|
18
|
+
|
|
19
|
+
store.dispatch(importConfig(deepmerge(getConfigFromPlugins(filteredPlugins), config)));
|
|
20
|
+
|
|
21
|
+
return store;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default createPluggableStore;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Topics for understanding
|
|
2
|
+
// redux modules for nested stores
|
|
3
|
+
// state normalisation
|
|
4
|
+
// (normalizer library)
|
|
5
|
+
|
|
6
|
+
import { thunk } from 'redux-thunk';
|
|
7
|
+
import createSagaMiddleware from 'redux-saga';
|
|
8
|
+
import { combineReducers, createStore, applyMiddleware } from 'redux';
|
|
9
|
+
import { composeWithDevTools } from '@redux-devtools/extension';
|
|
10
|
+
import createRootReducer from './reducers/rootReducer';
|
|
11
|
+
import getRootSaga from './sagas';
|
|
12
|
+
import settings from '../config/settings';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Configure Store
|
|
16
|
+
*/
|
|
17
|
+
function configureStore(pluginReducers, pluginSagas = []) {
|
|
18
|
+
const miradorReducer = createRootReducer(pluginReducers);
|
|
19
|
+
|
|
20
|
+
const rootReducer = settings.state.slice ? combineReducers({ [settings.state.slice]: miradorReducer }) : miradorReducer;
|
|
21
|
+
|
|
22
|
+
// create the saga middleware
|
|
23
|
+
const sagaMiddleware = createSagaMiddleware();
|
|
24
|
+
|
|
25
|
+
const store = createStore(rootReducer, composeWithDevTools(applyMiddleware(thunk, sagaMiddleware)));
|
|
26
|
+
|
|
27
|
+
// then run the saga
|
|
28
|
+
sagaMiddleware.run(getRootSaga(pluginSagas));
|
|
29
|
+
|
|
30
|
+
return store;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default configureStore;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as actions from './actions';
|
|
2
|
+
import * as reducers from './reducers';
|
|
3
|
+
import * as sagas from './sagas';
|
|
4
|
+
import * as selectors from './selectors';
|
|
5
|
+
import createStore from './createStore';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
actions,
|
|
9
|
+
createStore,
|
|
10
|
+
reducers,
|
|
11
|
+
sagas,
|
|
12
|
+
selectors,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export * from './actions';
|
|
16
|
+
export * from './reducers';
|
|
17
|
+
export { default as rootReducer } from './reducers/rootReducer';
|
|
18
|
+
export { default as rootSaga } from './sagas';
|
|
19
|
+
export * from './selectors';
|
|
20
|
+
export { default as createStore } from './createStore';
|
|
21
|
+
export { default as createPluggableStore } from './createPluggableStore';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import omit from 'lodash/omit';
|
|
2
|
+
import ActionTypes from '../actions/action-types';
|
|
3
|
+
|
|
4
|
+
/** */
|
|
5
|
+
export function accessTokensReducer(state = {}, action) {
|
|
6
|
+
switch (action.type) {
|
|
7
|
+
case ActionTypes.RESOLVE_AUTHENTICATION_REQUEST:
|
|
8
|
+
return {
|
|
9
|
+
...state,
|
|
10
|
+
[action.tokenServiceId]: {
|
|
11
|
+
authId: action.id,
|
|
12
|
+
id: action.tokenServiceId,
|
|
13
|
+
isFetching: true,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
case ActionTypes.REQUEST_ACCESS_TOKEN:
|
|
17
|
+
return {
|
|
18
|
+
...state,
|
|
19
|
+
[action.serviceId]: {
|
|
20
|
+
authId: action.authId,
|
|
21
|
+
id: action.serviceId,
|
|
22
|
+
isFetching: true,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
case ActionTypes.RECEIVE_ACCESS_TOKEN:
|
|
26
|
+
return {
|
|
27
|
+
...state,
|
|
28
|
+
[action.serviceId]: {
|
|
29
|
+
...state[action.serviceId],
|
|
30
|
+
isFetching: false,
|
|
31
|
+
json: action.json,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
case ActionTypes.RECEIVE_ACCESS_TOKEN_FAILURE:
|
|
35
|
+
return {
|
|
36
|
+
...state,
|
|
37
|
+
[action.serviceId]: {
|
|
38
|
+
...state[action.serviceId],
|
|
39
|
+
error: action.error,
|
|
40
|
+
isFetching: false,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
case ActionTypes.RESET_AUTHENTICATION_STATE:
|
|
44
|
+
return omit(state, action.tokenServiceId);
|
|
45
|
+
case ActionTypes.RECEIVE_INFO_RESPONSE:
|
|
46
|
+
if (!action.tokenServiceId) return state;
|
|
47
|
+
if (state[action.tokenServiceId].success) return state;
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
...state,
|
|
51
|
+
[action.tokenServiceId]: {
|
|
52
|
+
...state[action.tokenServiceId],
|
|
53
|
+
success: true,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
default:
|
|
57
|
+
return state;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import ActionTypes from '../actions/action-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* annotationReducer
|
|
5
|
+
*/
|
|
6
|
+
export const annotationsReducer = (state = {}, action) => {
|
|
7
|
+
switch (action.type) {
|
|
8
|
+
case ActionTypes.REQUEST_ANNOTATION:
|
|
9
|
+
return {
|
|
10
|
+
...state,
|
|
11
|
+
[action.targetId]: {
|
|
12
|
+
...state[action.targetId],
|
|
13
|
+
[action.annotationId]: {
|
|
14
|
+
id: action.annotationId,
|
|
15
|
+
isFetching: true,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
case ActionTypes.RECEIVE_ANNOTATION:
|
|
20
|
+
return {
|
|
21
|
+
...state,
|
|
22
|
+
[action.targetId]: {
|
|
23
|
+
...state[action.targetId],
|
|
24
|
+
[action.annotationId]: {
|
|
25
|
+
id: action.annotationId,
|
|
26
|
+
isFetching: false,
|
|
27
|
+
json: action.annotationJson,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
case ActionTypes.RECEIVE_ANNOTATION_FAILURE:
|
|
32
|
+
return {
|
|
33
|
+
...state,
|
|
34
|
+
[action.targetId]: {
|
|
35
|
+
...state[action.targetId],
|
|
36
|
+
[action.annotationId]: {
|
|
37
|
+
error: action.error,
|
|
38
|
+
id: action.annotationId,
|
|
39
|
+
isFetching: false,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
case ActionTypes.IMPORT_MIRADOR_STATE:
|
|
44
|
+
return {};
|
|
45
|
+
default:
|
|
46
|
+
return state;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import omit from 'lodash/omit';
|
|
2
|
+
import ActionTypes from '../actions/action-types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* authReducer
|
|
6
|
+
*/
|
|
7
|
+
export const authReducer = (state = {}, action) => {
|
|
8
|
+
switch (action.type) {
|
|
9
|
+
case ActionTypes.ADD_AUTHENTICATION_REQUEST:
|
|
10
|
+
return {
|
|
11
|
+
...state,
|
|
12
|
+
[action.id]: {
|
|
13
|
+
id: action.id,
|
|
14
|
+
isFetching: true,
|
|
15
|
+
profile: action.profile,
|
|
16
|
+
windowId: action.windowId,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
case ActionTypes.RESOLVE_AUTHENTICATION_REQUEST:
|
|
20
|
+
return {
|
|
21
|
+
...state,
|
|
22
|
+
[action.id]: {
|
|
23
|
+
...state[action.id],
|
|
24
|
+
isFetching: false,
|
|
25
|
+
ok: action.ok,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
case ActionTypes.RECEIVE_ACCESS_TOKEN:
|
|
29
|
+
if (!action.authId) return state;
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
...state,
|
|
33
|
+
[action.authId]: {
|
|
34
|
+
...state[action.authId],
|
|
35
|
+
ok: true,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
case ActionTypes.RESET_AUTHENTICATION_STATE:
|
|
39
|
+
return omit(state, action.id);
|
|
40
|
+
default:
|
|
41
|
+
return state;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import ActionTypes from '../actions/action-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* catalogReducer
|
|
5
|
+
*/
|
|
6
|
+
export const catalogReducer = (state = [], action) => {
|
|
7
|
+
switch (action.type) {
|
|
8
|
+
case ActionTypes.ADD_RESOURCE:
|
|
9
|
+
if (state.some((m) => m.manifestId === action.manifestId)) return state;
|
|
10
|
+
|
|
11
|
+
return [{ manifestId: action.manifestId, ...action.payload }, ...state];
|
|
12
|
+
case ActionTypes.ADD_WINDOW:
|
|
13
|
+
if (state.some((m) => m.manifestId === action.window.manifestId)) return state;
|
|
14
|
+
|
|
15
|
+
return [{ manifestId: action.window.manifestId }, ...state];
|
|
16
|
+
case ActionTypes.UPDATE_WINDOW:
|
|
17
|
+
if (!action.payload.manifestId) return state;
|
|
18
|
+
if (state.some((m) => m.manifestId === action.payload.manifestId)) return state;
|
|
19
|
+
|
|
20
|
+
return [{ manifestId: action.payload.manifestId }, ...state];
|
|
21
|
+
case ActionTypes.REMOVE_RESOURCE:
|
|
22
|
+
return state.filter((r) => r.manifestId !== action.manifestId);
|
|
23
|
+
case ActionTypes.IMPORT_CONFIG:
|
|
24
|
+
return action.config.catalog || [];
|
|
25
|
+
case ActionTypes.IMPORT_MIRADOR_STATE:
|
|
26
|
+
return action.state.catalog || [];
|
|
27
|
+
default:
|
|
28
|
+
return state;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import omit from 'lodash/omit';
|
|
2
|
+
import set from 'lodash/fp/set';
|
|
3
|
+
import update from 'lodash/fp/update';
|
|
4
|
+
import ActionTypes from '../actions/action-types';
|
|
5
|
+
|
|
6
|
+
/** */
|
|
7
|
+
export function companionWindowsReducer(state = {}, action) {
|
|
8
|
+
switch (action.type) {
|
|
9
|
+
case ActionTypes.ADD_COMPANION_WINDOW:
|
|
10
|
+
return set([action.id], action.payload, state);
|
|
11
|
+
|
|
12
|
+
case ActionTypes.ADD_WINDOW:
|
|
13
|
+
return {
|
|
14
|
+
...state,
|
|
15
|
+
...(action.companionWindows || []).reduce((newState, cw) => {
|
|
16
|
+
// eslint-disable-next-line no-param-reassign
|
|
17
|
+
newState[cw.id] = {
|
|
18
|
+
...state[cw.id],
|
|
19
|
+
...cw,
|
|
20
|
+
windowId: action.id,
|
|
21
|
+
};
|
|
22
|
+
return newState;
|
|
23
|
+
}, {}),
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
case ActionTypes.REMOVE_WINDOW:
|
|
27
|
+
return Object.keys(state).reduce((object, key) => {
|
|
28
|
+
if (state[key].windowId !== action.windowId) {
|
|
29
|
+
// eslint-disable-next-line no-param-reassign
|
|
30
|
+
object[key] = state[key];
|
|
31
|
+
}
|
|
32
|
+
return object;
|
|
33
|
+
}, {});
|
|
34
|
+
|
|
35
|
+
case ActionTypes.UPDATE_COMPANION_WINDOW:
|
|
36
|
+
return update([action.id], (orig) => ({ ...(orig || {}), ...action.payload }), state);
|
|
37
|
+
|
|
38
|
+
case ActionTypes.REMOVE_COMPANION_WINDOW:
|
|
39
|
+
return omit(state, action.id);
|
|
40
|
+
|
|
41
|
+
case ActionTypes.IMPORT_MIRADOR_STATE:
|
|
42
|
+
return action.state.companionWindows || [];
|
|
43
|
+
|
|
44
|
+
case ActionTypes.TOGGLE_TOC_NODE:
|
|
45
|
+
return update([action.id, 'tocNodes'], (orig) => ({ ...(orig || {}), ...action.payload }), state);
|
|
46
|
+
default:
|
|
47
|
+
return state;
|
|
48
|
+
}
|
|
49
|
+
}
|