@digitalculture/ochre-sdk 0.4.4 → 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 +28 -20
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +26 -19
- package/package.json +1 -1
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
|
|
203
|
+
for (const option of result.data) {
|
|
203
204
|
switch (option) {
|
|
204
205
|
case "newline": {
|
|
205
|
-
|
|
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
|
|
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
|
|
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,7 +1568,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1561
1568
|
}
|
|
1562
1569
|
let captionLayout = getPropertyValueByLabel(
|
|
1563
1570
|
componentProperty.properties,
|
|
1564
|
-
"caption
|
|
1571
|
+
"layout-caption"
|
|
1565
1572
|
);
|
|
1566
1573
|
if (captionLayout === null) {
|
|
1567
1574
|
captionLayout = "bottom";
|
|
@@ -1737,7 +1744,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1737
1744
|
}
|
|
1738
1745
|
let captionLayout = getPropertyValueByLabel(
|
|
1739
1746
|
componentProperty.properties,
|
|
1740
|
-
"caption
|
|
1747
|
+
"layout-caption"
|
|
1741
1748
|
);
|
|
1742
1749
|
if (captionLayout === null) {
|
|
1743
1750
|
captionLayout = "bottom";
|
|
@@ -1931,9 +1938,9 @@ async function parseWebpage(webpageResource) {
|
|
|
1931
1938
|
if (!resourceType) {
|
|
1932
1939
|
continue;
|
|
1933
1940
|
}
|
|
1934
|
-
if (resourceType
|
|
1941
|
+
if (resourceType === "element") {
|
|
1935
1942
|
elementsToHandle.push(resource);
|
|
1936
|
-
} else {
|
|
1943
|
+
} else if (resourceType === "block") {
|
|
1937
1944
|
if (elementsToHandle.length > 0) {
|
|
1938
1945
|
const elements = await parseWebpageResources(
|
|
1939
1946
|
elementsToHandle,
|
|
@@ -2169,7 +2176,6 @@ function parseWebsiteProperties(properties) {
|
|
|
2169
2176
|
let isHeaderProjectDisplayed = true;
|
|
2170
2177
|
let isFooterDisplayed = true;
|
|
2171
2178
|
let isSidebarDisplayed = false;
|
|
2172
|
-
let sidebarVariant = "default";
|
|
2173
2179
|
let searchCollectionUuid = null;
|
|
2174
2180
|
let supportsThemeToggle = true;
|
|
2175
2181
|
const headerProperty = websiteProperties.find(
|
|
@@ -2208,12 +2214,6 @@ function parseWebsiteProperties(properties) {
|
|
|
2208
2214
|
if (sidebarProperty) {
|
|
2209
2215
|
isSidebarDisplayed = sidebarProperty.content === "Yes";
|
|
2210
2216
|
}
|
|
2211
|
-
const sidebarVariantProperty = websiteProperties.find(
|
|
2212
|
-
(property) => property.label === "sidebar-variant"
|
|
2213
|
-
)?.values[0];
|
|
2214
|
-
if (sidebarVariantProperty) {
|
|
2215
|
-
sidebarVariant = sidebarVariantProperty.content;
|
|
2216
|
-
}
|
|
2217
2217
|
const collectionSearchProperty = websiteProperties.find(
|
|
2218
2218
|
(property) => property.label === "search-collection"
|
|
2219
2219
|
)?.values[0];
|
|
@@ -2241,7 +2241,6 @@ function parseWebsiteProperties(properties) {
|
|
|
2241
2241
|
isHeaderProjectDisplayed,
|
|
2242
2242
|
isFooterDisplayed,
|
|
2243
2243
|
isSidebarDisplayed,
|
|
2244
|
-
sidebarVariant,
|
|
2245
2244
|
supportsThemeToggle,
|
|
2246
2245
|
searchCollectionUuid,
|
|
2247
2246
|
logoUrl: logoUuid !== null ? `https://ochre.lib.uchicago.edu/ochre?uuid=${logoUuid}&load` : null
|
|
@@ -2272,6 +2271,7 @@ async function parseWebsite(websiteTree, projectName, website) {
|
|
|
2272
2271
|
}
|
|
2273
2272
|
};
|
|
2274
2273
|
let sidebarLayout = "start";
|
|
2274
|
+
let sidebarMobileLayout = "default";
|
|
2275
2275
|
const sidebarCssStyles = [];
|
|
2276
2276
|
const sidebarResource = resources.find((resource) => {
|
|
2277
2277
|
const resourceProperties = resource.properties ? parseProperties(
|
|
@@ -2297,6 +2297,12 @@ async function parseWebsite(websiteTree, projectName, website) {
|
|
|
2297
2297
|
if (sidebarLayoutProperty) {
|
|
2298
2298
|
sidebarLayout = sidebarLayoutProperty.values[0].content;
|
|
2299
2299
|
}
|
|
2300
|
+
const sidebarMobileLayoutProperty = sidebarProperties.find(
|
|
2301
|
+
(property) => property.label === "layout-mobile"
|
|
2302
|
+
);
|
|
2303
|
+
if (sidebarMobileLayoutProperty) {
|
|
2304
|
+
sidebarMobileLayout = sidebarMobileLayoutProperty.values[0].content;
|
|
2305
|
+
}
|
|
2300
2306
|
const cssProperties = sidebarBaseProperties.find(
|
|
2301
2307
|
(property) => property.label === "presentation" && property.values[0].content === "css"
|
|
2302
2308
|
)?.properties ?? [];
|
|
@@ -2349,6 +2355,7 @@ async function parseWebsite(websiteTree, projectName, website) {
|
|
|
2349
2355
|
elements: sidebarElements,
|
|
2350
2356
|
title: sidebarTitle,
|
|
2351
2357
|
layout: sidebarLayout,
|
|
2358
|
+
mobileLayout: sidebarMobileLayout,
|
|
2352
2359
|
cssStyles: sidebarCssStyles
|
|
2353
2360
|
};
|
|
2354
2361
|
}
|
|
@@ -2676,5 +2683,6 @@ async function fetchWebsite(abbreviation) {
|
|
|
2676
2683
|
parseStringItem,
|
|
2677
2684
|
parseTree,
|
|
2678
2685
|
parseWebsite,
|
|
2679
|
-
trimEndLineBreaks
|
|
2686
|
+
trimEndLineBreaks,
|
|
2687
|
+
trimStartLineBreaks
|
|
2680
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
|
@@ -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
|
|
124
|
+
for (const option of result.data) {
|
|
125
125
|
switch (option) {
|
|
126
126
|
case "newline": {
|
|
127
|
-
|
|
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
|
|
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
|
|
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,7 +1489,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1483
1489
|
}
|
|
1484
1490
|
let captionLayout = getPropertyValueByLabel(
|
|
1485
1491
|
componentProperty.properties,
|
|
1486
|
-
"caption
|
|
1492
|
+
"layout-caption"
|
|
1487
1493
|
);
|
|
1488
1494
|
if (captionLayout === null) {
|
|
1489
1495
|
captionLayout = "bottom";
|
|
@@ -1659,7 +1665,7 @@ async function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1659
1665
|
}
|
|
1660
1666
|
let captionLayout = getPropertyValueByLabel(
|
|
1661
1667
|
componentProperty.properties,
|
|
1662
|
-
"caption
|
|
1668
|
+
"layout-caption"
|
|
1663
1669
|
);
|
|
1664
1670
|
if (captionLayout === null) {
|
|
1665
1671
|
captionLayout = "bottom";
|
|
@@ -1853,9 +1859,9 @@ async function parseWebpage(webpageResource) {
|
|
|
1853
1859
|
if (!resourceType) {
|
|
1854
1860
|
continue;
|
|
1855
1861
|
}
|
|
1856
|
-
if (resourceType
|
|
1862
|
+
if (resourceType === "element") {
|
|
1857
1863
|
elementsToHandle.push(resource);
|
|
1858
|
-
} else {
|
|
1864
|
+
} else if (resourceType === "block") {
|
|
1859
1865
|
if (elementsToHandle.length > 0) {
|
|
1860
1866
|
const elements = await parseWebpageResources(
|
|
1861
1867
|
elementsToHandle,
|
|
@@ -2091,7 +2097,6 @@ function parseWebsiteProperties(properties) {
|
|
|
2091
2097
|
let isHeaderProjectDisplayed = true;
|
|
2092
2098
|
let isFooterDisplayed = true;
|
|
2093
2099
|
let isSidebarDisplayed = false;
|
|
2094
|
-
let sidebarVariant = "default";
|
|
2095
2100
|
let searchCollectionUuid = null;
|
|
2096
2101
|
let supportsThemeToggle = true;
|
|
2097
2102
|
const headerProperty = websiteProperties.find(
|
|
@@ -2130,12 +2135,6 @@ function parseWebsiteProperties(properties) {
|
|
|
2130
2135
|
if (sidebarProperty) {
|
|
2131
2136
|
isSidebarDisplayed = sidebarProperty.content === "Yes";
|
|
2132
2137
|
}
|
|
2133
|
-
const sidebarVariantProperty = websiteProperties.find(
|
|
2134
|
-
(property) => property.label === "sidebar-variant"
|
|
2135
|
-
)?.values[0];
|
|
2136
|
-
if (sidebarVariantProperty) {
|
|
2137
|
-
sidebarVariant = sidebarVariantProperty.content;
|
|
2138
|
-
}
|
|
2139
2138
|
const collectionSearchProperty = websiteProperties.find(
|
|
2140
2139
|
(property) => property.label === "search-collection"
|
|
2141
2140
|
)?.values[0];
|
|
@@ -2163,7 +2162,6 @@ function parseWebsiteProperties(properties) {
|
|
|
2163
2162
|
isHeaderProjectDisplayed,
|
|
2164
2163
|
isFooterDisplayed,
|
|
2165
2164
|
isSidebarDisplayed,
|
|
2166
|
-
sidebarVariant,
|
|
2167
2165
|
supportsThemeToggle,
|
|
2168
2166
|
searchCollectionUuid,
|
|
2169
2167
|
logoUrl: logoUuid !== null ? `https://ochre.lib.uchicago.edu/ochre?uuid=${logoUuid}&load` : null
|
|
@@ -2194,6 +2192,7 @@ async function parseWebsite(websiteTree, projectName, website) {
|
|
|
2194
2192
|
}
|
|
2195
2193
|
};
|
|
2196
2194
|
let sidebarLayout = "start";
|
|
2195
|
+
let sidebarMobileLayout = "default";
|
|
2197
2196
|
const sidebarCssStyles = [];
|
|
2198
2197
|
const sidebarResource = resources.find((resource) => {
|
|
2199
2198
|
const resourceProperties = resource.properties ? parseProperties(
|
|
@@ -2219,6 +2218,12 @@ async function parseWebsite(websiteTree, projectName, website) {
|
|
|
2219
2218
|
if (sidebarLayoutProperty) {
|
|
2220
2219
|
sidebarLayout = sidebarLayoutProperty.values[0].content;
|
|
2221
2220
|
}
|
|
2221
|
+
const sidebarMobileLayoutProperty = sidebarProperties.find(
|
|
2222
|
+
(property) => property.label === "layout-mobile"
|
|
2223
|
+
);
|
|
2224
|
+
if (sidebarMobileLayoutProperty) {
|
|
2225
|
+
sidebarMobileLayout = sidebarMobileLayoutProperty.values[0].content;
|
|
2226
|
+
}
|
|
2222
2227
|
const cssProperties = sidebarBaseProperties.find(
|
|
2223
2228
|
(property) => property.label === "presentation" && property.values[0].content === "css"
|
|
2224
2229
|
)?.properties ?? [];
|
|
@@ -2271,6 +2276,7 @@ async function parseWebsite(websiteTree, projectName, website) {
|
|
|
2271
2276
|
elements: sidebarElements,
|
|
2272
2277
|
title: sidebarTitle,
|
|
2273
2278
|
layout: sidebarLayout,
|
|
2279
|
+
mobileLayout: sidebarMobileLayout,
|
|
2274
2280
|
cssStyles: sidebarCssStyles
|
|
2275
2281
|
};
|
|
2276
2282
|
}
|
|
@@ -2597,5 +2603,6 @@ export {
|
|
|
2597
2603
|
parseStringItem,
|
|
2598
2604
|
parseTree,
|
|
2599
2605
|
parseWebsite,
|
|
2600
|
-
trimEndLineBreaks
|
|
2606
|
+
trimEndLineBreaks,
|
|
2607
|
+
trimStartLineBreaks
|
|
2601
2608
|
};
|
package/package.json
CHANGED