@harvard-lts/mirador-eda-plugin 0.1.2 → 0.1.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.
Files changed (38) hide show
  1. package/dist/es/index.js +23 -34
  2. package/package.json +5 -4
  3. package/.github/pull_request_template.md +0 -31
  4. package/.github/workflows/publish-package.yml +0 -34
  5. package/.nvmrc +0 -1
  6. package/.parcelrc +0 -9
  7. package/.travis.yml +0 -16
  8. package/CONTRIBUTING.md +0 -20
  9. package/__mocks__/fileMock.js +0 -1
  10. package/babel.config.json +0 -11
  11. package/demo/data/manifest-3037.json +0 -524
  12. package/demo/data/manifest-5f3b.json +0 -315
  13. package/demo/data/manifest-609.json +0 -500
  14. package/demo/data/ms_am_1118_3_142_0001.jpg +0 -0
  15. package/demo/data/ms_am_1118_3_142_0002.jpg +0 -0
  16. package/demo/data/ms_am_1118_3_142_0003.jpg +0 -0
  17. package/demo/demoEntry.js +0 -21
  18. package/demo/index.html +0 -23
  19. package/jest.config.js +0 -23
  20. package/nwb.config.js +0 -20
  21. package/rollup.config.mjs +0 -12
  22. package/setupTests.js +0 -1
  23. package/src/index.js +0 -15
  24. package/src/plugins/EdaSideBarButtonsWrapper.js +0 -51
  25. package/src/plugins/EdaTranscriptionButton.js +0 -19
  26. package/src/plugins/EdaTranscriptionPanel.js +0 -245
  27. package/src/plugins/__tests__/EdaSideBarButtonsWrapper.spec.js +0 -183
  28. package/src/plugins/__tests__/EdaTranscriptionButton.spec.js +0 -17
  29. package/src/plugins/__tests__/EdaTranscriptionPanel.spec.js +0 -188
  30. package/src/plugins/__tests__/edaManifest.spec.js +0 -110
  31. package/src/plugins/__tests__/nonEdaManifest.spec.js +0 -64
  32. package/src/plugins/__tests__/transcriptionUtils.spec.js +0 -430
  33. package/src/plugins/testFixtures/combinedEditionsTranscriptions.js +0 -62
  34. package/src/plugins/testFixtures/franklinVariorum1998Transcription.js +0 -85
  35. package/src/plugins/testFixtures/johnsonPoems1955Transcription.js +0 -88
  36. package/src/plugins/transcriptionUtils.js +0 -114
  37. package/src/plugins/utils/suppressWarnings.js +0 -41
  38. package/webpack.config.cjs +0 -56
package/dist/es/index.js CHANGED
@@ -16,9 +16,6 @@ function _arrayLikeToArray(r, a) {
16
16
  function _arrayWithHoles(r) {
17
17
  if (Array.isArray(r)) return r;
18
18
  }
19
- function _arrayWithoutHoles(r) {
20
- if (Array.isArray(r)) return _arrayLikeToArray(r);
21
- }
22
19
  function _defineProperty(e, r, t) {
23
20
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
24
21
  value: t,
@@ -27,9 +24,6 @@ function _defineProperty(e, r, t) {
27
24
  writable: !0
28
25
  }) : e[r] = t, e;
29
26
  }
30
- function _iterableToArray(r) {
31
- if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
32
- }
33
27
  function _iterableToArrayLimit(r, l) {
34
28
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
35
29
  if (null != t) {
@@ -60,9 +54,6 @@ function _iterableToArrayLimit(r, l) {
60
54
  function _nonIterableRest() {
61
55
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
62
56
  }
63
- function _nonIterableSpread() {
64
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
65
- }
66
57
  function ownKeys(e, r) {
67
58
  var t = Object.keys(e);
68
59
  if (Object.getOwnPropertySymbols) {
@@ -107,9 +98,6 @@ function _objectWithoutPropertiesLoose(r, e) {
107
98
  function _slicedToArray(r, e) {
108
99
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
109
100
  }
110
- function _toConsumableArray(r) {
111
- return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
112
- }
113
101
  function _toPrimitive(t, r) {
114
102
  if ("object" != typeof t || !t) return t;
115
103
  var e = t[Symbol.toPrimitive];
@@ -287,17 +275,13 @@ var EdaTranscriptionPanel = function EdaTranscriptionPanel(_ref) {
287
275
  paperClassName: classes.paper,
288
276
  children: [(!transcriptions || transcriptions.length === 0) && /*#__PURE__*/jsx("div", {
289
277
  className: classes.root,
290
- children: /*#__PURE__*/jsxs("div", {
278
+ children: /*#__PURE__*/jsx("div", {
291
279
  className: classes.section,
292
- children: [/*#__PURE__*/jsx(Typography, {
280
+ children: /*#__PURE__*/jsx(Typography, {
293
281
  variant: "body1",
294
- className: classes.noTranscriptionsMessage1,
295
- children: "No Emily Dickinson Archive transcriptions are available for this manifest."
296
- }), /*#__PURE__*/jsx(Typography, {
297
- variant: "body2",
298
- className: classes.noTranscriptionsMessage2,
299
- children: "This feature is only available for items from the Emily Dickinson Archive."
300
- })]
282
+ className: classes.noTranscriptionsMessage,
283
+ children: "Emily Dickinson Archive transcriptions are not available for this manuscript."
284
+ })
301
285
  })
302
286
  }), /*#__PURE__*/jsxs("div", {
303
287
  className: classes.root,
@@ -353,9 +337,11 @@ var EdaTranscriptionPanel = function EdaTranscriptionPanel(_ref) {
353
337
  var styles = function styles(theme) {
354
338
  return {
355
339
  "@global": {
356
- ".react-draggable": {
340
+ ".react-draggable": _defineProperty(_defineProperty({}, theme.breakpoints.down("sm"), {
341
+ minWidth: "235px !important"
342
+ }), theme.breakpoints.up("sm"), {
357
343
  minWidth: "350px !important" // this must match the paper minWidth
358
- }
344
+ })
359
345
  },
360
346
  root: {
361
347
  height: "100%",
@@ -363,9 +349,11 @@ var styles = function styles(theme) {
363
349
  display: "flex",
364
350
  flexDirection: "column"
365
351
  },
366
- paper: {
352
+ paper: _defineProperty(_defineProperty({}, theme.breakpoints.down("sm"), {
353
+ minWidth: "235px"
354
+ }), theme.breakpoints.up("sm"), {
367
355
  minWidth: "350px" // this must match the companion window minWidth
368
- },
356
+ }),
369
357
  controls: {
370
358
  padding: theme.spacing(2),
371
359
  borderBottom: "1px solid ".concat(theme.palette.divider),
@@ -380,9 +368,11 @@ var styles = function styles(theme) {
380
368
  marginBottom: theme.spacing(0.5),
381
369
  fontSize: "0.875rem"
382
370
  },
383
- selectInput: {
371
+ selectInput: _defineProperty(_defineProperty({}, theme.breakpoints.down("sm"), {
372
+ width: 230
373
+ }), theme.breakpoints.up("sm"), {
384
374
  width: 300
385
- },
375
+ }),
386
376
  section: {
387
377
  flex: 1,
388
378
  fontSize: ".875em",
@@ -435,11 +425,8 @@ var styles = function styles(theme) {
435
425
  display: "block !important"
436
426
  }
437
427
  },
438
- noTranscriptionsMessage1: {
428
+ noTranscriptionsMessage: {
439
429
  padding: "16px"
440
- },
441
- noTranscriptionsMessage2: {
442
- padding: "0 16px 16px"
443
430
  }
444
431
  };
445
432
  };
@@ -469,7 +456,9 @@ var EdaSideBarButtonsWrapper = function EdaSideBarButtonsWrapper(_ref) {
469
456
  var TargetComponent = _ref.TargetComponent,
470
457
  targetProps = _objectWithoutProperties(_ref, _excluded);
471
458
  // shallowEqual prevents re-renders unless transcriptions actually change
472
- var transcriptions = useSelector(getEdaTranscription, shallowEqual);
459
+ var transcriptions = useSelector(function (state) {
460
+ return getEdaTranscription(state, targetProps.windowId);
461
+ }, shallowEqual);
473
462
  var hasTranscriptions = Boolean(transcriptions && transcriptions.length > 0);
474
463
 
475
464
  // sets the translation for the EDA Transcriptions button tooltip
@@ -483,8 +472,8 @@ var EdaSideBarButtonsWrapper = function EdaSideBarButtonsWrapper(_ref) {
483
472
  return originalTranslation(key, opts);
484
473
  };
485
474
 
486
- // if transcriptions exist, add EDA Transcriptions button and hide Annotations button
487
- var plugin = hasTranscriptions ? [].concat(_toConsumableArray(targetProps.PluginComponents || []), [EdaTranscriptionButton]) : targetProps.PluginComponents;
475
+ // if transcriptions exist, add EDA Transcriptions button
476
+ var plugin = hasTranscriptions ? [EdaTranscriptionButton] : targetProps.PluginComponents;
488
477
  return /*#__PURE__*/jsx(TargetComponent, _objectSpread2(_objectSpread2({}, targetProps), {}, {
489
478
  t: customTranslation,
490
479
  panels: _objectSpread2(_objectSpread2({}, targetProps.panels), {}, {
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@harvard-lts/mirador-eda-plugin",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "A Mirador plugin for displaying Emily Dickinson Archive transcriptions with toggleable line breaks and editorial marks",
5
- "main": "dist/index.js",
6
- "source": "src/index.js",
7
- "module": "es/index.js",
5
+ "module": "dist/es/index.js",
6
+ "files": [
7
+ "dist"
8
+ ],
8
9
  "scripts": {
9
10
  "start": "npm run serve",
10
11
  "clean": "rm -rf ./dist && rm -rf ./demo/dist",
@@ -1,31 +0,0 @@
1
- **The title of this pull-request should be a brief description of what the pull-request fixes/improves/changes. Ideally 50 characters or less.**
2
-
3
- ---
4
-
5
- **JIRA Ticket**: (link)
6
-
7
- - Other Relevant Links (Mailing list discussion, related pull requests, etc.)
8
-
9
- # What does this Pull Request do?
10
-
11
- A brief description of what the intended result of the PR will be and/or what problem it solves.
12
-
13
- # How should this be tested?
14
-
15
- A description of what steps someone could take to:
16
-
17
- - Reproduce the problem you are fixing (if applicable)
18
- - Test that the Pull Request does what is intended.
19
- - Please be as detailed as possible.
20
- - Good testing instructions help get your PR completed faster.
21
-
22
- # Test coverage
23
-
24
- Yes/No: Are changes in this pull-request covered by:
25
-
26
- - unit tests?
27
- - integration tests?
28
-
29
- # Interested parties
30
-
31
- Tag (@ mention) interested parties
@@ -1,34 +0,0 @@
1
- name: Publish to npmjs on release
2
- on:
3
- release:
4
- types: [published]
5
-
6
- jobs:
7
- publish:
8
- runs-on: ubuntu-latest
9
-
10
- steps:
11
- - name: Checkout repository
12
- uses: actions/checkout@v4
13
- with:
14
- fetch-depth: 0
15
-
16
- - name: Compare the tag and version
17
- run: |
18
- NODE_VERSION=$(node -p -e "require('./package.json').version")
19
- LATEST_TAG=$(git describe --tags --abbrev=0)
20
- if [ "v$NODE_VERSION" != $LATEST_TAG ]; then echo "Github tag ($LATEST_TAG) and version ($NODE_VERSION) don't match" && exit 1; fi
21
-
22
- - name: Set up Node.js
23
- uses: actions/setup-node@v4
24
- with:
25
- node-version: 18
26
- registry-url: "https://registry.npmjs.org"
27
-
28
- - name: Install dependencies
29
- run: npm ci
30
-
31
- - name: Publish to npm
32
- run: npm publish --access=public
33
- env:
34
- NODE_AUTH_TOKEN: ${{ secrets.LTS_NPM_TOKEN }}
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- lts/hydrogen
package/.parcelrc DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "@parcel/config-default",
3
- "transformers": {
4
- "*.{js,mjs,jsx,cjs,ts,tsx}": [
5
- "@parcel/transformer-js",
6
- "@parcel/transformer-react-refresh-wrap"
7
- ]
8
- }
9
- }
package/.travis.yml DELETED
@@ -1,16 +0,0 @@
1
- sudo: false
2
-
3
- language: node_js
4
- node_js:
5
- - 18
6
-
7
- before_install:
8
- - npm install codecov.io coveralls
9
-
10
- after_success:
11
- - cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js
12
- - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
13
-
14
- branches:
15
- only:
16
-
package/CONTRIBUTING.md DELETED
@@ -1,20 +0,0 @@
1
- ## Prerequisites
2
-
3
- Check the `.nvmrc` file for the requisite node version
4
-
5
- ## Installation
6
-
7
- - Running `npm install` in the component's root directory will install everything you need for development.
8
-
9
- ## Running Tests
10
-
11
- - `npm test` will run the tests once.
12
-
13
- - `npm run test:coverage` will run the tests and produce a coverage report in `coverage/`.
14
-
15
- - `npm run test:watch` will run the tests on every change.
16
-
17
- ## Building
18
-
19
- - `npm run build` will build the component for publishing to npm and also bundle the demo app.
20
-
@@ -1 +0,0 @@
1
- module.exports = "mock-file-stub"
package/babel.config.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "presets": [
3
- [
4
- "@babel/preset-env",
5
- {
6
- "modules": "auto"
7
- }
8
- ],
9
- ["@babel/preset-react", { "runtime": "automatic" }]
10
- ]
11
- }