@digitalculture/ochre-sdk 0.12.14 → 0.12.16
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 +5 -4
- package/dist/index.mjs +29 -26
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -559,7 +559,7 @@ type Website = {
|
|
|
559
559
|
isHeaderProjectDisplayed: boolean;
|
|
560
560
|
isFooterDisplayed: boolean;
|
|
561
561
|
isSidebarDisplayed: boolean;
|
|
562
|
-
|
|
562
|
+
headerSearchBarBoundElementUuid: string | null;
|
|
563
563
|
supportsThemeToggle: boolean;
|
|
564
564
|
defaultTheme: "light" | "dark" | null;
|
|
565
565
|
logoUrl: string | null;
|
|
@@ -676,6 +676,7 @@ type WebElementComponent = {
|
|
|
676
676
|
} | {
|
|
677
677
|
component: "collection";
|
|
678
678
|
collectionIds: Array<string>;
|
|
679
|
+
displayedPropertyUuids: Array<string> | null;
|
|
679
680
|
variant: "full" | "highlights";
|
|
680
681
|
itemVariant: "detailed" | "card" | "tile";
|
|
681
682
|
paginationVariant: "default" | "numeric";
|
|
@@ -683,10 +684,11 @@ type WebElementComponent = {
|
|
|
683
684
|
isSortDisplayed: boolean;
|
|
684
685
|
isFilterDisplayed: boolean;
|
|
685
686
|
filterSort: "default" | "alphabetical";
|
|
687
|
+
isUsingQueryParams: boolean;
|
|
686
688
|
search: {
|
|
687
|
-
isUsingQueryParams: boolean;
|
|
688
689
|
isResultsBarDisplayed: boolean;
|
|
689
690
|
isMapDisplayed: boolean;
|
|
691
|
+
isInputDisplayed: boolean;
|
|
690
692
|
};
|
|
691
693
|
options: {
|
|
692
694
|
attributeFilters: {
|
|
@@ -774,9 +776,8 @@ type WebElementComponent = {
|
|
|
774
776
|
}>;
|
|
775
777
|
} | {
|
|
776
778
|
component: "search-bar";
|
|
777
|
-
variant: "default" | "full";
|
|
778
779
|
placeholder: string | null;
|
|
779
|
-
|
|
780
|
+
baseFilterQueries: string | null;
|
|
780
781
|
boundElementUuid: string | null;
|
|
781
782
|
href: string | null;
|
|
782
783
|
} | {
|
package/dist/index.mjs
CHANGED
|
@@ -1795,6 +1795,7 @@ function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1795
1795
|
case "collection": {
|
|
1796
1796
|
const collectionLinks = links.filter((link) => link.category === "set");
|
|
1797
1797
|
if (collectionLinks.length === 0) throw new Error(`Collection links not found for the following component: “${componentName}”`);
|
|
1798
|
+
const displayedProperties = getPropertyByLabel(componentProperty.properties, "use-property");
|
|
1798
1799
|
let variant = getPropertyValueByLabel(componentProperty.properties, "variant");
|
|
1799
1800
|
variant ??= "full";
|
|
1800
1801
|
let itemVariant = getPropertyValueByLabel(componentProperty.properties, "item-variant");
|
|
@@ -1804,20 +1805,23 @@ function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1804
1805
|
let isUsingQueryParams = false;
|
|
1805
1806
|
const isUsingQueryParamsProperty = getPropertyValueByLabel(componentProperty.properties, "is-using-query-params");
|
|
1806
1807
|
if (isUsingQueryParamsProperty !== null) isUsingQueryParams = isUsingQueryParamsProperty === true;
|
|
1807
|
-
let
|
|
1808
|
-
const
|
|
1809
|
-
if (
|
|
1810
|
-
let
|
|
1811
|
-
const
|
|
1812
|
-
if (
|
|
1808
|
+
let isFilterResultsBarDisplayed = false;
|
|
1809
|
+
const isFilterResultsBarDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "filter-results-bar-displayed");
|
|
1810
|
+
if (isFilterResultsBarDisplayedProperty !== null) isFilterResultsBarDisplayed = isFilterResultsBarDisplayedProperty === true;
|
|
1811
|
+
let isFilterMapDisplayed = false;
|
|
1812
|
+
const isFilterMapDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "filter-map-displayed");
|
|
1813
|
+
if (isFilterMapDisplayedProperty !== null) isFilterMapDisplayed = isFilterMapDisplayedProperty === true;
|
|
1814
|
+
let isFilterInputDisplayed = false;
|
|
1815
|
+
const isFilterInputDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "filter-input-displayed");
|
|
1816
|
+
if (isFilterInputDisplayedProperty !== null) isFilterInputDisplayed = isFilterInputDisplayedProperty === true;
|
|
1813
1817
|
let isSortDisplayed = false;
|
|
1814
1818
|
const isSortDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "sort-displayed");
|
|
1815
1819
|
if (isSortDisplayedProperty !== null) isSortDisplayed = isSortDisplayedProperty === true;
|
|
1816
|
-
let
|
|
1817
|
-
const
|
|
1818
|
-
if (
|
|
1819
|
-
let
|
|
1820
|
-
|
|
1820
|
+
let isFilterSidebarDisplayed = false;
|
|
1821
|
+
const isFilterSidebarDisplayedProperty = getPropertyValueByLabel(componentProperty.properties, "filter-sidebar-displayed");
|
|
1822
|
+
if (isFilterSidebarDisplayedProperty !== null) isFilterSidebarDisplayed = isFilterSidebarDisplayedProperty === true;
|
|
1823
|
+
let filterSidebarSort = getPropertyValueByLabel(componentProperty.properties, "filter-sidebar-sort");
|
|
1824
|
+
filterSidebarSort ??= "default";
|
|
1821
1825
|
let layout = getPropertyValueByLabel(componentProperty.properties, "layout");
|
|
1822
1826
|
layout ??= "image-start";
|
|
1823
1827
|
const options = {
|
|
@@ -1862,17 +1866,19 @@ function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
1862
1866
|
};
|
|
1863
1867
|
}
|
|
1864
1868
|
properties.collectionIds = collectionLinks.map((link) => link.uuid);
|
|
1869
|
+
properties.displayedPropertyUuids = displayedProperties?.values.map((value) => value.uuid).filter(Boolean) ?? null;
|
|
1865
1870
|
properties.variant = variant;
|
|
1866
1871
|
properties.itemVariant = itemVariant;
|
|
1867
1872
|
properties.paginationVariant = paginationVariant;
|
|
1868
|
-
properties.
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1873
|
+
properties.isUsingQueryParams = isUsingQueryParams;
|
|
1874
|
+
properties.filter = {
|
|
1875
|
+
isSidebarDisplayed: isFilterSidebarDisplayed,
|
|
1876
|
+
isResultsBarDisplayed: isFilterResultsBarDisplayed,
|
|
1877
|
+
isMapDisplayed: isFilterMapDisplayed,
|
|
1878
|
+
isInputDisplayed: isFilterInputDisplayed,
|
|
1879
|
+
sidebarSort: filterSidebarSort
|
|
1872
1880
|
};
|
|
1873
1881
|
properties.isSortDisplayed = isSortDisplayed;
|
|
1874
|
-
properties.isFilterDisplayed = isFilterDisplayed;
|
|
1875
|
-
properties.filterSort = filterSort;
|
|
1876
1882
|
properties.layout = layout;
|
|
1877
1883
|
properties.options = options;
|
|
1878
1884
|
break;
|
|
@@ -2078,13 +2084,10 @@ function parseWebElementProperties(componentProperty, elementResource) {
|
|
|
2078
2084
|
const linkToProperty = getPropertyByLabel(componentProperty.properties, "link-to");
|
|
2079
2085
|
const href = linkToProperty?.values[0]?.href ?? linkToProperty?.values[0]?.slug ?? null;
|
|
2080
2086
|
if (!boundElementPropertyUuid && !href) throw new Error(`Bound element or href not found for the following component: “${componentName}”`);
|
|
2081
|
-
let variant = getPropertyValueByLabel(componentProperty.properties, "variant");
|
|
2082
|
-
variant ??= "default";
|
|
2083
2087
|
const placeholder = getPropertyValueByLabel(componentProperty.properties, "placeholder-text");
|
|
2084
|
-
const
|
|
2085
|
-
properties.variant = variant;
|
|
2088
|
+
const baseFilterQueries = getPropertyValueByLabel(componentProperty.properties, "base-filter-queries");
|
|
2086
2089
|
properties.placeholder = placeholder !== null ? String(placeholder) : null;
|
|
2087
|
-
properties.
|
|
2090
|
+
properties.baseFilterQueries = baseFilterQueries !== null ? String(baseFilterQueries).replaceAll(String.raw`\{`, "{").replaceAll(String.raw`\}`, "}") : null;
|
|
2088
2091
|
properties.boundElementUuid = boundElementPropertyUuid;
|
|
2089
2092
|
properties.href = href;
|
|
2090
2093
|
break;
|
|
@@ -2260,7 +2263,7 @@ function parseWebpage(webpageResource) {
|
|
|
2260
2263
|
let isHeaderSearchBarDisplayed = true;
|
|
2261
2264
|
const webpageSubProperties = webpageProperties.find((property) => property.label === "presentation" && property.values[0]?.content === "page")?.properties;
|
|
2262
2265
|
if (webpageSubProperties) {
|
|
2263
|
-
const headerProperty = webpageSubProperties.find((property) => property.label === "
|
|
2266
|
+
const headerProperty = webpageSubProperties.find((property) => property.label === "displayed-in-navbar")?.values[0];
|
|
2264
2267
|
if (headerProperty) displayedInHeader = headerProperty.content === true;
|
|
2265
2268
|
const widthProperty = webpageSubProperties.find((property) => property.label === "width")?.values[0];
|
|
2266
2269
|
if (widthProperty) width = widthProperty.content;
|
|
@@ -2270,7 +2273,7 @@ function parseWebpage(webpageResource) {
|
|
|
2270
2273
|
if (isSidebarDisplayedProperty) isSidebarDisplayed = isSidebarDisplayedProperty.content === true;
|
|
2271
2274
|
const isBreadcrumbsDisplayedProperty = webpageSubProperties.find((property) => property.label === "breadcrumbs-displayed")?.values[0];
|
|
2272
2275
|
if (isBreadcrumbsDisplayedProperty) isBreadcrumbsDisplayed = isBreadcrumbsDisplayedProperty.content === true;
|
|
2273
|
-
const isHeaderSearchBarDisplayedProperty = webpageSubProperties.find((property) => property.label === "
|
|
2276
|
+
const isHeaderSearchBarDisplayedProperty = webpageSubProperties.find((property) => property.label === "navbar-search-bar-displayed")?.values[0];
|
|
2274
2277
|
if (isHeaderSearchBarDisplayedProperty) isHeaderSearchBarDisplayed = isHeaderSearchBarDisplayedProperty.content === true;
|
|
2275
2278
|
}
|
|
2276
2279
|
const cssStyleSubProperties = webpageProperties.find((property) => property.label === "presentation" && property.values[0]?.content === "css")?.properties;
|
|
@@ -2651,7 +2654,7 @@ function parseWebsiteProperties(properties, websiteTree) {
|
|
|
2651
2654
|
if (footerProperty) isFooterDisplayed = footerProperty.content === true;
|
|
2652
2655
|
const sidebarProperty = websiteProperties.find((property) => property.label === "sidebar-displayed")?.values[0];
|
|
2653
2656
|
if (sidebarProperty) isSidebarDisplayed = sidebarProperty.content === true;
|
|
2654
|
-
const
|
|
2657
|
+
const headerSearchBarBoundElementUuid = websiteProperties.find((property) => property.label === "bound-element-navbar-search-bar")?.values[0]?.uuid ?? null;
|
|
2655
2658
|
const iiifViewerProperty = websiteProperties.find((property) => property.label === "iiif-viewer")?.values[0];
|
|
2656
2659
|
if (iiifViewerProperty) iiifViewer = iiifViewerProperty.content;
|
|
2657
2660
|
const supportsThemeToggleProperty = websiteProperties.find((property) => property.label === "supports-theme-toggle")?.values[0];
|
|
@@ -2700,7 +2703,7 @@ function parseWebsiteProperties(properties, websiteTree) {
|
|
|
2700
2703
|
isHeaderProjectDisplayed,
|
|
2701
2704
|
isFooterDisplayed,
|
|
2702
2705
|
isSidebarDisplayed,
|
|
2703
|
-
|
|
2706
|
+
headerSearchBarBoundElementUuid,
|
|
2704
2707
|
supportsThemeToggle,
|
|
2705
2708
|
defaultTheme,
|
|
2706
2709
|
logoUrl: logoUuid !== null ? `https://ochre.lib.uchicago.edu/ochre?uuid=${logoUuid}&load` : null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitalculture/ochre-sdk",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.16",
|
|
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",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dist"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"zod": "^4.1.
|
|
43
|
+
"zod": "^4.1.13"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@antfu/eslint-config": "^6.2.0",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"eslint": "^9.39.1",
|
|
50
50
|
"prettier": "^3.6.2",
|
|
51
51
|
"terser": "^5.44.1",
|
|
52
|
-
"tsdown": "^0.16.
|
|
52
|
+
"tsdown": "^0.16.7",
|
|
53
53
|
"typescript": "^5.9.3",
|
|
54
|
-
"vitest": "^4.0.
|
|
54
|
+
"vitest": "^4.0.14"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"dev": "tsdown src/index.ts --watch",
|