@digitalculture/ochre-sdk 0.4.11 → 0.4.12
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 +70 -11
- package/dist/index.d.cts +11 -6
- package/dist/index.d.ts +11 -6
- package/dist/index.js +70 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1882,6 +1882,14 @@ async function parseWebElement(elementResource, elementProperties) {
|
|
|
1882
1882
|
const cssStyle = property.values[0].content;
|
|
1883
1883
|
cssStyles.push({ label: property.label, value: cssStyle });
|
|
1884
1884
|
}
|
|
1885
|
+
const mobileCssProperties = elementResourceProperties.find(
|
|
1886
|
+
(property) => property.label === "presentation" && property.values[0].content === "css-mobile"
|
|
1887
|
+
)?.properties ?? [];
|
|
1888
|
+
const cssStylesMobile = [];
|
|
1889
|
+
for (const property of mobileCssProperties) {
|
|
1890
|
+
const cssStyle = property.values[0].content;
|
|
1891
|
+
cssStylesMobile.push({ label: property.label, value: cssStyle });
|
|
1892
|
+
}
|
|
1885
1893
|
const titleProperties = elementResourceProperties.find(
|
|
1886
1894
|
(property) => property.label === "presentation" && property.values[0].content === "title"
|
|
1887
1895
|
)?.properties;
|
|
@@ -1926,6 +1934,7 @@ async function parseWebElement(elementResource, elementProperties) {
|
|
|
1926
1934
|
}
|
|
1927
1935
|
},
|
|
1928
1936
|
cssStyles,
|
|
1937
|
+
cssStylesMobile,
|
|
1929
1938
|
...properties
|
|
1930
1939
|
};
|
|
1931
1940
|
}
|
|
@@ -1975,12 +1984,14 @@ async function parseWebpage(webpageResource) {
|
|
|
1975
1984
|
blocks: [],
|
|
1976
1985
|
elements,
|
|
1977
1986
|
properties: {
|
|
1978
|
-
spacing:
|
|
1979
|
-
gap:
|
|
1987
|
+
spacing: void 0,
|
|
1988
|
+
gap: void 0,
|
|
1980
1989
|
alignItems: "start",
|
|
1981
1990
|
justifyContent: "stretch"
|
|
1982
1991
|
},
|
|
1983
|
-
|
|
1992
|
+
propertiesMobile: null,
|
|
1993
|
+
cssStyles: [],
|
|
1994
|
+
cssStylesMobile: []
|
|
1984
1995
|
};
|
|
1985
1996
|
blocks.push(block);
|
|
1986
1997
|
elementsToHandle = [];
|
|
@@ -1997,12 +2008,14 @@ async function parseWebpage(webpageResource) {
|
|
|
1997
2008
|
blocks: [],
|
|
1998
2009
|
elements,
|
|
1999
2010
|
properties: {
|
|
2000
|
-
spacing:
|
|
2001
|
-
gap:
|
|
2011
|
+
spacing: void 0,
|
|
2012
|
+
gap: void 0,
|
|
2002
2013
|
alignItems: "start",
|
|
2003
2014
|
justifyContent: "stretch"
|
|
2004
2015
|
},
|
|
2005
|
-
|
|
2016
|
+
propertiesMobile: null,
|
|
2017
|
+
cssStyles: [],
|
|
2018
|
+
cssStylesMobile: []
|
|
2006
2019
|
};
|
|
2007
2020
|
blocks.push(block);
|
|
2008
2021
|
}
|
|
@@ -2055,6 +2068,18 @@ async function parseWebpage(webpageResource) {
|
|
|
2055
2068
|
});
|
|
2056
2069
|
}
|
|
2057
2070
|
}
|
|
2071
|
+
const mobileCssStyleSubProperties = webpageProperties.find(
|
|
2072
|
+
(property) => property.label === "presentation" && property.values[0]?.content === "css-mobile"
|
|
2073
|
+
)?.properties;
|
|
2074
|
+
const cssStylesMobile = [];
|
|
2075
|
+
if (mobileCssStyleSubProperties) {
|
|
2076
|
+
for (const property of mobileCssStyleSubProperties) {
|
|
2077
|
+
cssStylesMobile.push({
|
|
2078
|
+
label: property.label,
|
|
2079
|
+
value: property.values[0].content
|
|
2080
|
+
});
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2058
2083
|
return {
|
|
2059
2084
|
title: identification.label,
|
|
2060
2085
|
slug,
|
|
@@ -2065,7 +2090,8 @@ async function parseWebpage(webpageResource) {
|
|
|
2065
2090
|
variant,
|
|
2066
2091
|
backgroundImageUrl: imageLink ? `https://ochre.lib.uchicago.edu/ochre?uuid=${imageLink.uuid}&load` : null,
|
|
2067
2092
|
isSidebarDisplayed,
|
|
2068
|
-
cssStyles
|
|
2093
|
+
cssStyles,
|
|
2094
|
+
cssStylesMobile
|
|
2069
2095
|
},
|
|
2070
2096
|
webpages
|
|
2071
2097
|
};
|
|
@@ -2088,12 +2114,14 @@ async function parseBlock(blockResource) {
|
|
|
2088
2114
|
blocks: [],
|
|
2089
2115
|
elements: [],
|
|
2090
2116
|
properties: {
|
|
2091
|
-
spacing:
|
|
2092
|
-
gap:
|
|
2117
|
+
spacing: void 0,
|
|
2118
|
+
gap: void 0,
|
|
2093
2119
|
alignItems: "start",
|
|
2094
2120
|
justifyContent: "stretch"
|
|
2095
2121
|
},
|
|
2096
|
-
|
|
2122
|
+
propertiesMobile: null,
|
|
2123
|
+
cssStyles: [],
|
|
2124
|
+
cssStylesMobile: []
|
|
2097
2125
|
};
|
|
2098
2126
|
const blockProperties = blockResource.properties ? parseProperties(
|
|
2099
2127
|
Array.isArray(blockResource.properties.property) ? blockResource.properties.property : [blockResource.properties.property]
|
|
@@ -2132,6 +2160,17 @@ async function parseBlock(blockResource) {
|
|
|
2132
2160
|
if (justifyContentProperty) {
|
|
2133
2161
|
returnBlock.properties.justifyContent = justifyContentProperty.content;
|
|
2134
2162
|
}
|
|
2163
|
+
const mobileOverwriteProperty = blockMainProperties.find(
|
|
2164
|
+
(property) => property.label === "overwrite-mobile"
|
|
2165
|
+
);
|
|
2166
|
+
if (mobileOverwriteProperty) {
|
|
2167
|
+
const mobileOverwriteProperties = mobileOverwriteProperty.properties;
|
|
2168
|
+
const propertiesMobile = {};
|
|
2169
|
+
for (const property of mobileOverwriteProperties) {
|
|
2170
|
+
propertiesMobile[property.label] = property.values[0].content;
|
|
2171
|
+
}
|
|
2172
|
+
returnBlock.propertiesMobile = propertiesMobile;
|
|
2173
|
+
}
|
|
2135
2174
|
}
|
|
2136
2175
|
const blockBlocks = blockResource.resource ? await parseWebpageResources(
|
|
2137
2176
|
Array.isArray(blockResource.resource) ? blockResource.resource : [blockResource.resource],
|
|
@@ -2158,6 +2197,17 @@ async function parseBlock(blockResource) {
|
|
|
2158
2197
|
});
|
|
2159
2198
|
}
|
|
2160
2199
|
}
|
|
2200
|
+
const blockMobileCssStyles = blockProperties.find(
|
|
2201
|
+
(property) => property.label === "presentation" && property.values[0]?.content === "css-mobile"
|
|
2202
|
+
)?.properties;
|
|
2203
|
+
if (blockMobileCssStyles) {
|
|
2204
|
+
for (const property of blockMobileCssStyles) {
|
|
2205
|
+
returnBlock.cssStylesMobile.push({
|
|
2206
|
+
label: property.label,
|
|
2207
|
+
value: property.values[0].content
|
|
2208
|
+
});
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2161
2211
|
return returnBlock;
|
|
2162
2212
|
}
|
|
2163
2213
|
function parseWebsiteProperties(properties) {
|
|
@@ -2296,6 +2346,7 @@ async function parseWebsite(websiteTree, projectName, website) {
|
|
|
2296
2346
|
let sidebarLayout = "start";
|
|
2297
2347
|
let sidebarMobileLayout = "default";
|
|
2298
2348
|
const sidebarCssStyles = [];
|
|
2349
|
+
const sidebarCssStylesMobile = [];
|
|
2299
2350
|
const sidebarResource = resources.find((resource) => {
|
|
2300
2351
|
const resourceProperties = resource.properties ? parseProperties(
|
|
2301
2352
|
Array.isArray(resource.properties.property) ? resource.properties.property : [resource.properties.property]
|
|
@@ -2333,6 +2384,13 @@ async function parseWebsite(websiteTree, projectName, website) {
|
|
|
2333
2384
|
const cssStyle = property.values[0].content;
|
|
2334
2385
|
sidebarCssStyles.push({ label: property.label, value: cssStyle });
|
|
2335
2386
|
}
|
|
2387
|
+
const mobileCssProperties = sidebarBaseProperties.find(
|
|
2388
|
+
(property) => property.label === "presentation" && property.values[0].content === "css-mobile"
|
|
2389
|
+
)?.properties ?? [];
|
|
2390
|
+
for (const property of mobileCssProperties) {
|
|
2391
|
+
const cssStyle = property.values[0].content;
|
|
2392
|
+
sidebarCssStylesMobile.push({ label: property.label, value: cssStyle });
|
|
2393
|
+
}
|
|
2336
2394
|
const titleProperties = sidebarBaseProperties.find(
|
|
2337
2395
|
(property) => property.label === "presentation" && property.values[0].content === "title"
|
|
2338
2396
|
)?.properties;
|
|
@@ -2379,7 +2437,8 @@ async function parseWebsite(websiteTree, projectName, website) {
|
|
|
2379
2437
|
title: sidebarTitle,
|
|
2380
2438
|
layout: sidebarLayout,
|
|
2381
2439
|
mobileLayout: sidebarMobileLayout,
|
|
2382
|
-
cssStyles: sidebarCssStyles
|
|
2440
|
+
cssStyles: sidebarCssStyles,
|
|
2441
|
+
cssStylesMobile: sidebarCssStylesMobile
|
|
2383
2442
|
};
|
|
2384
2443
|
}
|
|
2385
2444
|
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<
|
|
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
|
|
589
|
+
type WebBlock = {
|
|
587
590
|
uuid: string;
|
|
588
591
|
layout: "vertical" | "horizontal" | "grid";
|
|
589
|
-
blocks: Array<
|
|
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 |
|
|
598
|
+
spacing: string | undefined;
|
|
596
599
|
/**
|
|
597
600
|
* `gap` CSS property value
|
|
598
601
|
*/
|
|
599
|
-
gap:
|
|
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
|
/**
|
|
@@ -1841,4 +1846,4 @@ declare function parseStringDocumentItem(item: OchreStringRichTextItem, footnote
|
|
|
1841
1846
|
*/
|
|
1842
1847
|
declare function parseStringContent(content: OchreStringContent, language?: string): string;
|
|
1843
1848
|
|
|
1844
|
-
export { type Bibliography, type
|
|
1849
|
+
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<
|
|
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
|
|
589
|
+
type WebBlock = {
|
|
587
590
|
uuid: string;
|
|
588
591
|
layout: "vertical" | "horizontal" | "grid";
|
|
589
|
-
blocks: Array<
|
|
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 |
|
|
598
|
+
spacing: string | undefined;
|
|
596
599
|
/**
|
|
597
600
|
* `gap` CSS property value
|
|
598
601
|
*/
|
|
599
|
-
gap:
|
|
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
|
/**
|
|
@@ -1841,4 +1846,4 @@ declare function parseStringDocumentItem(item: OchreStringRichTextItem, footnote
|
|
|
1841
1846
|
*/
|
|
1842
1847
|
declare function parseStringContent(content: OchreStringContent, language?: string): string;
|
|
1843
1848
|
|
|
1844
|
-
export { type Bibliography, type
|
|
1849
|
+
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
|
@@ -1805,6 +1805,14 @@ async function parseWebElement(elementResource, elementProperties) {
|
|
|
1805
1805
|
const cssStyle = property.values[0].content;
|
|
1806
1806
|
cssStyles.push({ label: property.label, value: cssStyle });
|
|
1807
1807
|
}
|
|
1808
|
+
const mobileCssProperties = elementResourceProperties.find(
|
|
1809
|
+
(property) => property.label === "presentation" && property.values[0].content === "css-mobile"
|
|
1810
|
+
)?.properties ?? [];
|
|
1811
|
+
const cssStylesMobile = [];
|
|
1812
|
+
for (const property of mobileCssProperties) {
|
|
1813
|
+
const cssStyle = property.values[0].content;
|
|
1814
|
+
cssStylesMobile.push({ label: property.label, value: cssStyle });
|
|
1815
|
+
}
|
|
1808
1816
|
const titleProperties = elementResourceProperties.find(
|
|
1809
1817
|
(property) => property.label === "presentation" && property.values[0].content === "title"
|
|
1810
1818
|
)?.properties;
|
|
@@ -1849,6 +1857,7 @@ async function parseWebElement(elementResource, elementProperties) {
|
|
|
1849
1857
|
}
|
|
1850
1858
|
},
|
|
1851
1859
|
cssStyles,
|
|
1860
|
+
cssStylesMobile,
|
|
1852
1861
|
...properties
|
|
1853
1862
|
};
|
|
1854
1863
|
}
|
|
@@ -1898,12 +1907,14 @@ async function parseWebpage(webpageResource) {
|
|
|
1898
1907
|
blocks: [],
|
|
1899
1908
|
elements,
|
|
1900
1909
|
properties: {
|
|
1901
|
-
spacing:
|
|
1902
|
-
gap:
|
|
1910
|
+
spacing: void 0,
|
|
1911
|
+
gap: void 0,
|
|
1903
1912
|
alignItems: "start",
|
|
1904
1913
|
justifyContent: "stretch"
|
|
1905
1914
|
},
|
|
1906
|
-
|
|
1915
|
+
propertiesMobile: null,
|
|
1916
|
+
cssStyles: [],
|
|
1917
|
+
cssStylesMobile: []
|
|
1907
1918
|
};
|
|
1908
1919
|
blocks.push(block);
|
|
1909
1920
|
elementsToHandle = [];
|
|
@@ -1920,12 +1931,14 @@ async function parseWebpage(webpageResource) {
|
|
|
1920
1931
|
blocks: [],
|
|
1921
1932
|
elements,
|
|
1922
1933
|
properties: {
|
|
1923
|
-
spacing:
|
|
1924
|
-
gap:
|
|
1934
|
+
spacing: void 0,
|
|
1935
|
+
gap: void 0,
|
|
1925
1936
|
alignItems: "start",
|
|
1926
1937
|
justifyContent: "stretch"
|
|
1927
1938
|
},
|
|
1928
|
-
|
|
1939
|
+
propertiesMobile: null,
|
|
1940
|
+
cssStyles: [],
|
|
1941
|
+
cssStylesMobile: []
|
|
1929
1942
|
};
|
|
1930
1943
|
blocks.push(block);
|
|
1931
1944
|
}
|
|
@@ -1978,6 +1991,18 @@ async function parseWebpage(webpageResource) {
|
|
|
1978
1991
|
});
|
|
1979
1992
|
}
|
|
1980
1993
|
}
|
|
1994
|
+
const mobileCssStyleSubProperties = webpageProperties.find(
|
|
1995
|
+
(property) => property.label === "presentation" && property.values[0]?.content === "css-mobile"
|
|
1996
|
+
)?.properties;
|
|
1997
|
+
const cssStylesMobile = [];
|
|
1998
|
+
if (mobileCssStyleSubProperties) {
|
|
1999
|
+
for (const property of mobileCssStyleSubProperties) {
|
|
2000
|
+
cssStylesMobile.push({
|
|
2001
|
+
label: property.label,
|
|
2002
|
+
value: property.values[0].content
|
|
2003
|
+
});
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
1981
2006
|
return {
|
|
1982
2007
|
title: identification.label,
|
|
1983
2008
|
slug,
|
|
@@ -1988,7 +2013,8 @@ async function parseWebpage(webpageResource) {
|
|
|
1988
2013
|
variant,
|
|
1989
2014
|
backgroundImageUrl: imageLink ? `https://ochre.lib.uchicago.edu/ochre?uuid=${imageLink.uuid}&load` : null,
|
|
1990
2015
|
isSidebarDisplayed,
|
|
1991
|
-
cssStyles
|
|
2016
|
+
cssStyles,
|
|
2017
|
+
cssStylesMobile
|
|
1992
2018
|
},
|
|
1993
2019
|
webpages
|
|
1994
2020
|
};
|
|
@@ -2011,12 +2037,14 @@ async function parseBlock(blockResource) {
|
|
|
2011
2037
|
blocks: [],
|
|
2012
2038
|
elements: [],
|
|
2013
2039
|
properties: {
|
|
2014
|
-
spacing:
|
|
2015
|
-
gap:
|
|
2040
|
+
spacing: void 0,
|
|
2041
|
+
gap: void 0,
|
|
2016
2042
|
alignItems: "start",
|
|
2017
2043
|
justifyContent: "stretch"
|
|
2018
2044
|
},
|
|
2019
|
-
|
|
2045
|
+
propertiesMobile: null,
|
|
2046
|
+
cssStyles: [],
|
|
2047
|
+
cssStylesMobile: []
|
|
2020
2048
|
};
|
|
2021
2049
|
const blockProperties = blockResource.properties ? parseProperties(
|
|
2022
2050
|
Array.isArray(blockResource.properties.property) ? blockResource.properties.property : [blockResource.properties.property]
|
|
@@ -2055,6 +2083,17 @@ async function parseBlock(blockResource) {
|
|
|
2055
2083
|
if (justifyContentProperty) {
|
|
2056
2084
|
returnBlock.properties.justifyContent = justifyContentProperty.content;
|
|
2057
2085
|
}
|
|
2086
|
+
const mobileOverwriteProperty = blockMainProperties.find(
|
|
2087
|
+
(property) => property.label === "overwrite-mobile"
|
|
2088
|
+
);
|
|
2089
|
+
if (mobileOverwriteProperty) {
|
|
2090
|
+
const mobileOverwriteProperties = mobileOverwriteProperty.properties;
|
|
2091
|
+
const propertiesMobile = {};
|
|
2092
|
+
for (const property of mobileOverwriteProperties) {
|
|
2093
|
+
propertiesMobile[property.label] = property.values[0].content;
|
|
2094
|
+
}
|
|
2095
|
+
returnBlock.propertiesMobile = propertiesMobile;
|
|
2096
|
+
}
|
|
2058
2097
|
}
|
|
2059
2098
|
const blockBlocks = blockResource.resource ? await parseWebpageResources(
|
|
2060
2099
|
Array.isArray(blockResource.resource) ? blockResource.resource : [blockResource.resource],
|
|
@@ -2081,6 +2120,17 @@ async function parseBlock(blockResource) {
|
|
|
2081
2120
|
});
|
|
2082
2121
|
}
|
|
2083
2122
|
}
|
|
2123
|
+
const blockMobileCssStyles = blockProperties.find(
|
|
2124
|
+
(property) => property.label === "presentation" && property.values[0]?.content === "css-mobile"
|
|
2125
|
+
)?.properties;
|
|
2126
|
+
if (blockMobileCssStyles) {
|
|
2127
|
+
for (const property of blockMobileCssStyles) {
|
|
2128
|
+
returnBlock.cssStylesMobile.push({
|
|
2129
|
+
label: property.label,
|
|
2130
|
+
value: property.values[0].content
|
|
2131
|
+
});
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2084
2134
|
return returnBlock;
|
|
2085
2135
|
}
|
|
2086
2136
|
function parseWebsiteProperties(properties) {
|
|
@@ -2219,6 +2269,7 @@ async function parseWebsite(websiteTree, projectName, website) {
|
|
|
2219
2269
|
let sidebarLayout = "start";
|
|
2220
2270
|
let sidebarMobileLayout = "default";
|
|
2221
2271
|
const sidebarCssStyles = [];
|
|
2272
|
+
const sidebarCssStylesMobile = [];
|
|
2222
2273
|
const sidebarResource = resources.find((resource) => {
|
|
2223
2274
|
const resourceProperties = resource.properties ? parseProperties(
|
|
2224
2275
|
Array.isArray(resource.properties.property) ? resource.properties.property : [resource.properties.property]
|
|
@@ -2256,6 +2307,13 @@ async function parseWebsite(websiteTree, projectName, website) {
|
|
|
2256
2307
|
const cssStyle = property.values[0].content;
|
|
2257
2308
|
sidebarCssStyles.push({ label: property.label, value: cssStyle });
|
|
2258
2309
|
}
|
|
2310
|
+
const mobileCssProperties = sidebarBaseProperties.find(
|
|
2311
|
+
(property) => property.label === "presentation" && property.values[0].content === "css-mobile"
|
|
2312
|
+
)?.properties ?? [];
|
|
2313
|
+
for (const property of mobileCssProperties) {
|
|
2314
|
+
const cssStyle = property.values[0].content;
|
|
2315
|
+
sidebarCssStylesMobile.push({ label: property.label, value: cssStyle });
|
|
2316
|
+
}
|
|
2259
2317
|
const titleProperties = sidebarBaseProperties.find(
|
|
2260
2318
|
(property) => property.label === "presentation" && property.values[0].content === "title"
|
|
2261
2319
|
)?.properties;
|
|
@@ -2302,7 +2360,8 @@ async function parseWebsite(websiteTree, projectName, website) {
|
|
|
2302
2360
|
title: sidebarTitle,
|
|
2303
2361
|
layout: sidebarLayout,
|
|
2304
2362
|
mobileLayout: sidebarMobileLayout,
|
|
2305
|
-
cssStyles: sidebarCssStyles
|
|
2363
|
+
cssStyles: sidebarCssStyles,
|
|
2364
|
+
cssStylesMobile: sidebarCssStylesMobile
|
|
2306
2365
|
};
|
|
2307
2366
|
}
|
|
2308
2367
|
return {
|
package/package.json
CHANGED