@digitalculture/ochre-sdk 0.13.6 → 0.13.8
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.d.mts +6 -0
- package/dist/index.mjs +23 -0
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -649,6 +649,12 @@ type WebElement = {
|
|
|
649
649
|
* Union type of all possible web element components
|
|
650
650
|
*/
|
|
651
651
|
type WebElementComponent = {
|
|
652
|
+
component: "3d-viewer";
|
|
653
|
+
resourceId: string;
|
|
654
|
+
isInteractive: boolean;
|
|
655
|
+
isControlsDisplayed: boolean;
|
|
656
|
+
isLightingDisplayed: boolean;
|
|
657
|
+
} | {
|
|
652
658
|
component: "advanced-search";
|
|
653
659
|
boundElementUuid: string | null;
|
|
654
660
|
href: string | null;
|
package/dist/index.mjs
CHANGED
|
@@ -37,6 +37,7 @@ const websiteSchema = z.object({
|
|
|
37
37
|
* @internal
|
|
38
38
|
*/
|
|
39
39
|
const componentSchema = z.enum([
|
|
40
|
+
"3d-viewer",
|
|
40
41
|
"advanced-search",
|
|
41
42
|
"annotated-document",
|
|
42
43
|
"annotated-image",
|
|
@@ -589,6 +590,10 @@ function parseStringDocumentItem(item) {
|
|
|
589
590
|
case "webpage": return `<ExternalLink href="${linkResource.href}" ${linkContent !== null ? `content="${linkContent}"` : ""}>${itemString}</ExternalLink>`;
|
|
590
591
|
default: return "";
|
|
591
592
|
}
|
|
593
|
+
} else if ("spatialUnit" in link) {
|
|
594
|
+
const linkSpatialUnit = Array.isArray(link.spatialUnit) ? link.spatialUnit[0] : link.spatialUnit;
|
|
595
|
+
if (linkSpatialUnit.publicationDateTime != null) return `<InternalLink uuid="${linkSpatialUnit.uuid}">${itemString}</InternalLink>`;
|
|
596
|
+
else return `<TooltipSpan>${itemString}</TooltipSpan>`;
|
|
592
597
|
} else if ("concept" in link) {
|
|
593
598
|
const linkConcept = Array.isArray(link.concept) ? link.concept[0] : link.concept;
|
|
594
599
|
if (linkConcept.publicationDateTime != null) return `<InternalLink uuid="${linkConcept.uuid}">${itemString}</InternalLink>`;
|
|
@@ -1702,6 +1707,24 @@ function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1702
1707
|
const properties = { component: componentName };
|
|
1703
1708
|
const links = elementResource.links ? parseLinks(Array.isArray(elementResource.links) ? elementResource.links : [elementResource.links]) : [];
|
|
1704
1709
|
switch (componentName) {
|
|
1710
|
+
case "3d-viewer": {
|
|
1711
|
+
const resourceLink = links.find((link) => link.category === "resource" && link.fileFormat === "model/obj");
|
|
1712
|
+
if (!resourceLink) throw new Error(`Resource link not found for the following component: “${componentName}”`);
|
|
1713
|
+
let isInteractive = true;
|
|
1714
|
+
const isInteractiveProperty = getPropertyValueByLabel(componentProperty.properties, "is-interactive");
|
|
1715
|
+
if (isInteractiveProperty !== null) isInteractive = isInteractiveProperty === true;
|
|
1716
|
+
let isControlsDisplayed = true;
|
|
1717
|
+
const isControlsDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "controls-displayed");
|
|
1718
|
+
if (isControlsDisplayedProperty !== null) isControlsDisplayed = isControlsDisplayedProperty === true;
|
|
1719
|
+
let isLightingDisplayed = true;
|
|
1720
|
+
const isLightingDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "lighting-displayed");
|
|
1721
|
+
if (isLightingDisplayedProperty !== null) isLightingDisplayed = isLightingDisplayedProperty === true;
|
|
1722
|
+
properties.resourceId = resourceLink.uuid;
|
|
1723
|
+
properties.isInteractive = isInteractive;
|
|
1724
|
+
properties.isControlsDisplayed = isControlsDisplayed;
|
|
1725
|
+
properties.isLightingDisplayed = isLightingDisplayed;
|
|
1726
|
+
break;
|
|
1727
|
+
}
|
|
1705
1728
|
case "advanced-search": {
|
|
1706
1729
|
const boundElementPropertyUuid = getPropertyByLabel(componentProperty.properties, "bound-element")?.values[0]?.uuid;
|
|
1707
1730
|
const linkToProperty = getPropertyByLabel(componentProperty.properties, "link-to");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitalculture/ochre-sdk",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Node.js library for working with OCHRE (Online Cultural and Historical Research Environment) data",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"zod": "^4.1.13"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@antfu/eslint-config": "^6.
|
|
47
|
-
"@types/node": "^24.10.
|
|
46
|
+
"@antfu/eslint-config": "^6.5.1",
|
|
47
|
+
"@types/node": "^24.10.2",
|
|
48
48
|
"bumpp": "^10.3.2",
|
|
49
49
|
"eslint": "^9.39.1",
|
|
50
50
|
"prettier": "^3.7.4",
|
|
51
51
|
"terser": "^5.44.1",
|
|
52
|
-
"tsdown": "^0.17.
|
|
52
|
+
"tsdown": "^0.17.2",
|
|
53
53
|
"typescript": "^5.9.3",
|
|
54
54
|
"vitest": "^4.0.15"
|
|
55
55
|
},
|