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 +19 -7
- package/es/CanvasDownloadLinks.js +224 -240
- package/es/ManifestDownloadLinks.js +26 -60
- package/es/MiradorDownloadDialog.js +99 -158
- package/es/RenderingDownloadLink.js +44 -51
- package/es/index.js +3 -5
- package/es/miradorDownloadPlugin.js +49 -84
- package/es/translations.js +39 -0
- package/lib/CanvasDownloadLinks.js +236 -277
- package/lib/ManifestDownloadLinks.js +33 -83
- package/lib/MiradorDownloadDialog.js +112 -203
- package/lib/RenderingDownloadLink.js +54 -76
- package/lib/index.js +22 -18
- package/lib/miradorDownloadPlugin.js +58 -110
- package/lib/translations.js +45 -0
- package/package.json +60 -31
- package/umd/mirador-dl-plugin.js +3 -21812
- package/umd/mirador-dl-plugin.js.LICENSE.txt +58 -0
- package/umd/mirador-dl-plugin.js.map +1 -0
- package/umd/mirador-dl-plugin.min.js +0 -42
- package/umd/mirador-dl-plugin.min.js.map +0 -1
|
@@ -1,137 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _react = require(
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
var _MenuItem = require('@material-ui/core/MenuItem');
|
|
24
|
-
|
|
25
|
-
var _MenuItem2 = _interopRequireDefault(_MenuItem);
|
|
26
|
-
|
|
27
|
-
var _VerticalAlignBottomSharp = require('@material-ui/icons/VerticalAlignBottomSharp');
|
|
28
|
-
|
|
29
|
-
var _VerticalAlignBottomSharp2 = _interopRequireDefault(_VerticalAlignBottomSharp);
|
|
30
|
-
|
|
31
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
|
-
|
|
33
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
34
|
-
|
|
35
|
-
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; }
|
|
36
|
-
|
|
37
|
-
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; }
|
|
38
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactI18next = require("react-i18next");
|
|
9
|
+
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
10
|
+
var _ListItemIcon = _interopRequireDefault(require("@mui/material/ListItemIcon"));
|
|
11
|
+
var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
|
|
12
|
+
var _VerticalAlignBottom = _interopRequireDefault(require("@mui/icons-material/VerticalAlignBottom"));
|
|
13
|
+
var _translations = _interopRequireDefault(require("./translations"));
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
22
|
+
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); } // eslint-disable-next-line default-param-last
|
|
39
23
|
var downloadDialogReducer = function downloadDialogReducer() {
|
|
40
24
|
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
41
|
-
var action = arguments[1];
|
|
42
|
-
|
|
25
|
+
var action = arguments.length > 1 ? arguments[1] : undefined;
|
|
43
26
|
if (action.type === 'OPEN_WINDOW_DIALOG') {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return _extends({}, state, (_extends2 = {}, _extends2[action.windowId] = {
|
|
27
|
+
return _objectSpread(_objectSpread({}, state), {}, _defineProperty({}, action.windowId, {
|
|
47
28
|
openDialog: action.dialogType
|
|
48
|
-
}
|
|
29
|
+
}));
|
|
49
30
|
}
|
|
50
|
-
|
|
51
31
|
if (action.type === 'CLOSE_WINDOW_DIALOG') {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return _extends({}, state, (_extends3 = {}, _extends3[action.windowId] = {
|
|
32
|
+
return _objectSpread(_objectSpread({}, state), {}, _defineProperty({}, action.windowId, {
|
|
55
33
|
openDialog: null
|
|
56
|
-
}
|
|
34
|
+
}));
|
|
57
35
|
}
|
|
58
36
|
return state;
|
|
59
37
|
};
|
|
60
|
-
|
|
61
38
|
var mapDispatchToProps = function mapDispatchToProps(dispatch, _ref) {
|
|
62
39
|
var windowId = _ref.windowId;
|
|
63
40
|
return {
|
|
64
41
|
openDownloadDialog: function openDownloadDialog() {
|
|
65
|
-
return dispatch({
|
|
42
|
+
return dispatch({
|
|
43
|
+
type: 'OPEN_WINDOW_DIALOG',
|
|
44
|
+
windowId: windowId,
|
|
45
|
+
dialogType: 'download'
|
|
46
|
+
});
|
|
66
47
|
}
|
|
67
48
|
};
|
|
68
49
|
};
|
|
69
|
-
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
MiradorDownload.prototype.openDialogAndCloseMenu = function openDialogAndCloseMenu() {
|
|
80
|
-
var _props = this.props,
|
|
81
|
-
handleClose = _props.handleClose,
|
|
82
|
-
openDownloadDialog = _props.openDownloadDialog;
|
|
83
|
-
|
|
84
|
-
|
|
50
|
+
function MiradorDownload(_ref2) {
|
|
51
|
+
var _ref2$handleClose = _ref2.handleClose,
|
|
52
|
+
handleClose = _ref2$handleClose === void 0 ? function () {} : _ref2$handleClose,
|
|
53
|
+
_ref2$openDownloadDia = _ref2.openDownloadDialog,
|
|
54
|
+
openDownloadDialog = _ref2$openDownloadDia === void 0 ? function () {} : _ref2$openDownloadDia;
|
|
55
|
+
var openDialogAndCloseMenu = (0, _react.useCallback)(function () {
|
|
85
56
|
openDownloadDialog();
|
|
86
57
|
handleClose();
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
_react2.default.createElement(_VerticalAlignBottomSharp2.default, null)
|
|
104
|
-
),
|
|
105
|
-
_react2.default.createElement(
|
|
106
|
-
_ListItemText2.default,
|
|
107
|
-
{ primaryTypographyProps: { variant: 'body1' } },
|
|
108
|
-
'Download'
|
|
109
|
-
)
|
|
110
|
-
)
|
|
111
|
-
);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
return MiradorDownload;
|
|
115
|
-
}(_react.Component);
|
|
116
|
-
|
|
117
|
-
MiradorDownload.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
118
|
-
handleClose: _propTypes2.default.func,
|
|
119
|
-
openDownloadDialog: _propTypes2.default.func
|
|
120
|
-
} : {};
|
|
121
|
-
|
|
122
|
-
MiradorDownload.defaultProps = {
|
|
123
|
-
handleClose: function handleClose() {},
|
|
124
|
-
openDownloadDialog: function openDownloadDialog() {}
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
exports.default = {
|
|
58
|
+
}, [handleClose, openDownloadDialog]);
|
|
59
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
60
|
+
t = _useTranslation.t;
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem["default"], {
|
|
62
|
+
onClick: openDialogAndCloseMenu,
|
|
63
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemIcon["default"], {
|
|
64
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_VerticalAlignBottom["default"], {})
|
|
65
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText["default"], {
|
|
66
|
+
primaryTypographyProps: {
|
|
67
|
+
variant: 'body1'
|
|
68
|
+
},
|
|
69
|
+
children: t('mirador-dl-plugin.download')
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
var _default = exports["default"] = {
|
|
128
74
|
target: 'WindowTopBarPluginMenu',
|
|
129
75
|
mode: 'add',
|
|
130
76
|
name: 'MiradorDownloadPlugin',
|
|
131
77
|
component: MiradorDownload,
|
|
78
|
+
config: {
|
|
79
|
+
translations: _translations["default"]
|
|
80
|
+
},
|
|
132
81
|
mapDispatchToProps: mapDispatchToProps,
|
|
133
82
|
reducers: {
|
|
134
83
|
windowDialogs: downloadDialogReducer
|
|
135
84
|
}
|
|
136
|
-
};
|
|
137
|
-
module.exports = exports['default'];
|
|
85
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var translations = {
|
|
8
|
+
de: {
|
|
9
|
+
'mirador-dl-plugin': {
|
|
10
|
+
close: 'Schließen',
|
|
11
|
+
download: 'Download',
|
|
12
|
+
other_download: 'Andere Download-Optionen',
|
|
13
|
+
whole_image: 'Gesamtes Bild ({{width}} x {{height}}px)',
|
|
14
|
+
zoomed_region: 'Aktueller Bildausschnitt ({{width}} x {{height}}px)'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
en: {
|
|
18
|
+
'mirador-dl-plugin': {
|
|
19
|
+
close: 'Close',
|
|
20
|
+
download: 'Download',
|
|
21
|
+
other_download: 'Other download options',
|
|
22
|
+
whole_image: 'Whole image ({{width}} x {{height}}px)',
|
|
23
|
+
zoomed_region: 'Zoomed region ({{width}} x {{height}}px)'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
et: {
|
|
27
|
+
'mirador-dl-plugin': {
|
|
28
|
+
close: 'Sulge',
|
|
29
|
+
download: 'Lae alla',
|
|
30
|
+
other_download: 'Teised allalaadimise valikud',
|
|
31
|
+
whole_image: 'Kogu pilt ({{width}} x {{height}}px)',
|
|
32
|
+
zoomed_region: 'Suurendatud piirkond ({{width}} x {{height}}px)'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
fr: {
|
|
36
|
+
'mirador-dl-plugin': {
|
|
37
|
+
close: 'Fermer',
|
|
38
|
+
download: 'Télécharger',
|
|
39
|
+
other_download: 'Autres options de téléchargement',
|
|
40
|
+
whole_image: 'Image entière ({{width}} x {{height}}px)',
|
|
41
|
+
zoomed_region: 'Région zoomée ({{width}} x {{height}}px)'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var _default = exports["default"] = translations;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mirador-dl-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
4
|
"description": "mirador-dl-plugin React component",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -11,47 +11,76 @@
|
|
|
11
11
|
"umd"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
14
|
+
"build": "npm run build:umd && npm run build:demo",
|
|
15
|
+
"build:demo": "NODE_ENV=development webpack --mode=development",
|
|
16
|
+
"build:umd": "NODE_ENV=production webpack --mode=production",
|
|
17
|
+
"build:es": "mkdir -p es && cp -r src/* es && NODE_ENV=production MODULE_FORMAT=es npx babel es -d es",
|
|
18
|
+
"build:cjs": "mkdir -p lib && cp -r src/* lib && NODE_ENV=production MODULE_FORMAT=cjs npx babel lib -d lib",
|
|
19
|
+
"clean": "rm -rf ./umd && rm -rf ./es && rm -rf ./lib && rm -rf ./demo/dist",
|
|
20
|
+
"lint": "eslint ./src ./__tests__",
|
|
21
|
+
"prepublishOnly": "npm run clean && npm run build:es && npm run build:cjs && npm run build",
|
|
22
|
+
"start": "NODE_ENV=development webpack serve --open",
|
|
19
23
|
"test": "npm run lint && jest",
|
|
20
24
|
"test:coverage": "jest --coverage",
|
|
21
25
|
"test:watch": "jest --watch"
|
|
22
26
|
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@emotion/babel-plugin": "^11.11.0",
|
|
29
|
+
"@emotion/cache": "^11.11.0",
|
|
30
|
+
"@emotion/react": "^11.10.6",
|
|
31
|
+
"@emotion/styled": "^11.10.6"
|
|
32
|
+
},
|
|
23
33
|
"peerDependencies": {
|
|
24
|
-
"@material
|
|
25
|
-
"@material-ui/icons": "^4.9.1",
|
|
34
|
+
"@mui/material": "^5.x",
|
|
26
35
|
"lodash": "^4.17.11",
|
|
27
|
-
"mirador": "^
|
|
28
|
-
"
|
|
29
|
-
"react": "
|
|
30
|
-
"react-
|
|
36
|
+
"mirador": "^4.0.0-alpha.7",
|
|
37
|
+
"react": "18.x",
|
|
38
|
+
"react-dom": "18.x",
|
|
39
|
+
"react-i18next": "^13.0.0 || ^14.0.0 || ^15.0.0"
|
|
31
40
|
},
|
|
32
41
|
"devDependencies": {
|
|
33
|
-
"@babel/
|
|
34
|
-
"@babel/
|
|
35
|
-
"@babel/
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
42
|
+
"@babel/cli": "^7.17.6",
|
|
43
|
+
"@babel/core": "^7.17.7",
|
|
44
|
+
"@babel/eslint-parser": "^7.5.4",
|
|
45
|
+
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
46
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
47
|
+
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
|
48
|
+
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
49
|
+
"@babel/plugin-transform-regenerator": "^7.16.7",
|
|
50
|
+
"@babel/plugin-transform-runtime": "^7.24.7",
|
|
51
|
+
"@babel/preset-env": "^7.16.11",
|
|
52
|
+
"@babel/preset-react": "^7.16.7",
|
|
53
|
+
"@mui/material": "^5.x",
|
|
54
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
|
|
55
|
+
"@testing-library/dom": "^9.2.0",
|
|
56
|
+
"@testing-library/jest-dom": "^6.1.5",
|
|
57
|
+
"@testing-library/react": "^14.1.0",
|
|
58
|
+
"@testing-library/user-event": "^14.4.3",
|
|
38
59
|
"babel-eslint": "^10.0.3",
|
|
39
60
|
"babel-jest": "^24.9.0",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"eslint": "^
|
|
43
|
-
"eslint-config-airbnb": "^
|
|
44
|
-
"eslint-plugin-
|
|
45
|
-
"eslint-plugin-
|
|
46
|
-
"eslint-plugin-
|
|
47
|
-
"eslint-plugin-
|
|
48
|
-
"
|
|
61
|
+
"babel-loader": "^9.1.0",
|
|
62
|
+
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
63
|
+
"eslint": "^8.11.0",
|
|
64
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
65
|
+
"eslint-plugin-babel": "^5.3.0",
|
|
66
|
+
"eslint-plugin-import": "^2.25.4",
|
|
67
|
+
"eslint-plugin-jest": "^27.1.5",
|
|
68
|
+
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
69
|
+
"eslint-plugin-react": "^7.29.4",
|
|
70
|
+
"eslint-plugin-react-hooks": "^4.3.0",
|
|
71
|
+
"html-loader": "^5.0.0",
|
|
72
|
+
"html-webpack-plugin": "^5.6.0",
|
|
73
|
+
"jest": "^29.3.1",
|
|
74
|
+
"jest-environment-jsdom": "^29.4.3",
|
|
75
|
+
"jest-puppeteer": "^9.0.2",
|
|
49
76
|
"lodash": "^4.17.15",
|
|
50
|
-
"mirador": "^
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
77
|
+
"mirador": "^4.0.0-alpha.5",
|
|
78
|
+
"react": "^18.0.0",
|
|
79
|
+
"react-dom": "^18.0.0",
|
|
80
|
+
"terser-webpack-plugin": "^5.3.1",
|
|
81
|
+
"webpack": "^5.70.0",
|
|
82
|
+
"webpack-cli": "^5.1.4",
|
|
83
|
+
"webpack-dev-server": "^4.7.4"
|
|
55
84
|
},
|
|
56
85
|
"author": "",
|
|
57
86
|
"homepage": "",
|