@digitalculture/ochre-sdk 0.4.4 → 0.4.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
@@ -72,7 +72,8 @@ __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
 
@@ -199,13 +200,11 @@ function parseWhitespace(contentString, whitespace) {
199
200
  console.warn(`Invalid whitespace string provided: \u201C${whitespace}\u201D`);
200
201
  return contentString;
201
202
  }
202
- for (const [index, option] of result.data.entries()) {
203
+ for (const option of result.data) {
203
204
  switch (option) {
204
205
  case "newline": {
205
- if (index !== 0) {
206
- returnString = `<br />
206
+ returnString = `<br />
207
207
  ${returnString}`;
208
- }
209
208
  break;
210
209
  }
211
210
  case "trailing": {
@@ -260,7 +259,7 @@ function parseStringItem(item) {
260
259
  break;
261
260
  }
262
261
  }
263
- return returnString.replaceAll("&#39;", "'");
262
+ return trimStartLineBreaks(trimEndLineBreaks(returnString));
264
263
  }
265
264
  function parseStringDocumentItem(item, footnotes) {
266
265
  if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") {
@@ -383,7 +382,7 @@ function parseStringDocumentItem(item, footnotes) {
383
382
  );
384
383
  }
385
384
  }
386
- return returnString.replaceAll("&#39;", "'");
385
+ return trimStartLineBreaks(trimEndLineBreaks(returnString));
387
386
  }
388
387
  function trimEndLineBreaks(string) {
389
388
  const trimmedString = string.replaceAll(/^\n<br \/>|\n<br \/>$/g, "");
@@ -393,6 +392,14 @@ function trimEndLineBreaks(string) {
393
392
  }
394
393
  return trimmedString;
395
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
+ }
396
403
  function parseStringContent(content, language = "eng") {
397
404
  switch (typeof content.content) {
398
405
  case "string":
@@ -1561,11 +1568,27 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1561
1568
  }
1562
1569
  let captionLayout = getPropertyValueByLabel(
1563
1570
  componentProperty.properties,
1564
- "caption-layout"
1571
+ "layout-caption"
1565
1572
  );
1566
1573
  if (captionLayout === null) {
1567
1574
  captionLayout = "bottom";
1568
1575
  }
1576
+ let width = null;
1577
+ const widthProperty = getPropertyValueByLabel(
1578
+ componentProperty.properties,
1579
+ "width"
1580
+ );
1581
+ if (widthProperty !== null) {
1582
+ width = Number.parseFloat(widthProperty);
1583
+ }
1584
+ let height = null;
1585
+ const heightProperty = getPropertyValueByLabel(
1586
+ componentProperty.properties,
1587
+ "height"
1588
+ );
1589
+ if (heightProperty !== null) {
1590
+ height = Number.parseFloat(heightProperty);
1591
+ }
1569
1592
  let isFullWidth = true;
1570
1593
  const isFullWidthProperty = getPropertyValueByLabel(
1571
1594
  componentProperty.properties,
@@ -1625,13 +1648,15 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1625
1648
  }
1626
1649
  properties.images = images;
1627
1650
  properties.variant = variant;
1628
- properties.carouselOptions = carouselOptions;
1651
+ properties.width = width;
1652
+ properties.height = height;
1629
1653
  properties.isFullWidth = isFullWidth;
1630
1654
  properties.isFullHeight = isFullHeight;
1631
1655
  properties.imageQuality = imageQuality;
1632
1656
  properties.captionLayout = captionLayout;
1633
1657
  properties.captionSource = captionSource;
1634
1658
  properties.altTextSource = altTextSource;
1659
+ properties.carouselOptions = carouselOptions;
1635
1660
  break;
1636
1661
  }
1637
1662
  case "image-gallery": {
@@ -1737,7 +1762,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1737
1762
  }
1738
1763
  let captionLayout = getPropertyValueByLabel(
1739
1764
  componentProperty.properties,
1740
- "caption-layout"
1765
+ "layout-caption"
1741
1766
  );
1742
1767
  if (captionLayout === null) {
1743
1768
  captionLayout = "bottom";
@@ -1931,9 +1956,9 @@ async function parseWebpage(webpageResource) {
1931
1956
  if (!resourceType) {
1932
1957
  continue;
1933
1958
  }
1934
- if (resourceType !== "block") {
1959
+ if (resourceType === "element") {
1935
1960
  elementsToHandle.push(resource);
1936
- } else {
1961
+ } else if (resourceType === "block") {
1937
1962
  if (elementsToHandle.length > 0) {
1938
1963
  const elements = await parseWebpageResources(
1939
1964
  elementsToHandle,
@@ -2169,7 +2194,6 @@ function parseWebsiteProperties(properties) {
2169
2194
  let isHeaderProjectDisplayed = true;
2170
2195
  let isFooterDisplayed = true;
2171
2196
  let isSidebarDisplayed = false;
2172
- let sidebarVariant = "default";
2173
2197
  let searchCollectionUuid = null;
2174
2198
  let supportsThemeToggle = true;
2175
2199
  const headerProperty = websiteProperties.find(
@@ -2208,12 +2232,6 @@ function parseWebsiteProperties(properties) {
2208
2232
  if (sidebarProperty) {
2209
2233
  isSidebarDisplayed = sidebarProperty.content === "Yes";
2210
2234
  }
2211
- const sidebarVariantProperty = websiteProperties.find(
2212
- (property) => property.label === "sidebar-variant"
2213
- )?.values[0];
2214
- if (sidebarVariantProperty) {
2215
- sidebarVariant = sidebarVariantProperty.content;
2216
- }
2217
2235
  const collectionSearchProperty = websiteProperties.find(
2218
2236
  (property) => property.label === "search-collection"
2219
2237
  )?.values[0];
@@ -2241,7 +2259,6 @@ function parseWebsiteProperties(properties) {
2241
2259
  isHeaderProjectDisplayed,
2242
2260
  isFooterDisplayed,
2243
2261
  isSidebarDisplayed,
2244
- sidebarVariant,
2245
2262
  supportsThemeToggle,
2246
2263
  searchCollectionUuid,
2247
2264
  logoUrl: logoUuid !== null ? `https://ochre.lib.uchicago.edu/ochre?uuid=${logoUuid}&load` : null
@@ -2272,6 +2289,7 @@ async function parseWebsite(websiteTree, projectName, website) {
2272
2289
  }
2273
2290
  };
2274
2291
  let sidebarLayout = "start";
2292
+ let sidebarMobileLayout = "default";
2275
2293
  const sidebarCssStyles = [];
2276
2294
  const sidebarResource = resources.find((resource) => {
2277
2295
  const resourceProperties = resource.properties ? parseProperties(
@@ -2297,6 +2315,12 @@ async function parseWebsite(websiteTree, projectName, website) {
2297
2315
  if (sidebarLayoutProperty) {
2298
2316
  sidebarLayout = sidebarLayoutProperty.values[0].content;
2299
2317
  }
2318
+ const sidebarMobileLayoutProperty = sidebarProperties.find(
2319
+ (property) => property.label === "layout-mobile"
2320
+ );
2321
+ if (sidebarMobileLayoutProperty) {
2322
+ sidebarMobileLayout = sidebarMobileLayoutProperty.values[0].content;
2323
+ }
2300
2324
  const cssProperties = sidebarBaseProperties.find(
2301
2325
  (property) => property.label === "presentation" && property.values[0].content === "css"
2302
2326
  )?.properties ?? [];
@@ -2349,6 +2373,7 @@ async function parseWebsite(websiteTree, projectName, website) {
2349
2373
  elements: sidebarElements,
2350
2374
  title: sidebarTitle,
2351
2375
  layout: sidebarLayout,
2376
+ mobileLayout: sidebarMobileLayout,
2352
2377
  cssStyles: sidebarCssStyles
2353
2378
  };
2354
2379
  }
@@ -2676,5 +2701,6 @@ async function fetchWebsite(abbreviation) {
2676
2701
  parseStringItem,
2677
2702
  parseTree,
2678
2703
  parseWebsite,
2679
- trimEndLineBreaks
2704
+ trimEndLineBreaks,
2705
+ trimStartLineBreaks
2680
2706
  });
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;
@@ -510,15 +510,17 @@ type WebElementComponent = {
510
510
  component: "image";
511
511
  images: Array<WebImage>;
512
512
  variant: "default" | "carousel";
513
- carouselOptions: {
514
- secondsPerImage: number;
515
- } | null;
513
+ width: number | null;
514
+ height: number | null;
516
515
  isFullWidth: boolean;
517
516
  isFullHeight: boolean;
518
517
  imageQuality: "high" | "low";
519
518
  captionSource: "name" | "abbreviation" | "description";
520
519
  captionLayout: "top" | "bottom" | "suppress";
521
520
  altTextSource: "name" | "abbreviation" | "description";
521
+ carouselOptions: {
522
+ secondsPerImage: number;
523
+ } | null;
522
524
  } | {
523
525
  component: "image-gallery";
524
526
  galleryId: string;
@@ -1838,6 +1840,19 @@ declare function parseStringDocumentItem(item: OchreStringRichTextItem, footnote
1838
1840
  * ```
1839
1841
  */
1840
1842
  declare function trimEndLineBreaks(string: string): string;
1843
+ /**
1844
+ * Removes leading line breaks from a string
1845
+ *
1846
+ * @param string - Input string to trim
1847
+ * @returns String with leading line breaks removed
1848
+ *
1849
+ * @example
1850
+ * ```ts
1851
+ * const trimmed = trimStartLineBreaks("<br />\n<br />\nHello");
1852
+ * // Returns: "Hello"
1853
+ * ```
1854
+ */
1855
+ declare function trimStartLineBreaks(string: string): string;
1841
1856
  /**
1842
1857
  * Parses raw string content into a formatted string
1843
1858
  *
@@ -1847,4 +1862,4 @@ declare function trimEndLineBreaks(string: string): string;
1847
1862
  */
1848
1863
  declare function parseStringContent(content: OchreStringContent, language?: string): string;
1849
1864
 
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 };
1865
+ 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;
@@ -510,15 +510,17 @@ type WebElementComponent = {
510
510
  component: "image";
511
511
  images: Array<WebImage>;
512
512
  variant: "default" | "carousel";
513
- carouselOptions: {
514
- secondsPerImage: number;
515
- } | null;
513
+ width: number | null;
514
+ height: number | null;
516
515
  isFullWidth: boolean;
517
516
  isFullHeight: boolean;
518
517
  imageQuality: "high" | "low";
519
518
  captionSource: "name" | "abbreviation" | "description";
520
519
  captionLayout: "top" | "bottom" | "suppress";
521
520
  altTextSource: "name" | "abbreviation" | "description";
521
+ carouselOptions: {
522
+ secondsPerImage: number;
523
+ } | null;
522
524
  } | {
523
525
  component: "image-gallery";
524
526
  galleryId: string;
@@ -1838,6 +1840,19 @@ declare function parseStringDocumentItem(item: OchreStringRichTextItem, footnote
1838
1840
  * ```
1839
1841
  */
1840
1842
  declare function trimEndLineBreaks(string: string): string;
1843
+ /**
1844
+ * Removes leading line breaks from a string
1845
+ *
1846
+ * @param string - Input string to trim
1847
+ * @returns String with leading line breaks removed
1848
+ *
1849
+ * @example
1850
+ * ```ts
1851
+ * const trimmed = trimStartLineBreaks("<br />\n<br />\nHello");
1852
+ * // Returns: "Hello"
1853
+ * ```
1854
+ */
1855
+ declare function trimStartLineBreaks(string: string): string;
1841
1856
  /**
1842
1857
  * Parses raw string content into a formatted string
1843
1858
  *
@@ -1847,4 +1862,4 @@ declare function trimEndLineBreaks(string: string): string;
1847
1862
  */
1848
1863
  declare function parseStringContent(content: OchreStringContent, language?: string): string;
1849
1864
 
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 };
1865
+ 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
@@ -121,13 +121,11 @@ function parseWhitespace(contentString, whitespace) {
121
121
  console.warn(`Invalid whitespace string provided: \u201C${whitespace}\u201D`);
122
122
  return contentString;
123
123
  }
124
- for (const [index, option] of result.data.entries()) {
124
+ for (const option of result.data) {
125
125
  switch (option) {
126
126
  case "newline": {
127
- if (index !== 0) {
128
- returnString = `<br />
127
+ returnString = `<br />
129
128
  ${returnString}`;
130
- }
131
129
  break;
132
130
  }
133
131
  case "trailing": {
@@ -182,7 +180,7 @@ function parseStringItem(item) {
182
180
  break;
183
181
  }
184
182
  }
185
- return returnString.replaceAll("&#39;", "'");
183
+ return trimStartLineBreaks(trimEndLineBreaks(returnString));
186
184
  }
187
185
  function parseStringDocumentItem(item, footnotes) {
188
186
  if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") {
@@ -305,7 +303,7 @@ function parseStringDocumentItem(item, footnotes) {
305
303
  );
306
304
  }
307
305
  }
308
- return returnString.replaceAll("&#39;", "'");
306
+ return trimStartLineBreaks(trimEndLineBreaks(returnString));
309
307
  }
310
308
  function trimEndLineBreaks(string) {
311
309
  const trimmedString = string.replaceAll(/^\n<br \/>|\n<br \/>$/g, "");
@@ -315,6 +313,14 @@ function trimEndLineBreaks(string) {
315
313
  }
316
314
  return trimmedString;
317
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
+ }
318
324
  function parseStringContent(content, language = "eng") {
319
325
  switch (typeof content.content) {
320
326
  case "string":
@@ -1483,11 +1489,27 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1483
1489
  }
1484
1490
  let captionLayout = getPropertyValueByLabel(
1485
1491
  componentProperty.properties,
1486
- "caption-layout"
1492
+ "layout-caption"
1487
1493
  );
1488
1494
  if (captionLayout === null) {
1489
1495
  captionLayout = "bottom";
1490
1496
  }
1497
+ let width = null;
1498
+ const widthProperty = getPropertyValueByLabel(
1499
+ componentProperty.properties,
1500
+ "width"
1501
+ );
1502
+ if (widthProperty !== null) {
1503
+ width = Number.parseFloat(widthProperty);
1504
+ }
1505
+ let height = null;
1506
+ const heightProperty = getPropertyValueByLabel(
1507
+ componentProperty.properties,
1508
+ "height"
1509
+ );
1510
+ if (heightProperty !== null) {
1511
+ height = Number.parseFloat(heightProperty);
1512
+ }
1491
1513
  let isFullWidth = true;
1492
1514
  const isFullWidthProperty = getPropertyValueByLabel(
1493
1515
  componentProperty.properties,
@@ -1547,13 +1569,15 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1547
1569
  }
1548
1570
  properties.images = images;
1549
1571
  properties.variant = variant;
1550
- properties.carouselOptions = carouselOptions;
1572
+ properties.width = width;
1573
+ properties.height = height;
1551
1574
  properties.isFullWidth = isFullWidth;
1552
1575
  properties.isFullHeight = isFullHeight;
1553
1576
  properties.imageQuality = imageQuality;
1554
1577
  properties.captionLayout = captionLayout;
1555
1578
  properties.captionSource = captionSource;
1556
1579
  properties.altTextSource = altTextSource;
1580
+ properties.carouselOptions = carouselOptions;
1557
1581
  break;
1558
1582
  }
1559
1583
  case "image-gallery": {
@@ -1659,7 +1683,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
1659
1683
  }
1660
1684
  let captionLayout = getPropertyValueByLabel(
1661
1685
  componentProperty.properties,
1662
- "caption-layout"
1686
+ "layout-caption"
1663
1687
  );
1664
1688
  if (captionLayout === null) {
1665
1689
  captionLayout = "bottom";
@@ -1853,9 +1877,9 @@ async function parseWebpage(webpageResource) {
1853
1877
  if (!resourceType) {
1854
1878
  continue;
1855
1879
  }
1856
- if (resourceType !== "block") {
1880
+ if (resourceType === "element") {
1857
1881
  elementsToHandle.push(resource);
1858
- } else {
1882
+ } else if (resourceType === "block") {
1859
1883
  if (elementsToHandle.length > 0) {
1860
1884
  const elements = await parseWebpageResources(
1861
1885
  elementsToHandle,
@@ -2091,7 +2115,6 @@ function parseWebsiteProperties(properties) {
2091
2115
  let isHeaderProjectDisplayed = true;
2092
2116
  let isFooterDisplayed = true;
2093
2117
  let isSidebarDisplayed = false;
2094
- let sidebarVariant = "default";
2095
2118
  let searchCollectionUuid = null;
2096
2119
  let supportsThemeToggle = true;
2097
2120
  const headerProperty = websiteProperties.find(
@@ -2130,12 +2153,6 @@ function parseWebsiteProperties(properties) {
2130
2153
  if (sidebarProperty) {
2131
2154
  isSidebarDisplayed = sidebarProperty.content === "Yes";
2132
2155
  }
2133
- const sidebarVariantProperty = websiteProperties.find(
2134
- (property) => property.label === "sidebar-variant"
2135
- )?.values[0];
2136
- if (sidebarVariantProperty) {
2137
- sidebarVariant = sidebarVariantProperty.content;
2138
- }
2139
2156
  const collectionSearchProperty = websiteProperties.find(
2140
2157
  (property) => property.label === "search-collection"
2141
2158
  )?.values[0];
@@ -2163,7 +2180,6 @@ function parseWebsiteProperties(properties) {
2163
2180
  isHeaderProjectDisplayed,
2164
2181
  isFooterDisplayed,
2165
2182
  isSidebarDisplayed,
2166
- sidebarVariant,
2167
2183
  supportsThemeToggle,
2168
2184
  searchCollectionUuid,
2169
2185
  logoUrl: logoUuid !== null ? `https://ochre.lib.uchicago.edu/ochre?uuid=${logoUuid}&load` : null
@@ -2194,6 +2210,7 @@ async function parseWebsite(websiteTree, projectName, website) {
2194
2210
  }
2195
2211
  };
2196
2212
  let sidebarLayout = "start";
2213
+ let sidebarMobileLayout = "default";
2197
2214
  const sidebarCssStyles = [];
2198
2215
  const sidebarResource = resources.find((resource) => {
2199
2216
  const resourceProperties = resource.properties ? parseProperties(
@@ -2219,6 +2236,12 @@ async function parseWebsite(websiteTree, projectName, website) {
2219
2236
  if (sidebarLayoutProperty) {
2220
2237
  sidebarLayout = sidebarLayoutProperty.values[0].content;
2221
2238
  }
2239
+ const sidebarMobileLayoutProperty = sidebarProperties.find(
2240
+ (property) => property.label === "layout-mobile"
2241
+ );
2242
+ if (sidebarMobileLayoutProperty) {
2243
+ sidebarMobileLayout = sidebarMobileLayoutProperty.values[0].content;
2244
+ }
2222
2245
  const cssProperties = sidebarBaseProperties.find(
2223
2246
  (property) => property.label === "presentation" && property.values[0].content === "css"
2224
2247
  )?.properties ?? [];
@@ -2271,6 +2294,7 @@ async function parseWebsite(websiteTree, projectName, website) {
2271
2294
  elements: sidebarElements,
2272
2295
  title: sidebarTitle,
2273
2296
  layout: sidebarLayout,
2297
+ mobileLayout: sidebarMobileLayout,
2274
2298
  cssStyles: sidebarCssStyles
2275
2299
  };
2276
2300
  }
@@ -2597,5 +2621,6 @@ export {
2597
2621
  parseStringItem,
2598
2622
  parseTree,
2599
2623
  parseWebsite,
2600
- trimEndLineBreaks
2624
+ trimEndLineBreaks,
2625
+ trimStartLineBreaks
2601
2626
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.4.4",
3
+ "version": "0.4.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",