@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.
- package/README.md +7 -7
- package/dist/editioncrafter.js +65802 -0
- package/dist/editioncrafter.umd.cjs +553 -0
- package/dist/es/src/action/DiplomaticActions.js +9 -11
- package/dist/es/src/action/DocumentActions.js +164 -154
- package/dist/es/src/action/GlossaryActions.js +9 -11
- package/dist/es/src/action/initialState/diplomaticInitialState.js +2 -2
- package/dist/es/src/action/initialState/documentInitialState.js +9 -12
- package/dist/es/src/action/initialState/glossaryInitialState.js +3 -3
- package/dist/es/src/action/rootReducer.js +31 -29
- package/dist/es/src/component/AlphabetLinks.js +44 -66
- package/dist/es/src/component/CustomizedTooltops.js +101 -110
- package/dist/es/src/component/DiploMatic.js +64 -91
- package/dist/es/src/component/DocumentView.js +442 -366
- package/dist/es/src/component/EditorComment.js +51 -75
- package/dist/es/src/component/ErrorBoundary.js +37 -61
- package/dist/es/src/component/FigureImage.js +56 -67
- package/dist/es/src/component/GlossaryView.js +157 -149
- package/dist/es/src/component/HelpPopper.js +96 -78
- package/dist/es/src/component/ImageGridView.js +184 -249
- package/dist/es/src/component/ImageView.js +155 -165
- package/dist/es/src/component/ImageZoomControl.js +19 -38
- package/dist/es/src/component/JumpToFolio.js +56 -60
- package/dist/es/src/component/Navigation.js +374 -328
- package/dist/es/src/component/Pagination.js +73 -70
- package/dist/es/src/component/Parser.js +11 -32
- package/dist/es/src/component/RingSpinner.js +31 -32
- package/dist/es/src/component/RouteListener.js +30 -21
- package/dist/es/src/component/SeaDragonComponent.js +33 -56
- package/dist/es/src/component/SinglePaneView.js +15 -33
- package/dist/es/src/component/SplitPaneView.js +151 -170
- package/dist/es/src/component/TranscriptionView.js +190 -179
- package/dist/es/src/component/Watermark.js +21 -30
- package/dist/es/src/component/XMLView.js +60 -82
- package/dist/es/src/hooks/useIsWidthUp.js +9 -7
- package/dist/es/src/icons/ByIcon.js +16 -16
- package/dist/es/src/icons/CcIcon.js +16 -16
- package/dist/es/src/icons/NcIcon.js +16 -16
- package/dist/es/src/icons/SaIcon.js +16 -16
- package/dist/es/src/icons/SideMenuIconLeft.js +30 -38
- package/dist/es/src/icons/SideMenuIconRight.js +32 -38
- package/dist/es/src/index.js +21 -20
- package/dist/es/src/lib/copyObject.js +3 -2
- package/dist/es/src/lib/registerServiceWorker.js +77 -54
- package/dist/es/src/model/DocumentHelper.js +7 -6
- package/dist/es/src/model/Folio.js +68 -146
- package/dist/es/src/model/ReduxStore.js +32 -78
- package/dist/es/src/model/folioLayout.js +275 -280
- package/dist/es/src/saga/RouteListenerSaga.js +89 -203
- package/dist/es/src/saga/rootSaga.js +9 -16
- package/dist/es/src/scss/_imageView.scss +1 -1
- package/dist/es/src/scss/_navigation.scss +1 -1
- package/dist/es/src/scss/editioncrafter.scss +1 -1
- package/dist/style.css +1 -0
- package/package.json +36 -50
- package/dist/editioncrafter.min.js +0 -2
- package/dist/editioncrafter.min.js.LICENSE.txt +0 -144
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
4
|
+
return {
|
|
5
|
+
...state,
|
|
6
|
+
fixedFrameMode: mode,
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default DiplomaticActions
|
|
@@ -1,209 +1,219 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
4
|
+
const textPartialResourceProfileID = 'https://github.com/cu-mkp/editioncrafter-project/text-partial-resource.md'
|
|
5
|
+
|
|
13
6
|
DocumentActions.loadDocument = function loadDocument(state, manifestData) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
const folios = parseManifest(manifestData, state.transcriptionTypes)
|
|
8
|
+
const { folioIndex, folioByName } = createFolioIndex(folios)
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
...state,
|
|
19
12
|
loaded: true,
|
|
20
|
-
folios
|
|
21
|
-
folioIndex
|
|
22
|
-
folioByName
|
|
23
|
-
}
|
|
24
|
-
}
|
|
13
|
+
folios,
|
|
14
|
+
folioIndex,
|
|
15
|
+
folioByName,
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
25
19
|
DocumentActions.loadFolio = function loadFolio(state, folio) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
state.folios[folioIdx] = folio
|
|
29
|
-
state.folioIndex[folio.id] = folio
|
|
30
|
-
state.folioByName[folio.name] = folio
|
|
31
|
-
return
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
for (
|
|
38
|
-
|
|
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(
|
|
43
|
+
throw new Error(`IIIF manifest parser error: ${message}`)
|
|
49
44
|
}
|
|
45
|
+
|
|
50
46
|
function displayWarning(message) {
|
|
51
|
-
console.warn(
|
|
47
|
+
console.warn(`IIIF manifest parser warning: ${message}`)
|
|
52
48
|
}
|
|
49
|
+
|
|
53
50
|
function parseImageURLs(canvas) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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(
|
|
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(
|
|
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
|
-
|
|
97
|
+
const annos = {}
|
|
98
|
+
|
|
102
99
|
if (canvas.annotations) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
135
|
+
|
|
136
|
+
return annos
|
|
149
137
|
}
|
|
150
138
|
|
|
151
139
|
// The largest dimension for either width or height allowed in a thumbnail.
|
|
152
|
-
|
|
140
|
+
const MAX_THUMBNAIL_DIMENSION = 130
|
|
141
|
+
|
|
153
142
|
function parseManifest(manifest, transcriptionTypes) {
|
|
154
143
|
if (manifest.type === 'variorum') {
|
|
155
|
-
|
|
156
|
-
Object.keys(manifest.documentData).forEach(
|
|
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
|
-
|
|
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
|
-
|
|
171
|
-
if (
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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
|
|
200
|
-
annotations: canvas.annotations
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
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
|
-
|
|
218
|
+
|
|
219
|
+
export default DocumentActions
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
|
4
|
+
return {
|
|
5
|
+
...state,
|
|
9
6
|
loaded: true,
|
|
10
|
-
glossary: glossaryData
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
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
|
|
7
|
-
derivativeNames
|
|
3
|
+
documentName,
|
|
4
|
+
derivativeNames,
|
|
8
5
|
manifestURL: iiifManifest,
|
|
9
|
-
transcriptionTypes
|
|
10
|
-
variorum
|
|
11
|
-
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
|
+
}
|
|
@@ -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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
threePanel =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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(
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
}
|