@digitalculture/ochre-sdk 0.4.11 → 0.4.13

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
@@ -316,6 +316,9 @@ function parseStringDocumentItem(item, footnotes) {
316
316
  return `<TooltipSpan type="externalDocument" ${linkContent !== null ? `content="${linkContent}"` : ""}>${itemString}</TooltipSpan>`;
317
317
  }
318
318
  }
319
+ case "webpage": {
320
+ return `<ExternalLink href="${linkResource.href}" type="webpage" ${linkContent !== null ? `content="${linkContent}"` : ""}>${itemString}</ExternalLink>`;
321
+ }
319
322
  default: {
320
323
  return "";
321
324
  }
@@ -1882,6 +1885,14 @@ async function parseWebElement(elementResource, elementProperties) {
1882
1885
  const cssStyle = property.values[0].content;
1883
1886
  cssStyles.push({ label: property.label, value: cssStyle });
1884
1887
  }
1888
+ const mobileCssProperties = elementResourceProperties.find(
1889
+ (property) => property.label === "presentation" && property.values[0].content === "css-mobile"
1890
+ )?.properties ?? [];
1891
+ const cssStylesMobile = [];
1892
+ for (const property of mobileCssProperties) {
1893
+ const cssStyle = property.values[0].content;
1894
+ cssStylesMobile.push({ label: property.label, value: cssStyle });
1895
+ }
1885
1896
  const titleProperties = elementResourceProperties.find(
1886
1897
  (property) => property.label === "presentation" && property.values[0].content === "title"
1887
1898
  )?.properties;
@@ -1926,6 +1937,7 @@ async function parseWebElement(elementResource, elementProperties) {
1926
1937
  }
1927
1938
  },
1928
1939
  cssStyles,
1940
+ cssStylesMobile,
1929
1941
  ...properties
1930
1942
  };
1931
1943
  }
@@ -1975,12 +1987,14 @@ async function parseWebpage(webpageResource) {
1975
1987
  blocks: [],
1976
1988
  elements,
1977
1989
  properties: {
1978
- spacing: null,
1979
- gap: "none",
1990
+ spacing: void 0,
1991
+ gap: void 0,
1980
1992
  alignItems: "start",
1981
1993
  justifyContent: "stretch"
1982
1994
  },
1983
- cssStyles: []
1995
+ propertiesMobile: null,
1996
+ cssStyles: [],
1997
+ cssStylesMobile: []
1984
1998
  };
1985
1999
  blocks.push(block);
1986
2000
  elementsToHandle = [];
@@ -1997,12 +2011,14 @@ async function parseWebpage(webpageResource) {
1997
2011
  blocks: [],
1998
2012
  elements,
1999
2013
  properties: {
2000
- spacing: null,
2001
- gap: "none",
2014
+ spacing: void 0,
2015
+ gap: void 0,
2002
2016
  alignItems: "start",
2003
2017
  justifyContent: "stretch"
2004
2018
  },
2005
- cssStyles: []
2019
+ propertiesMobile: null,
2020
+ cssStyles: [],
2021
+ cssStylesMobile: []
2006
2022
  };
2007
2023
  blocks.push(block);
2008
2024
  }
@@ -2055,6 +2071,18 @@ async function parseWebpage(webpageResource) {
2055
2071
  });
2056
2072
  }
2057
2073
  }
2074
+ const mobileCssStyleSubProperties = webpageProperties.find(
2075
+ (property) => property.label === "presentation" && property.values[0]?.content === "css-mobile"
2076
+ )?.properties;
2077
+ const cssStylesMobile = [];
2078
+ if (mobileCssStyleSubProperties) {
2079
+ for (const property of mobileCssStyleSubProperties) {
2080
+ cssStylesMobile.push({
2081
+ label: property.label,
2082
+ value: property.values[0].content
2083
+ });
2084
+ }
2085
+ }
2058
2086
  return {
2059
2087
  title: identification.label,
2060
2088
  slug,
@@ -2065,7 +2093,8 @@ async function parseWebpage(webpageResource) {
2065
2093
  variant,
2066
2094
  backgroundImageUrl: imageLink ? `https://ochre.lib.uchicago.edu/ochre?uuid=${imageLink.uuid}&load` : null,
2067
2095
  isSidebarDisplayed,
2068
- cssStyles
2096
+ cssStyles,
2097
+ cssStylesMobile
2069
2098
  },
2070
2099
  webpages
2071
2100
  };
@@ -2088,12 +2117,14 @@ async function parseBlock(blockResource) {
2088
2117
  blocks: [],
2089
2118
  elements: [],
2090
2119
  properties: {
2091
- spacing: null,
2092
- gap: "none",
2120
+ spacing: void 0,
2121
+ gap: void 0,
2093
2122
  alignItems: "start",
2094
2123
  justifyContent: "stretch"
2095
2124
  },
2096
- cssStyles: []
2125
+ propertiesMobile: null,
2126
+ cssStyles: [],
2127
+ cssStylesMobile: []
2097
2128
  };
2098
2129
  const blockProperties = blockResource.properties ? parseProperties(
2099
2130
  Array.isArray(blockResource.properties.property) ? blockResource.properties.property : [blockResource.properties.property]
@@ -2132,6 +2163,17 @@ async function parseBlock(blockResource) {
2132
2163
  if (justifyContentProperty) {
2133
2164
  returnBlock.properties.justifyContent = justifyContentProperty.content;
2134
2165
  }
2166
+ const mobileOverwriteProperty = blockMainProperties.find(
2167
+ (property) => property.label === "overwrite-mobile"
2168
+ );
2169
+ if (mobileOverwriteProperty) {
2170
+ const mobileOverwriteProperties = mobileOverwriteProperty.properties;
2171
+ const propertiesMobile = {};
2172
+ for (const property of mobileOverwriteProperties) {
2173
+ propertiesMobile[property.label] = property.values[0].content;
2174
+ }
2175
+ returnBlock.propertiesMobile = propertiesMobile;
2176
+ }
2135
2177
  }
2136
2178
  const blockBlocks = blockResource.resource ? await parseWebpageResources(
2137
2179
  Array.isArray(blockResource.resource) ? blockResource.resource : [blockResource.resource],
@@ -2158,6 +2200,17 @@ async function parseBlock(blockResource) {
2158
2200
  });
2159
2201
  }
2160
2202
  }
2203
+ const blockMobileCssStyles = blockProperties.find(
2204
+ (property) => property.label === "presentation" && property.values[0]?.content === "css-mobile"
2205
+ )?.properties;
2206
+ if (blockMobileCssStyles) {
2207
+ for (const property of blockMobileCssStyles) {
2208
+ returnBlock.cssStylesMobile.push({
2209
+ label: property.label,
2210
+ value: property.values[0].content
2211
+ });
2212
+ }
2213
+ }
2161
2214
  return returnBlock;
2162
2215
  }
2163
2216
  function parseWebsiteProperties(properties) {
@@ -2296,6 +2349,7 @@ async function parseWebsite(websiteTree, projectName, website) {
2296
2349
  let sidebarLayout = "start";
2297
2350
  let sidebarMobileLayout = "default";
2298
2351
  const sidebarCssStyles = [];
2352
+ const sidebarCssStylesMobile = [];
2299
2353
  const sidebarResource = resources.find((resource) => {
2300
2354
  const resourceProperties = resource.properties ? parseProperties(
2301
2355
  Array.isArray(resource.properties.property) ? resource.properties.property : [resource.properties.property]
@@ -2333,6 +2387,13 @@ async function parseWebsite(websiteTree, projectName, website) {
2333
2387
  const cssStyle = property.values[0].content;
2334
2388
  sidebarCssStyles.push({ label: property.label, value: cssStyle });
2335
2389
  }
2390
+ const mobileCssProperties = sidebarBaseProperties.find(
2391
+ (property) => property.label === "presentation" && property.values[0].content === "css-mobile"
2392
+ )?.properties ?? [];
2393
+ for (const property of mobileCssProperties) {
2394
+ const cssStyle = property.values[0].content;
2395
+ sidebarCssStylesMobile.push({ label: property.label, value: cssStyle });
2396
+ }
2336
2397
  const titleProperties = sidebarBaseProperties.find(
2337
2398
  (property) => property.label === "presentation" && property.values[0].content === "title"
2338
2399
  )?.properties;
@@ -2379,7 +2440,8 @@ async function parseWebsite(websiteTree, projectName, website) {
2379
2440
  title: sidebarTitle,
2380
2441
  layout: sidebarLayout,
2381
2442
  mobileLayout: sidebarMobileLayout,
2382
- cssStyles: sidebarCssStyles
2443
+ cssStyles: sidebarCssStyles,
2444
+ cssStylesMobile: sidebarCssStylesMobile
2383
2445
  };
2384
2446
  }
2385
2447
  return {
package/dist/index.d.cts CHANGED
@@ -415,6 +415,7 @@ type Website = {
415
415
  layout: "start" | "end";
416
416
  mobileLayout: "default" | "inline";
417
417
  cssStyles: Array<Style>;
418
+ cssStylesMobile: Array<Style>;
418
419
  } | null;
419
420
  properties: WebsiteProperties;
420
421
  };
@@ -439,7 +440,7 @@ type Webpage = {
439
440
  title: string;
440
441
  slug: string;
441
442
  properties: WebpageProperties;
442
- blocks: Array<Block>;
443
+ blocks: Array<WebBlock>;
443
444
  webpages: Array<Webpage>;
444
445
  };
445
446
  /**
@@ -452,6 +453,7 @@ type WebpageProperties = {
452
453
  backgroundImageUrl: string | null;
453
454
  isSidebarDisplayed: boolean;
454
455
  cssStyles: Array<Style>;
456
+ cssStylesMobile: Array<Style>;
455
457
  };
456
458
  /**
457
459
  * Base properties for web elements
@@ -469,6 +471,7 @@ type WebElement = {
469
471
  };
470
472
  };
471
473
  cssStyles: Array<Style>;
474
+ cssStylesMobile: Array<Style>;
472
475
  } & WebElementComponent;
473
476
  /**
474
477
  * Union type of all possible web element components
@@ -583,20 +586,20 @@ type Style = {
583
586
  /**
584
587
  * Represents a block of vertical or horizontal content alignment
585
588
  */
586
- type Block = {
589
+ type WebBlock = {
587
590
  uuid: string;
588
591
  layout: "vertical" | "horizontal" | "grid";
589
- blocks: Array<Block>;
592
+ blocks: Array<WebBlock>;
590
593
  elements: Array<WebElement>;
591
594
  properties: {
592
595
  /**
593
596
  * valid `gridTemplateColumns` or `gridTemplateRows` CSS property value
594
597
  */
595
- spacing: string | null;
598
+ spacing: string | undefined;
596
599
  /**
597
600
  * `gap` CSS property value
598
601
  */
599
- gap: "none" | "small" | "medium" | "large";
602
+ gap: string | undefined;
600
603
  /**
601
604
  * `align-items` CSS property value
602
605
  */
@@ -606,7 +609,9 @@ type Block = {
606
609
  */
607
610
  justifyContent: "stretch" | "start" | "center" | "end" | "space-between";
608
611
  };
612
+ propertiesMobile: Record<string, string> | null;
609
613
  cssStyles: Array<Style>;
614
+ cssStylesMobile: Array<Style>;
610
615
  };
611
616
 
612
617
  /**
@@ -1023,6 +1028,7 @@ type OchreLinkItem = {
1023
1028
  widthPreview?: number;
1024
1029
  height?: number;
1025
1030
  width?: number;
1031
+ href?: string;
1026
1032
  };
1027
1033
 
1028
1034
  /**
@@ -1841,4 +1847,4 @@ declare function parseStringDocumentItem(item: OchreStringRichTextItem, footnote
1841
1847
  */
1842
1848
  declare function parseStringContent(content: OchreStringContent, language?: string): string;
1843
1849
 
1844
- 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 };
1850
+ export { type Bibliography, 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 WebBlock, 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 };
package/dist/index.d.ts CHANGED
@@ -415,6 +415,7 @@ type Website = {
415
415
  layout: "start" | "end";
416
416
  mobileLayout: "default" | "inline";
417
417
  cssStyles: Array<Style>;
418
+ cssStylesMobile: Array<Style>;
418
419
  } | null;
419
420
  properties: WebsiteProperties;
420
421
  };
@@ -439,7 +440,7 @@ type Webpage = {
439
440
  title: string;
440
441
  slug: string;
441
442
  properties: WebpageProperties;
442
- blocks: Array<Block>;
443
+ blocks: Array<WebBlock>;
443
444
  webpages: Array<Webpage>;
444
445
  };
445
446
  /**
@@ -452,6 +453,7 @@ type WebpageProperties = {
452
453
  backgroundImageUrl: string | null;
453
454
  isSidebarDisplayed: boolean;
454
455
  cssStyles: Array<Style>;
456
+ cssStylesMobile: Array<Style>;
455
457
  };
456
458
  /**
457
459
  * Base properties for web elements
@@ -469,6 +471,7 @@ type WebElement = {
469
471
  };
470
472
  };
471
473
  cssStyles: Array<Style>;
474
+ cssStylesMobile: Array<Style>;
472
475
  } & WebElementComponent;
473
476
  /**
474
477
  * Union type of all possible web element components
@@ -583,20 +586,20 @@ type Style = {
583
586
  /**
584
587
  * Represents a block of vertical or horizontal content alignment
585
588
  */
586
- type Block = {
589
+ type WebBlock = {
587
590
  uuid: string;
588
591
  layout: "vertical" | "horizontal" | "grid";
589
- blocks: Array<Block>;
592
+ blocks: Array<WebBlock>;
590
593
  elements: Array<WebElement>;
591
594
  properties: {
592
595
  /**
593
596
  * valid `gridTemplateColumns` or `gridTemplateRows` CSS property value
594
597
  */
595
- spacing: string | null;
598
+ spacing: string | undefined;
596
599
  /**
597
600
  * `gap` CSS property value
598
601
  */
599
- gap: "none" | "small" | "medium" | "large";
602
+ gap: string | undefined;
600
603
  /**
601
604
  * `align-items` CSS property value
602
605
  */
@@ -606,7 +609,9 @@ type Block = {
606
609
  */
607
610
  justifyContent: "stretch" | "start" | "center" | "end" | "space-between";
608
611
  };
612
+ propertiesMobile: Record<string, string> | null;
609
613
  cssStyles: Array<Style>;
614
+ cssStylesMobile: Array<Style>;
610
615
  };
611
616
 
612
617
  /**
@@ -1023,6 +1028,7 @@ type OchreLinkItem = {
1023
1028
  widthPreview?: number;
1024
1029
  height?: number;
1025
1030
  width?: number;
1031
+ href?: string;
1026
1032
  };
1027
1033
 
1028
1034
  /**
@@ -1841,4 +1847,4 @@ declare function parseStringDocumentItem(item: OchreStringRichTextItem, footnote
1841
1847
  */
1842
1848
  declare function parseStringContent(content: OchreStringContent, language?: string): string;
1843
1849
 
1844
- 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 };
1850
+ export { type Bibliography, 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 WebBlock, 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 };
package/dist/index.js CHANGED
@@ -239,6 +239,9 @@ function parseStringDocumentItem(item, footnotes) {
239
239
  return `<TooltipSpan type="externalDocument" ${linkContent !== null ? `content="${linkContent}"` : ""}>${itemString}</TooltipSpan>`;
240
240
  }
241
241
  }
242
+ case "webpage": {
243
+ return `<ExternalLink href="${linkResource.href}" type="webpage" ${linkContent !== null ? `content="${linkContent}"` : ""}>${itemString}</ExternalLink>`;
244
+ }
242
245
  default: {
243
246
  return "";
244
247
  }
@@ -1805,6 +1808,14 @@ async function parseWebElement(elementResource, elementProperties) {
1805
1808
  const cssStyle = property.values[0].content;
1806
1809
  cssStyles.push({ label: property.label, value: cssStyle });
1807
1810
  }
1811
+ const mobileCssProperties = elementResourceProperties.find(
1812
+ (property) => property.label === "presentation" && property.values[0].content === "css-mobile"
1813
+ )?.properties ?? [];
1814
+ const cssStylesMobile = [];
1815
+ for (const property of mobileCssProperties) {
1816
+ const cssStyle = property.values[0].content;
1817
+ cssStylesMobile.push({ label: property.label, value: cssStyle });
1818
+ }
1808
1819
  const titleProperties = elementResourceProperties.find(
1809
1820
  (property) => property.label === "presentation" && property.values[0].content === "title"
1810
1821
  )?.properties;
@@ -1849,6 +1860,7 @@ async function parseWebElement(elementResource, elementProperties) {
1849
1860
  }
1850
1861
  },
1851
1862
  cssStyles,
1863
+ cssStylesMobile,
1852
1864
  ...properties
1853
1865
  };
1854
1866
  }
@@ -1898,12 +1910,14 @@ async function parseWebpage(webpageResource) {
1898
1910
  blocks: [],
1899
1911
  elements,
1900
1912
  properties: {
1901
- spacing: null,
1902
- gap: "none",
1913
+ spacing: void 0,
1914
+ gap: void 0,
1903
1915
  alignItems: "start",
1904
1916
  justifyContent: "stretch"
1905
1917
  },
1906
- cssStyles: []
1918
+ propertiesMobile: null,
1919
+ cssStyles: [],
1920
+ cssStylesMobile: []
1907
1921
  };
1908
1922
  blocks.push(block);
1909
1923
  elementsToHandle = [];
@@ -1920,12 +1934,14 @@ async function parseWebpage(webpageResource) {
1920
1934
  blocks: [],
1921
1935
  elements,
1922
1936
  properties: {
1923
- spacing: null,
1924
- gap: "none",
1937
+ spacing: void 0,
1938
+ gap: void 0,
1925
1939
  alignItems: "start",
1926
1940
  justifyContent: "stretch"
1927
1941
  },
1928
- cssStyles: []
1942
+ propertiesMobile: null,
1943
+ cssStyles: [],
1944
+ cssStylesMobile: []
1929
1945
  };
1930
1946
  blocks.push(block);
1931
1947
  }
@@ -1978,6 +1994,18 @@ async function parseWebpage(webpageResource) {
1978
1994
  });
1979
1995
  }
1980
1996
  }
1997
+ const mobileCssStyleSubProperties = webpageProperties.find(
1998
+ (property) => property.label === "presentation" && property.values[0]?.content === "css-mobile"
1999
+ )?.properties;
2000
+ const cssStylesMobile = [];
2001
+ if (mobileCssStyleSubProperties) {
2002
+ for (const property of mobileCssStyleSubProperties) {
2003
+ cssStylesMobile.push({
2004
+ label: property.label,
2005
+ value: property.values[0].content
2006
+ });
2007
+ }
2008
+ }
1981
2009
  return {
1982
2010
  title: identification.label,
1983
2011
  slug,
@@ -1988,7 +2016,8 @@ async function parseWebpage(webpageResource) {
1988
2016
  variant,
1989
2017
  backgroundImageUrl: imageLink ? `https://ochre.lib.uchicago.edu/ochre?uuid=${imageLink.uuid}&load` : null,
1990
2018
  isSidebarDisplayed,
1991
- cssStyles
2019
+ cssStyles,
2020
+ cssStylesMobile
1992
2021
  },
1993
2022
  webpages
1994
2023
  };
@@ -2011,12 +2040,14 @@ async function parseBlock(blockResource) {
2011
2040
  blocks: [],
2012
2041
  elements: [],
2013
2042
  properties: {
2014
- spacing: null,
2015
- gap: "none",
2043
+ spacing: void 0,
2044
+ gap: void 0,
2016
2045
  alignItems: "start",
2017
2046
  justifyContent: "stretch"
2018
2047
  },
2019
- cssStyles: []
2048
+ propertiesMobile: null,
2049
+ cssStyles: [],
2050
+ cssStylesMobile: []
2020
2051
  };
2021
2052
  const blockProperties = blockResource.properties ? parseProperties(
2022
2053
  Array.isArray(blockResource.properties.property) ? blockResource.properties.property : [blockResource.properties.property]
@@ -2055,6 +2086,17 @@ async function parseBlock(blockResource) {
2055
2086
  if (justifyContentProperty) {
2056
2087
  returnBlock.properties.justifyContent = justifyContentProperty.content;
2057
2088
  }
2089
+ const mobileOverwriteProperty = blockMainProperties.find(
2090
+ (property) => property.label === "overwrite-mobile"
2091
+ );
2092
+ if (mobileOverwriteProperty) {
2093
+ const mobileOverwriteProperties = mobileOverwriteProperty.properties;
2094
+ const propertiesMobile = {};
2095
+ for (const property of mobileOverwriteProperties) {
2096
+ propertiesMobile[property.label] = property.values[0].content;
2097
+ }
2098
+ returnBlock.propertiesMobile = propertiesMobile;
2099
+ }
2058
2100
  }
2059
2101
  const blockBlocks = blockResource.resource ? await parseWebpageResources(
2060
2102
  Array.isArray(blockResource.resource) ? blockResource.resource : [blockResource.resource],
@@ -2081,6 +2123,17 @@ async function parseBlock(blockResource) {
2081
2123
  });
2082
2124
  }
2083
2125
  }
2126
+ const blockMobileCssStyles = blockProperties.find(
2127
+ (property) => property.label === "presentation" && property.values[0]?.content === "css-mobile"
2128
+ )?.properties;
2129
+ if (blockMobileCssStyles) {
2130
+ for (const property of blockMobileCssStyles) {
2131
+ returnBlock.cssStylesMobile.push({
2132
+ label: property.label,
2133
+ value: property.values[0].content
2134
+ });
2135
+ }
2136
+ }
2084
2137
  return returnBlock;
2085
2138
  }
2086
2139
  function parseWebsiteProperties(properties) {
@@ -2219,6 +2272,7 @@ async function parseWebsite(websiteTree, projectName, website) {
2219
2272
  let sidebarLayout = "start";
2220
2273
  let sidebarMobileLayout = "default";
2221
2274
  const sidebarCssStyles = [];
2275
+ const sidebarCssStylesMobile = [];
2222
2276
  const sidebarResource = resources.find((resource) => {
2223
2277
  const resourceProperties = resource.properties ? parseProperties(
2224
2278
  Array.isArray(resource.properties.property) ? resource.properties.property : [resource.properties.property]
@@ -2256,6 +2310,13 @@ async function parseWebsite(websiteTree, projectName, website) {
2256
2310
  const cssStyle = property.values[0].content;
2257
2311
  sidebarCssStyles.push({ label: property.label, value: cssStyle });
2258
2312
  }
2313
+ const mobileCssProperties = sidebarBaseProperties.find(
2314
+ (property) => property.label === "presentation" && property.values[0].content === "css-mobile"
2315
+ )?.properties ?? [];
2316
+ for (const property of mobileCssProperties) {
2317
+ const cssStyle = property.values[0].content;
2318
+ sidebarCssStylesMobile.push({ label: property.label, value: cssStyle });
2319
+ }
2259
2320
  const titleProperties = sidebarBaseProperties.find(
2260
2321
  (property) => property.label === "presentation" && property.values[0].content === "title"
2261
2322
  )?.properties;
@@ -2302,7 +2363,8 @@ async function parseWebsite(websiteTree, projectName, website) {
2302
2363
  title: sidebarTitle,
2303
2364
  layout: sidebarLayout,
2304
2365
  mobileLayout: sidebarMobileLayout,
2305
- cssStyles: sidebarCssStyles
2366
+ cssStyles: sidebarCssStyles,
2367
+ cssStylesMobile: sidebarCssStylesMobile
2306
2368
  };
2307
2369
  }
2308
2370
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalculture/ochre-sdk",
3
- "version": "0.4.11",
3
+ "version": "0.4.13",
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",