ochre-sdk 1.0.41 → 1.0.43
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 +2 -2
- package/dist/parsers/string.mjs +9 -62
- package/dist/parsers/website/index.mjs +4 -0
- package/dist/types/website.d.mts +20 -14
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MultilingualOptions, MultilingualString, MultilingualStringEntries, MultilingualStringEntry, MultilingualStringInput, MultilingualStringJSON, MultilingualStringObject, MultilingualStringText } from "./parsers/multilingual.mjs";
|
|
2
|
-
import { AccordionWebBlock, ContextTree, ContextTreeFilterLevel, ContextTreeLevel, ContextTreeLevelItem, Scope, Style, StylesheetCategory, StylesheetItem, WebAccordionItem, WebBlock, WebBlockByLayout, WebBlockItem, WebBlockLayout, WebElement, WebElementComponent, WebElementComponentName, WebElementComponentOf, WebElementOf, WebImage, WebTitle, Webpage, Website, WebsiteMetadata, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteSegment, WebsiteType } from "./types/website.mjs";
|
|
2
|
+
import { AccordionWebBlock, ContextTree, ContextTreeFilterLevel, ContextTreeLevel, ContextTreeLevelItem, Scope, Style, StylesheetCategory, StylesheetItem, WebAccordionItem, WebBlock, WebBlockByLayout, WebBlockItem, WebBlockLayout, WebElement, WebElementComponent, WebElementComponentName, WebElementComponentOf, WebElementOf, WebImage, WebSidebar, WebTitle, Webpage, Website, WebsiteMetadata, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteSegment, WebsiteType } from "./types/website.mjs";
|
|
3
3
|
import { AnyBibliography, AnyConcept, AnyItem, AnyPeriod, AnyPerson, AnyPropertyValue, AnyPropertyVariable, AnyResource, AnySet, AnySpatialUnit, AnyText, AnyTree, BaseItem, BaseItemLink, BelongsTo, Bibliography, BibliographyEntryInfo, BibliographyItemLink, BibliographySourceDocument, Concept, ConceptItemLink, ContainedItemCategory, ContainedItemCategoryFromOption, ContainedItemCategoryOption, Context, ContextItem, ContextItemCategory, ContextNode, Coordinates, CoordinatesSource, DictionaryUnitItemLink, EmbeddedBibliography, EmbeddedConcept, EmbeddedItem, EmbeddedPeriod, EmbeddedPerson, EmbeddedPropertyValue, EmbeddedPropertyVariable, EmbeddedResource, EmbeddedSet, EmbeddedSpatialUnit, EmbeddedText, EmbeddedTree, Event, Gallery, Heading, HeadingItemCategory, Identification, Image, ImageMap, ImageMapArea, Interpretation, Item, ItemCategory, ItemCategoryFromOption, ItemCategoryOption, ItemCategoryWithEmbeddedItems, ItemContainerCategory, ItemLink, ItemLinkCategory, ItemLinks, ItemPayloadKind, ItemProperty, ItemWithoutEmbeddedItems, LanguageCodes, License, Metadata, Note, Observation, Period, PeriodItemLink, Person, PersonItemLink, Property, PropertyLike, PropertyRelation, PropertyValue, PropertyValueContent, PropertyValueDataType, PropertyValueItemLink, PropertyValueQueryItem, PropertyVariable, PropertyVariableItemLink, Query, QueryGroup, QueryLeaf, QueryablePropertyValueDataType, RecursiveItemCategory, Resource, ResourceItemLink, Section, Set, SetAttributeValueQueryItem, SetBibliography, SetConcept, SetItem, SetItemCategory, SetItemLink, SetItemProperty, SetItemSimplifiedProperty, SetItemsSort, SetItemsSortDirection, SetPeriod, SetResource, SetSpatialUnit, SetTree, SimplifiedProperty, SpatialUnit, SpatialUnitItemLink, Text, TextItemLink, TopLevelItem, Tree, TreeItemCategory, TreeItemLink } from "./types/index.mjs";
|
|
4
4
|
import { fetchGallery } from "./fetchers/gallery.mjs";
|
|
5
5
|
import { fetchItemChildren } from "./fetchers/item-children.mjs";
|
|
@@ -11,4 +11,4 @@ import { fetchWebsiteMetadata } from "./fetchers/website-metadata.mjs";
|
|
|
11
11
|
import { fetchWebsite } from "./fetchers/website.mjs";
|
|
12
12
|
import { PropertyOptions, filterProperties, getLeafPropertyValues, getPropertyByVariableLabel, getPropertyByVariableLabelAndValue, getPropertyByVariableLabelAndValueContent, getPropertyByVariableLabelAndValueContents, getPropertyByVariableLabelAndValues, getPropertyByVariableUuid, getPropertyValueByVariableLabel, getPropertyValueByVariableUuid, getPropertyValueContentByVariableLabel, getPropertyValueContentByVariableUuid, getPropertyValueContentsByVariableUuid, getPropertyValuesByVariableLabel, getPropertyValuesByVariableUuid, getUniqueProperties, getUniquePropertyVariableLabels } from "./getters.mjs";
|
|
13
13
|
import { DEFAULT_PAGE_SIZE, flattenItemProperties } from "./helpers.mjs";
|
|
14
|
-
export { type AccordionWebBlock, type AnyBibliography, type AnyConcept, type AnyItem, type AnyPeriod, type AnyPerson, type AnyPropertyValue, type AnyPropertyVariable, type AnyResource, type AnySet, type AnySpatialUnit, type AnyText, type AnyTree, type BaseItem, type BaseItemLink, type BelongsTo, type Bibliography, type BibliographyEntryInfo, type BibliographyItemLink, type BibliographySourceDocument, type Concept, type ConceptItemLink, type ContainedItemCategory, type ContainedItemCategoryFromOption, type ContainedItemCategoryOption, type Context, type ContextItem, type ContextItemCategory, type ContextNode, type ContextTree, type ContextTreeFilterLevel, type ContextTreeLevel, type ContextTreeLevelItem, type Coordinates, type CoordinatesSource, DEFAULT_PAGE_SIZE, type DictionaryUnitItemLink, type EmbeddedBibliography, type EmbeddedConcept, type EmbeddedItem, type EmbeddedPeriod, type EmbeddedPerson, type EmbeddedPropertyValue, type EmbeddedPropertyVariable, type EmbeddedResource, type EmbeddedSet, type EmbeddedSpatialUnit, type EmbeddedText, type EmbeddedTree, type Event, type Gallery, type Heading, type HeadingItemCategory, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type Item, type ItemCategory, type ItemCategoryFromOption, type ItemCategoryOption, type ItemCategoryWithEmbeddedItems, type ItemContainerCategory, type ItemLink, type ItemLinkCategory, type ItemLinks, type ItemPayloadKind, type ItemProperty, type ItemWithoutEmbeddedItems, type LanguageCodes, type License, type Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntries, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringObject, type MultilingualStringText, type Note, type Observation, type Period, type PeriodItemLink, type Person, type PersonItemLink, type Property, type PropertyLike, PropertyOptions, type PropertyRelation, type PropertyValue, type PropertyValueContent, type PropertyValueDataType, type PropertyValueItemLink, type PropertyValueQueryItem, type PropertyVariable, type PropertyVariableItemLink, type Query, type QueryGroup, type QueryLeaf, type QueryablePropertyValueDataType, type RecursiveItemCategory, type Resource, type ResourceItemLink, type Scope, type Section, type Set, type SetAttributeValueQueryItem, type SetBibliography, type SetConcept, type SetItem, type SetItemCategory, type SetItemLink, type SetItemProperty, type SetItemSimplifiedProperty, type SetItemsSort, type SetItemsSortDirection, type SetPeriod, type SetResource, type SetSpatialUnit, type SetTree, type SimplifiedProperty, type SpatialUnit, type SpatialUnitItemLink, type Style, type StylesheetCategory, type StylesheetItem, type Text, type TextItemLink, type TopLevelItem, type Tree, type TreeItemCategory, type TreeItemLink, type WebAccordionItem, type WebBlock, type WebBlockByLayout, type WebBlockItem, type WebBlockLayout, type WebElement, type WebElementComponent, type WebElementComponentName, type WebElementComponentOf, type WebElementOf, type WebImage, type WebTitle, type Webpage, type Website, type WebsiteMetadata, type WebsitePropertyQuery, type WebsitePropertyQueryNode, type WebsiteSegment, type WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemChildren, fetchItemLinks, fetchSetItems, fetchSetPropertyValues, fetchWebsite, fetchWebsiteMetadata, filterProperties, flattenItemProperties, getLeafPropertyValues, getPropertyByVariableLabel, getPropertyByVariableLabelAndValue, getPropertyByVariableLabelAndValueContent, getPropertyByVariableLabelAndValueContents, getPropertyByVariableLabelAndValues, getPropertyByVariableUuid, getPropertyValueByVariableLabel, getPropertyValueByVariableUuid, getPropertyValueContentByVariableLabel, getPropertyValueContentByVariableUuid, getPropertyValueContentsByVariableUuid, getPropertyValuesByVariableLabel, getPropertyValuesByVariableUuid, getUniqueProperties, getUniquePropertyVariableLabels, withLanguages };
|
|
14
|
+
export { type AccordionWebBlock, type AnyBibliography, type AnyConcept, type AnyItem, type AnyPeriod, type AnyPerson, type AnyPropertyValue, type AnyPropertyVariable, type AnyResource, type AnySet, type AnySpatialUnit, type AnyText, type AnyTree, type BaseItem, type BaseItemLink, type BelongsTo, type Bibliography, type BibliographyEntryInfo, type BibliographyItemLink, type BibliographySourceDocument, type Concept, type ConceptItemLink, type ContainedItemCategory, type ContainedItemCategoryFromOption, type ContainedItemCategoryOption, type Context, type ContextItem, type ContextItemCategory, type ContextNode, type ContextTree, type ContextTreeFilterLevel, type ContextTreeLevel, type ContextTreeLevelItem, type Coordinates, type CoordinatesSource, DEFAULT_PAGE_SIZE, type DictionaryUnitItemLink, type EmbeddedBibliography, type EmbeddedConcept, type EmbeddedItem, type EmbeddedPeriod, type EmbeddedPerson, type EmbeddedPropertyValue, type EmbeddedPropertyVariable, type EmbeddedResource, type EmbeddedSet, type EmbeddedSpatialUnit, type EmbeddedText, type EmbeddedTree, type Event, type Gallery, type Heading, type HeadingItemCategory, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type Item, type ItemCategory, type ItemCategoryFromOption, type ItemCategoryOption, type ItemCategoryWithEmbeddedItems, type ItemContainerCategory, type ItemLink, type ItemLinkCategory, type ItemLinks, type ItemPayloadKind, type ItemProperty, type ItemWithoutEmbeddedItems, type LanguageCodes, type License, type Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntries, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringObject, type MultilingualStringText, type Note, type Observation, type Period, type PeriodItemLink, type Person, type PersonItemLink, type Property, type PropertyLike, PropertyOptions, type PropertyRelation, type PropertyValue, type PropertyValueContent, type PropertyValueDataType, type PropertyValueItemLink, type PropertyValueQueryItem, type PropertyVariable, type PropertyVariableItemLink, type Query, type QueryGroup, type QueryLeaf, type QueryablePropertyValueDataType, type RecursiveItemCategory, type Resource, type ResourceItemLink, type Scope, type Section, type Set, type SetAttributeValueQueryItem, type SetBibliography, type SetConcept, type SetItem, type SetItemCategory, type SetItemLink, type SetItemProperty, type SetItemSimplifiedProperty, type SetItemsSort, type SetItemsSortDirection, type SetPeriod, type SetResource, type SetSpatialUnit, type SetTree, type SimplifiedProperty, type SpatialUnit, type SpatialUnitItemLink, type Style, type StylesheetCategory, type StylesheetItem, type Text, type TextItemLink, type TopLevelItem, type Tree, type TreeItemCategory, type TreeItemLink, type WebAccordionItem, type WebBlock, type WebBlockByLayout, type WebBlockItem, type WebBlockLayout, type WebElement, type WebElementComponent, type WebElementComponentName, type WebElementComponentOf, type WebElementOf, type WebImage, type WebSidebar, type WebTitle, type Webpage, type Website, type WebsiteMetadata, type WebsitePropertyQuery, type WebsitePropertyQueryNode, type WebsiteSegment, type WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemChildren, fetchItemLinks, fetchSetItems, fetchSetPropertyValues, fetchWebsite, fetchWebsiteMetadata, filterProperties, flattenItemProperties, getLeafPropertyValues, getPropertyByVariableLabel, getPropertyByVariableLabelAndValue, getPropertyByVariableLabelAndValueContent, getPropertyByVariableLabelAndValueContents, getPropertyByVariableLabelAndValues, getPropertyByVariableUuid, getPropertyValueByVariableLabel, getPropertyValueByVariableUuid, getPropertyValueContentByVariableLabel, getPropertyValueContentByVariableUuid, getPropertyValueContentsByVariableUuid, getPropertyValuesByVariableLabel, getPropertyValuesByVariableUuid, getUniqueProperties, getUniquePropertyVariableLabels, withLanguages };
|
package/dist/parsers/string.mjs
CHANGED
|
@@ -15,60 +15,12 @@ const HEADING_LEVEL_TOKEN = "heading-level";
|
|
|
15
15
|
const RAW_MDX_BLOCK_DELIMITER = "``md``";
|
|
16
16
|
const RAW_MDX_BLOCK_PLACEHOLDER_PREFIX = "\0raw-mdx-block:";
|
|
17
17
|
const RAW_MDX_BLOCK_PLACEHOLDER_SUFFIX = "\0";
|
|
18
|
-
const RICH_LINE_BREAK = "<br />\n";
|
|
19
18
|
const MDX_QUOTED_ATTRIBUTE_ESCAPE_REGEX = /[\n\r"]/;
|
|
20
|
-
const MDX_NEWLINE_RUN_REGEX = /\n{3,}/g;
|
|
21
|
-
const MDX_SIMPLE_INLINE_TAG_REGEX = /<\/?(?:em|strong|u)>/g;
|
|
22
|
-
const MDX_MARKDOWN_LIST_LINE_REGEX = /^\s*(?:[*+-]|\d+[).])\s+/;
|
|
23
19
|
const MDX_RENDER_ELEMENTS = {
|
|
24
20
|
bold: "strong",
|
|
25
21
|
italic: "em",
|
|
26
22
|
underline: "u"
|
|
27
23
|
};
|
|
28
|
-
function hasNewlineWhitespace(value) {
|
|
29
|
-
return value?.split(" ").includes("newline") === true;
|
|
30
|
-
}
|
|
31
|
-
function hasNoRichTextPayload(item) {
|
|
32
|
-
return (item.payload == null || item.payload === "") && item.rend == null && item.links == null && item.properties == null && item.annotation == null && item.string == null;
|
|
33
|
-
}
|
|
34
|
-
function isRawMDXBlockDelimiter(item, index) {
|
|
35
|
-
return item.payload === RAW_MDX_BLOCK_DELIMITER && (index === 0 || hasNewlineWhitespace(item.whitespace)) && item.rend == null && item.links == null && item.properties == null && item.annotation == null && item.string == null;
|
|
36
|
-
}
|
|
37
|
-
function normalizeMDXNewlineRuns(value) {
|
|
38
|
-
return value.replaceAll(MDX_NEWLINE_RUN_REGEX, "\n\n");
|
|
39
|
-
}
|
|
40
|
-
function isMarkdownListLine(value) {
|
|
41
|
-
return MDX_MARKDOWN_LIST_LINE_REGEX.test(value);
|
|
42
|
-
}
|
|
43
|
-
function isStandaloneFormattedLine(value) {
|
|
44
|
-
const trimmedValue = value.trim();
|
|
45
|
-
if (trimmedValue === "" || isMarkdownListLine(trimmedValue)) return false;
|
|
46
|
-
const unwrappedValue = trimmedValue.replaceAll(MDX_SIMPLE_INLINE_TAG_REGEX, "").trim();
|
|
47
|
-
return unwrappedValue !== trimmedValue && unwrappedValue !== "";
|
|
48
|
-
}
|
|
49
|
-
function pushBlankLine(lines) {
|
|
50
|
-
if (lines.length > 0 && lines.at(-1) !== "") lines.push("");
|
|
51
|
-
}
|
|
52
|
-
function getLastNonBlankLine(lines) {
|
|
53
|
-
for (let index = lines.length - 1; index >= 0; index -= 1) {
|
|
54
|
-
const line = lines[index];
|
|
55
|
-
if (line != null && line.trim() !== "") return line;
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
function normalizeRawMDXBlock(value) {
|
|
60
|
-
const sourceLines = normalizeMDXNewlineRuns(value).split("\n");
|
|
61
|
-
const normalizedLines = [];
|
|
62
|
-
for (const [index, line] of sourceLines.entries()) {
|
|
63
|
-
const nextLine = sourceLines[index + 1];
|
|
64
|
-
const shouldStartOwnParagraph = isStandaloneFormattedLine(line);
|
|
65
|
-
const lastNonBlankLine = getLastNonBlankLine(normalizedLines);
|
|
66
|
-
if (shouldStartOwnParagraph || isMarkdownListLine(line) && (lastNonBlankLine == null || !isMarkdownListLine(lastNonBlankLine))) pushBlankLine(normalizedLines);
|
|
67
|
-
normalizedLines.push(line);
|
|
68
|
-
if (shouldStartOwnParagraph && nextLine != null && nextLine.trim() !== "" && !isMarkdownListLine(nextLine)) pushBlankLine(normalizedLines);
|
|
69
|
-
}
|
|
70
|
-
return normalizeMDXNewlineRuns(normalizedLines.join("\n"));
|
|
71
|
-
}
|
|
72
24
|
function isXMLRichTextLink(value) {
|
|
73
25
|
return typeof value === "object" && value != null;
|
|
74
26
|
}
|
|
@@ -116,9 +68,12 @@ function applyMDXRenderElements(contentString, options) {
|
|
|
116
68
|
}
|
|
117
69
|
function applyNewlineWhitespace(contentString, whitespace, rendering) {
|
|
118
70
|
if (whitespace == null) return contentString;
|
|
119
|
-
if (!
|
|
120
|
-
if (contentString === "")
|
|
121
|
-
|
|
71
|
+
if (!whitespace.split(" ").includes("newline")) return contentString;
|
|
72
|
+
if (contentString === "") {
|
|
73
|
+
if (rendering === "rich") return "<br />\n<br />\n";
|
|
74
|
+
return "\n\n";
|
|
75
|
+
}
|
|
76
|
+
if (rendering === "rich") return contentString.trim() === "***" ? `${contentString}\n` : `<br />\n${contentString}`;
|
|
122
77
|
return `\n${contentString}`;
|
|
123
78
|
}
|
|
124
79
|
/**
|
|
@@ -306,7 +261,7 @@ function parseNestedStringItems(items, contentItem, options) {
|
|
|
306
261
|
let result = "";
|
|
307
262
|
let rawMDXBlockStartIndex = null;
|
|
308
263
|
for (const [index, item] of items.entries()) {
|
|
309
|
-
if (
|
|
264
|
+
if (item.payload === RAW_MDX_BLOCK_DELIMITER && item.rend == null && item.links == null && item.properties == null && item.annotation == null && item.string == null) {
|
|
310
265
|
if (rawMDXBlockStartIndex == null) {
|
|
311
266
|
rawMDXBlockStartIndex = index;
|
|
312
267
|
continue;
|
|
@@ -321,8 +276,7 @@ function parseNestedStringItems(items, contentItem, options) {
|
|
|
321
276
|
rawMDXBlocks: options.rawMDXBlocks
|
|
322
277
|
});
|
|
323
278
|
}
|
|
324
|
-
if (rawMDXBlock !== "" && !rawMDXBlock.endsWith("\n") &&
|
|
325
|
-
rawMDXBlock = normalizeRawMDXBlock(rawMDXBlock);
|
|
279
|
+
if (rawMDXBlock !== "" && !rawMDXBlock.endsWith("\n") && item.whitespace?.split(" ").includes("newline") === true) rawMDXBlock += "\n";
|
|
326
280
|
if (options.rendering === "rich" && options.rawMDXBlocks != null) {
|
|
327
281
|
const placeholder = `${RAW_MDX_BLOCK_PLACEHOLDER_PREFIX}${options.rawMDXBlocks.length}${RAW_MDX_BLOCK_PLACEHOLDER_SUFFIX}`;
|
|
328
282
|
options.rawMDXBlocks.push(rawMDXBlock);
|
|
@@ -332,13 +286,7 @@ function parseNestedStringItems(items, contentItem, options) {
|
|
|
332
286
|
continue;
|
|
333
287
|
}
|
|
334
288
|
if (rawMDXBlockStartIndex != null) continue;
|
|
335
|
-
|
|
336
|
-
if (options.rendering === "rich" && hasNoRichTextPayload(item) && hasNewlineWhitespace(item.whitespace) && nextItem != null && isRawMDXBlockDelimiter(nextItem, index + 1)) {
|
|
337
|
-
result += "\n";
|
|
338
|
-
continue;
|
|
339
|
-
}
|
|
340
|
-
const parsedItem = parseXMLStringItem(item, contentItem, options);
|
|
341
|
-
result += options.rendering === "rich" && result.endsWith("\n") && parsedItem.startsWith(RICH_LINE_BREAK) ? parsedItem.slice(6) : parsedItem;
|
|
289
|
+
result += parseXMLStringItem(item, contentItem, options);
|
|
342
290
|
}
|
|
343
291
|
if (rawMDXBlockStartIndex != null) for (let index = rawMDXBlockStartIndex; index < items.length; index += 1) {
|
|
344
292
|
const item = items[index];
|
|
@@ -517,7 +465,6 @@ function parseXMLContentItem(contentItem, options) {
|
|
|
517
465
|
rawMDXBlocks
|
|
518
466
|
}));
|
|
519
467
|
for (const [index, rawMDXBlock] of rawMDXBlocks.entries()) serializedRichText = serializedRichText.replaceAll(`${RAW_MDX_BLOCK_PLACEHOLDER_PREFIX}${index}${RAW_MDX_BLOCK_PLACEHOLDER_SUFFIX}`, rawMDXBlock);
|
|
520
|
-
serializedRichText = normalizeMDXNewlineRuns(serializedRichText);
|
|
521
468
|
return {
|
|
522
469
|
text: parseNestedStringItems(contentItem.string, contentItem, {
|
|
523
470
|
...options,
|
|
@@ -383,6 +383,7 @@ function parseWebElementProperties(componentProperty, elementResource, options,
|
|
|
383
383
|
const isFilterSidebarDisplayed = componentReader.valueOr("filter-sidebar-displayed", false);
|
|
384
384
|
const filterSidebarSort = componentReader.valueOr("filter-sidebar-sort", "default");
|
|
385
385
|
const imageLayout = componentReader.valueOr("image-layout", "start");
|
|
386
|
+
const isImagePlaceholderDisplayed = componentReader.valueOr("image-placeholder-displayed", true);
|
|
386
387
|
const componentOptions = parseWebsiteOptions(elementResource.options, options);
|
|
387
388
|
properties = {
|
|
388
389
|
component: "collection",
|
|
@@ -395,6 +396,7 @@ function parseWebElementProperties(componentProperty, elementResource, options,
|
|
|
395
396
|
paginationVariant,
|
|
396
397
|
loadingVariant,
|
|
397
398
|
imageLayout,
|
|
399
|
+
isImagePlaceholderDisplayed,
|
|
398
400
|
expectedItemCount,
|
|
399
401
|
isUsingQueryParams,
|
|
400
402
|
isSortDisplayed,
|
|
@@ -791,6 +793,7 @@ function parseWebpage(webpageResource, options, context, slugPrefix) {
|
|
|
791
793
|
isDisplayedInNavbar: true,
|
|
792
794
|
isNavbarSearchBarDisplayed: true,
|
|
793
795
|
backgroundImage: null,
|
|
796
|
+
sidebar: null,
|
|
794
797
|
cssStyles: {
|
|
795
798
|
default: [],
|
|
796
799
|
tablet: [],
|
|
@@ -821,6 +824,7 @@ function parseWebpage(webpageResource, options, context, slugPrefix) {
|
|
|
821
824
|
returnWebpage.items = items;
|
|
822
825
|
returnWebpage.webpages = parseWebpages(webpageResources, options, context, slugPrefix == null ? void 0 : returnWebpage.slug);
|
|
823
826
|
returnWebpage.segments = parseWebsiteSegments(webpageResource.resource, context, options, returnWebpage.slug);
|
|
827
|
+
returnWebpage.properties.sidebar = parseSidebar(webpageResources, options, context);
|
|
824
828
|
const pageReader = webpageReader.nestedByValue("presentation", "page");
|
|
825
829
|
if (pageReader.size > 0) {
|
|
826
830
|
returnWebpage.properties.isDisplayedInNavbar = pageReader.valueOr("displayed-in-navbar", true);
|
package/dist/types/website.d.mts
CHANGED
|
@@ -92,7 +92,22 @@ type WebsitePropertyQuery<T extends LanguageCodes = LanguageCodes> = WebsiteProp
|
|
|
92
92
|
*/
|
|
93
93
|
type WebsiteType = "traditional" | "digital-collection" | "plum" | "cedar" | "elm" | "maple" | "oak" | "palm";
|
|
94
94
|
/**
|
|
95
|
-
* Represents a
|
|
95
|
+
* Represents a sidebar with its title, items, layout and responsive styles
|
|
96
|
+
*/
|
|
97
|
+
type WebSidebar<T extends LanguageCodes = LanguageCodes> = {
|
|
98
|
+
isDisplayed: boolean;
|
|
99
|
+
items: Array<WebElement<T> | WebBlock<T>>;
|
|
100
|
+
title: WebTitle<T>;
|
|
101
|
+
layout: "start" | "end";
|
|
102
|
+
mobileLayout: "default" | "inline";
|
|
103
|
+
cssStyles: {
|
|
104
|
+
default: Array<Style>;
|
|
105
|
+
tablet: Array<Style>;
|
|
106
|
+
mobile: Array<Style>;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Represents a website with its properties and items
|
|
96
111
|
*/
|
|
97
112
|
type Website<T extends LanguageCodes = LanguageCodes> = {
|
|
98
113
|
uuid: string;
|
|
@@ -139,18 +154,7 @@ type Website<T extends LanguageCodes = LanguageCodes> = {
|
|
|
139
154
|
logoUuid: string | null;
|
|
140
155
|
items: Array<WebElement<T> | WebBlock<T>> | null;
|
|
141
156
|
};
|
|
142
|
-
sidebar:
|
|
143
|
-
isDisplayed: boolean;
|
|
144
|
-
items: Array<WebElement<T> | WebBlock<T>>;
|
|
145
|
-
title: WebTitle<T>;
|
|
146
|
-
layout: "start" | "end";
|
|
147
|
-
mobileLayout: "default" | "inline";
|
|
148
|
-
cssStyles: {
|
|
149
|
-
default: Array<Style>;
|
|
150
|
-
tablet: Array<Style>;
|
|
151
|
-
mobile: Array<Style>;
|
|
152
|
-
};
|
|
153
|
-
} | null;
|
|
157
|
+
sidebar: WebSidebar<T> | null;
|
|
154
158
|
itemPage: {
|
|
155
159
|
isMainContentDisplayed: boolean;
|
|
156
160
|
isDescriptionDisplayed: boolean;
|
|
@@ -199,6 +203,7 @@ type Webpage<T extends LanguageCodes = LanguageCodes> = {
|
|
|
199
203
|
isDisplayedInNavbar: boolean;
|
|
200
204
|
isNavbarSearchBarDisplayed: boolean;
|
|
201
205
|
backgroundImage: WebImage<T> | null;
|
|
206
|
+
sidebar: WebSidebar<T> | null;
|
|
202
207
|
cssStyles: {
|
|
203
208
|
default: Array<Style>;
|
|
204
209
|
tablet: Array<Style>;
|
|
@@ -296,6 +301,7 @@ type WebElementComponent<T extends LanguageCodes = LanguageCodes> = {
|
|
|
296
301
|
paginationVariant: "default" | "numeric";
|
|
297
302
|
loadingVariant: "spinner" | "skeleton" | "animation" | "none";
|
|
298
303
|
imageLayout: "top" | "bottom" | "start" | "end" | null;
|
|
304
|
+
isImagePlaceholderDisplayed: boolean;
|
|
299
305
|
expectedItemCount: number | null;
|
|
300
306
|
isSortDisplayed: boolean;
|
|
301
307
|
isUsingQueryParams: boolean;
|
|
@@ -518,4 +524,4 @@ type WebsiteMetadata<T extends LanguageCodes = LanguageCodes> = {
|
|
|
518
524
|
};
|
|
519
525
|
};
|
|
520
526
|
//#endregion
|
|
521
|
-
export { AccordionWebBlock, ContextTree, ContextTreeFilterLevel, ContextTreeLevel, ContextTreeLevelItem, Scope, Style, StylesheetCategory, StylesheetItem, WebAccordionItem, WebBlock, WebBlockByLayout, WebBlockItem, WebBlockLayout, WebElement, WebElementComponent, WebElementComponentName, WebElementComponentOf, WebElementOf, WebImage, WebTitle, Webpage, Website, WebsiteMetadata, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteSegment, WebsiteType };
|
|
527
|
+
export { AccordionWebBlock, ContextTree, ContextTreeFilterLevel, ContextTreeLevel, ContextTreeLevelItem, Scope, Style, StylesheetCategory, StylesheetItem, WebAccordionItem, WebBlock, WebBlockByLayout, WebBlockItem, WebBlockLayout, WebElement, WebElementComponent, WebElementComponentName, WebElementComponentOf, WebElementOf, WebImage, WebSidebar, WebTitle, Webpage, Website, WebsiteMetadata, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteSegment, WebsiteType };
|