mirador-dl-plugin 0.12.0 → 1.0.0-alpha.1

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 CHANGED
@@ -1,20 +1,29 @@
1
- # mirador-download-plugin
1
+ # mirador-dl-plugin
2
2
 
3
3
  [![Travis][build-badge]][build]
4
4
  [![npm package][npm-badge]][npm]
5
5
  [![Coveralls][coveralls-badge]][coveralls]
6
6
 
7
- Describe mirador-download-plugin here.
7
+ `mirador-dl-plugin` is a Mirador 4 plugin that adds manifest-provided download links (e.g. `rendering`) to the window options menu. A [live demo](https://mirador-download-plugin.netlify.app/) with several institutions' manifests is available for testing.
8
8
 
9
- [build-badge]: https://img.shields.io/travis/user/repo/master.png?style=flat-square
10
- [build]: https://travis-ci.org/user/repo
9
+ ![download option in menu](https://user-images.githubusercontent.com/5402927/87057974-5e665a80-c1bc-11ea-8f10-7b783bdc972f.png)
11
10
 
12
- [npm-badge]: https://img.shields.io/npm/v/npm-package.png?style=flat-square
13
- [npm]: https://www.npmjs.org/package/npm-package
11
+ ![mirador-download-options](https://user-images.githubusercontent.com/5402927/87057857-3d056e80-c1bc-11ea-8860-7662208c19fa.png)
14
12
 
15
- [coveralls-badge]: https://img.shields.io/coveralls/user/repo/master.png?style=flat-square
13
+
14
+ [build-badge]: https://img.shields.io/travis/projectmirador/mirador-dl-plugin/main.png?style=flat-square
15
+ [build]: https://travis-ci.org/projectmirador/mirador-dl-plugin
16
+
17
+ [npm-badge]: https://img.shields.io/npm/v/mirador-dl-plugin.png?style=flat-square
18
+ [npm]: https://www.npmjs.org/package/mirador-dl-plugin
19
+
20
+ [coveralls-badge]: https://img.shields.io/coveralls/user/repo/main.png?style=flat-square
16
21
  [coveralls]: https://coveralls.io/github/user/repo
17
22
 
23
+ ## Installation
24
+
25
+ `mirador-dl-plugin` requires an instance of Mirador 4. See the [Mirador wiki](https://github.com/ProjectMirador/mirador/wiki) for examples of embedding Mirador within an application and additional information about plugins. See the [live demo's index.js](https://github.com/ProjectMirador/mirador-dl-plugin/blob/main/demo/src/index.js) for an example of importing and configuring `mirador-dl-plugin`.
26
+
18
27
  ## Configuration
19
28
 
20
29
  Configurations for this plugin are injected when Mirador is initialized under the `miradorDownloadPlugin` key.
@@ -31,3 +40,6 @@ Configurations for this plugin are injected when Mirador is initialized under th
31
40
  | Config Key | Type | Description |
32
41
  | --- | --- | --- |
33
42
  | `restrictDownloadOnSizeDefinition` | boolean (default: false) | If set to true the `Zoomed region` link will not be rendered if the image API returns a single size in the `sizes` section and the single size height/width is the same size or smaller than the reported height/width. |
43
+
44
+ ## Contribute
45
+ Mirador's development, design, and maintenance is driven by community needs and ongoing feedback and discussion. Join us at our regularly scheduled community calls, on [IIIF slack #mirador](http://bit.ly/iiif-slack), or the [mirador-tech](https://groups.google.com/forum/#!forum/mirador-tech) and [iiif-discuss](https://groups.google.com/forum/#!forum/iiif-discuss) mailing lists. To suggest features, report bugs, and clarify usage, please submit a GitHub issue.
@@ -1,253 +1,237 @@
1
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2
-
3
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
4
-
5
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
6
-
1
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
2
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
3
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
7
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
8
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
9
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
11
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
12
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
7
13
  import React, { Component } from 'react';
8
- import PropTypes from 'prop-types';
9
- import Typography from '@material-ui/core/Typography';
10
- import Link from '@material-ui/core/Link';
11
- import List from '@material-ui/core/List';
12
- import ListItem from '@material-ui/core/ListItem';
13
14
  import uniqBy from 'lodash/uniqBy';
14
- import { OSDReferences } from 'mirador/dist/es/src/plugins/OSDReferences';
15
+ import { OSDReferences } from 'mirador';
16
+ import Typography from '@mui/material/Typography';
17
+ import Link from '@mui/material/Link';
18
+ import List from '@mui/material/List';
19
+ import ListItem from '@mui/material/ListItem';
15
20
  import RenderingDownloadLink from './RenderingDownloadLink';
16
21
 
17
22
  /**
18
23
  * CanvasDownloadLinks ~
19
- */
20
-
21
- var CanvasDownloadLinks = function (_Component) {
22
- _inherits(CanvasDownloadLinks, _Component);
23
-
24
+ */
25
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
26
+ var CanvasDownloadLinks = /*#__PURE__*/function (_Component) {
24
27
  function CanvasDownloadLinks() {
25
28
  _classCallCheck(this, CanvasDownloadLinks);
26
-
27
- return _possibleConstructorReturn(this, _Component.apply(this, arguments));
29
+ return _callSuper(this, CanvasDownloadLinks, arguments);
28
30
  }
29
-
30
- CanvasDownloadLinks.prototype.zoomedImageLabel = function zoomedImageLabel() {
31
- var bounds = this.currentBounds();
32
- return 'Zoomed region (' + Math.floor(bounds.width) + ' x ' + Math.floor(bounds.height) + 'px)';
33
- };
34
-
35
- CanvasDownloadLinks.prototype.fullImageLabel = function fullImageLabel() {
36
- var canvas = this.props.canvas;
37
-
38
-
39
- return 'Whole image (' + canvas.getWidth() + ' x ' + canvas.getHeight() + 'px)';
40
- };
41
-
42
- CanvasDownloadLinks.prototype.smallImageLabel = function smallImageLabel() {
43
- var canvas = this.props.canvas;
44
-
45
-
46
- return 'Whole image (1000 x ' + Math.floor(1000 * canvas.getHeight() / canvas.getWidth()) + 'px)';
47
- };
48
-
49
- CanvasDownloadLinks.prototype.zoomedImageUrl = function zoomedImageUrl() {
50
- var canvas = this.props.canvas;
51
-
52
- var bounds = this.currentBounds();
53
- var boundsUrl = canvas.getCanonicalImageUri().replace(/\/full\/.*\/0\//, '/' + bounds.x + ',' + bounds.y + ',' + bounds.width + ',' + bounds.height + '/full/0/');
54
-
55
- return boundsUrl + '?download=true';
56
- };
57
-
58
- CanvasDownloadLinks.prototype.imageUrlForSize = function imageUrlForSize(size) {
59
- var canvas = this.props.canvas;
60
-
61
-
62
- return canvas.getCanonicalImageUri(size.width) + '?download=true';
63
- };
64
-
65
- CanvasDownloadLinks.prototype.fullImageUrl = function fullImageUrl() {
66
- var canvas = this.props.canvas;
67
-
68
-
69
- return canvas.getCanonicalImageUri().replace(/\/full\/.*\/0\//, '/full/full/0/') + '?download=true';
70
- };
71
-
72
- CanvasDownloadLinks.prototype.thousandPixelWideImage = function thousandPixelWideImage() {
73
- var canvas = this.props.canvas;
74
-
75
-
76
- return canvas.getCanonicalImageUri('1000') + '?download=true';
77
- };
78
-
79
- CanvasDownloadLinks.prototype.osdViewport = function osdViewport() {
80
- var windowId = this.props.windowId;
81
-
82
-
83
- return OSDReferences.get(windowId).current.viewport;
84
- };
85
-
86
- CanvasDownloadLinks.prototype.currentBounds = function currentBounds() {
87
- var bounds = this.osdViewport().getBounds();
88
-
89
- return Object.keys(bounds).reduce(function (object, key) {
90
- object[key] = Math.ceil(bounds[key]); // eslint-disable-line no-param-reassign
91
- return object;
92
- }, {});
93
- };
94
-
95
- CanvasDownloadLinks.prototype.definedSizesRestrictsDownload = function definedSizesRestrictsDownload() {
96
- var infoResponse = this.props.infoResponse;
97
-
98
- if (!infoResponse.json) return false;
99
- var _infoResponse$json = infoResponse.json,
31
+ _inherits(CanvasDownloadLinks, _Component);
32
+ return _createClass(CanvasDownloadLinks, [{
33
+ key: "zoomedImageLabel",
34
+ value: function zoomedImageLabel() {
35
+ var t = this.props.t;
36
+ var bounds = this.currentBounds();
37
+ return t('mirador-dl-plugin.zoomed_region', {
38
+ width: Math.floor(bounds.width),
39
+ height: Math.floor(bounds.height)
40
+ });
41
+ }
42
+ }, {
43
+ key: "fullImageLabel",
44
+ value: function fullImageLabel() {
45
+ var _this$props = this.props,
46
+ canvas = _this$props.canvas,
47
+ t = _this$props.t;
48
+ return t('mirador-dl-plugin.whole_image', {
49
+ width: canvas.getWidth(),
50
+ height: canvas.getHeight()
51
+ });
52
+ }
53
+ }, {
54
+ key: "smallImageLabel",
55
+ value: function smallImageLabel() {
56
+ var _this$props2 = this.props,
57
+ canvas = _this$props2.canvas,
58
+ t = _this$props2.t;
59
+ var height = Math.floor(1000 * canvas.getHeight() / canvas.getWidth());
60
+ return t('mirador-dl-plugin.whole_image', {
61
+ width: 1000,
62
+ height: height
63
+ });
64
+ }
65
+ }, {
66
+ key: "zoomedImageUrl",
67
+ value: function zoomedImageUrl() {
68
+ var canvas = this.props.canvas;
69
+ var bounds = this.currentBounds();
70
+ var boundsUrl = canvas.getCanonicalImageUri().replace(/\/full\/.*\/0\//, "/".concat(bounds.x, ",").concat(bounds.y, ",").concat(bounds.width, ",").concat(bounds.height, "/full/0/"));
71
+ return "".concat(boundsUrl, "?download=true");
72
+ }
73
+ }, {
74
+ key: "imageUrlForSize",
75
+ value: function imageUrlForSize(size) {
76
+ var canvas = this.props.canvas;
77
+ return "".concat(canvas.getCanonicalImageUri(size.width), "?download=true");
78
+ }
79
+ }, {
80
+ key: "fullImageUrl",
81
+ value: function fullImageUrl() {
82
+ var canvas = this.props.canvas;
83
+ return "".concat(canvas.getCanonicalImageUri().replace(/\/full\/.*\/0\//, '/full/full/0/'), "?download=true");
84
+ }
85
+ }, {
86
+ key: "thousandPixelWideImage",
87
+ value: function thousandPixelWideImage() {
88
+ var canvas = this.props.canvas;
89
+ return "".concat(canvas.getCanonicalImageUri('1000'), "?download=true");
90
+ }
91
+ }, {
92
+ key: "osdViewport",
93
+ value: function osdViewport() {
94
+ var windowId = this.props.windowId;
95
+ return OSDReferences.get(windowId).current.viewport;
96
+ }
97
+ }, {
98
+ key: "currentBounds",
99
+ value: function currentBounds() {
100
+ var bounds = this.osdViewport().getBounds();
101
+ return Object.keys(bounds).reduce(function (object, key) {
102
+ object[key] = Math.ceil(bounds[key]); // eslint-disable-line no-param-reassign
103
+ return object;
104
+ }, {});
105
+ }
106
+ }, {
107
+ key: "definedSizesRestrictsDownload",
108
+ value: function definedSizesRestrictsDownload() {
109
+ var infoResponse = this.props.infoResponse;
110
+ if (!infoResponse.json) return false;
111
+ var _infoResponse$json = infoResponse.json,
100
112
  height = _infoResponse$json.height,
101
113
  width = _infoResponse$json.width;
102
-
103
-
104
- if (this.definedSizes().length !== 1) return false;
105
-
106
- return this.definedSizes()[0].width <= width && this.definedSizes()[0].height <= height;
107
- };
108
-
109
- CanvasDownloadLinks.prototype.displayCurrentZoomLink = function displayCurrentZoomLink() {
110
- var _props = this.props,
111
- restrictDownloadOnSizeDefinition = _props.restrictDownloadOnSizeDefinition,
112
- infoResponse = _props.infoResponse,
113
- viewType = _props.viewType;
114
-
115
-
116
- if (viewType !== 'single') return false;
117
- if (restrictDownloadOnSizeDefinition && this.definedSizesRestrictsDownload()) return false;
118
- if (!(infoResponse && infoResponse.json)) return false;
119
-
120
- var bounds = this.currentBounds();
121
- return bounds.height < infoResponse.json.height && bounds.width < infoResponse.json.width && bounds.x >= 0 && bounds.y >= 0;
122
- };
123
-
124
- /**
125
- * This only returns unique sizes
126
- */
127
-
128
-
129
- CanvasDownloadLinks.prototype.definedSizes = function definedSizes() {
130
- var infoResponse = this.props.infoResponse;
131
-
132
- if (!(infoResponse && infoResponse.json && infoResponse.json.sizes)) return [];
133
-
134
- return uniqBy(infoResponse.json.sizes, function (size) {
135
- return '' + size.width + size.height;
136
- });
137
- };
138
-
139
- CanvasDownloadLinks.prototype.fullImageLink = function fullImageLink() {
140
- return React.createElement(
141
- ListItem,
142
- { disableGutters: true, divider: true, key: this.fullImageUrl() },
143
- React.createElement(
144
- Link,
145
- { href: this.fullImageUrl(), rel: 'noopener noreferrer', target: '_blank', variant: 'body1' },
146
- this.fullImageLabel()
147
- )
148
- );
149
- };
150
-
151
- CanvasDownloadLinks.prototype.thousandPixelWideLink = function thousandPixelWideLink() {
152
- var canvas = this.props.canvas;
153
-
154
-
155
- if (canvas.getWidth() < 1000) return '';
156
-
157
- return React.createElement(
158
- ListItem,
159
- { disableGutters: true, divider: true, key: this.thousandPixelWideImage() },
160
- React.createElement(
161
- Link,
162
- { href: this.thousandPixelWideImage(), rel: 'noopener noreferrer', target: '_blank', variant: 'body1' },
163
- this.smallImageLabel()
164
- )
165
- );
166
- };
167
-
168
- CanvasDownloadLinks.prototype.linksForDefinedSizes = function linksForDefinedSizes() {
169
- var _this2 = this;
170
-
171
- return this.definedSizes().map(function (size) {
172
- return React.createElement(
173
- ListItem,
174
- { disableGutters: true, divider: true, key: '' + size.width + size.height },
175
- React.createElement(
176
- Link,
177
- { href: _this2.imageUrlForSize(size), rel: 'noopener noreferrer', target: '_blank', variant: 'body1' },
178
- 'Whole image (' + size.width + ' x ' + size.height + 'px)'
179
- )
180
- );
181
- });
182
- };
183
-
184
- /**
185
- * Returns the rendered component
186
- */
187
-
188
-
189
- CanvasDownloadLinks.prototype.render = function render() {
190
- var _props2 = this.props,
191
- canvas = _props2.canvas,
192
- canvasLabel = _props2.canvasLabel,
193
- classes = _props2.classes;
194
-
195
-
196
- return React.createElement(
197
- React.Fragment,
198
- null,
199
- React.createElement(
200
- Typography,
201
- { noWrap: true, variant: 'h3', className: classes.h3 },
202
- canvasLabel
203
- ),
204
- React.createElement(
205
- List,
206
- null,
207
- this.displayCurrentZoomLink() && React.createElement(
208
- ListItem,
209
- { disableGutters: true, divider: true },
210
- React.createElement(
211
- Link,
212
- { href: this.zoomedImageUrl(), rel: 'noopener noreferrer', target: '_blank', variant: 'body1' },
213
- this.zoomedImageLabel()
214
- )
215
- ),
216
- this.definedSizes().length === 0 && [this.fullImageLink(), this.thousandPixelWideLink()],
217
- this.definedSizes().length > 0 && this.linksForDefinedSizes(),
218
- canvas.getRenderings().map(function (rendering) {
219
- return React.createElement(RenderingDownloadLink, { rendering: rendering, key: rendering.id });
114
+ if (this.definedSizes().length !== 1) return false;
115
+ return this.definedSizes()[0].width <= width && this.definedSizes()[0].height <= height;
116
+ }
117
+ }, {
118
+ key: "displayCurrentZoomLink",
119
+ value: function displayCurrentZoomLink() {
120
+ var _this$props3 = this.props,
121
+ restrictDownloadOnSizeDefinition = _this$props3.restrictDownloadOnSizeDefinition,
122
+ infoResponse = _this$props3.infoResponse,
123
+ viewType = _this$props3.viewType;
124
+ if (viewType !== 'single') return false;
125
+ if (restrictDownloadOnSizeDefinition && this.definedSizesRestrictsDownload()) return false;
126
+ if (!(infoResponse && infoResponse.json)) return false;
127
+ var bounds = this.currentBounds();
128
+ return bounds.height < infoResponse.json.height && bounds.width < infoResponse.json.width && bounds.x >= 0 && bounds.y >= 0;
129
+ }
130
+
131
+ /**
132
+ * This only returns unique sizes
133
+ */
134
+ }, {
135
+ key: "definedSizes",
136
+ value: function definedSizes() {
137
+ var infoResponse = this.props.infoResponse;
138
+ if (!(infoResponse && infoResponse.json && infoResponse.json.sizes)) return [];
139
+ return uniqBy(infoResponse.json.sizes, function (size) {
140
+ return "".concat(size.width).concat(size.height);
141
+ });
142
+ }
143
+ }, {
144
+ key: "fullImageLink",
145
+ value: function fullImageLink() {
146
+ return /*#__PURE__*/_jsx(ListItem, {
147
+ disableGutters: true,
148
+ divider: true,
149
+ children: /*#__PURE__*/_jsx(Link, {
150
+ href: this.fullImageUrl(),
151
+ rel: "noopener noreferrer",
152
+ target: "_blank",
153
+ variant: "body1",
154
+ children: this.fullImageLabel()
220
155
  })
221
- )
222
- );
223
- };
224
-
225
- return CanvasDownloadLinks;
156
+ }, this.fullImageUrl());
157
+ }
158
+ }, {
159
+ key: "thousandPixelWideLink",
160
+ value: function thousandPixelWideLink() {
161
+ var canvas = this.props.canvas;
162
+ if (canvas.getWidth() < 1000) return '';
163
+ return /*#__PURE__*/_jsx(ListItem, {
164
+ disableGutters: true,
165
+ divider: true,
166
+ children: /*#__PURE__*/_jsx(Link, {
167
+ href: this.thousandPixelWideImage(),
168
+ rel: "noopener noreferrer",
169
+ target: "_blank",
170
+ variant: "body1",
171
+ children: this.smallImageLabel()
172
+ })
173
+ }, this.thousandPixelWideImage());
174
+ }
175
+ }, {
176
+ key: "linksForDefinedSizes",
177
+ value: function linksForDefinedSizes() {
178
+ var _this = this;
179
+ var t = this.props.t;
180
+ return this.definedSizes().map(function (size) {
181
+ return /*#__PURE__*/_jsx(ListItem, {
182
+ disableGutters: true,
183
+ divider: true,
184
+ children: /*#__PURE__*/_jsx(Link, {
185
+ href: _this.imageUrlForSize(size),
186
+ rel: "noopener noreferrer",
187
+ target: "_blank",
188
+ variant: "body1",
189
+ children: t('mirador-dl-plugin.whole_image', {
190
+ width: size.width,
191
+ height: size.height
192
+ })
193
+ })
194
+ }, "".concat(size.width).concat(size.height));
195
+ });
196
+ }
197
+
198
+ /**
199
+ * Returns the rendered component
200
+ */
201
+ }, {
202
+ key: "render",
203
+ value: function render() {
204
+ var _this$props4 = this.props,
205
+ canvas = _this$props4.canvas,
206
+ canvasLabel = _this$props4.canvasLabel;
207
+ return /*#__PURE__*/_jsxs(React.Fragment, {
208
+ children: [/*#__PURE__*/_jsx(Typography, {
209
+ noWrap: true,
210
+ variant: "h3",
211
+ sx: {
212
+ marginTop: '20px'
213
+ },
214
+ children: canvasLabel
215
+ }), /*#__PURE__*/_jsxs(List, {
216
+ children: [this.displayCurrentZoomLink() && /*#__PURE__*/_jsx(ListItem, {
217
+ disableGutters: true,
218
+ divider: true,
219
+ children: /*#__PURE__*/_jsx(Link, {
220
+ href: this.zoomedImageUrl(),
221
+ download: true,
222
+ rel: "noopener noreferrer",
223
+ target: "_blank",
224
+ variant: "body1",
225
+ children: this.zoomedImageLabel()
226
+ })
227
+ }), this.definedSizes().length === 0 && [this.fullImageLink(), this.thousandPixelWideLink()], this.definedSizes().length > 0 && this.linksForDefinedSizes(), canvas.getRenderings().map(function (rendering) {
228
+ return /*#__PURE__*/_jsx(RenderingDownloadLink, {
229
+ rendering: rendering
230
+ }, rendering.id);
231
+ })]
232
+ })]
233
+ });
234
+ }
235
+ }]);
226
236
  }(Component);
227
-
228
- export { CanvasDownloadLinks as default };
229
-
230
-
231
- CanvasDownloadLinks.propTypes = process.env.NODE_ENV !== "production" ? {
232
- canvas: PropTypes.shape({
233
- id: PropTypes.string.isRequired,
234
- getCanonicalImageUri: PropTypes.func.isRequired,
235
- getHeight: PropTypes.func.isRequired,
236
- getRenderings: PropTypes.func.isRequired,
237
- getWidth: PropTypes.func.isRequired
238
- }).isRequired,
239
- canvasLabel: PropTypes.string.isRequired, // canvasLabel is passed because we need access to redux
240
- classes: PropTypes.shape({
241
- h3: PropTypes.string
242
- }).isRequired,
243
- infoResponse: PropTypes.shape({
244
- json: PropTypes.shape({
245
- height: PropTypes.number,
246
- sizes: PropTypes.arrayOf(PropTypes.shape({ height: PropTypes.number, width: PropTypes.number })),
247
- width: PropTypes.number
248
- })
249
- }).isRequired,
250
- restrictDownloadOnSizeDefinition: PropTypes.bool.isRequired,
251
- viewType: PropTypes.string.isRequired,
252
- windowId: PropTypes.string.isRequired
253
- } : {};
237
+ export { CanvasDownloadLinks as default };
@@ -1,64 +1,30 @@
1
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2
-
3
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
4
-
5
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
6
-
7
- import React, { Component } from 'react';
8
- import PropTypes from 'prop-types';
9
- import List from '@material-ui/core/List';
10
- import Typography from '@material-ui/core/Typography';
1
+ import React from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import Typography from '@mui/material/Typography';
4
+ import List from '@mui/material/List';
11
5
  import RenderingDownloadLink from './RenderingDownloadLink';
12
6
 
13
7
  /**
14
8
  * ManifestDownloadLinks ~
15
- */
16
-
17
- var ManifestDownloadLinks = function (_Component) {
18
- _inherits(ManifestDownloadLinks, _Component);
19
-
20
- function ManifestDownloadLinks() {
21
- _classCallCheck(this, ManifestDownloadLinks);
22
-
23
- return _possibleConstructorReturn(this, _Component.apply(this, arguments));
24
- }
25
-
26
- /**
27
- * Returns the rendered component
28
- */
29
- ManifestDownloadLinks.prototype.render = function render() {
30
- var _props = this.props,
31
- classes = _props.classes,
32
- renderings = _props.renderings;
33
-
34
-
35
- return React.createElement(
36
- React.Fragment,
37
- null,
38
- React.createElement(
39
- Typography,
40
- { variant: 'h3', className: classes.h3 },
41
- 'Other download options'
42
- ),
43
- React.createElement(
44
- List,
45
- null,
46
- renderings.map(function (rendering) {
47
- return React.createElement(RenderingDownloadLink, { rendering: rendering, key: rendering.id });
48
- })
49
- )
50
- );
51
- };
52
-
53
- return ManifestDownloadLinks;
54
- }(Component);
55
-
56
- export { ManifestDownloadLinks as default };
57
-
58
-
59
- ManifestDownloadLinks.propTypes = process.env.NODE_ENV !== "production" ? {
60
- classes: PropTypes.shape({
61
- h3: PropTypes.string
62
- }).isRequired,
63
- renderings: PropTypes.array.isRequired // eslint-disable-line react/forbid-prop-types
64
- } : {};
9
+ */
10
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
11
+ export default function ManifestDownloadLinks(_ref) {
12
+ var renderings = _ref.renderings;
13
+ var _useTranslation = useTranslation(),
14
+ t = _useTranslation.t;
15
+ return /*#__PURE__*/_jsxs(_Fragment, {
16
+ children: [/*#__PURE__*/_jsx(Typography, {
17
+ variant: "h3",
18
+ sx: {
19
+ marginTop: '20px'
20
+ },
21
+ children: t('mirador-dl-plugin.other_download')
22
+ }), /*#__PURE__*/_jsx(List, {
23
+ children: renderings.map(function (rendering) {
24
+ return /*#__PURE__*/_jsx(RenderingDownloadLink, {
25
+ rendering: rendering
26
+ }, rendering.id);
27
+ })
28
+ })]
29
+ });
30
+ }