@digitalculture/ochre-sdk 0.13.7 → 0.13.9
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 +7 -0
- package/dist/index.mjs +20 -0
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -649,6 +649,13 @@ 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
|
+
fileSize: number | null;
|
|
655
|
+
isInteractive: boolean;
|
|
656
|
+
isControlsDisplayed: boolean;
|
|
657
|
+
isLightingDisplayed: boolean;
|
|
658
|
+
} | {
|
|
652
659
|
component: "advanced-search";
|
|
653
660
|
boundElementUuid: string | null;
|
|
654
661
|
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",
|
|
@@ -1706,6 +1707,25 @@ function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1706
1707
|
const properties = { component: componentName };
|
|
1707
1708
|
const links = elementResource.links ? parseLinks(Array.isArray(elementResource.links) ? elementResource.links : [elementResource.links]) : [];
|
|
1708
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.fileSize = resourceLink.fileSize;
|
|
1724
|
+
properties.isInteractive = isInteractive;
|
|
1725
|
+
properties.isControlsDisplayed = isControlsDisplayed;
|
|
1726
|
+
properties.isLightingDisplayed = isLightingDisplayed;
|
|
1727
|
+
break;
|
|
1728
|
+
}
|
|
1709
1729
|
case "advanced-search": {
|
|
1710
1730
|
const boundElementPropertyUuid = getPropertyByLabel(componentProperty.properties, "bound-element")?.values[0]?.uuid;
|
|
1711
1731
|
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.9",
|
|
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,8 +43,8 @@
|
|
|
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.6.1",
|
|
47
|
+
"@types/node": "^24.10.3",
|
|
48
48
|
"bumpp": "^10.3.2",
|
|
49
49
|
"eslint": "^9.39.1",
|
|
50
50
|
"prettier": "^3.7.4",
|