@harvard-lts/mirador-hide-nav-plugin 1.0.11 → 2.0.0
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/README.md +16 -2
- package/dist/es/index.js +30 -115
- package/package.json +12 -6
package/README.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# mirador-hide-nav-plugin
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
[](https://github.com/harvard-lts/mirador-hide-nav-plugin/actions/workflows/coverage-node.yml)
|
|
4
|
+
|
|
5
|
+
<a href="https://github.com/harvard-lts/mirador-hide-nav-plugin/actions/workflows/coverage-node.yml"><img src="https://github.com/harvard-lts/mirador-hide-nav-plugin/raw/badges/test-coverage/coverage.svg"></a>
|
|
6
|
+
|
|
7
|
+
A Mirador 4 plugin that hides viewer navigation for manifest-defined single images.
|
|
8
|
+
|
|
9
|
+
## Compatibility
|
|
10
|
+
|
|
11
|
+
This plugin is compatible with **Mirador 4** (React 18/19, MUI 7). It is **not**
|
|
12
|
+
backwards compatible with Mirador 3 — the upgrade contains breaking changes
|
|
13
|
+
(top-level `mirador` imports, function/hook components, MUI 7 + Emotion).
|
|
14
|
+
|
|
15
|
+
Versioning convention: Mirador 4 releases are tagged `2.x`; Mirador 3 releases
|
|
16
|
+
are tagged `0.x` or `1.x`. Pin a `0.x`/`1.x` release if you still need Mirador 3.
|
|
3
17
|
|
|
4
18
|
## Requirements
|
|
5
19
|
|
|
@@ -24,7 +38,7 @@ The following are some useful scripts can be ran using `npm run <script>`. A ful
|
|
|
24
38
|
|
|
25
39
|
## Installing in Mirador
|
|
26
40
|
|
|
27
|
-
The `mirador-hide-nav-plugin` requires an instance of Mirador
|
|
41
|
+
The `mirador-hide-nav-plugin` requires an instance of Mirador 4. Visit the [Mirador wiki](https://github.com/ProjectMirador/mirador/wiki) to learn how to [create a Mirador 4 plugin](https://github.com/ProjectMirador/mirador/wiki/Creating-a-Mirador-4-Plugin) and for additional information about plugins.
|
|
28
42
|
|
|
29
43
|
Package you will need to install:
|
|
30
44
|
|
package/dist/es/index.js
CHANGED
|
@@ -1,121 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getManifestoInstance } from 'mirador
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { getManifestoInstance } from 'mirador';
|
|
3
3
|
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
return e;
|
|
7
|
-
}
|
|
8
|
-
function _callSuper(t, o, e) {
|
|
9
|
-
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
10
|
-
}
|
|
11
|
-
function _classCallCheck(a, n) {
|
|
12
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
13
|
-
}
|
|
14
|
-
function _defineProperties(e, r) {
|
|
15
|
-
for (var t = 0; t < r.length; t++) {
|
|
16
|
-
var o = r[t];
|
|
17
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function _createClass(e, r, t) {
|
|
21
|
-
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
22
|
-
writable: !1
|
|
23
|
-
}), e;
|
|
24
|
-
}
|
|
25
|
-
function _getPrototypeOf(t) {
|
|
26
|
-
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
27
|
-
return t.__proto__ || Object.getPrototypeOf(t);
|
|
28
|
-
}, _getPrototypeOf(t);
|
|
29
|
-
}
|
|
30
|
-
function _inherits(t, e) {
|
|
31
|
-
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
32
|
-
t.prototype = Object.create(e && e.prototype, {
|
|
33
|
-
constructor: {
|
|
34
|
-
value: t,
|
|
35
|
-
writable: !0,
|
|
36
|
-
configurable: !0
|
|
37
|
-
}
|
|
38
|
-
}), Object.defineProperty(t, "prototype", {
|
|
39
|
-
writable: !1
|
|
40
|
-
}), e && _setPrototypeOf(t, e);
|
|
41
|
-
}
|
|
42
|
-
function _isNativeReflectConstruct() {
|
|
43
|
-
try {
|
|
44
|
-
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
45
|
-
} catch (t) {}
|
|
46
|
-
return (_isNativeReflectConstruct = function () {
|
|
47
|
-
return !!t;
|
|
48
|
-
})();
|
|
49
|
-
}
|
|
50
|
-
function _possibleConstructorReturn(t, e) {
|
|
51
|
-
if (e && ("object" == typeof e || "function" == typeof e)) return e;
|
|
52
|
-
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
53
|
-
return _assertThisInitialized(t);
|
|
54
|
-
}
|
|
55
|
-
function _setPrototypeOf(t, e) {
|
|
56
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
57
|
-
return t.__proto__ = e, t;
|
|
58
|
-
}, _setPrototypeOf(t, e);
|
|
59
|
-
}
|
|
60
|
-
function _toPrimitive(t, r) {
|
|
61
|
-
if ("object" != typeof t || !t) return t;
|
|
62
|
-
var e = t[Symbol.toPrimitive];
|
|
63
|
-
if (void 0 !== e) {
|
|
64
|
-
var i = e.call(t, r || "default");
|
|
65
|
-
if ("object" != typeof i) return i;
|
|
66
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
67
|
-
}
|
|
68
|
-
return ("string" === r ? String : Number)(t);
|
|
69
|
-
}
|
|
70
|
-
function _toPropertyKey(t) {
|
|
71
|
-
var i = _toPrimitive(t, "string");
|
|
72
|
-
return "symbol" == typeof i ? i : i + "";
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
var hideViewerNavigation = /*#__PURE__*/function (_Component) {
|
|
76
|
-
function hideViewerNavigation() {
|
|
77
|
-
_classCallCheck(this, hideViewerNavigation);
|
|
78
|
-
return _callSuper(this, hideViewerNavigation, arguments);
|
|
79
|
-
}
|
|
80
|
-
_inherits(hideViewerNavigation, _Component);
|
|
81
|
-
return _createClass(hideViewerNavigation, [{
|
|
82
|
-
key: "isIndividualImage",
|
|
83
|
-
value: function isIndividualImage() {
|
|
84
|
-
var manifest = this.props.manifest;
|
|
85
|
-
var individualValue = 'individuals';
|
|
4
|
+
var isIndividualImage = function isIndividualImage(manifest) {
|
|
5
|
+
var individualValue = 'individuals';
|
|
86
6
|
|
|
87
|
-
|
|
88
|
-
|
|
7
|
+
// IIIF v2
|
|
8
|
+
if (manifest && manifest.getSequences() && manifest.getSequences()[0] && manifest.getSequences()[0].getProperty('viewingHint')) return manifest.getSequences()[0].getProperty('viewingHint') == individualValue;
|
|
89
9
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
window.document.querySelectorAll('.mirador-osd-navigation').forEach(function (elem) {
|
|
108
|
-
return elem.remove();
|
|
109
|
-
});
|
|
110
|
-
window.document.querySelectorAll('[class*="Connect(WithPlugins(ZoomControls))-divider-"]').forEach(function (elem) {
|
|
111
|
-
return elem.remove();
|
|
112
|
-
});
|
|
113
|
-
}
|
|
10
|
+
// IIIF v3
|
|
11
|
+
if (manifest && manifest.getBehavior()) return manifest.getBehavior() == individualValue;
|
|
12
|
+
return false;
|
|
13
|
+
};
|
|
14
|
+
function HideViewerNavigation(_ref) {
|
|
15
|
+
var manifest = _ref.manifest;
|
|
16
|
+
useEffect(function () {
|
|
17
|
+
if (isIndividualImage(manifest)) {
|
|
18
|
+
window.document.querySelectorAll('.mirador-osd-info').forEach(function (elem) {
|
|
19
|
+
return elem.remove();
|
|
20
|
+
});
|
|
21
|
+
window.document.querySelectorAll('.mirador-osd-navigation').forEach(function (elem) {
|
|
22
|
+
return elem.remove();
|
|
23
|
+
});
|
|
24
|
+
window.document.querySelectorAll('[class*="Connect(WithPlugins(ZoomControls))-divider-"]').forEach(function (elem) {
|
|
25
|
+
return elem.remove();
|
|
26
|
+
});
|
|
114
27
|
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
28
|
+
});
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
var mapStateToProps = function mapStateToProps(state, _ref2) {
|
|
32
|
+
var windowId = _ref2.windowId;
|
|
119
33
|
return {
|
|
120
34
|
manifestId: (getManifestoInstance(state, {
|
|
121
35
|
windowId: windowId
|
|
@@ -126,9 +40,10 @@ var mapStateToProps = function mapStateToProps(state, _ref) {
|
|
|
126
40
|
};
|
|
127
41
|
};
|
|
128
42
|
var hideViewerNavigationPlugin = {
|
|
43
|
+
name: 'HideViewerNavigationPlugin',
|
|
129
44
|
target: 'Window',
|
|
130
45
|
mode: 'add',
|
|
131
|
-
component:
|
|
46
|
+
component: HideViewerNavigation,
|
|
132
47
|
mapStateToProps: mapStateToProps
|
|
133
48
|
};
|
|
134
49
|
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-component"
|
|
7
7
|
],
|
|
8
|
-
"version": "
|
|
8
|
+
"version": "2.0.0",
|
|
9
9
|
"description": "mirador-analytics-plugin React component",
|
|
10
10
|
"module": "dist/es/index.js",
|
|
11
11
|
"files": [
|
|
@@ -20,14 +20,20 @@
|
|
|
20
20
|
"serve": "vite",
|
|
21
21
|
"test": "vitest run",
|
|
22
22
|
"test:coverage": "vitest run --coverage",
|
|
23
|
+
"test:unit": "node scripts/coverage-ci.mjs",
|
|
23
24
|
"test:watch": "vitest"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
27
|
+
"@emotion/react": "^11.11.0",
|
|
28
|
+
"@emotion/styled": "^11.11.0",
|
|
29
|
+
"@mui/material": "^7.0.0",
|
|
30
|
+
"@mui/system": "^7.0.0",
|
|
26
31
|
"jquery": "^3.7.0",
|
|
27
|
-
"node": "^22.22.3",
|
|
28
32
|
"prop-types": "^15.8.1",
|
|
29
|
-
"react": "^
|
|
30
|
-
"react-dom": "^
|
|
33
|
+
"react": "^19.0.0",
|
|
34
|
+
"react-dom": "^19.0.0",
|
|
35
|
+
"react-i18next": "^15.0.0",
|
|
36
|
+
"redux": "^5.0.0"
|
|
31
37
|
},
|
|
32
38
|
"devDependencies": {
|
|
33
39
|
"@babel/cli": "^7.26.4",
|
|
@@ -36,12 +42,12 @@
|
|
|
36
42
|
"@babel/preset-react": "^7.18.6",
|
|
37
43
|
"@rollup/plugin-babel": "^6.0.3",
|
|
38
44
|
"@testing-library/jest-dom": "^6.1.5",
|
|
39
|
-
"@testing-library/react": "^
|
|
45
|
+
"@testing-library/react": "^16.0.0",
|
|
40
46
|
"@vitejs/plugin-react": "^5.1.2",
|
|
41
47
|
"@vitest/coverage-v8": "^4.0.17",
|
|
42
48
|
"@vitest/ui": "^4.0.17",
|
|
43
49
|
"jsdom": "^27.4.0",
|
|
44
|
-
"mirador": "^
|
|
50
|
+
"mirador": "^4.1.0",
|
|
45
51
|
"npm-run-all": "^4.1.5",
|
|
46
52
|
"rollup": "^3.29.5",
|
|
47
53
|
"url": "^0.11.4",
|