@digitalculture/ochre-sdk 0.3.0 → 0.3.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 CHANGED
@@ -2068,7 +2068,7 @@ async function parseWebsite(websiteTree, projectName, website) {
2068
2068
  let sidebar = null;
2069
2069
  const sidebarElements = [];
2070
2070
  const sidebarTitle = {
2071
- label: "title",
2071
+ label: "",
2072
2072
  variant: "default",
2073
2073
  properties: {
2074
2074
  isNameDisplayed: false,
@@ -2087,6 +2087,43 @@ async function parseWebsite(websiteTree, projectName, website) {
2087
2087
  );
2088
2088
  });
2089
2089
  if (sidebarResource) {
2090
+ 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);
2091
+ const sidebarProperties = sidebarResource.properties ? parseProperties(
2092
+ Array.isArray(sidebarResource.properties.property) ? sidebarResource.properties.property : [sidebarResource.properties.property]
2093
+ ) : [];
2094
+ const cssProperties = sidebarProperties.find(
2095
+ (property) => property.label === "presentation" && property.values[0].content === "css"
2096
+ )?.properties ?? [];
2097
+ for (const property of cssProperties) {
2098
+ const cssStyle = property.values[0].content;
2099
+ sidebarCssStyles.push({ label: property.label, value: cssStyle });
2100
+ }
2101
+ const titleProperties = sidebarProperties.find(
2102
+ (property) => property.label === "title"
2103
+ )?.properties;
2104
+ if (titleProperties) {
2105
+ const titleVariant = getPropertyValueByLabel(titleProperties, "variant");
2106
+ if (titleVariant) {
2107
+ sidebarTitle.variant = titleVariant;
2108
+ }
2109
+ const titleShow = titleProperties.filter(
2110
+ (property) => property.label === "display"
2111
+ );
2112
+ if (titleShow.length > 0) {
2113
+ sidebarTitle.properties.isNameDisplayed = titleShow.some(
2114
+ (property) => property.values[0].content === "name"
2115
+ );
2116
+ sidebarTitle.properties.isDescriptionDisplayed = titleShow.some(
2117
+ (property) => property.values[0].content === "description"
2118
+ );
2119
+ sidebarTitle.properties.isDateDisplayed = titleShow.some(
2120
+ (property) => property.values[0].content === "date"
2121
+ );
2122
+ sidebarTitle.properties.isCreatorsDisplayed = titleShow.some(
2123
+ (property) => property.values[0].content === "creators"
2124
+ );
2125
+ }
2126
+ }
2090
2127
  const sidebarResources = sidebarResource.resource ? Array.isArray(sidebarResource.resource) ? sidebarResource.resource : [sidebarResource.resource] : [];
2091
2128
  for (const resource of sidebarResources) {
2092
2129
  const sidebarResourceProperties = resource.properties ? parseProperties(
@@ -2099,42 +2136,6 @@ async function parseWebsite(websiteTree, projectName, website) {
2099
2136
  )?.properties ?? []
2100
2137
  );
2101
2138
  sidebarElements.push(element);
2102
- const cssProperties = sidebarResourceProperties.find(
2103
- (property) => property.label === "presentation" && property.values[0].content === "css"
2104
- )?.properties ?? [];
2105
- for (const property of cssProperties) {
2106
- const cssStyle = property.values[0].content;
2107
- sidebarCssStyles.push({ label: property.label, value: cssStyle });
2108
- }
2109
- const titleProperties = sidebarResourceProperties.find(
2110
- (property) => property.label === "title"
2111
- )?.properties;
2112
- if (titleProperties) {
2113
- const titleVariant = getPropertyValueByLabel(
2114
- titleProperties,
2115
- "variant"
2116
- );
2117
- if (titleVariant) {
2118
- sidebarTitle.variant = titleVariant;
2119
- }
2120
- const titleShow = titleProperties.filter(
2121
- (property) => property.label === "display"
2122
- );
2123
- if (titleShow.length > 0) {
2124
- sidebarTitle.properties.isNameDisplayed = titleShow.some(
2125
- (property) => property.values[0].content === "name"
2126
- );
2127
- sidebarTitle.properties.isDescriptionDisplayed = titleShow.some(
2128
- (property) => property.values[0].content === "description"
2129
- );
2130
- sidebarTitle.properties.isDateDisplayed = titleShow.some(
2131
- (property) => property.values[0].content === "date"
2132
- );
2133
- sidebarTitle.properties.isCreatorsDisplayed = titleShow.some(
2134
- (property) => property.values[0].content === "creators"
2135
- );
2136
- }
2137
- }
2138
2139
  }
2139
2140
  }
2140
2141
  if (sidebarElements.length > 0) {
package/dist/index.js CHANGED
@@ -1990,7 +1990,7 @@ async function parseWebsite(websiteTree, projectName, website) {
1990
1990
  let sidebar = null;
1991
1991
  const sidebarElements = [];
1992
1992
  const sidebarTitle = {
1993
- label: "title",
1993
+ label: "",
1994
1994
  variant: "default",
1995
1995
  properties: {
1996
1996
  isNameDisplayed: false,
@@ -2009,6 +2009,43 @@ async function parseWebsite(websiteTree, projectName, website) {
2009
2009
  );
2010
2010
  });
2011
2011
  if (sidebarResource) {
2012
+ 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);
2013
+ const sidebarProperties = sidebarResource.properties ? parseProperties(
2014
+ Array.isArray(sidebarResource.properties.property) ? sidebarResource.properties.property : [sidebarResource.properties.property]
2015
+ ) : [];
2016
+ const cssProperties = sidebarProperties.find(
2017
+ (property) => property.label === "presentation" && property.values[0].content === "css"
2018
+ )?.properties ?? [];
2019
+ for (const property of cssProperties) {
2020
+ const cssStyle = property.values[0].content;
2021
+ sidebarCssStyles.push({ label: property.label, value: cssStyle });
2022
+ }
2023
+ const titleProperties = sidebarProperties.find(
2024
+ (property) => property.label === "title"
2025
+ )?.properties;
2026
+ if (titleProperties) {
2027
+ const titleVariant = getPropertyValueByLabel(titleProperties, "variant");
2028
+ if (titleVariant) {
2029
+ sidebarTitle.variant = titleVariant;
2030
+ }
2031
+ const titleShow = titleProperties.filter(
2032
+ (property) => property.label === "display"
2033
+ );
2034
+ if (titleShow.length > 0) {
2035
+ sidebarTitle.properties.isNameDisplayed = titleShow.some(
2036
+ (property) => property.values[0].content === "name"
2037
+ );
2038
+ sidebarTitle.properties.isDescriptionDisplayed = titleShow.some(
2039
+ (property) => property.values[0].content === "description"
2040
+ );
2041
+ sidebarTitle.properties.isDateDisplayed = titleShow.some(
2042
+ (property) => property.values[0].content === "date"
2043
+ );
2044
+ sidebarTitle.properties.isCreatorsDisplayed = titleShow.some(
2045
+ (property) => property.values[0].content === "creators"
2046
+ );
2047
+ }
2048
+ }
2012
2049
  const sidebarResources = sidebarResource.resource ? Array.isArray(sidebarResource.resource) ? sidebarResource.resource : [sidebarResource.resource] : [];
2013
2050
  for (const resource of sidebarResources) {
2014
2051
  const sidebarResourceProperties = resource.properties ? parseProperties(
@@ -2021,42 +2058,6 @@ async function parseWebsite(websiteTree, projectName, website) {
2021
2058
  )?.properties ?? []
2022
2059
  );
2023
2060
  sidebarElements.push(element);
2024
- const cssProperties = sidebarResourceProperties.find(
2025
- (property) => property.label === "presentation" && property.values[0].content === "css"
2026
- )?.properties ?? [];
2027
- for (const property of cssProperties) {
2028
- const cssStyle = property.values[0].content;
2029
- sidebarCssStyles.push({ label: property.label, value: cssStyle });
2030
- }
2031
- const titleProperties = sidebarResourceProperties.find(
2032
- (property) => property.label === "title"
2033
- )?.properties;
2034
- if (titleProperties) {
2035
- const titleVariant = getPropertyValueByLabel(
2036
- titleProperties,
2037
- "variant"
2038
- );
2039
- if (titleVariant) {
2040
- sidebarTitle.variant = titleVariant;
2041
- }
2042
- const titleShow = titleProperties.filter(
2043
- (property) => property.label === "display"
2044
- );
2045
- if (titleShow.length > 0) {
2046
- sidebarTitle.properties.isNameDisplayed = titleShow.some(
2047
- (property) => property.values[0].content === "name"
2048
- );
2049
- sidebarTitle.properties.isDescriptionDisplayed = titleShow.some(
2050
- (property) => property.values[0].content === "description"
2051
- );
2052
- sidebarTitle.properties.isDateDisplayed = titleShow.some(
2053
- (property) => property.values[0].content === "date"
2054
- );
2055
- sidebarTitle.properties.isCreatorsDisplayed = titleShow.some(
2056
- (property) => property.values[0].content === "creators"
2057
- );
2058
- }
2059
- }
2060
2061
  }
2061
2062
  }
2062
2063
  if (sidebarElements.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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",