@digitalculture/ochre-sdk 0.3.4 → 0.3.6

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 CHANGED
@@ -1667,7 +1667,12 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1667
1667
  if (variant === null) {
1668
1668
  variant = "block";
1669
1669
  }
1670
+ const heading = getPropertyValueByLabel(
1671
+ componentProperty.properties,
1672
+ "heading"
1673
+ );
1670
1674
  properties.variant = variant;
1675
+ properties.heading = heading;
1671
1676
  properties.content = document.content;
1672
1677
  break;
1673
1678
  }
@@ -2097,23 +2102,28 @@ async function parseWebsite(websiteTree, projectName, website) {
2097
2102
  });
2098
2103
  if (sidebarResource) {
2099
2104
  sidebarTitle.label = typeof sidebarResource.identification.label === "string" || typeof sidebarResource.identification.label === "number" || typeof sidebarResource.identification.label === "boolean" ? parseFakeString(sidebarResource.identification.label) : parseStringContent(sidebarResource.identification.label);
2100
- const sidebarProperties = sidebarResource.properties ? parseProperties(
2105
+ const sidebarBaseProperties = sidebarResource.properties ? parseProperties(
2101
2106
  Array.isArray(sidebarResource.properties.property) ? sidebarResource.properties.property : [sidebarResource.properties.property]
2102
2107
  ) : [];
2108
+ const sidebarProperties = sidebarBaseProperties.find(
2109
+ (property) => property.label === "presentation" && property.values[0]?.content === "element"
2110
+ )?.properties.find(
2111
+ (property) => property.label === "component" && property.values[0]?.content === "sidebar"
2112
+ )?.properties ?? [];
2103
2113
  const sidebarLayoutProperty = sidebarProperties.find(
2104
2114
  (property) => property.label === "layout"
2105
2115
  );
2106
2116
  if (sidebarLayoutProperty) {
2107
2117
  sidebarLayout = sidebarLayoutProperty.values[0].content;
2108
2118
  }
2109
- const cssProperties = sidebarProperties.find(
2119
+ const cssProperties = sidebarBaseProperties.find(
2110
2120
  (property) => property.label === "presentation" && property.values[0].content === "css"
2111
2121
  )?.properties ?? [];
2112
2122
  for (const property of cssProperties) {
2113
2123
  const cssStyle = property.values[0].content;
2114
2124
  sidebarCssStyles.push({ label: property.label, value: cssStyle });
2115
2125
  }
2116
- const titleProperties = sidebarProperties.find(
2126
+ const titleProperties = sidebarBaseProperties.find(
2117
2127
  (property) => property.label === "presentation" && property.values[0].content === "title"
2118
2128
  )?.properties;
2119
2129
  if (titleProperties) {
package/dist/index.d.cts CHANGED
@@ -535,6 +535,7 @@ type WebElementComponent = {
535
535
  } | {
536
536
  component: "text";
537
537
  variant: "title" | "block" | "banner";
538
+ heading: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | null;
538
539
  content: string;
539
540
  } | {
540
541
  component: "text-image";
package/dist/index.d.ts CHANGED
@@ -535,6 +535,7 @@ type WebElementComponent = {
535
535
  } | {
536
536
  component: "text";
537
537
  variant: "title" | "block" | "banner";
538
+ heading: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | null;
538
539
  content: string;
539
540
  } | {
540
541
  component: "text-image";
package/dist/index.js CHANGED
@@ -1589,7 +1589,12 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1589
1589
  if (variant === null) {
1590
1590
  variant = "block";
1591
1591
  }
1592
+ const heading = getPropertyValueByLabel(
1593
+ componentProperty.properties,
1594
+ "heading"
1595
+ );
1592
1596
  properties.variant = variant;
1597
+ properties.heading = heading;
1593
1598
  properties.content = document.content;
1594
1599
  break;
1595
1600
  }
@@ -2019,23 +2024,28 @@ async function parseWebsite(websiteTree, projectName, website) {
2019
2024
  });
2020
2025
  if (sidebarResource) {
2021
2026
  sidebarTitle.label = typeof sidebarResource.identification.label === "string" || typeof sidebarResource.identification.label === "number" || typeof sidebarResource.identification.label === "boolean" ? parseFakeString(sidebarResource.identification.label) : parseStringContent(sidebarResource.identification.label);
2022
- const sidebarProperties = sidebarResource.properties ? parseProperties(
2027
+ const sidebarBaseProperties = sidebarResource.properties ? parseProperties(
2023
2028
  Array.isArray(sidebarResource.properties.property) ? sidebarResource.properties.property : [sidebarResource.properties.property]
2024
2029
  ) : [];
2030
+ const sidebarProperties = sidebarBaseProperties.find(
2031
+ (property) => property.label === "presentation" && property.values[0]?.content === "element"
2032
+ )?.properties.find(
2033
+ (property) => property.label === "component" && property.values[0]?.content === "sidebar"
2034
+ )?.properties ?? [];
2025
2035
  const sidebarLayoutProperty = sidebarProperties.find(
2026
2036
  (property) => property.label === "layout"
2027
2037
  );
2028
2038
  if (sidebarLayoutProperty) {
2029
2039
  sidebarLayout = sidebarLayoutProperty.values[0].content;
2030
2040
  }
2031
- const cssProperties = sidebarProperties.find(
2041
+ const cssProperties = sidebarBaseProperties.find(
2032
2042
  (property) => property.label === "presentation" && property.values[0].content === "css"
2033
2043
  )?.properties ?? [];
2034
2044
  for (const property of cssProperties) {
2035
2045
  const cssStyle = property.values[0].content;
2036
2046
  sidebarCssStyles.push({ label: property.label, value: cssStyle });
2037
2047
  }
2038
- const titleProperties = sidebarProperties.find(
2048
+ const titleProperties = sidebarBaseProperties.find(
2039
2049
  (property) => property.label === "presentation" && property.values[0].content === "title"
2040
2050
  )?.properties;
2041
2051
  if (titleProperties) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
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",
@@ -41,20 +41,20 @@
41
41
  ],
42
42
  "dependencies": {
43
43
  "iso-639-3": "^3.0.1",
44
- "zod": "^3.24.1"
44
+ "zod": "^3.24.2"
45
45
  },
46
46
  "devDependencies": {
47
- "@antfu/eslint-config": "^4.1.1",
47
+ "@antfu/eslint-config": "^4.3.0",
48
48
  "@arethetypeswrong/cli": "^0.17.3",
49
- "@changesets/cli": "^2.27.12",
49
+ "@changesets/cli": "^2.28.1",
50
50
  "@total-typescript/ts-reset": "^0.6.1",
51
- "@types/node": "^22.13.1",
52
- "eslint": "^9.19.0",
51
+ "@types/node": "^22.13.4",
52
+ "eslint": "^9.20.1",
53
53
  "eslint-plugin-unused-imports": "^4.1.4",
54
- "prettier": "^3.4.2",
54
+ "prettier": "^3.5.1",
55
55
  "tsup": "^8.3.6",
56
56
  "typescript": "^5.7.3",
57
- "vitest": "^3.0.5"
57
+ "vitest": "^3.0.6"
58
58
  },
59
59
  "scripts": {
60
60
  "dev": "tsup src/index.ts --watch",