Skip to content

Commit c316914

Browse files
committed
typed config working
1 parent c614e2b commit c316914

File tree

27 files changed

+491
-254
lines changed

27 files changed

+491
-254
lines changed

src/content-handlers/iiif/BaseConfig.ts

+94-24
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,34 @@ export class Metric {
1010

1111
export type Options = {
1212
/** Determines if the focus can be stolen */
13-
allowStealFocus: boolean;
13+
allowStealFocus?: boolean;
1414

1515
/** Version of the authentication API */
1616
authAPIVersion: number;
1717

1818
/** Height of the bookmark thumbnail */
19-
bookmarkThumbHeight: number;
19+
bookmarkThumbHeight?: number;
2020

2121
/** Width of the bookmark thumbnail */
22-
bookmarkThumbWidth: number;
22+
bookmarkThumbWidth?: number;
2323

2424
/** Determines if drop is enabled */
25-
dropEnabled: boolean;
25+
dropEnabled?: boolean;
2626

2727
/** Determines if the footer panel is enabled */
28-
footerPanelEnabled: boolean;
28+
footerPanelEnabled?: boolean;
2929

3030
/** Determines if the header panel is enabled */
31-
headerPanelEnabled: boolean;
31+
headerPanelEnabled?: boolean;
3232

3333
/** Determines if the left panel is enabled */
34-
leftPanelEnabled: boolean;
34+
leftPanelEnabled?: boolean;
3535

3636
/** Determines if locales are limited */
37-
limitLocales: boolean;
37+
limitLocales?: boolean;
3838

3939
/** Determines if double click annotation is enabled */
40-
doubleClickAnnotationEnabled: boolean;
40+
doubleClickAnnotationEnabled?: boolean;
4141

4242
/** Metrics array */
4343
metrics: Metric[];
@@ -46,7 +46,7 @@ export type Options = {
4646
multiSelectionMimeType: string;
4747

4848
/** Determines if the navigator is enabled */
49-
navigatorEnabled: boolean;
49+
navigatorEnabled?: boolean;
5050

5151
/** Template for opening */
5252
openTemplate: string;
@@ -55,31 +55,31 @@ export type Options = {
5555
overrideFullScreen: boolean;
5656

5757
/** Determines if paging is enabled */
58-
pagingEnabled: boolean;
58+
pagingEnabled?: boolean;
5959

6060
/** Determines if paging option is enabled */
61-
pagingOptionEnabled: boolean;
61+
pagingOptionEnabled?: boolean;
6262

6363
/** Determines if access control is pessimistic */
64-
pessimisticAccessControl: boolean;
64+
pessimisticAccessControl?: boolean;
6565

6666
/** Determines if viewport is preserved */
67-
preserveViewport: boolean;
67+
preserveViewport?: boolean;
6868

6969
/** Determines if the right panel is enabled */
70-
rightPanelEnabled: boolean;
70+
rightPanelEnabled?: boolean;
7171

7272
/** Determines if user settings are saved */
73-
saveUserSettings: boolean;
73+
saveUserSettings?: boolean;
7474

7575
/** Determines if click to zoom is enabled */
76-
clickToZoomEnabled: boolean;
76+
clickToZoomEnabled?: boolean;
7777

7878
/** Determines if search within is enabled */
79-
searchWithinEnabled: boolean;
79+
searchWithinEnabled?: boolean;
8080

8181
/** Determines if seealso content is enabled */
82-
seeAlsoEnabled: boolean;
82+
seeAlsoEnabled?: boolean;
8383

8484
/** Determines if terms of use are enabled */
8585
termsOfUseEnabled: boolean;
@@ -91,13 +91,16 @@ export type Options = {
9191
tokenStorage: string | StorageType;
9292

9393
/** Determines if arrow keys can be used to navigate */
94-
useArrowKeysToNavigate: boolean;
94+
useArrowKeysToNavigate?: boolean;
95+
96+
/** Determines if PDF.js should be used for PDF rendering */
97+
usePdfJs?: boolean;
9598

9699
/** Determines if zoom to search result is enabled */
97-
zoomToSearchResultEnabled: boolean;
100+
zoomToSearchResultEnabled?: boolean;
98101

99102
/** Determines if zoom to bounds is enabled */
100-
zoomToBoundsEnabled: boolean;
103+
zoomToBoundsEnabled?: boolean;
101104
};
102105

103106
type Locale = {
@@ -110,12 +113,16 @@ export type Localisation = {
110113
locales: Locale[];
111114
};
112115

116+
type DialogueOptions = {
117+
topCloseButtonEnabled: boolean;
118+
};
119+
113120
type DialogueContent = {
114121
close: string;
115122
};
116123

117124
type Dialogue = {
118-
topCloseButtonEnabled: boolean;
125+
options?: DialogueOptions;
119126
content: DialogueContent;
120127
};
121128

@@ -167,10 +174,15 @@ type DownloadDialogueContent = {
167174
};
168175

169176
type DownloadDialogue = {
170-
options: DownloadDialogueOptions;
177+
options?: DownloadDialogueOptions;
171178
content: DownloadDialogueContent;
172179
};
173180

181+
/**
182+
* Type for Generic Dialogue Options
183+
*/
184+
type GenericDialogueOptions = {};
185+
174186
type GenericDialogueContent = {
175187
emptyValue: string;
176188
invalidNumber: string;
@@ -181,9 +193,66 @@ type GenericDialogueContent = {
181193
};
182194

183195
type GenericDialogue = {
196+
options?: GenericDialogueOptions;
184197
content: GenericDialogueContent;
185198
};
186199

200+
type MoreInfoRightPanelOptions = {
201+
/** Order in which canvases are displayed */
202+
canvasDisplayOrder: string;
203+
/** Canvases to exclude from display */
204+
canvasExclude: string;
205+
/** Determines if copying to clipboard is enabled */
206+
copyToClipboardEnabled: boolean;
207+
/** Order in which manifests are displayed */
208+
manifestDisplayOrder: string;
209+
/** Manifests to exclude from display */
210+
manifestExclude: string;
211+
/** Duration of the panel animation */
212+
panelAnimationDuration: number;
213+
/** Width of the collapsed panel */
214+
panelCollapsedWidth: number;
215+
/** Width of the expanded panel */
216+
panelExpandedWidth: number;
217+
/** Determines if the panel is open */
218+
panelOpen: boolean;
219+
/** Language codes for right-to-left languages */
220+
rtlLanguageCodes: string;
221+
/** Determines if all languages should be shown */
222+
showAllLanguages: boolean;
223+
/** Limit for the text */
224+
textLimit: number;
225+
/** Type of the text limit */
226+
textLimitType: string;
227+
};
228+
229+
type MoreInfoRightPanelContent = {
230+
attribution: string;
231+
canvasHeader: string;
232+
collapse: string;
233+
collapseFull: string;
234+
copiedToClipboard: string;
235+
copyToClipboard: string;
236+
description: string;
237+
expand: string;
238+
expandFull: string;
239+
holdingText: string;
240+
less: string;
241+
license: string;
242+
logo: string;
243+
manifestHeader: string;
244+
more: string;
245+
noData: string;
246+
page: string;
247+
rangeHeader: string;
248+
title: string;
249+
};
250+
251+
type MoreInfoRightPanel = {
252+
options: MoreInfoRightPanelOptions;
253+
content: MoreInfoRightPanelContent;
254+
};
255+
187256
export type Content = {
188257
authCORSError: string;
189258
authorisationFailedMessage: string;
@@ -203,6 +272,7 @@ export type BaseConfig = {
203272
dialogue: Dialogue;
204273
downloadDialogue: DownloadDialogue;
205274
genericDialogue: GenericDialogue;
275+
moreInfoRightPanel: MoreInfoRightPanel;
206276
};
207277
localisation: Localisation;
208278
content: Content;

src/content-handlers/iiif/extensions/uv-aleph-extension/Extension.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { ShareDialogue } from "./ShareDialogue";
1212
import { AlephLeftPanel } from "../../modules/uv-alephleftpanel-module/AlephLeftPanel";
1313
import { Strings, Bools } from "@edsilv/utils";
1414
import "./theme/theme.less";
15-
import defaultConfig from "./config/en-GB.json";
15+
import defaultConfig from "./config/config.json";
1616
import { Config } from "./config/Config";
1717

1818
export default class Extension extends BaseExtension
@@ -118,7 +118,7 @@ export default class Extension extends BaseExtension
118118
}
119119

120120
isLeftPanelEnabled(): boolean {
121-
return Bools.getBool(this.data.config.options.leftPanelEnabled, true);
121+
return Bools.getBool(this.data.config!.options.leftPanelEnabled, true);
122122
}
123123

124124
getEmbedScript(template: string, width: number, height: number): string {

src/content-handlers/iiif/extensions/uv-aleph-extension/config/en-GB.json src/content-handlers/iiif/extensions/uv-aleph-extension/config/config.json

+46-41
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@
6767
}
6868
},
6969
"dialogue": {
70-
"topCloseButtonEnabled": false,
70+
"options": {
71+
"topCloseButtonEnabled": false
72+
},
7173
"content": {
7274
"close": "Close"
7375
}
@@ -136,28 +138,28 @@
136138
"rtlLanguageCodes": "ar, ara, dv, div, he, heb, ur, urd",
137139
"showAllLanguages": false,
138140
"textLimit": 4,
139-
"textLimitType": "lines",
140-
"limitToRange": false
141+
"textLimitType": "lines"
141142
},
142143
"content": {
143-
"attribution": "Attribution",
144-
"collapse": "Collapse Information",
145-
"collapseFull": "Collapse Gallery",
146-
"description": "Description",
147-
"expand": "Expand Information",
148-
"expandFull": "Expand Gallery",
149-
"holdingText": "Your module goes here!",
150-
"less": "less",
151-
"license": "License",
152-
"logo": "Logo",
153-
"more": "more",
154-
"noData": "No data to display",
155-
"page": "Page",
156-
"title": "More Information",
157-
"manifestHeader": "About the item",
158-
"canvasHeader": "About the image",
159-
"copyToClipboard": "Copy to clipboard",
160-
"copiedToClipboard": "Copied to clipboard"
144+
"attribution": "$attribution",
145+
"canvasHeader": "$aboutTheImage",
146+
"collapse": "$collapseInformation",
147+
"collapseFull": "$collapseGallery",
148+
"copiedToClipboard": "$copiedToClipboard",
149+
"copyToClipboard": "$copyToClipboard",
150+
"description": "$description",
151+
"expand": "$expandInformation",
152+
"expandFull": "$expandGallery",
153+
"holdingText": "$moduleGoesHere",
154+
"less": "$less",
155+
"license": "$license",
156+
"logo": "$logo",
157+
"manifestHeader": "$aboutTheItem",
158+
"more": "$more",
159+
"noData": "$noDataToDisplay",
160+
"page": "$page",
161+
"rangeHeader": "$aboutThisSection",
162+
"title": "$moreInformation"
161163
}
162164
},
163165
"alephCenterPanel": {
@@ -211,25 +213,28 @@
211213
},
212214
"downloadDialogue": {
213215
"content": {
214-
"currentViewAsJpg": "Current view {0} x {1}px (jpg)",
215-
"currentViewAsJpgExplanation": "Opens in a new window",
216-
"download": "Download",
217-
"downloadSelection": "Download Selection",
218-
"downloadSelectionExplanation": "Opens a dialogue to select which pages to download.",
219-
"editSettings": "Edit Settings",
220-
"entireDocument": "Entire document ({0})",
221-
"entireFileAsOriginal": "Entire file",
222-
"entireFileAsOriginalWithFormat": "Entire file ({0})",
223-
"noneAvailable": "No download options are available.",
224-
"pagingNote": "Please turn off Two Page View for additional options.",
225-
"preview": "Preview",
226-
"title": "Download",
227-
"wholeImageHighRes": "Whole image {0} x {1}px ({2})",
228-
"wholeImageHighResExplanation": "Opens in a new window.",
229-
"wholeImagesHighRes": "Whole images ({0})",
230-
"wholeImagesHighResExplanation": "Opens in two new windows.",
231-
"wholeImageLowResAsJpg": "Whole image {0} x {1}px (jpg)",
232-
"wholeImageLowResAsJpgExplanation": "Opens in a new window."
216+
"allPages": "$allPages",
217+
"currentViewAsJpg": "$currentViewAsJpg",
218+
"currentViewAsJpgExplanation": "$openNewWindow",
219+
"download": "$download",
220+
"downloadSelection": "$downloadSelection",
221+
"downloadSelectionExplanation": "$downloadSelectionExplanation",
222+
"editSettings": "$editSettings",
223+
"entireDocument": "$entireDocument",
224+
"entireFileAsOriginal": "$entireFile",
225+
"individualPages": "$individualPages",
226+
"noneAvailable": "$noDownloadOptionsAvailable",
227+
"pagingNote": "$pagingNote",
228+
"preview": "$preview",
229+
"selection": "$selection",
230+
"termsOfUse": "$termsOfUse",
231+
"title": "$download",
232+
"wholeImageHighRes": "$wholeImageHighRes",
233+
"wholeImageHighResExplanation": "$openNewWindow",
234+
"wholeImageLowResAsJpg": "$wholeImageLowResAsJpg",
235+
"wholeImageLowResAsJpgExplanation": "$openNewWindow",
236+
"wholeImagesHighRes": "$wholeImagesHighRes",
237+
"wholeImagesHighResExplanation": "$wholeImagesHighResExplanation"
233238
}
234239
},
235240
"loginDialogue": {
@@ -265,4 +270,4 @@
265270
"mediaViewer": "Media Viewer",
266271
"skipToDownload": "Skip to downloads and alternative formats"
267272
}
268-
}
273+
}

src/content-handlers/iiif/extensions/uv-av-extension/Extension.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export default class Extension extends BaseExtension implements IAVExtension {
141141
}
142142

143143
isLeftPanelEnabled(): boolean {
144-
return Bools.getBool(this.data.config.options.leftPanelEnabled, true);
144+
return Bools.getBool(this.data.config!.options.leftPanelEnabled, true);
145145
}
146146

147147
render(): void {

0 commit comments

Comments
 (0)