@digitalculture/ochre-sdk 0.4.3 → 0.4.5

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
@@ -72,11 +72,13 @@ __export(index_exports, {
72
72
  parseStringItem: () => parseStringItem,
73
73
  parseTree: () => parseTree,
74
74
  parseWebsite: () => parseWebsite,
75
- trimEndLineBreaks: () => trimEndLineBreaks
75
+ trimEndLineBreaks: () => trimEndLineBreaks,
76
+ trimStartLineBreaks: () => trimStartLineBreaks
76
77
  });
77
78
  module.exports = __toCommonJS(index_exports);
78
79
 
79
80
  // src/utils/parse.ts
81
+ var import_uuid = require("uuid");
80
82
  var import_zod3 = require("zod");
81
83
 
82
84
  // src/utils/fetchers/generic.ts
@@ -198,13 +200,11 @@ function parseWhitespace(contentString, whitespace) {
198
200
  console.warn(`Invalid whitespace string provided: \u201C${whitespace}\u201D`);
199
201
  return contentString;
200
202
  }
201
- for (const [index, option] of result.data.entries()) {
203
+ for (const option of result.data) {
202
204
  switch (option) {
203
205
  case "newline": {
204
- if (index !== 0) {
205
- returnString = `<br />
206
+ returnString = `<br />
206
207
  ${returnString}`;
207
- }
208
208
  break;
209
209
  }
210
210
  case "trailing": {
@@ -259,7 +259,7 @@ function parseStringItem(item) {
259
259
  break;
260
260
  }
261
261
  }
262
- return returnString.replaceAll("&#39;", "'");
262
+ return trimStartLineBreaks(trimEndLineBreaks(returnString));
263
263
  }
264
264
  function parseStringDocumentItem(item, footnotes) {
265
265
  if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") {
@@ -382,7 +382,7 @@ function parseStringDocumentItem(item, footnotes) {
382
382
  );
383
383
  }
384
384
  }
385
- return returnString.replaceAll("&#39;", "'");
385
+ return trimStartLineBreaks(trimEndLineBreaks(returnString));
386
386
  }
387
387
  function trimEndLineBreaks(string) {
388
388
  const trimmedString = string.replaceAll(/^\n<br \/>|\n<br \/>$/g, "");
@@ -392,6 +392,14 @@ function trimEndLineBreaks(string) {
392
392
  }
393
393
  return trimmedString;
394
394
  }
395
+ function trimStartLineBreaks(string) {
396
+ const trimmedString = string.replaceAll(/^<br \/>\n|<br \/>\n$/g, "");
397
+ const leadingLineBreaks = /^<br \/>\n/.exec(trimmedString);
398
+ if (leadingLineBreaks) {
399
+ return trimStartLineBreaks(trimmedString);
400
+ }
401
+ return trimmedString;
402
+ }
395
403
  function parseStringContent(content, language = "eng") {
396
404
  switch (typeof content.content) {
397
405
  case "string":
@@ -1560,7 +1568,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1560
1568
  }
1561
1569
  let captionLayout = getPropertyValueByLabel(
1562
1570
  componentProperty.properties,
1563
- "caption-layout"
1571
+ "layout-caption"
1564
1572
  );
1565
1573
  if (captionLayout === null) {
1566
1574
  captionLayout = "bottom";
@@ -1736,7 +1744,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1736
1744
  }
1737
1745
  let captionLayout = getPropertyValueByLabel(
1738
1746
  componentProperty.properties,
1739
- "caption-layout"
1747
+ "layout-caption"
1740
1748
  );
1741
1749
  if (captionLayout === null) {
1742
1750
  captionLayout = "bottom";
@@ -1930,16 +1938,16 @@ async function parseWebpage(webpageResource) {
1930
1938
  if (!resourceType) {
1931
1939
  continue;
1932
1940
  }
1933
- if (resourceType !== "block") {
1941
+ if (resourceType === "element") {
1934
1942
  elementsToHandle.push(resource);
1935
- } else {
1943
+ } else if (resourceType === "block") {
1936
1944
  if (elementsToHandle.length > 0) {
1937
1945
  const elements = await parseWebpageResources(
1938
1946
  elementsToHandle,
1939
1947
  "element"
1940
1948
  );
1941
1949
  const block = {
1942
- uuid: resource.uuid,
1950
+ uuid: (0, import_uuid.v4)(),
1943
1951
  layout: "vertical",
1944
1952
  blocks: [],
1945
1953
  elements,
@@ -1961,7 +1969,7 @@ async function parseWebpage(webpageResource) {
1961
1969
  if (elementsToHandle.length > 0) {
1962
1970
  const elements = await parseWebpageResources(elementsToHandle, "element");
1963
1971
  const block = {
1964
- uuid: webpageResource.uuid,
1972
+ uuid: (0, import_uuid.v4)(),
1965
1973
  layout: "vertical",
1966
1974
  blocks: [],
1967
1975
  elements,
@@ -2168,7 +2176,6 @@ function parseWebsiteProperties(properties) {
2168
2176
  let isHeaderProjectDisplayed = true;
2169
2177
  let isFooterDisplayed = true;
2170
2178
  let isSidebarDisplayed = false;
2171
- let sidebarVariant = "default";
2172
2179
  let searchCollectionUuid = null;
2173
2180
  let supportsThemeToggle = true;
2174
2181
  const headerProperty = websiteProperties.find(
@@ -2207,12 +2214,6 @@ function parseWebsiteProperties(properties) {
2207
2214
  if (sidebarProperty) {
2208
2215
  isSidebarDisplayed = sidebarProperty.content === "Yes";
2209
2216
  }
2210
- const sidebarVariantProperty = websiteProperties.find(
2211
- (property) => property.label === "sidebar-variant"
2212
- )?.values[0];
2213
- if (sidebarVariantProperty) {
2214
- sidebarVariant = sidebarVariantProperty.content;
2215
- }
2216
2217
  const collectionSearchProperty = websiteProperties.find(
2217
2218
  (property) => property.label === "search-collection"
2218
2219
  )?.values[0];
@@ -2240,7 +2241,6 @@ function parseWebsiteProperties(properties) {
2240
2241
  isHeaderProjectDisplayed,
2241
2242
  isFooterDisplayed,
2242
2243
  isSidebarDisplayed,
2243
- sidebarVariant,
2244
2244
  supportsThemeToggle,
2245
2245
  searchCollectionUuid,
2246
2246
  logoUrl: logoUuid !== null ? `https://ochre.lib.uchicago.edu/ochre?uuid=${logoUuid}&load` : null
@@ -2271,6 +2271,7 @@ async function parseWebsite(websiteTree, projectName, website) {
2271
2271
  }
2272
2272
  };
2273
2273
  let sidebarLayout = "start";
2274
+ let sidebarMobileLayout = "default";
2274
2275
  const sidebarCssStyles = [];
2275
2276
  const sidebarResource = resources.find((resource) => {
2276
2277
  const resourceProperties = resource.properties ? parseProperties(
@@ -2296,6 +2297,12 @@ async function parseWebsite(websiteTree, projectName, website) {
2296
2297
  if (sidebarLayoutProperty) {
2297
2298
  sidebarLayout = sidebarLayoutProperty.values[0].content;
2298
2299
  }
2300
+ const sidebarMobileLayoutProperty = sidebarProperties.find(
2301
+ (property) => property.label === "layout-mobile"
2302
+ );
2303
+ if (sidebarMobileLayoutProperty) {
2304
+ sidebarMobileLayout = sidebarMobileLayoutProperty.values[0].content;
2305
+ }
2299
2306
  const cssProperties = sidebarBaseProperties.find(
2300
2307
  (property) => property.label === "presentation" && property.values[0].content === "css"
2301
2308
  )?.properties ?? [];
@@ -2348,6 +2355,7 @@ async function parseWebsite(websiteTree, projectName, website) {
2348
2355
  elements: sidebarElements,
2349
2356
  title: sidebarTitle,
2350
2357
  layout: sidebarLayout,
2358
+ mobileLayout: sidebarMobileLayout,
2351
2359
  cssStyles: sidebarCssStyles
2352
2360
  };
2353
2361
  }
@@ -2675,5 +2683,6 @@ async function fetchWebsite(abbreviation) {
2675
2683
  parseStringItem,
2676
2684
  parseTree,
2677
2685
  parseWebsite,
2678
- trimEndLineBreaks
2686
+ trimEndLineBreaks,
2687
+ trimStartLineBreaks
2679
2688
  });
package/dist/index.d.cts CHANGED
@@ -413,6 +413,7 @@ type Website = {
413
413
  elements: Array<WebElement>;
414
414
  title: WebElement["title"];
415
415
  layout: "start" | "end";
416
+ mobileLayout: "default" | "inline";
416
417
  cssStyles: Array<Style>;
417
418
  } | null;
418
419
  properties: WebsiteProperties;
@@ -430,7 +431,6 @@ type WebsiteProperties = {
430
431
  isHeaderProjectDisplayed: boolean;
431
432
  isFooterDisplayed: boolean;
432
433
  isSidebarDisplayed: boolean;
433
- sidebarVariant: "default" | "inline";
434
434
  supportsThemeToggle: boolean;
435
435
  searchCollectionUuid: string | null;
436
436
  logoUrl: string | null;
@@ -1838,6 +1838,19 @@ declare function parseStringDocumentItem(item: OchreStringRichTextItem, footnote
1838
1838
  * ```
1839
1839
  */
1840
1840
  declare function trimEndLineBreaks(string: string): string;
1841
+ /**
1842
+ * Removes leading line breaks from a string
1843
+ *
1844
+ * @param string - Input string to trim
1845
+ * @returns String with leading line breaks removed
1846
+ *
1847
+ * @example
1848
+ * ```ts
1849
+ * const trimmed = trimStartLineBreaks("<br />\n<br />\nHello");
1850
+ * // Returns: "Hello"
1851
+ * ```
1852
+ */
1853
+ declare function trimStartLineBreaks(string: string): string;
1841
1854
  /**
1842
1855
  * Parses raw string content into a formatted string
1843
1856
  *
@@ -1847,4 +1860,4 @@ declare function trimEndLineBreaks(string: string): string;
1847
1860
  */
1848
1861
  declare function parseStringContent(content: OchreStringContent, language?: string): string;
1849
1862
 
1850
- export { type Bibliography, type Block, type Concept, type Context, type ContextItem, type ContextNode, type Coordinates, type Data, type Document, type Event, type Footnote, type Gallery, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type License, type Link, type Metadata, type NestedConcept, type NestedResource, type NestedSpatialUnit, type Note, type Observation, type Period, type Person, type Property, type PropertyValue, type PropertyValueType, type Resource, type Set, type SpatialUnit, type Style, type Tree, type WebElement, type WebElementComponent, type WebImage, type Webpage, type WebpageProperties, type Website, type WebsiteProperties, fetchBibliography, fetchByUuid, fetchConcept, fetchGallery, fetchPeriod, fetchResource, fetchSet, fetchSpatialUnit, fetchTree, fetchWebsite, filterProperties, getAllPropertyLabels, getPropertyByLabel, getPropertyValueByLabel, getPropertyValuesByLabel, parseBibliographies, parseBibliography, parseConcept, parseConcepts, parseContext, parseCoordinates, parseDocument, parseEmailAndUrl, parseEvents, parseFakeString, parseIdentification, parseImage, parseImageMap, parseInterpretations, parseLanguages, parseLicense, parseLink, parseLinks, parseMetadata, parseNotes, parseObservation, parseObservations, parsePeriod, parsePeriods, parsePerson, parsePersons, parseProperties, parseResource, parseResources, parseSet, parseSpatialUnit, parseSpatialUnits, parseStringContent, parseStringDocumentItem, parseStringItem, parseTree, parseWebsite, trimEndLineBreaks };
1863
+ export { type Bibliography, type Block, type Concept, type Context, type ContextItem, type ContextNode, type Coordinates, type Data, type Document, type Event, type Footnote, type Gallery, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type License, type Link, type Metadata, type NestedConcept, type NestedResource, type NestedSpatialUnit, type Note, type Observation, type Period, type Person, type Property, type PropertyValue, type PropertyValueType, type Resource, type Set, type SpatialUnit, type Style, type Tree, type WebElement, type WebElementComponent, type WebImage, type Webpage, type WebpageProperties, type Website, type WebsiteProperties, fetchBibliography, fetchByUuid, fetchConcept, fetchGallery, fetchPeriod, fetchResource, fetchSet, fetchSpatialUnit, fetchTree, fetchWebsite, filterProperties, getAllPropertyLabels, getPropertyByLabel, getPropertyValueByLabel, getPropertyValuesByLabel, parseBibliographies, parseBibliography, parseConcept, parseConcepts, parseContext, parseCoordinates, parseDocument, parseEmailAndUrl, parseEvents, parseFakeString, parseIdentification, parseImage, parseImageMap, parseInterpretations, parseLanguages, parseLicense, parseLink, parseLinks, parseMetadata, parseNotes, parseObservation, parseObservations, parsePeriod, parsePeriods, parsePerson, parsePersons, parseProperties, parseResource, parseResources, parseSet, parseSpatialUnit, parseSpatialUnits, parseStringContent, parseStringDocumentItem, parseStringItem, parseTree, parseWebsite, trimEndLineBreaks, trimStartLineBreaks };
package/dist/index.d.ts CHANGED
@@ -413,6 +413,7 @@ type Website = {
413
413
  elements: Array<WebElement>;
414
414
  title: WebElement["title"];
415
415
  layout: "start" | "end";
416
+ mobileLayout: "default" | "inline";
416
417
  cssStyles: Array<Style>;
417
418
  } | null;
418
419
  properties: WebsiteProperties;
@@ -430,7 +431,6 @@ type WebsiteProperties = {
430
431
  isHeaderProjectDisplayed: boolean;
431
432
  isFooterDisplayed: boolean;
432
433
  isSidebarDisplayed: boolean;
433
- sidebarVariant: "default" | "inline";
434
434
  supportsThemeToggle: boolean;
435
435
  searchCollectionUuid: string | null;
436
436
  logoUrl: string | null;
@@ -1838,6 +1838,19 @@ declare function parseStringDocumentItem(item: OchreStringRichTextItem, footnote
1838
1838
  * ```
1839
1839
  */
1840
1840
  declare function trimEndLineBreaks(string: string): string;
1841
+ /**
1842
+ * Removes leading line breaks from a string
1843
+ *
1844
+ * @param string - Input string to trim
1845
+ * @returns String with leading line breaks removed
1846
+ *
1847
+ * @example
1848
+ * ```ts
1849
+ * const trimmed = trimStartLineBreaks("<br />\n<br />\nHello");
1850
+ * // Returns: "Hello"
1851
+ * ```
1852
+ */
1853
+ declare function trimStartLineBreaks(string: string): string;
1841
1854
  /**
1842
1855
  * Parses raw string content into a formatted string
1843
1856
  *
@@ -1847,4 +1860,4 @@ declare function trimEndLineBreaks(string: string): string;
1847
1860
  */
1848
1861
  declare function parseStringContent(content: OchreStringContent, language?: string): string;
1849
1862
 
1850
- export { type Bibliography, type Block, type Concept, type Context, type ContextItem, type ContextNode, type Coordinates, type Data, type Document, type Event, type Footnote, type Gallery, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type License, type Link, type Metadata, type NestedConcept, type NestedResource, type NestedSpatialUnit, type Note, type Observation, type Period, type Person, type Property, type PropertyValue, type PropertyValueType, type Resource, type Set, type SpatialUnit, type Style, type Tree, type WebElement, type WebElementComponent, type WebImage, type Webpage, type WebpageProperties, type Website, type WebsiteProperties, fetchBibliography, fetchByUuid, fetchConcept, fetchGallery, fetchPeriod, fetchResource, fetchSet, fetchSpatialUnit, fetchTree, fetchWebsite, filterProperties, getAllPropertyLabels, getPropertyByLabel, getPropertyValueByLabel, getPropertyValuesByLabel, parseBibliographies, parseBibliography, parseConcept, parseConcepts, parseContext, parseCoordinates, parseDocument, parseEmailAndUrl, parseEvents, parseFakeString, parseIdentification, parseImage, parseImageMap, parseInterpretations, parseLanguages, parseLicense, parseLink, parseLinks, parseMetadata, parseNotes, parseObservation, parseObservations, parsePeriod, parsePeriods, parsePerson, parsePersons, parseProperties, parseResource, parseResources, parseSet, parseSpatialUnit, parseSpatialUnits, parseStringContent, parseStringDocumentItem, parseStringItem, parseTree, parseWebsite, trimEndLineBreaks };
1863
+ export { type Bibliography, type Block, type Concept, type Context, type ContextItem, type ContextNode, type Coordinates, type Data, type Document, type Event, type Footnote, type Gallery, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type License, type Link, type Metadata, type NestedConcept, type NestedResource, type NestedSpatialUnit, type Note, type Observation, type Period, type Person, type Property, type PropertyValue, type PropertyValueType, type Resource, type Set, type SpatialUnit, type Style, type Tree, type WebElement, type WebElementComponent, type WebImage, type Webpage, type WebpageProperties, type Website, type WebsiteProperties, fetchBibliography, fetchByUuid, fetchConcept, fetchGallery, fetchPeriod, fetchResource, fetchSet, fetchSpatialUnit, fetchTree, fetchWebsite, filterProperties, getAllPropertyLabels, getPropertyByLabel, getPropertyValueByLabel, getPropertyValuesByLabel, parseBibliographies, parseBibliography, parseConcept, parseConcepts, parseContext, parseCoordinates, parseDocument, parseEmailAndUrl, parseEvents, parseFakeString, parseIdentification, parseImage, parseImageMap, parseInterpretations, parseLanguages, parseLicense, parseLink, parseLinks, parseMetadata, parseNotes, parseObservation, parseObservations, parsePeriod, parsePeriods, parsePerson, parsePersons, parseProperties, parseResource, parseResources, parseSet, parseSpatialUnit, parseSpatialUnits, parseStringContent, parseStringDocumentItem, parseStringItem, parseTree, parseWebsite, trimEndLineBreaks, trimStartLineBreaks };
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // src/utils/parse.ts
2
+ import { v4 as uuidv4 } from "uuid";
2
3
  import { z as z3 } from "zod";
3
4
 
4
5
  // src/utils/fetchers/generic.ts
@@ -120,13 +121,11 @@ function parseWhitespace(contentString, whitespace) {
120
121
  console.warn(`Invalid whitespace string provided: \u201C${whitespace}\u201D`);
121
122
  return contentString;
122
123
  }
123
- for (const [index, option] of result.data.entries()) {
124
+ for (const option of result.data) {
124
125
  switch (option) {
125
126
  case "newline": {
126
- if (index !== 0) {
127
- returnString = `<br />
127
+ returnString = `<br />
128
128
  ${returnString}`;
129
- }
130
129
  break;
131
130
  }
132
131
  case "trailing": {
@@ -181,7 +180,7 @@ function parseStringItem(item) {
181
180
  break;
182
181
  }
183
182
  }
184
- return returnString.replaceAll("&#39;", "'");
183
+ return trimStartLineBreaks(trimEndLineBreaks(returnString));
185
184
  }
186
185
  function parseStringDocumentItem(item, footnotes) {
187
186
  if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") {
@@ -304,7 +303,7 @@ function parseStringDocumentItem(item, footnotes) {
304
303
  );
305
304
  }
306
305
  }
307
- return returnString.replaceAll("&#39;", "'");
306
+ return trimStartLineBreaks(trimEndLineBreaks(returnString));
308
307
  }
309
308
  function trimEndLineBreaks(string) {
310
309
  const trimmedString = string.replaceAll(/^\n<br \/>|\n<br \/>$/g, "");
@@ -314,6 +313,14 @@ function trimEndLineBreaks(string) {
314
313
  }
315
314
  return trimmedString;
316
315
  }
316
+ function trimStartLineBreaks(string) {
317
+ const trimmedString = string.replaceAll(/^<br \/>\n|<br \/>\n$/g, "");
318
+ const leadingLineBreaks = /^<br \/>\n/.exec(trimmedString);
319
+ if (leadingLineBreaks) {
320
+ return trimStartLineBreaks(trimmedString);
321
+ }
322
+ return trimmedString;
323
+ }
317
324
  function parseStringContent(content, language = "eng") {
318
325
  switch (typeof content.content) {
319
326
  case "string":
@@ -1482,7 +1489,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1482
1489
  }
1483
1490
  let captionLayout = getPropertyValueByLabel(
1484
1491
  componentProperty.properties,
1485
- "caption-layout"
1492
+ "layout-caption"
1486
1493
  );
1487
1494
  if (captionLayout === null) {
1488
1495
  captionLayout = "bottom";
@@ -1658,7 +1665,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1658
1665
  }
1659
1666
  let captionLayout = getPropertyValueByLabel(
1660
1667
  componentProperty.properties,
1661
- "caption-layout"
1668
+ "layout-caption"
1662
1669
  );
1663
1670
  if (captionLayout === null) {
1664
1671
  captionLayout = "bottom";
@@ -1852,16 +1859,16 @@ async function parseWebpage(webpageResource) {
1852
1859
  if (!resourceType) {
1853
1860
  continue;
1854
1861
  }
1855
- if (resourceType !== "block") {
1862
+ if (resourceType === "element") {
1856
1863
  elementsToHandle.push(resource);
1857
- } else {
1864
+ } else if (resourceType === "block") {
1858
1865
  if (elementsToHandle.length > 0) {
1859
1866
  const elements = await parseWebpageResources(
1860
1867
  elementsToHandle,
1861
1868
  "element"
1862
1869
  );
1863
1870
  const block = {
1864
- uuid: resource.uuid,
1871
+ uuid: uuidv4(),
1865
1872
  layout: "vertical",
1866
1873
  blocks: [],
1867
1874
  elements,
@@ -1883,7 +1890,7 @@ async function parseWebpage(webpageResource) {
1883
1890
  if (elementsToHandle.length > 0) {
1884
1891
  const elements = await parseWebpageResources(elementsToHandle, "element");
1885
1892
  const block = {
1886
- uuid: webpageResource.uuid,
1893
+ uuid: uuidv4(),
1887
1894
  layout: "vertical",
1888
1895
  blocks: [],
1889
1896
  elements,
@@ -2090,7 +2097,6 @@ function parseWebsiteProperties(properties) {
2090
2097
  let isHeaderProjectDisplayed = true;
2091
2098
  let isFooterDisplayed = true;
2092
2099
  let isSidebarDisplayed = false;
2093
- let sidebarVariant = "default";
2094
2100
  let searchCollectionUuid = null;
2095
2101
  let supportsThemeToggle = true;
2096
2102
  const headerProperty = websiteProperties.find(
@@ -2129,12 +2135,6 @@ function parseWebsiteProperties(properties) {
2129
2135
  if (sidebarProperty) {
2130
2136
  isSidebarDisplayed = sidebarProperty.content === "Yes";
2131
2137
  }
2132
- const sidebarVariantProperty = websiteProperties.find(
2133
- (property) => property.label === "sidebar-variant"
2134
- )?.values[0];
2135
- if (sidebarVariantProperty) {
2136
- sidebarVariant = sidebarVariantProperty.content;
2137
- }
2138
2138
  const collectionSearchProperty = websiteProperties.find(
2139
2139
  (property) => property.label === "search-collection"
2140
2140
  )?.values[0];
@@ -2162,7 +2162,6 @@ function parseWebsiteProperties(properties) {
2162
2162
  isHeaderProjectDisplayed,
2163
2163
  isFooterDisplayed,
2164
2164
  isSidebarDisplayed,
2165
- sidebarVariant,
2166
2165
  supportsThemeToggle,
2167
2166
  searchCollectionUuid,
2168
2167
  logoUrl: logoUuid !== null ? `https://ochre.lib.uchicago.edu/ochre?uuid=${logoUuid}&load` : null
@@ -2193,6 +2192,7 @@ async function parseWebsite(websiteTree, projectName, website) {
2193
2192
  }
2194
2193
  };
2195
2194
  let sidebarLayout = "start";
2195
+ let sidebarMobileLayout = "default";
2196
2196
  const sidebarCssStyles = [];
2197
2197
  const sidebarResource = resources.find((resource) => {
2198
2198
  const resourceProperties = resource.properties ? parseProperties(
@@ -2218,6 +2218,12 @@ async function parseWebsite(websiteTree, projectName, website) {
2218
2218
  if (sidebarLayoutProperty) {
2219
2219
  sidebarLayout = sidebarLayoutProperty.values[0].content;
2220
2220
  }
2221
+ const sidebarMobileLayoutProperty = sidebarProperties.find(
2222
+ (property) => property.label === "layout-mobile"
2223
+ );
2224
+ if (sidebarMobileLayoutProperty) {
2225
+ sidebarMobileLayout = sidebarMobileLayoutProperty.values[0].content;
2226
+ }
2221
2227
  const cssProperties = sidebarBaseProperties.find(
2222
2228
  (property) => property.label === "presentation" && property.values[0].content === "css"
2223
2229
  )?.properties ?? [];
@@ -2270,6 +2276,7 @@ async function parseWebsite(websiteTree, projectName, website) {
2270
2276
  elements: sidebarElements,
2271
2277
  title: sidebarTitle,
2272
2278
  layout: sidebarLayout,
2279
+ mobileLayout: sidebarMobileLayout,
2273
2280
  cssStyles: sidebarCssStyles
2274
2281
  };
2275
2282
  }
@@ -2596,5 +2603,6 @@ export {
2596
2603
  parseStringItem,
2597
2604
  parseTree,
2598
2605
  parseWebsite,
2599
- trimEndLineBreaks
2606
+ trimEndLineBreaks,
2607
+ trimStartLineBreaks
2600
2608
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
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,6 +41,7 @@
41
41
  ],
42
42
  "dependencies": {
43
43
  "iso-639-3": "^3.0.1",
44
+ "uuid": "^11.1.0",
44
45
  "zod": "^3.24.2"
45
46
  },
46
47
  "devDependencies": {