@cu-mkp/editioncrafter 1.0.3 → 1.0.4-beta.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.
Files changed (57) hide show
  1. package/README.md +7 -7
  2. package/dist/editioncrafter.js +65802 -0
  3. package/dist/editioncrafter.umd.cjs +553 -0
  4. package/dist/es/src/action/DiplomaticActions.js +9 -11
  5. package/dist/es/src/action/DocumentActions.js +164 -154
  6. package/dist/es/src/action/GlossaryActions.js +9 -11
  7. package/dist/es/src/action/initialState/diplomaticInitialState.js +2 -2
  8. package/dist/es/src/action/initialState/documentInitialState.js +9 -12
  9. package/dist/es/src/action/initialState/glossaryInitialState.js +3 -3
  10. package/dist/es/src/action/rootReducer.js +31 -29
  11. package/dist/es/src/component/AlphabetLinks.js +44 -66
  12. package/dist/es/src/component/CustomizedTooltops.js +101 -110
  13. package/dist/es/src/component/DiploMatic.js +64 -91
  14. package/dist/es/src/component/DocumentView.js +442 -366
  15. package/dist/es/src/component/EditorComment.js +51 -75
  16. package/dist/es/src/component/ErrorBoundary.js +37 -61
  17. package/dist/es/src/component/FigureImage.js +56 -67
  18. package/dist/es/src/component/GlossaryView.js +157 -149
  19. package/dist/es/src/component/HelpPopper.js +96 -78
  20. package/dist/es/src/component/ImageGridView.js +184 -249
  21. package/dist/es/src/component/ImageView.js +155 -165
  22. package/dist/es/src/component/ImageZoomControl.js +19 -38
  23. package/dist/es/src/component/JumpToFolio.js +56 -60
  24. package/dist/es/src/component/Navigation.js +374 -328
  25. package/dist/es/src/component/Pagination.js +73 -70
  26. package/dist/es/src/component/Parser.js +11 -32
  27. package/dist/es/src/component/RingSpinner.js +31 -32
  28. package/dist/es/src/component/RouteListener.js +30 -21
  29. package/dist/es/src/component/SeaDragonComponent.js +33 -56
  30. package/dist/es/src/component/SinglePaneView.js +15 -33
  31. package/dist/es/src/component/SplitPaneView.js +151 -170
  32. package/dist/es/src/component/TranscriptionView.js +190 -179
  33. package/dist/es/src/component/Watermark.js +21 -30
  34. package/dist/es/src/component/XMLView.js +60 -82
  35. package/dist/es/src/hooks/useIsWidthUp.js +9 -7
  36. package/dist/es/src/icons/ByIcon.js +16 -16
  37. package/dist/es/src/icons/CcIcon.js +16 -16
  38. package/dist/es/src/icons/NcIcon.js +16 -16
  39. package/dist/es/src/icons/SaIcon.js +16 -16
  40. package/dist/es/src/icons/SideMenuIconLeft.js +30 -38
  41. package/dist/es/src/icons/SideMenuIconRight.js +32 -38
  42. package/dist/es/src/index.js +21 -20
  43. package/dist/es/src/lib/copyObject.js +3 -2
  44. package/dist/es/src/lib/registerServiceWorker.js +77 -54
  45. package/dist/es/src/model/DocumentHelper.js +7 -6
  46. package/dist/es/src/model/Folio.js +68 -146
  47. package/dist/es/src/model/ReduxStore.js +32 -78
  48. package/dist/es/src/model/folioLayout.js +275 -280
  49. package/dist/es/src/saga/RouteListenerSaga.js +89 -203
  50. package/dist/es/src/saga/rootSaga.js +9 -16
  51. package/dist/es/src/scss/_imageView.scss +1 -1
  52. package/dist/es/src/scss/_navigation.scss +1 -1
  53. package/dist/es/src/scss/editioncrafter.scss +1 -1
  54. package/dist/style.css +1 -0
  55. package/package.json +36 -50
  56. package/dist/editioncrafter.min.js +0 -2
  57. package/dist/editioncrafter.min.js.LICENSE.txt +0 -144
@@ -1,12 +1,10 @@
1
- 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; }
2
- 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; }
3
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
- var DiplomaticActions = {};
1
+ const DiplomaticActions = {}
2
+
7
3
  DiplomaticActions.setFixedFrameMode = function setFixedFrameMode(state, mode) {
8
- return _objectSpread(_objectSpread({}, state), {}, {
9
- fixedFrameMode: mode
10
- });
11
- };
12
- export default DiplomaticActions;
4
+ return {
5
+ ...state,
6
+ fixedFrameMode: mode,
7
+ }
8
+ }
9
+
10
+ export default DiplomaticActions
@@ -1,209 +1,219 @@
1
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
2
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
4
- 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; }
5
- 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; }
6
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
8
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
9
- var DocumentActions = {};
1
+ const DocumentActions = {}
10
2
 
11
3
  // Profile ID for EditionCrafter text partials
12
- var textPartialResourceProfileID = 'https://github.com/cu-mkp/editioncrafter-project/text-partial-resource.md';
4
+ const textPartialResourceProfileID = 'https://github.com/cu-mkp/editioncrafter-project/text-partial-resource.md'
5
+
13
6
  DocumentActions.loadDocument = function loadDocument(state, manifestData) {
14
- var folios = parseManifest(manifestData, state.transcriptionTypes);
15
- var _createFolioIndex = createFolioIndex(folios),
16
- folioIndex = _createFolioIndex.folioIndex,
17
- folioByName = _createFolioIndex.folioByName;
18
- return _objectSpread(_objectSpread({}, state), {}, {
7
+ const folios = parseManifest(manifestData, state.transcriptionTypes)
8
+ const { folioIndex, folioByName } = createFolioIndex(folios)
9
+
10
+ return {
11
+ ...state,
19
12
  loaded: true,
20
- folios: folios,
21
- folioIndex: folioIndex,
22
- folioByName: folioByName
23
- });
24
- };
13
+ folios,
14
+ folioIndex,
15
+ folioByName,
16
+ }
17
+ }
18
+
25
19
  DocumentActions.loadFolio = function loadFolio(state, folio) {
26
- var oldFolio = state.folioIndex[folio.id];
27
- var folioIdx = state.folios.indexOf(oldFolio);
28
- state.folios[folioIdx] = folio;
29
- state.folioIndex[folio.id] = folio;
30
- state.folioByName[folio.name] = folio;
31
- return _objectSpread({}, state);
32
- };
20
+ const oldFolio = state.folioIndex[folio.id]
21
+ const folioIdx = state.folios.indexOf(oldFolio)
22
+ state.folios[folioIdx] = folio
23
+ state.folioIndex[folio.id] = folio
24
+ state.folioByName[folio.name] = folio
25
+ return {
26
+ ...state,
27
+ }
28
+ }
29
+
33
30
  function createFolioIndex(folios) {
34
31
  // Store an ordered array of folio ids, used for next/prev navigation purposes later
35
- var folioIndex = {};
36
- var folioByName = {};
37
- for (var idx = 0; idx < folios.length; idx++) {
38
- var folio = folios[idx];
39
- folioIndex[folio.id] = folio;
40
- folioByName[folio.name] = folio;
32
+ const folioIndex = {}
33
+ const folioByName = {}
34
+ for (let idx = 0; idx < folios.length; idx++) {
35
+ const folio = folios[idx]
36
+ folioIndex[folio.id] = folio
37
+ folioByName[folio.name] = folio
41
38
  }
42
- return {
43
- folioIndex: folioIndex,
44
- folioByName: folioByName
45
- };
39
+ return { folioIndex, folioByName }
46
40
  }
41
+
47
42
  function throwError(message) {
48
- throw new Error("IIIF manifest parser error: ".concat(message));
43
+ throw new Error(`IIIF manifest parser error: ${message}`)
49
44
  }
45
+
50
46
  function displayWarning(message) {
51
- console.warn("IIIF manifest parser warning: ".concat(message));
47
+ console.warn(`IIIF manifest parser warning: ${message}`)
52
48
  }
49
+
53
50
  function parseImageURLs(canvas) {
54
- var _iterator = _createForOfIteratorHelper(canvas.items),
55
- _step;
56
- try {
57
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
58
- var annotationPage = _step.value;
59
- if (annotationPage.type !== 'AnnotationPage') throwError("Expected AnnotationPage in items property of ".concat(canvas.id));
60
- if (!annotationPage.items) throwError("Expected items property in AnnotationPage ".concat(annotationPage.id));
61
- var _iterator2 = _createForOfIteratorHelper(annotationPage.items),
62
- _step2;
63
- try {
64
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
65
- var annotation = _step2.value;
66
- if (annotation.type !== 'Annotation') throwError("Expected Annotation in items property of ".concat(annotationPage.id));
67
- if (annotation.motivation === 'painting') {
68
- if (!annotation.body) throwError("Expected body property in Annotation ".concat(annotation.id));
69
- if (!annotation.body.id) {
70
- return null;
71
- }
72
- return {
73
- bodyId: annotation.body.id,
74
- imageURL: "".concat(annotation.body.id, "/info.json")
75
- };
76
- }
51
+ for (const annotationPage of canvas.items) {
52
+ if (annotationPage.type !== 'AnnotationPage')
53
+ throwError(`Expected AnnotationPage in items property of ${canvas.id}`)
54
+ if (!annotationPage.items)
55
+ throwError(`Expected items property in AnnotationPage ${annotationPage.id}`)
56
+ for (const annotation of annotationPage.items) {
57
+ if (annotation.type !== 'Annotation')
58
+ throwError(`Expected Annotation in items property of ${annotationPage.id}`)
59
+ if (annotation.motivation === 'painting') {
60
+ if (!annotation.body)
61
+ throwError(`Expected body property in Annotation ${annotation.id}`)
62
+ if (!annotation.body.id) {
63
+ return null
64
+ }
65
+
66
+ // if the service property exists, it's a IIIF image
67
+ if (annotation.body.service) {
68
+ return ({
69
+ bodyId: annotation.body.id,
70
+ imageURL: `${annotation.body.id}/info.json`,
71
+ imageType: 'iiif',
72
+ })
77
73
  }
78
- } catch (err) {
79
- _iterator2.e(err);
80
- } finally {
81
- _iterator2.f();
74
+
75
+ return ({
76
+ bodyId: annotation.body.id,
77
+ imageURL: annotation.body.id,
78
+ imageType: 'image',
79
+ })
82
80
  }
83
81
  }
84
- } catch (err) {
85
- _iterator.e(err);
86
- } finally {
87
- _iterator.f();
88
82
  }
89
- throwError("Unable to find painting Annotation for canvas: ".concat(canvas.id));
90
- return null;
83
+ throwError(`Unable to find painting Annotation for canvas: ${canvas.id}`)
84
+ return null
91
85
  }
86
+
92
87
  function parseLabel(parent) {
93
88
  // TODO support labels in different languages, multiple labels in same language
94
89
  if (!parent.label) {
95
- displayWarning("".concat(parent.id, " does not have a label property."));
96
- return '';
90
+ displayWarning(`${parent.id} does not have a label property.`)
91
+ return ''
97
92
  }
98
- return parent.label.none[0];
93
+ return parent.label.none[0]
99
94
  }
95
+
100
96
  function parseAnnotationURLs(canvas, transcriptionTypes) {
101
- var annos = {};
97
+ const annos = {}
98
+
102
99
  if (canvas.annotations) {
103
- var _iterator3 = _createForOfIteratorHelper(canvas.annotations),
104
- _step3;
105
- try {
106
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
107
- var annotationPage = _step3.value;
108
- if (annotationPage.type === 'AnnotationPage') {
109
- if (!annotationPage.items) throwError("Expected items property in AnnotationPage ".concat(annotationPage.id));
110
- var _iterator4 = _createForOfIteratorHelper(annotationPage.items),
111
- _step4;
112
- try {
113
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
114
- var annotation = _step4.value;
115
- if (annotation.type !== 'Annotation') throwError("Expected Annotation in items property of ".concat(annotationPage.id));
116
- if (annotation.motivation === 'supplementing') {
117
- if (!annotation.body) throwError("Expected body property in Annotation ".concat(annotation.id));
118
- var annotationBody = annotation.body;
119
- if (annotationBody.profile === textPartialResourceProfileID && annotationBody.type === 'TextPartial') {
120
- if (!annotationBody.id) throwError("Expected id property in TextPartial in ".concat(annotation.id));
121
- if (!annotationBody.format) throwError("Expected format property in TextPartial in ".concat(annotation.id));
122
- var id = annotationBody.id,
123
- format = annotationBody.format;
124
- var idParts = id.split('/');
125
- if (idParts.length < 5) throwError("TextPartial id property is in the wrong format: ".concat(id));
126
- var transcriptionTypeID = idParts[idParts.length - 2];
127
- if (transcriptionTypes[transcriptionTypeID]) {
128
- if (!annos[transcriptionTypeID]) annos[transcriptionTypeID] = {};
129
- if (format === 'text/html') annos[transcriptionTypeID].htmlURL = id;
130
- if (format === 'text/xml') annos[transcriptionTypeID].xmlURL = id;
131
- }
132
- }
100
+ for (const annotationPage of canvas.annotations) {
101
+ if (annotationPage.type === 'AnnotationPage') {
102
+ if (!annotationPage.items)
103
+ throwError(`Expected items property in AnnotationPage ${annotationPage.id}`)
104
+ for (const annotation of annotationPage.items) {
105
+ if (annotation.type !== 'Annotation')
106
+ throwError(`Expected Annotation in items property of ${annotationPage.id}`)
107
+ if (annotation.motivation === 'supplementing') {
108
+ if (!annotation.body)
109
+ throwError(`Expected body property in Annotation ${annotation.id}`)
110
+ const { body: annotationBody } = annotation
111
+ if (annotationBody.profile === textPartialResourceProfileID && annotationBody.type === 'TextPartial') {
112
+ if (!annotationBody.id)
113
+ throwError(`Expected id property in TextPartial in ${annotation.id}`)
114
+ if (!annotationBody.format)
115
+ throwError(`Expected format property in TextPartial in ${annotation.id}`)
116
+ const { id, format } = annotationBody
117
+ const idParts = id.split('/')
118
+ if (idParts.length < 5)
119
+ throwError(`TextPartial id property is in the wrong format: ${id}`)
120
+ const transcriptionTypeID = idParts[idParts.length - 2]
121
+ if (transcriptionTypes[transcriptionTypeID]) {
122
+ if (!annos[transcriptionTypeID])
123
+ annos[transcriptionTypeID] = {}
124
+ if (format === 'text/html')
125
+ annos[transcriptionTypeID].htmlURL = id
126
+ if (format === 'text/xml')
127
+ annos[transcriptionTypeID].xmlURL = id
133
128
  }
134
129
  }
135
- } catch (err) {
136
- _iterator4.e(err);
137
- } finally {
138
- _iterator4.f();
139
130
  }
140
131
  }
141
132
  }
142
- } catch (err) {
143
- _iterator3.e(err);
144
- } finally {
145
- _iterator3.f();
146
133
  }
147
134
  }
148
- return annos;
135
+
136
+ return annos
149
137
  }
150
138
 
151
139
  // The largest dimension for either width or height allowed in a thumbnail.
152
- var MAX_THUMBNAIL_DIMENSION = 130;
140
+ const MAX_THUMBNAIL_DIMENSION = 130
141
+
153
142
  function parseManifest(manifest, transcriptionTypes) {
154
143
  if (manifest.type === 'variorum') {
155
- var folios = [];
156
- Object.keys(manifest.documentData).forEach(function (key) {
157
- folios = folios.concat(parseSingleManifest(manifest.documentData[key], transcriptionTypes[key], key));
158
- });
159
- return folios;
144
+ let folios = []
145
+ Object.keys(manifest.documentData).forEach((key) => {
146
+ folios = folios.concat(parseSingleManifest(manifest.documentData[key], transcriptionTypes[key], key))
147
+ })
148
+ return folios
160
149
  }
161
- return parseSingleManifest(manifest, transcriptionTypes);
150
+ return parseSingleManifest(manifest, transcriptionTypes)
162
151
  }
152
+
163
153
  function parseSingleManifest(manifest, transcriptionTypes, document) {
164
- var folios = [];
154
+ const folios = []
165
155
 
166
156
  // make sure this is a IIIF Presentation API v3 Manifest
167
157
  if (!manifest['@context'] || !manifest['@context'].includes('http://iiif.io/api/presentation/3/context.json')) {
168
- throwError('Expected root object to have a @context containing: http://iiif.io/api/presentation/3/context.json');
158
+ throwError('Expected root object to have a @context containing: http://iiif.io/api/presentation/3/context.json')
169
159
  }
170
- if (manifest.type !== 'Manifest') throwError("Expected root object of type 'Manifest'.");
171
- if (!manifest.items) throwError('Expected manifest to have an items property.');
172
- var canvases = manifest.items;
173
- for (var i = 0; i < canvases.length; i++) {
174
- var canvas = canvases[i];
175
- if (canvas.type !== 'Canvas') throwError("Expected items[".concat(i, "] to be of type 'Canvas'."));
176
- if (!canvas.id) throwError("Expected items[".concat(i, "] to have an id property."));
177
- if (parseImageURLs(canvas)) {
178
- var folioID = canvas.id.substr(canvas.id.lastIndexOf('/') + 1);
179
- var canvasLabel = parseLabel(canvas);
180
- var _parseImageURLs = parseImageURLs(canvas),
181
- bodyId = _parseImageURLs.bodyId,
182
- imageURL = _parseImageURLs.imageURL;
183
- var annotationURLs = parseAnnotationURLs(canvas, transcriptionTypes);
184
- var ratio = canvas.width / canvas.height;
185
- var thumbnailDimensions = [];
160
+
161
+ if (manifest.type !== 'Manifest')
162
+ throwError('Expected root object of type \'Manifest\'.')
163
+ if (!manifest.items)
164
+ throwError('Expected manifest to have an items property.')
165
+ const canvases = manifest.items
166
+
167
+ for (let i = 0; i < canvases.length; i++) {
168
+ const canvas = canvases[i]
169
+ if (canvas.type !== 'Canvas')
170
+ throwError(`Expected items[${i}] to be of type 'Canvas'.`)
171
+ if (!canvas.id)
172
+ throwError(`Expected items[${i}] to have an id property.`)
173
+
174
+ const imageUrls = parseImageURLs(canvas)
175
+
176
+ if (imageUrls) {
177
+ const folioID = canvas.id.substr(canvas.id.lastIndexOf('/') + 1)
178
+ const canvasLabel = parseLabel(canvas)
179
+ const {
180
+ bodyId,
181
+ imageURL,
182
+ imageType,
183
+ } = imageUrls
184
+ const annotationURLs = parseAnnotationURLs(canvas, transcriptionTypes)
185
+
186
+ const ratio = canvas.width / canvas.height
187
+
188
+ let thumbnailDimensions = []
186
189
  if (ratio > 1) {
187
- thumbnailDimensions = [MAX_THUMBNAIL_DIMENSION, Math.round(MAX_THUMBNAIL_DIMENSION / ratio)];
188
- } else {
189
- thumbnailDimensions = [Math.round(MAX_THUMBNAIL_DIMENSION * ratio), MAX_THUMBNAIL_DIMENSION];
190
+ thumbnailDimensions = [MAX_THUMBNAIL_DIMENSION, Math.round(MAX_THUMBNAIL_DIMENSION / ratio)]
190
191
  }
191
- var thumbnailURL = "".concat(bodyId, "/full/").concat(thumbnailDimensions.join(','), "/0/default.jpg");
192
- var folio = {
193
- id: document ? "".concat(document, "_").concat(folioID) : folioID,
192
+ else {
193
+ thumbnailDimensions = [Math.round(MAX_THUMBNAIL_DIMENSION * ratio), MAX_THUMBNAIL_DIMENSION]
194
+ }
195
+
196
+ const thumbnailURL = imageType === 'iiif'
197
+ ? `${bodyId}/full/${thumbnailDimensions.join(',')}/0/default.jpg`
198
+ : imageURL
199
+
200
+ const folio = {
201
+ id: document ? `${document}_${folioID}` : folioID,
194
202
  doc_id: document || manifest.id,
195
203
  name: canvasLabel,
196
204
  pageNumber: i,
197
205
  image_zoom_url: imageURL,
198
206
  image_thumbnail_url: thumbnailURL,
199
- annotationURLs: annotationURLs,
200
- annotations: canvas.annotations ? canvas.annotations.filter(function (a) {
201
- return a.motivation === 'tagging';
202
- }) : []
203
- };
204
- folios.push(folio);
207
+ annotationURLs,
208
+ annotations: canvas.annotations
209
+ ? canvas.annotations.filter(a => a.motivation === 'tagging')
210
+ : [],
211
+ }
212
+
213
+ folios.push(folio)
205
214
  }
206
215
  }
207
- return folios;
216
+ return folios
208
217
  }
209
- export default DocumentActions;
218
+
219
+ export default DocumentActions
@@ -1,13 +1,11 @@
1
- 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; }
2
- 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; }
3
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
- var GlossaryActions = {};
1
+ const GlossaryActions = {}
2
+
7
3
  GlossaryActions.loadGlossary = function loadAuthors(state, glossaryData) {
8
- return _objectSpread(_objectSpread({}, state), {}, {
4
+ return {
5
+ ...state,
9
6
  loaded: true,
10
- glossary: glossaryData
11
- });
12
- };
13
- export default GlossaryActions;
7
+ glossary: glossaryData,
8
+ }
9
+ }
10
+
11
+ export default GlossaryActions
@@ -1,3 +1,3 @@
1
1
  export default {
2
- fixedFrameMode: false
3
- };
2
+ fixedFrameMode: false,
3
+ }
@@ -1,17 +1,14 @@
1
- export default function documentInitalState(iiifManifest, documentName, transcriptionTypes) {
2
- var variorum = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
3
- var derivativeNames = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
4
- var threePanel = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
1
+ export default function documentInitalState(iiifManifest, documentName, transcriptionTypes, variorum = false, derivativeNames = null, threePanel = false) {
5
2
  return {
6
- documentName: documentName,
7
- derivativeNames: derivativeNames,
3
+ documentName,
4
+ derivativeNames,
8
5
  manifestURL: iiifManifest,
9
- transcriptionTypes: transcriptionTypes,
10
- variorum: variorum,
11
- threePanel: threePanel,
6
+ transcriptionTypes,
7
+ variorum,
8
+ threePanel,
12
9
  folios: [],
13
10
  loaded: false,
14
11
  folioIndex: {},
15
- folioByName: {}
16
- };
17
- }
12
+ folioByName: {},
13
+ }
14
+ }
@@ -2,6 +2,6 @@ export default function glossaryInitialState(glossaryURL) {
2
2
  return {
3
3
  glossary: {},
4
4
  loaded: false,
5
- URL: glossaryURL
6
- };
7
- }
5
+ URL: glossaryURL,
6
+ }
7
+ }
@@ -1,36 +1,38 @@
1
- import { combineReducers } from 'redux';
1
+ import { combineReducers } from 'redux'
2
+
3
+ import { createReducer } from '../model/ReduxStore'
4
+ import DiplomaticActions from './DiplomaticActions'
5
+ import DocumentActions from './DocumentActions'
6
+ import GlossaryActions from './GlossaryActions'
7
+
8
+ import diplomaticInitialState from './initialState/diplomaticInitialState'
9
+ import documentInitialState from './initialState/documentInitialState'
10
+ import glossaryInitialState from './initialState/glossaryInitialState'
2
11
 
3
- // eslint-disable-next-line import/no-cycle
4
- import { createReducer } from '../model/ReduxStore';
5
- import GlossaryActions from './GlossaryActions';
6
- import DocumentActions from './DocumentActions';
7
- import DiplomaticActions from './DiplomaticActions';
8
- import diplomaticInitialState from './initialState/diplomaticInitialState';
9
- import glossaryInitialState from './initialState/glossaryInitialState';
10
- import documentInitialState from './initialState/documentInitialState';
11
12
  export default function rootReducer(config) {
12
- var documentName = config.documentName,
13
- documentInfo = config.documentInfo,
14
- glossaryURL = config.glossaryURL,
15
- _config$threePanel = config.threePanel,
16
- threePanel = _config$threePanel === void 0 ? false : _config$threePanel;
17
- var variorum = documentInfo && Object.keys(documentInfo).length > 1;
18
- var transcriptionTypesInfo = {};
19
- var manifestInfo = {};
20
- var derivativesInfo = {};
13
+ const {
14
+ documentName,
15
+ documentInfo,
16
+ glossaryURL,
17
+ threePanel = false,
18
+ } = config
19
+ const variorum = documentInfo && Object.keys(documentInfo).length > 1
20
+ const transcriptionTypesInfo = {}
21
+ const manifestInfo = {}
22
+ const derivativesInfo = {}
21
23
  if (variorum) {
22
- Object.keys(config.documentInfo).forEach(function (key) {
23
- transcriptionTypesInfo[key] = config.documentInfo[key].transcriptionTypes;
24
- manifestInfo[key] = config.documentInfo[key].iiifManifest;
25
- derivativesInfo[key] = config.documentInfo[key].documentName;
26
- });
24
+ Object.keys(config.documentInfo).forEach((key) => {
25
+ transcriptionTypesInfo[key] = config.documentInfo[key].transcriptionTypes
26
+ manifestInfo[key] = config.documentInfo[key].iiifManifest
27
+ derivativesInfo[key] = config.documentInfo[key].documentName
28
+ })
27
29
  }
28
- var transcriptionTypes = variorum ? transcriptionTypesInfo : config.transcriptionTypes;
29
- var iiifManifest = variorum ? manifestInfo : config.iiifManifest;
30
- var derivativeNames = variorum && derivativesInfo;
30
+ const transcriptionTypes = variorum ? transcriptionTypesInfo : config.transcriptionTypes
31
+ const iiifManifest = variorum ? manifestInfo : config.iiifManifest
32
+ const derivativeNames = variorum && derivativesInfo
31
33
  return combineReducers({
32
34
  diplomatic: createReducer('DiplomaticActions', DiplomaticActions, diplomaticInitialState),
33
35
  document: createReducer('DocumentActions', DocumentActions, documentInitialState(iiifManifest, documentName, transcriptionTypes, variorum, derivativeNames, threePanel)),
34
- glossary: createReducer('GlossaryActions', GlossaryActions, glossaryInitialState(glossaryURL))
35
- });
36
- }
36
+ glossary: createReducer('GlossaryActions', GlossaryActions, glossaryInitialState(glossaryURL)),
37
+ })
38
+ }