dbf-mirador 4.2.3 → 4.2.4
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/dist/{CommentSharp-B0J_-jEq.js → CommentSharp-vA_xN68i.js} +3 -3
- package/dist/{CommentSharp-B0J_-jEq.js.map → CommentSharp-vA_xN68i.js.map} +1 -1
- package/dist/{FailedImageContext-aQXnWSHN.js → FailedImageContext-BHWsZAMA.js} +2 -2
- package/dist/{FailedImageContext-aQXnWSHN.js.map → FailedImageContext-BHWsZAMA.js.map} +1 -1
- package/dist/{WindowCanvasNavigationControls-CUX723BQ.js → WindowCanvasNavigationControls-BrFA_lpX.js} +3 -3
- package/dist/{WindowCanvasNavigationControls-CUX723BQ.js.map → WindowCanvasNavigationControls-BrFA_lpX.js.map} +1 -1
- package/dist/{canvas-C8oHvXFN.js → canvas-CIZQPIS-.js} +2 -2
- package/dist/{canvas-C8oHvXFN.js.map → canvas-CIZQPIS-.js.map} +1 -1
- package/dist/{canvases-gRqhr-IH.js → canvases-CKYPFdER.js} +85 -69
- package/dist/canvases-CKYPFdER.js.map +1 -0
- package/dist/{index.module-CbBRf_R8.js → index.module-nqrEw3fv.js} +2 -2
- package/dist/{index.module-CbBRf_R8.js.map → index.module-nqrEw3fv.js.map} +1 -1
- package/dist/mirador.es.js +6977 -7019
- package/dist/mirador.es.js.map +1 -1
- package/dist/mirador.min.js +72 -72
- package/dist/mirador.min.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/MiradorViewer.jsx +2 -1
- package/src/lib/rtlLanguages.js +13 -0
- package/src/state/selectors/config.js +14 -6
- package/dist/canvases-gRqhr-IH.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbf-mirador",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.4",
|
|
4
4
|
"description": "An open-source, web-based 'multi-up' viewer that supports zoom-pan-rotate functionality, ability to display/compare simple images, and images with annotations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/mirador.min.js",
|
|
@@ -13,6 +13,7 @@ class MiradorViewer {
|
|
|
13
13
|
constructor(config, viewerConfig = {}) {
|
|
14
14
|
this.plugins = filterValidPlugins(viewerConfig.plugins || []);
|
|
15
15
|
this.config = config;
|
|
16
|
+
this.dndManager = viewerConfig.dndManager;
|
|
16
17
|
this.store = viewerConfig.store || createPluggableStore(this.config, this.plugins);
|
|
17
18
|
|
|
18
19
|
if (config.id) this.renderInto(document.getElementById(config.id));
|
|
@@ -26,7 +27,7 @@ class MiradorViewer {
|
|
|
26
27
|
this.container = container;
|
|
27
28
|
this.root = createRoot(this.container);
|
|
28
29
|
|
|
29
|
-
this.root.render(this.render());
|
|
30
|
+
this.root.render(this.render({ dndManager: this.dndManager }));
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
/**
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** ISO 639-1 codes for languages conventionally written right-to-left. */
|
|
2
|
+
const RTL_LANGUAGES = ['ar', 'fa', 'he', 'ur'];
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Whether a locale code (e.g. 'ar', 'ar-SA') is a right-to-left language, for deriving a
|
|
6
|
+
* sensible default MUI theme `direction` from the active UI language.
|
|
7
|
+
* @param {string} language
|
|
8
|
+
* @returns {boolean}
|
|
9
|
+
*/
|
|
10
|
+
export function isRtlLanguage(language) {
|
|
11
|
+
if (!language) return false;
|
|
12
|
+
return RTL_LANGUAGES.includes(language.split('-')[0].toLowerCase());
|
|
13
|
+
}
|
|
@@ -2,6 +2,7 @@ import { createSelector } from 'reselect';
|
|
|
2
2
|
import deepmerge from 'deepmerge';
|
|
3
3
|
import { miradorSlice, EMPTY_ARRAY, EMPTY_OBJECT } from './utils';
|
|
4
4
|
import { getWorkspace } from './getters';
|
|
5
|
+
import { isRtlLanguage } from '../../lib/rtlLanguages';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Returns the config from the redux state.
|
|
@@ -62,13 +63,16 @@ export const getShowZoomControlsConfig = createSelector([getWorkspace, getConfig
|
|
|
62
63
|
);
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
|
-
* Returns the theme from the config.
|
|
66
|
+
* Returns the theme from the config. When no `direction` is explicitly configured (on the base
|
|
67
|
+
* theme or the selected named theme), one is derived from the active UI language - e.g. Arabic
|
|
68
|
+
* (`ar`) implies `rtl` - rather than always defaulting to `ltr` regardless of language.
|
|
66
69
|
* @param {object} state
|
|
67
70
|
* @returns {object} {palette: {...}, typography: {...}, overrides: {...}, ...}
|
|
68
71
|
*/
|
|
69
|
-
export const getTheme = createSelector([getConfig], ({ theme, themes, selectedTheme }) =>
|
|
70
|
-
deepmerge(theme, themes[selectedTheme] || {})
|
|
71
|
-
);
|
|
72
|
+
export const getTheme = createSelector([getConfig], ({ theme, themes, selectedTheme, language }) => {
|
|
73
|
+
const merged = deepmerge(theme, themes[selectedTheme] || {});
|
|
74
|
+
return merged.direction || !isRtlLanguage(language) ? merged : { ...merged, direction: 'rtl' };
|
|
75
|
+
});
|
|
72
76
|
|
|
73
77
|
/**
|
|
74
78
|
* Returns the theme ids from the config.
|
|
@@ -81,11 +85,15 @@ export const getThemeIds = createSelector([getConfig], ({ themes }) => Object.ke
|
|
|
81
85
|
export const getContainerId = createSelector([getConfig], ({ id }) => id);
|
|
82
86
|
|
|
83
87
|
/**
|
|
84
|
-
* Returns the theme direction from the config
|
|
88
|
+
* Returns the theme direction from the config, falling back to a language-derived default (see
|
|
89
|
+
* getTheme) when no direction is explicitly configured.
|
|
85
90
|
* @param {object} state
|
|
86
91
|
* @returns {string}
|
|
87
92
|
*/
|
|
88
|
-
export const getThemeDirection = createSelector(
|
|
93
|
+
export const getThemeDirection = createSelector(
|
|
94
|
+
[getConfig],
|
|
95
|
+
({ theme, language }) => theme.direction || (isRtlLanguage(language) ? 'rtl' : 'ltr'),
|
|
96
|
+
);
|
|
89
97
|
/**
|
|
90
98
|
* Returns the requests configurations from the config.
|
|
91
99
|
* @param {object} state
|