@harvard-lts/mirador-pdf-plugin 0.0.5 → 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.
Files changed (3) hide show
  1. package/README.md +20 -4
  2. package/dist/es/index.js +31 -45
  3. package/package.json +17 -10
package/README.md CHANGED
@@ -1,6 +1,22 @@
1
1
  # mirador-pdf-plugin
2
2
 
3
- A [Mirador 3](https://projectmirador.org/) plugin that adds a **Download PDF** option to the window top-bar menu. It connects to an external PDF download service and allows users to optionally specify a page number or range before downloading.
3
+ [![Node Unit Tests](https://github.com/harvard-lts/mirador-pdf-plugin/actions/workflows/coverage-node.yml/badge.svg)](https://github.com/harvard-lts/mirador-pdf-plugin/actions/workflows/coverage-node.yml)
4
+
5
+ <a href="https://github.com/harvard-lts/mirador-pdf-plugin/actions/workflows/coverage-node.yml"><img src="https://github.com/harvard-lts/mirador-pdf-plugin/raw/badges/test-coverage/coverage.svg"></a>
6
+
7
+ A [Mirador 4](https://projectmirador.org/) plugin that adds a **Download PDF** option to the window top-bar menu. It connects to an external PDF download service and allows users to optionally specify a page number or range before downloading.
8
+
9
+ ## Compatibility
10
+
11
+ This plugin is **Mirador 4-compatible** (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 styling).
14
+
15
+ Versioning convention:
16
+
17
+ - **Mirador 4** releases are tagged `2.x`.
18
+ - **Mirador 3** releases are tagged `0.x` or `1.x` — pin one of these if you
19
+ still need Mirador 3.
4
20
 
5
21
  ## Features
6
22
 
@@ -13,7 +29,7 @@ A [Mirador 3](https://projectmirador.org/) plugin that adds a **Download PDF** o
13
29
  ## Requirements
14
30
 
15
31
  - [NVM](https://github.com/nvm-sh/nvm)
16
- - Mirador 3
32
+ - Mirador 4
17
33
 
18
34
  ## Setup
19
35
 
@@ -33,7 +49,7 @@ The following are some useful scripts that can be run using `npm run <script>`.
33
49
 
34
50
  ## Installing in Mirador
35
51
 
36
- The `mirador-pdf-plugin` requires an instance of Mirador 3. Visit the [Mirador wiki](https://github.com/ProjectMirador/mirador/wiki) to learn how to [install an existing plugin](https://github.com/ProjectMirador/mirador/wiki/Mirador-3-plugins#installing-an-existing-plugin) and for additional information about plugins.
52
+ The `mirador-pdf-plugin` requires an instance of Mirador 4. Visit the [Mirador wiki](https://github.com/ProjectMirador/mirador/wiki) and the [Creating a Mirador 4 Plugin](https://github.com/ProjectMirador/mirador/wiki/Creating-a-Mirador-4-Plugin) page for information about installing and building plugins.
37
53
 
38
54
  Install the package:
39
55
 
@@ -46,7 +62,7 @@ npm i @harvard-lts/mirador-pdf-plugin
46
62
  Pass a `miradorPdfPlugin` object in your Mirador config block:
47
63
 
48
64
  ```js
49
- import Mirador from 'mirador/dist/es/src/index';
65
+ import Mirador from 'mirador';
50
66
  import Plugin from '@harvard-lts/mirador-pdf-plugin';
51
67
 
52
68
  Mirador.viewer(
package/dist/es/index.js CHANGED
@@ -1,18 +1,17 @@
1
- import { useState, useEffect, useMemo } from 'react';
2
- import MenuItem from '@material-ui/core/MenuItem';
3
- import ListItemIcon from '@material-ui/core/ListItemIcon';
4
- import ListItemText from '@material-ui/core/ListItemText';
5
- import { getManifestoInstance } from 'mirador/dist/es/src/state/selectors/manifests';
6
- import PDFIcon from '@material-ui/icons/PictureAsPdf';
1
+ import MenuItem from '@mui/material/MenuItem';
2
+ import ListItemIcon from '@mui/material/ListItemIcon';
3
+ import ListItemText from '@mui/material/ListItemText';
4
+ import PDFIcon from '@mui/icons-material/PictureAsPdf';
5
+ import { getManifestoInstance } from 'mirador';
7
6
  import { jsx, jsxs } from 'react/jsx-runtime';
8
- import { withStyles } from '@material-ui/core/styles';
9
- import Button from '@material-ui/core/Button';
10
- import Dialog from '@material-ui/core/Dialog';
11
- import DialogActions from '@material-ui/core/DialogActions';
12
- import DialogContent from '@material-ui/core/DialogContent';
13
- import DialogTitle from '@material-ui/core/DialogTitle';
14
- import TextField from '@material-ui/core/TextField';
15
- import Typography from '@material-ui/core/Typography';
7
+ import { useState, useEffect, useMemo } from 'react';
8
+ import Button from '@mui/material/Button';
9
+ import Dialog from '@mui/material/Dialog';
10
+ import DialogActions from '@mui/material/DialogActions';
11
+ import DialogContent from '@mui/material/DialogContent';
12
+ import DialogTitle from '@mui/material/DialogTitle';
13
+ import TextField from '@mui/material/TextField';
14
+ import Typography from '@mui/material/Typography';
16
15
 
17
16
  function _arrayLikeToArray(r, a) {
18
17
  (null == a || a > r.length) && (a = r.length);
@@ -146,8 +145,10 @@ var mapDispatchToProps$1 = function mapDispatchToProps(dispatch, _ref2) {
146
145
  };
147
146
  };
148
147
  var MiradorPdfMenuItem = function MiradorPdfMenuItem(_ref3) {
149
- var handleClose = _ref3.handleClose,
150
- openDialog = _ref3.openDialog;
148
+ var _ref3$handleClose = _ref3.handleClose,
149
+ handleClose = _ref3$handleClose === void 0 ? function () {} : _ref3$handleClose,
150
+ _ref3$openDialog = _ref3.openDialog,
151
+ openDialog = _ref3$openDialog === void 0 ? function () {} : _ref3$openDialog;
151
152
  var handleClick = function handleClick() {
152
153
  openDialog();
153
154
  handleClose();
@@ -159,17 +160,13 @@ var MiradorPdfMenuItem = function MiradorPdfMenuItem(_ref3) {
159
160
  children: /*#__PURE__*/jsx(PDFIcon, {})
160
161
  }), /*#__PURE__*/jsx(ListItemText, {
161
162
  primaryTypographyProps: {
162
- variant: "body1"
163
+ variant: 'body1'
163
164
  },
164
165
  children: "Download PDF"
165
166
  })]
166
167
  })
167
168
  });
168
169
  };
169
- MiradorPdfMenuItem.defaultProps = {
170
- handleClose: function handleClose() {},
171
- openDialog: function openDialog() {}
172
- };
173
170
  var miradorPdfMenuItem = {
174
171
  target: 'WindowTopBarPluginMenu',
175
172
  mode: 'add',
@@ -279,14 +276,16 @@ var validatePages = function validatePages(pages, totalPages, maxPages) {
279
276
  };
280
277
  };
281
278
  var MiradorPdfDialog = function MiradorPdfDialog(_ref3) {
282
- var open = _ref3.open,
279
+ var _ref3$open = _ref3.open,
280
+ open = _ref3$open === void 0 ? false : _ref3$open,
283
281
  closeDialog = _ref3.closeDialog,
284
282
  manifestId = _ref3.manifestId,
285
283
  totalPages = _ref3.totalPages,
286
284
  pdfAPI = _ref3.pdfAPI,
287
- maxPages = _ref3.maxPages,
288
- containerId = _ref3.containerId,
289
- classes = _ref3.classes;
285
+ _ref3$maxPages = _ref3.maxPages,
286
+ maxPages = _ref3$maxPages === void 0 ? 500 : _ref3$maxPages,
287
+ _ref3$containerId = _ref3.containerId,
288
+ containerId = _ref3$containerId === void 0 ? null : _ref3$containerId;
290
289
  var _useState = useState(''),
291
290
  _useState2 = _slicedToArray(_useState, 2),
292
291
  pages = _useState2[0],
@@ -335,12 +334,11 @@ var MiradorPdfDialog = function MiradorPdfDialog(_ref3) {
335
334
  fullWidth: true,
336
335
  maxWidth: "sm",
337
336
  children: [/*#__PURE__*/jsx(DialogTitle, {
338
- disableTypography: true,
339
- className: classes.h2,
340
- children: /*#__PURE__*/jsx(Typography, {
341
- variant: "h2",
342
- children: "PDF Download"
343
- })
337
+ variant: "h2",
338
+ sx: {
339
+ paddingBottom: 0
340
+ },
341
+ children: "PDF Download"
344
342
  }), /*#__PURE__*/jsxs(DialogContent, {
345
343
  children: [/*#__PURE__*/jsx(Typography, {
346
344
  variant: "body1",
@@ -369,7 +367,7 @@ var MiradorPdfDialog = function MiradorPdfDialog(_ref3) {
369
367
  }), /*#__PURE__*/jsxs(DialogActions, {
370
368
  children: [/*#__PURE__*/jsx(Button, {
371
369
  onClick: handleClose,
372
- color: "default",
370
+ color: "inherit",
373
371
  children: "Close"
374
372
  }), /*#__PURE__*/jsx(Button, {
375
373
  onClick: handleDownload,
@@ -381,23 +379,11 @@ var MiradorPdfDialog = function MiradorPdfDialog(_ref3) {
381
379
  })]
382
380
  });
383
381
  };
384
- MiradorPdfDialog.defaultProps = {
385
- open: false,
386
- maxPages: 500,
387
- containerId: null
388
- };
389
- var styles = function styles() {
390
- return {
391
- h2: {
392
- paddingBottom: 0
393
- }
394
- };
395
- };
396
382
  var miradorPdfDialog = {
397
383
  target: 'Window',
398
384
  mode: 'add',
399
385
  name: 'MiradorPdfDialog',
400
- component: withStyles(styles)(MiradorPdfDialog),
386
+ component: MiradorPdfDialog,
401
387
  mapStateToProps: mapStateToProps,
402
388
  mapDispatchToProps: mapDispatchToProps
403
389
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@harvard-lts/mirador-pdf-plugin",
3
- "version": "0.0.5",
4
- "description": "A Mirador 3 plugin that interacts with MPS PDF Download Service ",
3
+ "version": "2.0.0",
4
+ "description": "A Mirador 4 plugin that interacts with MPS PDF Download Service ",
5
5
  "module": "dist/es/index.js",
6
6
  "files": [
7
7
  "dist"
@@ -15,7 +15,8 @@
15
15
  "serve": "vite",
16
16
  "test": "vitest run",
17
17
  "test:coverage": "vitest run --coverage",
18
- "test:watch": "vitest"
18
+ "test:watch": "vitest",
19
+ "test:unit": "node scripts/coverage-ci.mjs"
19
20
  },
20
21
  "repository": {
21
22
  "type": "git",
@@ -26,11 +27,17 @@
26
27
  "license": "Apache-2.0",
27
28
  "homepage": "https://github.com/harvard-lts/mirador-pdf-plugin#readme",
28
29
  "dependencies": {
30
+ "@emotion/react": "^11.11.0",
31
+ "@emotion/styled": "^11.11.0",
32
+ "@mui/material": "^7.0.0",
33
+ "@mui/system": "^7.0.0",
34
+ "@mui/icons-material": "^7.0.0",
29
35
  "jquery": "^3.7.0",
30
36
  "prop-types": "^15.8.1",
31
- "react": "^16.14.0",
32
- "react-dom": "^16.14.0",
33
- "redux": "^4.2.1",
37
+ "react": "^19.0.0",
38
+ "react-dom": "^19.0.0",
39
+ "react-i18next": "^15.0.0",
40
+ "redux": "^5.0.0",
34
41
  "redux-saga": "^1.2.3"
35
42
  },
36
43
  "devDependencies": {
@@ -40,17 +47,17 @@
40
47
  "@babel/preset-react": "^7.18.6",
41
48
  "@rollup/plugin-babel": "^6.0.3",
42
49
  "@testing-library/jest-dom": "^6.1.5",
43
- "@testing-library/react": "^12.0.0",
44
- "@vitejs/plugin-react": "^4.7.0",
50
+ "@testing-library/react": "^16.0.0",
51
+ "@vitejs/plugin-react": "^5.1.2",
45
52
  "@vitest/coverage-v8": "^4.1.8",
46
53
  "@vitest/ui": "^4.1.8",
47
54
  "jsdom": "^23.0.0",
48
- "mirador": "^3.4.3",
55
+ "mirador": "^4.1.0",
49
56
  "npm-run-all": "^4.1.5",
50
57
  "parcel": "^2.8.3",
51
58
  "rollup": "^3.29.5",
52
59
  "url": "^0.11.4",
53
- "vite": "^7.3.5",
60
+ "vite": "^8.0.16",
54
61
  "vitest": "^4.1.8",
55
62
  "whatwg-fetch": "^3.6.20"
56
63
  }