ochre-sdk 1.3.16 → 1.3.18
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/dist/parsers/website/components.mjs +19 -0
- package/dist/parsers/website/reader.d.mts +1 -0
- package/dist/parsers/website/reader.mjs +11 -0
- package/dist/types/index.d.mts +1 -1
- package/dist/types/website.d.mts +11 -0
- package/dist/xml/schemas.d.mts +3 -3
- package/dist/xml/schemas.mjs +4 -2
- package/dist/xml/types.d.mts +1 -1
- package/package.json +1 -1
|
@@ -455,6 +455,24 @@ function parseMapComponent(parameters) {
|
|
|
455
455
|
let maximumBounds = null;
|
|
456
456
|
const maximumBoundsProperty = componentReader.value("maximum-bounds");
|
|
457
457
|
if (maximumBoundsProperty !== null) maximumBounds = parseBounds(String(maximumBoundsProperty));
|
|
458
|
+
const layerSettings = [];
|
|
459
|
+
for (const layerReader of componentReader.nestedAllByValue("customize-special", "arcgis-layer")) {
|
|
460
|
+
const uuid = layerReader.uuid("use-layer");
|
|
461
|
+
if (uuid == null) continue;
|
|
462
|
+
const opacity = layerReader.value("opacity-percent");
|
|
463
|
+
const filterFields = layerReader.stringValues("filter-field");
|
|
464
|
+
layerSettings.push({
|
|
465
|
+
uuid,
|
|
466
|
+
isBasemap: layerReader.value("is-basemap"),
|
|
467
|
+
isDisplayedByDefault: layerReader.value("displayed-by-default"),
|
|
468
|
+
opacity: typeof opacity === "number" ? Math.min(Math.max(opacity, 0), 100) / 100 : null,
|
|
469
|
+
ochreLinkField: layerReader.stringValue("ochre-link-field"),
|
|
470
|
+
periodField: layerReader.stringValue("period-field"),
|
|
471
|
+
periodOrder: layerReader.stringValues("period-order"),
|
|
472
|
+
filterFields: filterFields.length > 0 ? filterFields : null,
|
|
473
|
+
markerColor: layerReader.stringValue("marker-color")
|
|
474
|
+
});
|
|
475
|
+
}
|
|
458
476
|
return {
|
|
459
477
|
component: "map",
|
|
460
478
|
linkUuids,
|
|
@@ -462,6 +480,7 @@ function parseMapComponent(parameters) {
|
|
|
462
480
|
customBasemap,
|
|
463
481
|
initialBounds,
|
|
464
482
|
maximumBounds,
|
|
483
|
+
layerSettings,
|
|
465
484
|
...properties
|
|
466
485
|
};
|
|
467
486
|
}
|
|
@@ -44,6 +44,7 @@ export declare class WebsitePresentationReader<T extends LanguageCodes> {
|
|
|
44
44
|
* @returns The string, or null when the property is unset or not string-like
|
|
45
45
|
*/
|
|
46
46
|
stringValue(label: string): string | null;
|
|
47
|
+
stringValues(label: string): Array<string>;
|
|
47
48
|
uuid(label: string): string | null;
|
|
48
49
|
multilingualValue(label: string, options: ParserOptions<T>): MultilingualString<T> | null;
|
|
49
50
|
/**
|
|
@@ -63,6 +63,17 @@ var WebsitePresentationReader = class WebsitePresentationReader {
|
|
|
63
63
|
if (typeof value === "string") return value;
|
|
64
64
|
return typeof value === "number" ? value.toString() : null;
|
|
65
65
|
}
|
|
66
|
+
stringValues(label) {
|
|
67
|
+
const values = [];
|
|
68
|
+
for (const property of this.sourceProperties) {
|
|
69
|
+
if (getProperty([property], { label }) == null) continue;
|
|
70
|
+
for (const { content } of property.values) {
|
|
71
|
+
const value = typeof content === "number" ? content.toString() : content;
|
|
72
|
+
if (typeof value === "string" && value.trim() !== "") values.push(value.trim());
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return values;
|
|
76
|
+
}
|
|
66
77
|
uuid(label) {
|
|
67
78
|
return this.valueNode(label)?.uuid ?? null;
|
|
68
79
|
}
|
package/dist/types/index.d.mts
CHANGED
|
@@ -229,7 +229,7 @@ export type Image<T extends LanguageCodes = LanguageCodes> = {
|
|
|
229
229
|
* Download option of an item in OCHRE
|
|
230
230
|
*/
|
|
231
231
|
export type DownloadOption = {
|
|
232
|
-
type: "highQuality" | "iiifManifest" | "document" | "ocr";
|
|
232
|
+
type: "highQuality" | "iiifManifest" | "document" | "ocr" | "mets" | "alto";
|
|
233
233
|
href: string;
|
|
234
234
|
fileFormat: string;
|
|
235
235
|
};
|
package/dist/types/website.d.mts
CHANGED
|
@@ -426,6 +426,17 @@ export type WebElementComponent<T extends LanguageCodes = LanguageCodes> = {
|
|
|
426
426
|
customBasemap: string | null;
|
|
427
427
|
initialBounds: [[number, number], [number, number]] | null;
|
|
428
428
|
maximumBounds: [[number, number], [number, number]] | null;
|
|
429
|
+
layerSettings: Array<{
|
|
430
|
+
uuid: string;
|
|
431
|
+
isBasemap: boolean | null;
|
|
432
|
+
isDisplayedByDefault: boolean | null;
|
|
433
|
+
opacity: number | null;
|
|
434
|
+
ochreLinkField: string | null;
|
|
435
|
+
periodField: string | null;
|
|
436
|
+
periodOrder: Array<string>;
|
|
437
|
+
filterFields: Array<string> | null;
|
|
438
|
+
markerColor: string | null;
|
|
439
|
+
}>;
|
|
429
440
|
isControlsDisplayed: boolean;
|
|
430
441
|
isInteractive: boolean;
|
|
431
442
|
isClustered: boolean;
|
package/dist/xml/schemas.d.mts
CHANGED
|
@@ -449,7 +449,7 @@ export declare const XMLGalleryData: v.ObjectSchema<{
|
|
|
449
449
|
}, "XMLImageMap: Shape error">, undefined>;
|
|
450
450
|
readonly downloadOptions: v.OptionalSchema<v.ObjectSchema<{
|
|
451
451
|
readonly option: v.ArraySchema<v.ObjectSchema<{
|
|
452
|
-
readonly type: v.PicklistSchema<["highQuality", "iiifManifest", "document", "ocr"], "XMLDownloadOptions: type is highQuality, iiifManifest, document, or
|
|
452
|
+
readonly type: v.PicklistSchema<["highQuality", "iiifManifest", "document", "ocr", "mets", "alto"], "XMLDownloadOptions: type is highQuality, iiifManifest, document, ocr, mets, or alto">;
|
|
453
453
|
readonly href: v.SchemaWithPipe<readonly [v.StringSchema<"XMLDownloadOptions: href is string and required">, v.UrlAction<string, "XMLDownloadOptions: href is not a valid URL">]>;
|
|
454
454
|
readonly fileFormat: v.StringSchema<"XMLDownloadOptions: fileFormat is string and required">;
|
|
455
455
|
}, "XMLDownloadOptions: option is object with type, href, and fileFormat">, undefined>;
|
|
@@ -1653,7 +1653,7 @@ export declare const XMLGalleryData: v.ObjectSchema<{
|
|
|
1653
1653
|
}, "XMLImage: Shape error">, undefined>;
|
|
1654
1654
|
readonly downloadOptions: v.OptionalSchema<v.ObjectSchema<{
|
|
1655
1655
|
readonly option: v.ArraySchema<v.ObjectSchema<{
|
|
1656
|
-
readonly type: v.PicklistSchema<["highQuality", "iiifManifest", "document", "ocr"], "XMLDownloadOptions: type is highQuality, iiifManifest, document, or
|
|
1656
|
+
readonly type: v.PicklistSchema<["highQuality", "iiifManifest", "document", "ocr", "mets", "alto"], "XMLDownloadOptions: type is highQuality, iiifManifest, document, ocr, mets, or alto">;
|
|
1657
1657
|
readonly href: v.SchemaWithPipe<readonly [v.StringSchema<"XMLDownloadOptions: href is string and required">, v.UrlAction<string, "XMLDownloadOptions: href is not a valid URL">]>;
|
|
1658
1658
|
readonly fileFormat: v.StringSchema<"XMLDownloadOptions: fileFormat is string and required">;
|
|
1659
1659
|
}, "XMLDownloadOptions: option is object with type, href, and fileFormat">, undefined>;
|
|
@@ -2997,7 +2997,7 @@ export declare const XMLGalleryData: v.ObjectSchema<{
|
|
|
2997
2997
|
}, "XMLImage: Shape error">, undefined>;
|
|
2998
2998
|
readonly downloadOptions: v.OptionalSchema<v.ObjectSchema<{
|
|
2999
2999
|
readonly option: v.ArraySchema<v.ObjectSchema<{
|
|
3000
|
-
readonly type: v.PicklistSchema<["highQuality", "iiifManifest", "document", "ocr"], "XMLDownloadOptions: type is highQuality, iiifManifest, document, or
|
|
3000
|
+
readonly type: v.PicklistSchema<["highQuality", "iiifManifest", "document", "ocr", "mets", "alto"], "XMLDownloadOptions: type is highQuality, iiifManifest, document, ocr, mets, or alto">;
|
|
3001
3001
|
readonly href: v.SchemaWithPipe<readonly [v.StringSchema<"XMLDownloadOptions: href is string and required">, v.UrlAction<string, "XMLDownloadOptions: href is not a valid URL">]>;
|
|
3002
3002
|
readonly fileFormat: v.StringSchema<"XMLDownloadOptions: fileFormat is string and required">;
|
|
3003
3003
|
}, "XMLDownloadOptions: option is object with type, href, and fileFormat">, undefined>;
|
package/dist/xml/schemas.mjs
CHANGED
|
@@ -226,8 +226,10 @@ const XMLDownloadOptions = v.object({ option: v.array(v.object({
|
|
|
226
226
|
"highQuality",
|
|
227
227
|
"iiifManifest",
|
|
228
228
|
"document",
|
|
229
|
-
"ocr"
|
|
230
|
-
|
|
229
|
+
"ocr",
|
|
230
|
+
"mets",
|
|
231
|
+
"alto"
|
|
232
|
+
], "XMLDownloadOptions: type is highQuality, iiifManifest, document, ocr, mets, or alto"),
|
|
231
233
|
href: v.pipe(v.string("XMLDownloadOptions: href is string and required"), v.url("XMLDownloadOptions: href is not a valid URL")),
|
|
232
234
|
fileFormat: v.string("XMLDownloadOptions: fileFormat is string and required")
|
|
233
235
|
}, "XMLDownloadOptions: option is object with type, href, and fileFormat")) }, "XMLDownloadOptions: Shape error");
|
package/dist/xml/types.d.mts
CHANGED
|
@@ -168,7 +168,7 @@ export type XMLImage = {
|
|
|
168
168
|
};
|
|
169
169
|
export type XMLDownloadOptions = {
|
|
170
170
|
option: Array<{
|
|
171
|
-
type: "highQuality" | "iiifManifest" | "document" | "ocr";
|
|
171
|
+
type: "highQuality" | "iiifManifest" | "document" | "ocr" | "mets" | "alto";
|
|
172
172
|
href: string;
|
|
173
173
|
fileFormat: string;
|
|
174
174
|
}>;
|