@digitalculture/ochre-sdk 0.1.29 → 0.2.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/dist/index.cjs +132 -22
- package/dist/index.d.cts +28 -11
- package/dist/index.d.ts +28 -11
- package/dist/index.js +132 -22
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -587,17 +587,15 @@ var componentSchema = import_zod3.z.enum(
|
|
|
587
587
|
"iiif-viewer",
|
|
588
588
|
"image",
|
|
589
589
|
"image-gallery",
|
|
590
|
-
"interactive-chapter-table",
|
|
591
590
|
"item-gallery",
|
|
592
|
-
"menu",
|
|
593
|
-
"menu-item",
|
|
594
591
|
"n-columns",
|
|
595
592
|
"n-rows",
|
|
596
593
|
"network-graph",
|
|
597
594
|
"table",
|
|
598
595
|
"text",
|
|
599
596
|
"text-image",
|
|
600
|
-
"timeline"
|
|
597
|
+
"timeline",
|
|
598
|
+
"video"
|
|
601
599
|
],
|
|
602
600
|
{ message: "Invalid component" }
|
|
603
601
|
);
|
|
@@ -1357,13 +1355,10 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1357
1355
|
`Image link not found for the following component: \u201C${componentName}\u201D`
|
|
1358
1356
|
);
|
|
1359
1357
|
}
|
|
1360
|
-
|
|
1358
|
+
const isSearchable = getPropertyValueByLabel(
|
|
1361
1359
|
componentProperty.properties,
|
|
1362
1360
|
"is-searchable"
|
|
1363
1361
|
) === "Yes";
|
|
1364
|
-
if (!isSearchable) {
|
|
1365
|
-
isSearchable = false;
|
|
1366
|
-
}
|
|
1367
1362
|
properties.imageUuid = imageLink.uuid;
|
|
1368
1363
|
properties.isSearchable = isSearchable;
|
|
1369
1364
|
break;
|
|
@@ -1468,12 +1463,44 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1468
1463
|
`Image link not found for the following component: \u201C${componentName}\u201D`
|
|
1469
1464
|
);
|
|
1470
1465
|
}
|
|
1466
|
+
let captionLayout = getPropertyValueByLabel(
|
|
1467
|
+
componentProperty.properties,
|
|
1468
|
+
"caption-layout"
|
|
1469
|
+
);
|
|
1470
|
+
if (captionLayout === null) {
|
|
1471
|
+
captionLayout = "bottom";
|
|
1472
|
+
}
|
|
1473
|
+
let imageQuality = getPropertyValueByLabel(
|
|
1474
|
+
componentProperty.properties,
|
|
1475
|
+
"image-quality"
|
|
1476
|
+
);
|
|
1477
|
+
if (imageQuality === null) {
|
|
1478
|
+
imageQuality = "high";
|
|
1479
|
+
}
|
|
1480
|
+
let captionSource = getPropertyValueByLabel(
|
|
1481
|
+
componentProperty.properties,
|
|
1482
|
+
"caption-source"
|
|
1483
|
+
);
|
|
1484
|
+
if (captionSource === null) {
|
|
1485
|
+
captionSource = "name";
|
|
1486
|
+
}
|
|
1487
|
+
let altTextSource = getPropertyValueByLabel(
|
|
1488
|
+
componentProperty.properties,
|
|
1489
|
+
"alt-text-source"
|
|
1490
|
+
);
|
|
1491
|
+
if (altTextSource === null) {
|
|
1492
|
+
altTextSource = "name";
|
|
1493
|
+
}
|
|
1471
1494
|
properties.image = {
|
|
1472
1495
|
url: `https://ochre.lib.uchicago.edu/ochre?uuid=${imageLink.uuid}&load`,
|
|
1473
1496
|
label: imageLink.identification?.label ?? null,
|
|
1474
1497
|
width: imageLink.image?.width ?? 0,
|
|
1475
1498
|
height: imageLink.image?.height ?? 0
|
|
1476
1499
|
};
|
|
1500
|
+
properties.imageQuality = imageQuality;
|
|
1501
|
+
properties.captionLayout = captionLayout;
|
|
1502
|
+
properties.captionSource = captionSource;
|
|
1503
|
+
properties.altTextSource = altTextSource;
|
|
1477
1504
|
break;
|
|
1478
1505
|
}
|
|
1479
1506
|
case "image-gallery": {
|
|
@@ -1483,10 +1510,12 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1483
1510
|
`Image gallery link not found for the following component: \u201C${componentName}\u201D`
|
|
1484
1511
|
);
|
|
1485
1512
|
}
|
|
1513
|
+
const isSearchable = getPropertyValueByLabel(
|
|
1514
|
+
componentProperty.properties,
|
|
1515
|
+
"is-searchable"
|
|
1516
|
+
) === "Yes";
|
|
1486
1517
|
properties.galleryId = galleryLink.uuid;
|
|
1487
|
-
|
|
1488
|
-
}
|
|
1489
|
-
case "interactive-chapter-table": {
|
|
1518
|
+
properties.isSearchable = isSearchable;
|
|
1490
1519
|
break;
|
|
1491
1520
|
}
|
|
1492
1521
|
case "item-gallery": {
|
|
@@ -1496,13 +1525,12 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1496
1525
|
`Item gallery link not found for the following component: \u201C${componentName}\u201D`
|
|
1497
1526
|
);
|
|
1498
1527
|
}
|
|
1528
|
+
const isSearchable = getPropertyValueByLabel(
|
|
1529
|
+
componentProperty.properties,
|
|
1530
|
+
"is-searchable"
|
|
1531
|
+
) === "Yes";
|
|
1499
1532
|
properties.galleryId = galleryLink.uuid;
|
|
1500
|
-
|
|
1501
|
-
}
|
|
1502
|
-
case "menu": {
|
|
1503
|
-
break;
|
|
1504
|
-
}
|
|
1505
|
-
case "menu-item": {
|
|
1533
|
+
properties.isSearchable = isSearchable;
|
|
1506
1534
|
break;
|
|
1507
1535
|
}
|
|
1508
1536
|
case "n-columns": {
|
|
@@ -1588,17 +1616,40 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1588
1616
|
)}`
|
|
1589
1617
|
);
|
|
1590
1618
|
}
|
|
1619
|
+
let imageQuality = getPropertyValueByLabel(
|
|
1620
|
+
componentProperty.properties,
|
|
1621
|
+
"image-quality"
|
|
1622
|
+
);
|
|
1623
|
+
if (imageQuality === null) {
|
|
1624
|
+
imageQuality = "high";
|
|
1625
|
+
}
|
|
1626
|
+
let captionSource = getPropertyValueByLabel(
|
|
1627
|
+
componentProperty.properties,
|
|
1628
|
+
"caption-source"
|
|
1629
|
+
);
|
|
1630
|
+
if (captionSource === null) {
|
|
1631
|
+
captionSource = "name";
|
|
1632
|
+
}
|
|
1633
|
+
let altTextSource = getPropertyValueByLabel(
|
|
1634
|
+
componentProperty.properties,
|
|
1635
|
+
"alt-text-source"
|
|
1636
|
+
);
|
|
1637
|
+
if (altTextSource === null) {
|
|
1638
|
+
altTextSource = "name";
|
|
1639
|
+
}
|
|
1591
1640
|
properties.variant = variant;
|
|
1592
|
-
properties.layout = layout;
|
|
1593
|
-
properties.captionLayout = captionLayout;
|
|
1594
|
-
properties.content = document.content;
|
|
1595
1641
|
properties.image = {
|
|
1596
1642
|
url: `https://ochre.lib.uchicago.edu/ochre?uuid=${imageLink2.uuid}&preview`,
|
|
1597
1643
|
label: imageLink2.identification?.label ?? null,
|
|
1598
1644
|
width: imageLink2.image?.width ?? 0,
|
|
1599
1645
|
height: imageLink2.image?.height ?? 0
|
|
1600
1646
|
};
|
|
1601
|
-
properties.
|
|
1647
|
+
properties.imageQuality = imageQuality;
|
|
1648
|
+
properties.layout = layout;
|
|
1649
|
+
properties.captionSource = captionSource;
|
|
1650
|
+
properties.captionLayout = captionLayout;
|
|
1651
|
+
properties.altTextSource = altTextSource;
|
|
1652
|
+
properties.content = document.content;
|
|
1602
1653
|
break;
|
|
1603
1654
|
}
|
|
1604
1655
|
case "timeline": {
|
|
@@ -1611,12 +1662,31 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1611
1662
|
properties.timelineId = timelineLink.uuid;
|
|
1612
1663
|
break;
|
|
1613
1664
|
}
|
|
1665
|
+
case "video": {
|
|
1666
|
+
const videoLink = links.find((link) => link.type === "video");
|
|
1667
|
+
if (!videoLink) {
|
|
1668
|
+
throw new Error(
|
|
1669
|
+
`Video link not found for the following component: \u201C${componentName}\u201D`
|
|
1670
|
+
);
|
|
1671
|
+
}
|
|
1672
|
+
let isChaptersDislayed = getPropertyValueByLabel(
|
|
1673
|
+
componentProperty.properties,
|
|
1674
|
+
"chapters-displayed"
|
|
1675
|
+
);
|
|
1676
|
+
if (isChaptersDislayed == null) {
|
|
1677
|
+
isChaptersDislayed = "Yes";
|
|
1678
|
+
}
|
|
1679
|
+
properties.videoId = videoLink.uuid;
|
|
1680
|
+
properties.isChaptersDislayed = isChaptersDislayed === "Yes";
|
|
1681
|
+
break;
|
|
1682
|
+
}
|
|
1614
1683
|
default: {
|
|
1615
1684
|
console.warn(
|
|
1616
1685
|
`Invalid or non-implemented component name \u201C${componentName}\u201D for the following element: \u201C${parseStringContent(
|
|
1617
1686
|
elementResource.identification.label
|
|
1618
1687
|
)}\u201D`
|
|
1619
1688
|
);
|
|
1689
|
+
break;
|
|
1620
1690
|
}
|
|
1621
1691
|
}
|
|
1622
1692
|
return properties;
|
|
@@ -1646,9 +1716,49 @@ async function parseWebElement(elementResource, elementProperties) {
|
|
|
1646
1716
|
const cssStyle = property.values[0].content;
|
|
1647
1717
|
cssStyles.push({ label: property.label, value: cssStyle });
|
|
1648
1718
|
}
|
|
1719
|
+
const titleProperties = elementResourceProperties.find(
|
|
1720
|
+
(property) => property.label === "title"
|
|
1721
|
+
)?.properties;
|
|
1722
|
+
let variant = "default";
|
|
1723
|
+
let isNameDisplayed = false;
|
|
1724
|
+
let isDescriptionDisplayed = false;
|
|
1725
|
+
let isDateDisplayed = false;
|
|
1726
|
+
let isCreatorsDisplayed = false;
|
|
1727
|
+
if (titleProperties) {
|
|
1728
|
+
const titleVariant = getPropertyValueByLabel(titleProperties, "variant");
|
|
1729
|
+
if (titleVariant) {
|
|
1730
|
+
variant = titleVariant;
|
|
1731
|
+
}
|
|
1732
|
+
const titleShow = titleProperties.filter(
|
|
1733
|
+
(property) => property.label === "display"
|
|
1734
|
+
);
|
|
1735
|
+
if (titleShow.length > 0) {
|
|
1736
|
+
isNameDisplayed = titleShow.some(
|
|
1737
|
+
(property) => property.values[0].content === "name"
|
|
1738
|
+
);
|
|
1739
|
+
isDescriptionDisplayed = titleShow.some(
|
|
1740
|
+
(property) => property.values[0].content === "description"
|
|
1741
|
+
);
|
|
1742
|
+
isDateDisplayed = titleShow.some(
|
|
1743
|
+
(property) => property.values[0].content === "date"
|
|
1744
|
+
);
|
|
1745
|
+
isCreatorsDisplayed = titleShow.some(
|
|
1746
|
+
(property) => property.values[0].content === "creators"
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1649
1750
|
return {
|
|
1650
1751
|
uuid: elementResource.uuid,
|
|
1651
|
-
title:
|
|
1752
|
+
title: {
|
|
1753
|
+
label: identification.label,
|
|
1754
|
+
variant,
|
|
1755
|
+
properties: {
|
|
1756
|
+
isNameDisplayed,
|
|
1757
|
+
isDescriptionDisplayed,
|
|
1758
|
+
isDateDisplayed,
|
|
1759
|
+
isCreatorsDisplayed
|
|
1760
|
+
}
|
|
1761
|
+
},
|
|
1652
1762
|
cssStyles,
|
|
1653
1763
|
...properties
|
|
1654
1764
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -442,7 +442,16 @@ type WebpageProperties = {
|
|
|
442
442
|
*/
|
|
443
443
|
type WebElement = {
|
|
444
444
|
uuid: string;
|
|
445
|
-
title:
|
|
445
|
+
title: {
|
|
446
|
+
label: string;
|
|
447
|
+
variant: "default" | "simple";
|
|
448
|
+
properties: {
|
|
449
|
+
isNameDisplayed: boolean;
|
|
450
|
+
isDescriptionDisplayed: boolean;
|
|
451
|
+
isDateDisplayed: boolean;
|
|
452
|
+
isCreatorsDisplayed: boolean;
|
|
453
|
+
};
|
|
454
|
+
};
|
|
446
455
|
cssStyles: Array<Style>;
|
|
447
456
|
} & WebElementComponent;
|
|
448
457
|
/**
|
|
@@ -454,6 +463,7 @@ type WebElementComponent = {
|
|
|
454
463
|
} | {
|
|
455
464
|
component: "annotated-image";
|
|
456
465
|
imageUuid: string;
|
|
466
|
+
isSearchable: boolean;
|
|
457
467
|
} | {
|
|
458
468
|
component: "bibliography";
|
|
459
469
|
bibliographies: Array<Bibliography>;
|
|
@@ -468,27 +478,29 @@ type WebElementComponent = {
|
|
|
468
478
|
label: string;
|
|
469
479
|
} | {
|
|
470
480
|
component: "collection";
|
|
481
|
+
collectionId: string;
|
|
471
482
|
variant: "full" | "highlights";
|
|
472
483
|
layout: "image-top" | "image-bottom" | "image-start" | "image-end";
|
|
473
|
-
|
|
484
|
+
isSearchable: boolean;
|
|
474
485
|
} | {
|
|
475
486
|
component: "iiif-viewer";
|
|
476
487
|
IIIFId: string;
|
|
477
488
|
} | {
|
|
478
489
|
component: "image";
|
|
479
|
-
|
|
490
|
+
variant: "default" | "carousel";
|
|
491
|
+
images: Array<WebImage>;
|
|
492
|
+
imageQuality: "high" | "low";
|
|
493
|
+
captionSource: "name" | "abbreviation" | "description";
|
|
494
|
+
captionLayout: "top" | "bottom" | "suppress";
|
|
495
|
+
altTextSource: "name" | "abbreviation" | "description";
|
|
480
496
|
} | {
|
|
481
497
|
component: "image-gallery";
|
|
482
498
|
galleryId: string;
|
|
483
|
-
|
|
484
|
-
component: "interactive-chapter-table";
|
|
499
|
+
isSearchable: boolean;
|
|
485
500
|
} | {
|
|
486
501
|
component: "item-gallery";
|
|
487
502
|
galleryId: string;
|
|
488
|
-
|
|
489
|
-
component: "menu";
|
|
490
|
-
} | {
|
|
491
|
-
component: "menu-item";
|
|
503
|
+
isSearchable: boolean;
|
|
492
504
|
} | {
|
|
493
505
|
component: "n-columns";
|
|
494
506
|
columns: Array<WebElement>;
|
|
@@ -507,14 +519,19 @@ type WebElementComponent = {
|
|
|
507
519
|
} | {
|
|
508
520
|
component: "text-image";
|
|
509
521
|
variant: "title" | "block" | "banner";
|
|
522
|
+
image: WebImage;
|
|
523
|
+
imageQuality: "high" | "low";
|
|
510
524
|
layout: "image-top" | "image-bottom" | "image-start" | "image-end" | "image-background";
|
|
525
|
+
captionSource: "name" | "abbreviation" | "description";
|
|
511
526
|
captionLayout: "top" | "bottom" | "suppress";
|
|
512
|
-
|
|
513
|
-
imageOpacity: number | null;
|
|
527
|
+
altTextSource: "name" | "abbreviation" | "description";
|
|
514
528
|
content: string;
|
|
515
529
|
} | {
|
|
516
530
|
component: "timeline";
|
|
517
531
|
timelineId: string;
|
|
532
|
+
} | {
|
|
533
|
+
component: "video";
|
|
534
|
+
isChaptersDislayed: boolean;
|
|
518
535
|
};
|
|
519
536
|
/**
|
|
520
537
|
* Represents an image used in web elements
|
package/dist/index.d.ts
CHANGED
|
@@ -442,7 +442,16 @@ type WebpageProperties = {
|
|
|
442
442
|
*/
|
|
443
443
|
type WebElement = {
|
|
444
444
|
uuid: string;
|
|
445
|
-
title:
|
|
445
|
+
title: {
|
|
446
|
+
label: string;
|
|
447
|
+
variant: "default" | "simple";
|
|
448
|
+
properties: {
|
|
449
|
+
isNameDisplayed: boolean;
|
|
450
|
+
isDescriptionDisplayed: boolean;
|
|
451
|
+
isDateDisplayed: boolean;
|
|
452
|
+
isCreatorsDisplayed: boolean;
|
|
453
|
+
};
|
|
454
|
+
};
|
|
446
455
|
cssStyles: Array<Style>;
|
|
447
456
|
} & WebElementComponent;
|
|
448
457
|
/**
|
|
@@ -454,6 +463,7 @@ type WebElementComponent = {
|
|
|
454
463
|
} | {
|
|
455
464
|
component: "annotated-image";
|
|
456
465
|
imageUuid: string;
|
|
466
|
+
isSearchable: boolean;
|
|
457
467
|
} | {
|
|
458
468
|
component: "bibliography";
|
|
459
469
|
bibliographies: Array<Bibliography>;
|
|
@@ -468,27 +478,29 @@ type WebElementComponent = {
|
|
|
468
478
|
label: string;
|
|
469
479
|
} | {
|
|
470
480
|
component: "collection";
|
|
481
|
+
collectionId: string;
|
|
471
482
|
variant: "full" | "highlights";
|
|
472
483
|
layout: "image-top" | "image-bottom" | "image-start" | "image-end";
|
|
473
|
-
|
|
484
|
+
isSearchable: boolean;
|
|
474
485
|
} | {
|
|
475
486
|
component: "iiif-viewer";
|
|
476
487
|
IIIFId: string;
|
|
477
488
|
} | {
|
|
478
489
|
component: "image";
|
|
479
|
-
|
|
490
|
+
variant: "default" | "carousel";
|
|
491
|
+
images: Array<WebImage>;
|
|
492
|
+
imageQuality: "high" | "low";
|
|
493
|
+
captionSource: "name" | "abbreviation" | "description";
|
|
494
|
+
captionLayout: "top" | "bottom" | "suppress";
|
|
495
|
+
altTextSource: "name" | "abbreviation" | "description";
|
|
480
496
|
} | {
|
|
481
497
|
component: "image-gallery";
|
|
482
498
|
galleryId: string;
|
|
483
|
-
|
|
484
|
-
component: "interactive-chapter-table";
|
|
499
|
+
isSearchable: boolean;
|
|
485
500
|
} | {
|
|
486
501
|
component: "item-gallery";
|
|
487
502
|
galleryId: string;
|
|
488
|
-
|
|
489
|
-
component: "menu";
|
|
490
|
-
} | {
|
|
491
|
-
component: "menu-item";
|
|
503
|
+
isSearchable: boolean;
|
|
492
504
|
} | {
|
|
493
505
|
component: "n-columns";
|
|
494
506
|
columns: Array<WebElement>;
|
|
@@ -507,14 +519,19 @@ type WebElementComponent = {
|
|
|
507
519
|
} | {
|
|
508
520
|
component: "text-image";
|
|
509
521
|
variant: "title" | "block" | "banner";
|
|
522
|
+
image: WebImage;
|
|
523
|
+
imageQuality: "high" | "low";
|
|
510
524
|
layout: "image-top" | "image-bottom" | "image-start" | "image-end" | "image-background";
|
|
525
|
+
captionSource: "name" | "abbreviation" | "description";
|
|
511
526
|
captionLayout: "top" | "bottom" | "suppress";
|
|
512
|
-
|
|
513
|
-
imageOpacity: number | null;
|
|
527
|
+
altTextSource: "name" | "abbreviation" | "description";
|
|
514
528
|
content: string;
|
|
515
529
|
} | {
|
|
516
530
|
component: "timeline";
|
|
517
531
|
timelineId: string;
|
|
532
|
+
} | {
|
|
533
|
+
component: "video";
|
|
534
|
+
isChaptersDislayed: boolean;
|
|
518
535
|
};
|
|
519
536
|
/**
|
|
520
537
|
* Represents an image used in web elements
|
package/dist/index.js
CHANGED
|
@@ -510,17 +510,15 @@ var componentSchema = z3.enum(
|
|
|
510
510
|
"iiif-viewer",
|
|
511
511
|
"image",
|
|
512
512
|
"image-gallery",
|
|
513
|
-
"interactive-chapter-table",
|
|
514
513
|
"item-gallery",
|
|
515
|
-
"menu",
|
|
516
|
-
"menu-item",
|
|
517
514
|
"n-columns",
|
|
518
515
|
"n-rows",
|
|
519
516
|
"network-graph",
|
|
520
517
|
"table",
|
|
521
518
|
"text",
|
|
522
519
|
"text-image",
|
|
523
|
-
"timeline"
|
|
520
|
+
"timeline",
|
|
521
|
+
"video"
|
|
524
522
|
],
|
|
525
523
|
{ message: "Invalid component" }
|
|
526
524
|
);
|
|
@@ -1280,13 +1278,10 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1280
1278
|
`Image link not found for the following component: \u201C${componentName}\u201D`
|
|
1281
1279
|
);
|
|
1282
1280
|
}
|
|
1283
|
-
|
|
1281
|
+
const isSearchable = getPropertyValueByLabel(
|
|
1284
1282
|
componentProperty.properties,
|
|
1285
1283
|
"is-searchable"
|
|
1286
1284
|
) === "Yes";
|
|
1287
|
-
if (!isSearchable) {
|
|
1288
|
-
isSearchable = false;
|
|
1289
|
-
}
|
|
1290
1285
|
properties.imageUuid = imageLink.uuid;
|
|
1291
1286
|
properties.isSearchable = isSearchable;
|
|
1292
1287
|
break;
|
|
@@ -1391,12 +1386,44 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1391
1386
|
`Image link not found for the following component: \u201C${componentName}\u201D`
|
|
1392
1387
|
);
|
|
1393
1388
|
}
|
|
1389
|
+
let captionLayout = getPropertyValueByLabel(
|
|
1390
|
+
componentProperty.properties,
|
|
1391
|
+
"caption-layout"
|
|
1392
|
+
);
|
|
1393
|
+
if (captionLayout === null) {
|
|
1394
|
+
captionLayout = "bottom";
|
|
1395
|
+
}
|
|
1396
|
+
let imageQuality = getPropertyValueByLabel(
|
|
1397
|
+
componentProperty.properties,
|
|
1398
|
+
"image-quality"
|
|
1399
|
+
);
|
|
1400
|
+
if (imageQuality === null) {
|
|
1401
|
+
imageQuality = "high";
|
|
1402
|
+
}
|
|
1403
|
+
let captionSource = getPropertyValueByLabel(
|
|
1404
|
+
componentProperty.properties,
|
|
1405
|
+
"caption-source"
|
|
1406
|
+
);
|
|
1407
|
+
if (captionSource === null) {
|
|
1408
|
+
captionSource = "name";
|
|
1409
|
+
}
|
|
1410
|
+
let altTextSource = getPropertyValueByLabel(
|
|
1411
|
+
componentProperty.properties,
|
|
1412
|
+
"alt-text-source"
|
|
1413
|
+
);
|
|
1414
|
+
if (altTextSource === null) {
|
|
1415
|
+
altTextSource = "name";
|
|
1416
|
+
}
|
|
1394
1417
|
properties.image = {
|
|
1395
1418
|
url: `https://ochre.lib.uchicago.edu/ochre?uuid=${imageLink.uuid}&load`,
|
|
1396
1419
|
label: imageLink.identification?.label ?? null,
|
|
1397
1420
|
width: imageLink.image?.width ?? 0,
|
|
1398
1421
|
height: imageLink.image?.height ?? 0
|
|
1399
1422
|
};
|
|
1423
|
+
properties.imageQuality = imageQuality;
|
|
1424
|
+
properties.captionLayout = captionLayout;
|
|
1425
|
+
properties.captionSource = captionSource;
|
|
1426
|
+
properties.altTextSource = altTextSource;
|
|
1400
1427
|
break;
|
|
1401
1428
|
}
|
|
1402
1429
|
case "image-gallery": {
|
|
@@ -1406,10 +1433,12 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1406
1433
|
`Image gallery link not found for the following component: \u201C${componentName}\u201D`
|
|
1407
1434
|
);
|
|
1408
1435
|
}
|
|
1436
|
+
const isSearchable = getPropertyValueByLabel(
|
|
1437
|
+
componentProperty.properties,
|
|
1438
|
+
"is-searchable"
|
|
1439
|
+
) === "Yes";
|
|
1409
1440
|
properties.galleryId = galleryLink.uuid;
|
|
1410
|
-
|
|
1411
|
-
}
|
|
1412
|
-
case "interactive-chapter-table": {
|
|
1441
|
+
properties.isSearchable = isSearchable;
|
|
1413
1442
|
break;
|
|
1414
1443
|
}
|
|
1415
1444
|
case "item-gallery": {
|
|
@@ -1419,13 +1448,12 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1419
1448
|
`Item gallery link not found for the following component: \u201C${componentName}\u201D`
|
|
1420
1449
|
);
|
|
1421
1450
|
}
|
|
1451
|
+
const isSearchable = getPropertyValueByLabel(
|
|
1452
|
+
componentProperty.properties,
|
|
1453
|
+
"is-searchable"
|
|
1454
|
+
) === "Yes";
|
|
1422
1455
|
properties.galleryId = galleryLink.uuid;
|
|
1423
|
-
|
|
1424
|
-
}
|
|
1425
|
-
case "menu": {
|
|
1426
|
-
break;
|
|
1427
|
-
}
|
|
1428
|
-
case "menu-item": {
|
|
1456
|
+
properties.isSearchable = isSearchable;
|
|
1429
1457
|
break;
|
|
1430
1458
|
}
|
|
1431
1459
|
case "n-columns": {
|
|
@@ -1511,17 +1539,40 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1511
1539
|
)}`
|
|
1512
1540
|
);
|
|
1513
1541
|
}
|
|
1542
|
+
let imageQuality = getPropertyValueByLabel(
|
|
1543
|
+
componentProperty.properties,
|
|
1544
|
+
"image-quality"
|
|
1545
|
+
);
|
|
1546
|
+
if (imageQuality === null) {
|
|
1547
|
+
imageQuality = "high";
|
|
1548
|
+
}
|
|
1549
|
+
let captionSource = getPropertyValueByLabel(
|
|
1550
|
+
componentProperty.properties,
|
|
1551
|
+
"caption-source"
|
|
1552
|
+
);
|
|
1553
|
+
if (captionSource === null) {
|
|
1554
|
+
captionSource = "name";
|
|
1555
|
+
}
|
|
1556
|
+
let altTextSource = getPropertyValueByLabel(
|
|
1557
|
+
componentProperty.properties,
|
|
1558
|
+
"alt-text-source"
|
|
1559
|
+
);
|
|
1560
|
+
if (altTextSource === null) {
|
|
1561
|
+
altTextSource = "name";
|
|
1562
|
+
}
|
|
1514
1563
|
properties.variant = variant;
|
|
1515
|
-
properties.layout = layout;
|
|
1516
|
-
properties.captionLayout = captionLayout;
|
|
1517
|
-
properties.content = document.content;
|
|
1518
1564
|
properties.image = {
|
|
1519
1565
|
url: `https://ochre.lib.uchicago.edu/ochre?uuid=${imageLink2.uuid}&preview`,
|
|
1520
1566
|
label: imageLink2.identification?.label ?? null,
|
|
1521
1567
|
width: imageLink2.image?.width ?? 0,
|
|
1522
1568
|
height: imageLink2.image?.height ?? 0
|
|
1523
1569
|
};
|
|
1524
|
-
properties.
|
|
1570
|
+
properties.imageQuality = imageQuality;
|
|
1571
|
+
properties.layout = layout;
|
|
1572
|
+
properties.captionSource = captionSource;
|
|
1573
|
+
properties.captionLayout = captionLayout;
|
|
1574
|
+
properties.altTextSource = altTextSource;
|
|
1575
|
+
properties.content = document.content;
|
|
1525
1576
|
break;
|
|
1526
1577
|
}
|
|
1527
1578
|
case "timeline": {
|
|
@@ -1534,12 +1585,31 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1534
1585
|
properties.timelineId = timelineLink.uuid;
|
|
1535
1586
|
break;
|
|
1536
1587
|
}
|
|
1588
|
+
case "video": {
|
|
1589
|
+
const videoLink = links.find((link) => link.type === "video");
|
|
1590
|
+
if (!videoLink) {
|
|
1591
|
+
throw new Error(
|
|
1592
|
+
`Video link not found for the following component: \u201C${componentName}\u201D`
|
|
1593
|
+
);
|
|
1594
|
+
}
|
|
1595
|
+
let isChaptersDislayed = getPropertyValueByLabel(
|
|
1596
|
+
componentProperty.properties,
|
|
1597
|
+
"chapters-displayed"
|
|
1598
|
+
);
|
|
1599
|
+
if (isChaptersDislayed == null) {
|
|
1600
|
+
isChaptersDislayed = "Yes";
|
|
1601
|
+
}
|
|
1602
|
+
properties.videoId = videoLink.uuid;
|
|
1603
|
+
properties.isChaptersDislayed = isChaptersDislayed === "Yes";
|
|
1604
|
+
break;
|
|
1605
|
+
}
|
|
1537
1606
|
default: {
|
|
1538
1607
|
console.warn(
|
|
1539
1608
|
`Invalid or non-implemented component name \u201C${componentName}\u201D for the following element: \u201C${parseStringContent(
|
|
1540
1609
|
elementResource.identification.label
|
|
1541
1610
|
)}\u201D`
|
|
1542
1611
|
);
|
|
1612
|
+
break;
|
|
1543
1613
|
}
|
|
1544
1614
|
}
|
|
1545
1615
|
return properties;
|
|
@@ -1569,9 +1639,49 @@ async function parseWebElement(elementResource, elementProperties) {
|
|
|
1569
1639
|
const cssStyle = property.values[0].content;
|
|
1570
1640
|
cssStyles.push({ label: property.label, value: cssStyle });
|
|
1571
1641
|
}
|
|
1642
|
+
const titleProperties = elementResourceProperties.find(
|
|
1643
|
+
(property) => property.label === "title"
|
|
1644
|
+
)?.properties;
|
|
1645
|
+
let variant = "default";
|
|
1646
|
+
let isNameDisplayed = false;
|
|
1647
|
+
let isDescriptionDisplayed = false;
|
|
1648
|
+
let isDateDisplayed = false;
|
|
1649
|
+
let isCreatorsDisplayed = false;
|
|
1650
|
+
if (titleProperties) {
|
|
1651
|
+
const titleVariant = getPropertyValueByLabel(titleProperties, "variant");
|
|
1652
|
+
if (titleVariant) {
|
|
1653
|
+
variant = titleVariant;
|
|
1654
|
+
}
|
|
1655
|
+
const titleShow = titleProperties.filter(
|
|
1656
|
+
(property) => property.label === "display"
|
|
1657
|
+
);
|
|
1658
|
+
if (titleShow.length > 0) {
|
|
1659
|
+
isNameDisplayed = titleShow.some(
|
|
1660
|
+
(property) => property.values[0].content === "name"
|
|
1661
|
+
);
|
|
1662
|
+
isDescriptionDisplayed = titleShow.some(
|
|
1663
|
+
(property) => property.values[0].content === "description"
|
|
1664
|
+
);
|
|
1665
|
+
isDateDisplayed = titleShow.some(
|
|
1666
|
+
(property) => property.values[0].content === "date"
|
|
1667
|
+
);
|
|
1668
|
+
isCreatorsDisplayed = titleShow.some(
|
|
1669
|
+
(property) => property.values[0].content === "creators"
|
|
1670
|
+
);
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1572
1673
|
return {
|
|
1573
1674
|
uuid: elementResource.uuid,
|
|
1574
|
-
title:
|
|
1675
|
+
title: {
|
|
1676
|
+
label: identification.label,
|
|
1677
|
+
variant,
|
|
1678
|
+
properties: {
|
|
1679
|
+
isNameDisplayed,
|
|
1680
|
+
isDescriptionDisplayed,
|
|
1681
|
+
isDateDisplayed,
|
|
1682
|
+
isCreatorsDisplayed
|
|
1683
|
+
}
|
|
1684
|
+
},
|
|
1575
1685
|
cssStyles,
|
|
1576
1686
|
...properties
|
|
1577
1687
|
};
|
package/package.json
CHANGED