@digitalculture/ochre-sdk 0.12.10 → 0.12.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.d.mts +26 -19
- package/dist/index.mjs +26 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -559,36 +559,39 @@ type Website = {
|
|
|
559
559
|
isHeaderProjectDisplayed: boolean;
|
|
560
560
|
isFooterDisplayed: boolean;
|
|
561
561
|
isSidebarDisplayed: boolean;
|
|
562
|
-
|
|
562
|
+
headerSearchBarPageSlug: string | null;
|
|
563
563
|
iiifViewer: "universal-viewer" | "clover";
|
|
564
564
|
supportsThemeToggle: boolean;
|
|
565
565
|
defaultTheme: "light" | "dark" | null;
|
|
566
566
|
logoUrl: string | null;
|
|
567
567
|
};
|
|
568
568
|
};
|
|
569
|
+
/**
|
|
570
|
+
* Represents a webpage with its title, slug, properties, items and subpages
|
|
571
|
+
*/
|
|
569
572
|
type Webpage = {
|
|
570
573
|
title: string;
|
|
571
574
|
slug: string;
|
|
572
|
-
properties:
|
|
575
|
+
properties: {
|
|
576
|
+
displayedInHeader: boolean;
|
|
577
|
+
width: "full" | "large" | "narrow" | "default";
|
|
578
|
+
variant: "default" | "no-background";
|
|
579
|
+
backgroundImageUrl: string | null;
|
|
580
|
+
isBreadcrumbsDisplayed: boolean;
|
|
581
|
+
isSidebarDisplayed: boolean;
|
|
582
|
+
isHeaderSearchBarDisplayed: boolean;
|
|
583
|
+
cssStyles: {
|
|
584
|
+
default: Array<Style>;
|
|
585
|
+
tablet: Array<Style>;
|
|
586
|
+
mobile: Array<Style>;
|
|
587
|
+
};
|
|
588
|
+
};
|
|
573
589
|
items: Array<WebElement | WebBlock>;
|
|
574
590
|
webpages: Array<Webpage>;
|
|
575
591
|
};
|
|
576
592
|
/**
|
|
577
|
-
*
|
|
593
|
+
* Represents a title with its label and variant
|
|
578
594
|
*/
|
|
579
|
-
type WebpageProperties = {
|
|
580
|
-
displayedInHeader: boolean;
|
|
581
|
-
width: "full" | "large" | "narrow" | "default";
|
|
582
|
-
variant: "default" | "no-background";
|
|
583
|
-
backgroundImageUrl: string | null;
|
|
584
|
-
isBreadcrumbsDisplayed: boolean;
|
|
585
|
-
isSidebarDisplayed: boolean;
|
|
586
|
-
cssStyles: {
|
|
587
|
-
default: Array<Style>;
|
|
588
|
-
tablet: Array<Style>;
|
|
589
|
-
mobile: Array<Style>;
|
|
590
|
-
};
|
|
591
|
-
};
|
|
592
595
|
type WebTitle = {
|
|
593
596
|
label: string;
|
|
594
597
|
variant: "default" | "simple";
|
|
@@ -662,11 +665,15 @@ type WebElementComponent = {
|
|
|
662
665
|
variant: "full" | "highlights";
|
|
663
666
|
itemVariant: "detailed" | "card" | "tile";
|
|
664
667
|
paginationVariant: "default" | "numeric";
|
|
665
|
-
|
|
668
|
+
layout: "image-top" | "image-bottom" | "image-start" | "image-end";
|
|
666
669
|
isSortDisplayed: boolean;
|
|
667
670
|
isFilterDisplayed: boolean;
|
|
668
671
|
filterSort: "default" | "alphabetical";
|
|
669
|
-
|
|
672
|
+
search: {
|
|
673
|
+
isInputDisplayed: boolean;
|
|
674
|
+
isResultsBarDisplayed: boolean;
|
|
675
|
+
isMapDisplayed: boolean;
|
|
676
|
+
};
|
|
670
677
|
options: {
|
|
671
678
|
attributeFilters: {
|
|
672
679
|
bibliographies: boolean;
|
|
@@ -1200,4 +1207,4 @@ declare function filterProperties(property: Property, filter: {
|
|
|
1200
1207
|
value: string | number | boolean | Date;
|
|
1201
1208
|
}, options?: PropertyOptions): boolean;
|
|
1202
1209
|
//#endregion
|
|
1203
|
-
export { Bibliography, Concept, Context, ContextItem, ContextNode, Coordinates, CoordinatesItem, Data, DataCategory, Event, Gallery, Identification, Image, ImageMap, ImageMapArea, Interpretation, LevelContext, LevelContextItem, License, Link, Metadata, Note, Observation, Period, Person, Property, PropertyQueryItem, PropertyValue, PropertyValueContent, PropertyValueContentType, Resource, Set, SpatialUnit, Style, Tree, UuidMetadata, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebTitle, Webpage,
|
|
1210
|
+
export { Bibliography, Concept, Context, ContextItem, ContextNode, Coordinates, CoordinatesItem, Data, DataCategory, Event, Gallery, Identification, Image, ImageMap, ImageMapArea, Interpretation, LevelContext, LevelContextItem, License, Link, Metadata, Note, Observation, Period, Person, Property, PropertyQueryItem, PropertyValue, PropertyValueContent, PropertyValueContentType, Resource, Set, SpatialUnit, Style, Tree, UuidMetadata, WebBlock, WebBlockLayout, WebElement, WebElementComponent, WebImage, WebTitle, Webpage, Website, fetchByUuidMetadata, fetchGallery, fetchItem, fetchPropertyQuery, fetchWebsite, filterProperties, getPropertyByLabel, getPropertyByUuid, getPropertyValueByLabel, getPropertyValueByUuid, getPropertyValuesByLabel, getPropertyValuesByUuid, getUniqueProperties, getUniquePropertyLabels };
|
package/dist/index.mjs
CHANGED
|
@@ -1801,9 +1801,15 @@ function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1801
1801
|
itemVariant ??= "detailed";
|
|
1802
1802
|
let paginationVariant = getPropertyValueByLabel(componentProperty.properties, "pagination-variant");
|
|
1803
1803
|
paginationVariant ??= "default";
|
|
1804
|
-
let
|
|
1805
|
-
const
|
|
1806
|
-
if (
|
|
1804
|
+
let isInputDisplayed = false;
|
|
1805
|
+
const isInputDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "input-displayed");
|
|
1806
|
+
if (isInputDisplayedProperty !== null) isInputDisplayed = isInputDisplayedProperty === true;
|
|
1807
|
+
let isResultsBarDisplayed = false;
|
|
1808
|
+
const isResultsBarDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "results-bar-displayed");
|
|
1809
|
+
if (isResultsBarDisplayedProperty !== null) isResultsBarDisplayed = isResultsBarDisplayedProperty === true;
|
|
1810
|
+
let isMapDisplayed = false;
|
|
1811
|
+
const isMapDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "map-displayed");
|
|
1812
|
+
if (isMapDisplayedProperty !== null) isMapDisplayed = isMapDisplayedProperty === true;
|
|
1807
1813
|
let isSortDisplayed = false;
|
|
1808
1814
|
const isSortDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "sort-displayed");
|
|
1809
1815
|
if (isSortDisplayedProperty !== null) isSortDisplayed = isSortDisplayedProperty === true;
|
|
@@ -1859,7 +1865,11 @@ function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1859
1865
|
properties.variant = variant;
|
|
1860
1866
|
properties.itemVariant = itemVariant;
|
|
1861
1867
|
properties.paginationVariant = paginationVariant;
|
|
1862
|
-
properties.
|
|
1868
|
+
properties.search = {
|
|
1869
|
+
isInputDisplayed,
|
|
1870
|
+
isResultsBarDisplayed,
|
|
1871
|
+
isMapDisplayed
|
|
1872
|
+
};
|
|
1863
1873
|
properties.isSortDisplayed = isSortDisplayed;
|
|
1864
1874
|
properties.isFilterDisplayed = isFilterDisplayed;
|
|
1865
1875
|
properties.filterSort = filterSort;
|
|
@@ -2247,6 +2257,7 @@ function parseWebpage(webpageResource) {
|
|
|
2247
2257
|
let variant = "default";
|
|
2248
2258
|
let isSidebarDisplayed = true;
|
|
2249
2259
|
let isBreadcrumbsDisplayed = false;
|
|
2260
|
+
let isHeaderSearchBarDisplayed = true;
|
|
2250
2261
|
const webpageSubProperties = webpageProperties.find((property) => property.label === "presentation" && property.values[0]?.content === "page")?.properties;
|
|
2251
2262
|
if (webpageSubProperties) {
|
|
2252
2263
|
const headerProperty = webpageSubProperties.find((property) => property.label === "header")?.values[0];
|
|
@@ -2255,10 +2266,12 @@ function parseWebpage(webpageResource) {
|
|
|
2255
2266
|
if (widthProperty) width = widthProperty.content;
|
|
2256
2267
|
const variantProperty = webpageSubProperties.find((property) => property.label === "variant")?.values[0];
|
|
2257
2268
|
if (variantProperty) variant = variantProperty.content;
|
|
2258
|
-
const isSidebarDisplayedProperty = webpageSubProperties.find((property) => property.label === "sidebar-
|
|
2269
|
+
const isSidebarDisplayedProperty = webpageSubProperties.find((property) => property.label === "sidebar-displayed")?.values[0];
|
|
2259
2270
|
if (isSidebarDisplayedProperty) isSidebarDisplayed = isSidebarDisplayedProperty.content === true;
|
|
2260
|
-
const isBreadcrumbsDisplayedProperty = webpageSubProperties.find((property) => property.label === "breadcrumbs-
|
|
2271
|
+
const isBreadcrumbsDisplayedProperty = webpageSubProperties.find((property) => property.label === "breadcrumbs-displayed")?.values[0];
|
|
2261
2272
|
if (isBreadcrumbsDisplayedProperty) isBreadcrumbsDisplayed = isBreadcrumbsDisplayedProperty.content === true;
|
|
2273
|
+
const isHeaderSearchBarDisplayedProperty = webpageSubProperties.find((property) => property.label === "header-search-bar-displayed")?.values[0];
|
|
2274
|
+
if (isHeaderSearchBarDisplayedProperty) isHeaderSearchBarDisplayed = isHeaderSearchBarDisplayedProperty.content === true;
|
|
2262
2275
|
}
|
|
2263
2276
|
const cssStyleSubProperties = webpageProperties.find((property) => property.label === "presentation" && property.values[0]?.content === "css")?.properties;
|
|
2264
2277
|
const cssStyles = [];
|
|
@@ -2289,6 +2302,7 @@ function parseWebpage(webpageResource) {
|
|
|
2289
2302
|
backgroundImageUrl: imageLink ? `https://ochre.lib.uchicago.edu/ochre?uuid=${imageLink.uuid}&load` : null,
|
|
2290
2303
|
isSidebarDisplayed,
|
|
2291
2304
|
isBreadcrumbsDisplayed,
|
|
2305
|
+
isHeaderSearchBarDisplayed,
|
|
2292
2306
|
cssStyles: {
|
|
2293
2307
|
default: cssStyles,
|
|
2294
2308
|
tablet: cssStylesTablet,
|
|
@@ -2625,19 +2639,19 @@ function parseWebsiteProperties(properties) {
|
|
|
2625
2639
|
let iiifViewer = "universal-viewer";
|
|
2626
2640
|
let supportsThemeToggle = true;
|
|
2627
2641
|
let defaultTheme = null;
|
|
2628
|
-
const headerProperty = websiteProperties.find((property) => property.label === "navbar-
|
|
2642
|
+
const headerProperty = websiteProperties.find((property) => property.label === "navbar-displayed")?.values[0];
|
|
2629
2643
|
if (headerProperty) isHeaderDisplayed = headerProperty.content === true;
|
|
2630
2644
|
const headerVariantProperty = websiteProperties.find((property) => property.label === "navbar-variant")?.values[0];
|
|
2631
2645
|
if (headerVariantProperty) headerVariant = headerVariantProperty.content;
|
|
2632
2646
|
const headerAlignmentProperty = websiteProperties.find((property) => property.label === "navbar-alignment")?.values[0];
|
|
2633
2647
|
if (headerAlignmentProperty) headerAlignment = headerAlignmentProperty.content;
|
|
2634
|
-
const isHeaderProjectDisplayedProperty = websiteProperties.find((property) => property.label === "navbar-project-
|
|
2648
|
+
const isHeaderProjectDisplayedProperty = websiteProperties.find((property) => property.label === "navbar-project-displayed")?.values[0];
|
|
2635
2649
|
if (isHeaderProjectDisplayedProperty) isHeaderProjectDisplayed = isHeaderProjectDisplayedProperty.content === true;
|
|
2636
|
-
const footerProperty = websiteProperties.find((property) => property.label === "footer-
|
|
2650
|
+
const footerProperty = websiteProperties.find((property) => property.label === "footer-displayed")?.values[0];
|
|
2637
2651
|
if (footerProperty) isFooterDisplayed = footerProperty.content === true;
|
|
2638
|
-
const sidebarProperty = websiteProperties.find((property) => property.label === "sidebar-
|
|
2652
|
+
const sidebarProperty = websiteProperties.find((property) => property.label === "sidebar-displayed")?.values[0];
|
|
2639
2653
|
if (sidebarProperty) isSidebarDisplayed = sidebarProperty.content === true;
|
|
2640
|
-
const
|
|
2654
|
+
const headerSearchBarPageSlug = websiteProperties.find((property) => property.label === "navbar-search-bar-page")?.values[0]?.content?.toString() ?? null;
|
|
2641
2655
|
const iiifViewerProperty = websiteProperties.find((property) => property.label === "iiif-viewer")?.values[0];
|
|
2642
2656
|
if (iiifViewerProperty) iiifViewer = iiifViewerProperty.content;
|
|
2643
2657
|
const supportsThemeToggleProperty = websiteProperties.find((property) => property.label === "supports-theme-toggle")?.values[0];
|
|
@@ -2656,7 +2670,7 @@ function parseWebsiteProperties(properties) {
|
|
|
2656
2670
|
isHeaderProjectDisplayed,
|
|
2657
2671
|
isFooterDisplayed,
|
|
2658
2672
|
isSidebarDisplayed,
|
|
2659
|
-
|
|
2673
|
+
headerSearchBarPageSlug,
|
|
2660
2674
|
iiifViewer,
|
|
2661
2675
|
supportsThemeToggle,
|
|
2662
2676
|
defaultTheme,
|
package/package.json
CHANGED