ochre-sdk 1.3.19 → 1.3.21
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/website/components.mjs +13 -3
- package/dist/query.mjs +41 -23
- package/dist/schemas.d.mts +5 -0
- package/dist/schemas.mjs +12 -1
- package/dist/types/index.d.mts +5 -0
- package/dist/types/website.d.mts +6 -1
- 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, ContextTreeFilterVariant, ContextTreeLevel, ContextTreeLevelItem, ProtectedWebsite, ResponsiveStyles, Scope, Style, StylesheetCategory, StylesheetItem, WebAccordionItem, WebBlock, WebBlockByLayout, WebBlockItem, WebBlockLayout, WebElement, WebElementComponent, WebElementComponentName, WebElementComponentOf, WebElementOf, WebIiifViewer, WebImage, WebLoadingVariant, WebOptions, WebRelationVariant, WebSectionDisplay, WebSectionVariant, WebSidebar, WebTitle, Webpage, Website, WebsiteMetadata, WebsitePrivacy, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteSegment, WebsiteType } from "./types/website.mjs";
|
|
2
|
+
import { AccordionWebBlock, ContextTree, ContextTreeFilterLevel, ContextTreeFilterVariant, ContextTreeLevel, ContextTreeLevelItem, ProtectedWebsite, ResponsiveStyles, Scope, Style, StylesheetCategory, StylesheetItem, WebAccordionItem, WebBlock, WebBlockByLayout, WebBlockItem, WebBlockLayout, WebCollectionVariant, WebElement, WebElementComponent, WebElementComponentName, WebElementComponentOf, WebElementOf, WebIiifViewer, WebImage, WebLoadingVariant, WebOptions, WebRelationVariant, WebSectionDisplay, WebSectionVariant, WebSidebar, WebTitle, Webpage, Website, WebsiteMetadata, WebsitePrivacy, 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, DownloadOption, 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, ItemLocation, ItemPayloadKind, ItemProperty, ItemWithoutEmbeddedItems, LanguageCodes, License, MapLayer, Metadata, Note, Observation, OcrString, 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, SetStyle, SetStyleProperty, SetTree, SimplifiedProperty, SpatialUnit, SpatialUnitItemLink, Text, TextItemLink, TopLevelItem, Tree, TreeItemCategory, TreeItemLink } from "./types/index.mjs";
|
|
4
4
|
import { DEFAULT_PAGE_SIZE } from "./constants.mjs";
|
|
5
5
|
import { fetchGallery } from "./fetchers/gallery.mjs";
|
|
@@ -18,4 +18,4 @@ import { PropertyOptions, PropertySelector, getLeafPropertyValues, getProperty,
|
|
|
18
18
|
import { flattenItemProperties } from "./helpers.mjs";
|
|
19
19
|
import { OCHRE_LANGUAGES, OchreLanguage, OchreLanguageCode, OchreLanguageKind, OchreLanguageStandard, getOchreLanguage, getOchreLanguageCode, isOchreLanguageCode } from "./languages.mjs";
|
|
20
20
|
import { defineLanguages } from "./parsers/languages.mjs";
|
|
21
|
-
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 ContextTreeFilterVariant, type ContextTreeLevel, type ContextTreeLevelItem, type Coordinates, type CoordinatesSource, DEFAULT_PAGE_SIZE, type DictionaryUnitItemLink, type DownloadOption, 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 ItemLocation, type ItemPayloadKind, type ItemProperty, type ItemWithoutEmbeddedItems, type LanguageCodes, type License, type MapLayer, type Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntries, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringObject, type MultilingualStringText, type Note, OCHRE_LANGUAGES, type Observation, type OchreLanguage, type OchreLanguageCode, type OchreLanguageKind, type OchreLanguageStandard, type OcrString, type Period, type PeriodItemLink, type Person, type PersonItemLink, type Property, type PropertyLike, type PropertyOptions, type PropertyRelation, type PropertySelector, type PropertyValue, type PropertyValueContent, type PropertyValueDataType, type PropertyValueItemLink, type PropertyValueQueryItem, type PropertyVariable, type PropertyVariableItemLink, type ProtectedWebsite, type Query, type QueryGroup, type QueryLeaf, type QueryablePropertyValueDataType, type RecursiveItemCategory, type Resource, type ResourceItemLink, type ResponsiveStyles, 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 SetStyle, type SetStyleProperty, 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 WebIiifViewer, type WebImage, type WebLoadingVariant, type WebOptions, type WebRelationVariant, type WebSectionDisplay, type WebSectionVariant, type WebSidebar, type WebTitle, type Webpage, type Website, type WebsiteMetadata, type WebsitePrivacy, type WebsitePropertyQuery, type WebsitePropertyQueryNode, type WebsiteSegment, type WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemChildren, fetchItemLinks, fetchItemLocations, fetchItemOcrData, fetchMapLayers, fetchSetItems, fetchSetPropertyValues, fetchTreeItems, fetchWebsite, fetchWebsiteMetadata, flattenItemProperties, getLeafPropertyValues, getOchreLanguage, getOchreLanguageCode, getProperty, getPropertyValue, getPropertyValues, getUniqueProperties, getUniquePropertyVariableLabels, isOchreLanguageCode, isPropertyMatchingFilter, normalizePropertyVariableLabel };
|
|
21
|
+
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 ContextTreeFilterVariant, type ContextTreeLevel, type ContextTreeLevelItem, type Coordinates, type CoordinatesSource, DEFAULT_PAGE_SIZE, type DictionaryUnitItemLink, type DownloadOption, 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 ItemLocation, type ItemPayloadKind, type ItemProperty, type ItemWithoutEmbeddedItems, type LanguageCodes, type License, type MapLayer, type Metadata, type MultilingualOptions, MultilingualString, type MultilingualStringEntries, type MultilingualStringEntry, type MultilingualStringInput, type MultilingualStringJSON, type MultilingualStringObject, type MultilingualStringText, type Note, OCHRE_LANGUAGES, type Observation, type OchreLanguage, type OchreLanguageCode, type OchreLanguageKind, type OchreLanguageStandard, type OcrString, type Period, type PeriodItemLink, type Person, type PersonItemLink, type Property, type PropertyLike, type PropertyOptions, type PropertyRelation, type PropertySelector, type PropertyValue, type PropertyValueContent, type PropertyValueDataType, type PropertyValueItemLink, type PropertyValueQueryItem, type PropertyVariable, type PropertyVariableItemLink, type ProtectedWebsite, type Query, type QueryGroup, type QueryLeaf, type QueryablePropertyValueDataType, type RecursiveItemCategory, type Resource, type ResourceItemLink, type ResponsiveStyles, 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 SetStyle, type SetStyleProperty, 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 WebCollectionVariant, type WebElement, type WebElementComponent, type WebElementComponentName, type WebElementComponentOf, type WebElementOf, type WebIiifViewer, type WebImage, type WebLoadingVariant, type WebOptions, type WebRelationVariant, type WebSectionDisplay, type WebSectionVariant, type WebSidebar, type WebTitle, type Webpage, type Website, type WebsiteMetadata, type WebsitePrivacy, type WebsitePropertyQuery, type WebsitePropertyQueryNode, type WebsiteSegment, type WebsiteType, defineLanguages, fetchGallery, fetchItem, fetchItemChildren, fetchItemLinks, fetchItemLocations, fetchItemOcrData, fetchMapLayers, fetchSetItems, fetchSetPropertyValues, fetchTreeItems, fetchWebsite, fetchWebsiteMetadata, flattenItemProperties, getLeafPropertyValues, getOchreLanguage, getOchreLanguageCode, getProperty, getPropertyValue, getPropertyValues, getUniqueProperties, getUniquePropertyVariableLabels, isOchreLanguageCode, isPropertyMatchingFilter, normalizePropertyVariableLabel };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { normalizeItemCategory } from "../../categories.mjs";
|
|
2
|
-
import { componentSchema } from "../../schemas.mjs";
|
|
2
|
+
import { collectionVariantSchema, componentSchema } from "../../schemas.mjs";
|
|
3
3
|
import { parseXMLContent, transformPermanentIdentificationUrlToItemLink } from "../string.mjs";
|
|
4
4
|
import { parseStringContent } from "../helpers.mjs";
|
|
5
5
|
import { parseBibliographyList, parseIdentification, parseLinks, parseSimplifiedProperties } from "../index.mjs";
|
|
@@ -17,7 +17,7 @@ import * as v from "valibot";
|
|
|
17
17
|
* "collection" component and the "query" component's collection overrides.
|
|
18
18
|
*/
|
|
19
19
|
const COLLECTION_PROPERTY_DEFAULTS = {
|
|
20
|
-
|
|
20
|
+
variants: ["slide"],
|
|
21
21
|
paginationVariant: "default",
|
|
22
22
|
loadingVariant: "skeleton",
|
|
23
23
|
minimumColumnCount: null,
|
|
@@ -39,6 +39,15 @@ const COLLECTION_IMAGE_DEFAULTS = {
|
|
|
39
39
|
isPlaceholderDisplayed: true
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
|
+
* Reads every "variant" value a collection accepts, in OCHRE order and without
|
|
43
|
+
* duplicates, skipping values the SDK does not know, so the first entry is the
|
|
44
|
+
* variant the collection opens with. Returns `null` when none are set.
|
|
45
|
+
*/
|
|
46
|
+
function parseCollectionVariants(reader) {
|
|
47
|
+
const [defaultVariant, ...otherVariants] = [...new Set(reader.stringValues("variant").filter((value) => v.is(collectionVariantSchema, value)))];
|
|
48
|
+
return defaultVariant == null ? null : [defaultVariant, ...otherVariants];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
42
51
|
* Reads the collection display properties explicitly set on a reader, omitting
|
|
43
52
|
* any that are unset. The "collection" component merges these over
|
|
44
53
|
* {@link COLLECTION_PROPERTY_DEFAULTS} and {@link COLLECTION_IMAGE_DEFAULTS},
|
|
@@ -56,7 +65,8 @@ function parseCollectionPropertyOverrides(reader) {
|
|
|
56
65
|
const value = reader.value(label);
|
|
57
66
|
if (value != null) imageOverrides[key] = value;
|
|
58
67
|
}
|
|
59
|
-
|
|
68
|
+
const variants = parseCollectionVariants(reader);
|
|
69
|
+
if (variants != null) overrides.variants = variants;
|
|
60
70
|
read("paginationVariant", "pagination-variant");
|
|
61
71
|
read("loadingVariant", "loading-variant");
|
|
62
72
|
read("minimumColumnCount", "minimum-column-count");
|
package/dist/query.mjs
CHANGED
|
@@ -232,12 +232,12 @@ function buildPropertyLabelQuery(propertyVariable) {
|
|
|
232
232
|
value: searchValue(propertyVariable)
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
return
|
|
235
|
+
function buildValueIdReferenceQuery() {
|
|
236
|
+
return buildPlainElementAttributeValueQueryExpression({
|
|
237
237
|
elementName: "value",
|
|
238
238
|
attributeName: "dataType",
|
|
239
|
-
value: searchValue("IDREF")
|
|
240
|
-
})
|
|
239
|
+
value: searchValue("xs:IDREF")
|
|
240
|
+
});
|
|
241
241
|
}
|
|
242
242
|
/**
|
|
243
243
|
* Match a field's `content` in a language, falling back to another language
|
|
@@ -435,7 +435,6 @@ function buildPropertyAllQueryExpression(parameters) {
|
|
|
435
435
|
return buildPropertyTextMatchQueryExpression({
|
|
436
436
|
propertyVariable: query.propertyVariable,
|
|
437
437
|
propertyRelation: query.propertyRelation,
|
|
438
|
-
valueFilters: [buildValueNotIdReferenceQuery()],
|
|
439
438
|
contentQueryExpression: buildRichTextContentQueryExpression({
|
|
440
439
|
language: query.language,
|
|
441
440
|
fallbackLanguage: query.fallbackLanguage,
|
|
@@ -467,6 +466,26 @@ function buildPropertyIdReferenceQueryExpression(parameters) {
|
|
|
467
466
|
}))
|
|
468
467
|
});
|
|
469
468
|
}
|
|
469
|
+
function buildPropertyIdReferenceTextQueryExpression(parameters) {
|
|
470
|
+
const { propertyVariable, propertyRelation, value, matchMode, isCaseSensitive, language, fallbackLanguage } = parameters;
|
|
471
|
+
return buildPropertyTextMatchQueryExpression({
|
|
472
|
+
propertyVariable,
|
|
473
|
+
propertyRelation,
|
|
474
|
+
valueFilters: [buildValueIdReferenceQuery()],
|
|
475
|
+
contentQueryExpression: matchMode === "exact" ? buildValueContentExactInnerQuery({
|
|
476
|
+
language,
|
|
477
|
+
fallbackLanguage,
|
|
478
|
+
value,
|
|
479
|
+
isCaseSensitive
|
|
480
|
+
}) : buildRichTextContentQueryExpression({
|
|
481
|
+
language,
|
|
482
|
+
fallbackLanguage,
|
|
483
|
+
value,
|
|
484
|
+
matchMode,
|
|
485
|
+
isCaseSensitive
|
|
486
|
+
})
|
|
487
|
+
});
|
|
488
|
+
}
|
|
470
489
|
function buildPropertyDateRangeQueryExpression(query) {
|
|
471
490
|
const rangeQueryExpressions = [];
|
|
472
491
|
if (query.from != null) rangeQueryExpressions.push(`cts:element-attribute-range-query(xs:QName("value"), xs:QName("rawValue"), ">=", ${stringLiteral(query.from)})`);
|
|
@@ -652,11 +671,21 @@ function buildLeafValueQueryExpression(parameters) {
|
|
|
652
671
|
value,
|
|
653
672
|
matchMode
|
|
654
673
|
});
|
|
655
|
-
case "IDREF":
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
674
|
+
case "IDREF":
|
|
675
|
+
if (query.matchMode === "exact") return buildPropertyIdReferenceQueryExpression({
|
|
676
|
+
propertyVariable: query.propertyVariable,
|
|
677
|
+
propertyRelation: query.propertyRelation,
|
|
678
|
+
value
|
|
679
|
+
});
|
|
680
|
+
return buildPropertyIdReferenceTextQueryExpression({
|
|
681
|
+
propertyVariable: query.propertyVariable,
|
|
682
|
+
propertyRelation: query.propertyRelation,
|
|
683
|
+
value,
|
|
684
|
+
matchMode,
|
|
685
|
+
isCaseSensitive: query.isCaseSensitive,
|
|
686
|
+
language: query.language,
|
|
687
|
+
fallbackLanguage: query.fallbackLanguage
|
|
688
|
+
});
|
|
660
689
|
case "string": return buildPropertyStringQueryExpression({
|
|
661
690
|
propertyVariable: query.propertyVariable,
|
|
662
691
|
propertyRelation: query.propertyRelation,
|
|
@@ -749,7 +778,7 @@ function getLeafHelperKey(parameters) {
|
|
|
749
778
|
"leaf",
|
|
750
779
|
matchMode,
|
|
751
780
|
query.target,
|
|
752
|
-
query.dataType,
|
|
781
|
+
query.dataType === "IDREF" && query.matchMode !== "exact" ? "IDREF-text" : query.dataType,
|
|
753
782
|
query.propertyVariable ?? "",
|
|
754
783
|
query.propertyRelation ?? "",
|
|
755
784
|
value,
|
|
@@ -868,18 +897,7 @@ function buildLeafQueryExpression(context, query) {
|
|
|
868
897
|
}
|
|
869
898
|
function getGroupableIncludesValue(query) {
|
|
870
899
|
if (query.matchMode !== "includes" || query.isNegated === true) return null;
|
|
871
|
-
|
|
872
|
-
case "string":
|
|
873
|
-
case "title":
|
|
874
|
-
case "description":
|
|
875
|
-
case "image":
|
|
876
|
-
case "periods":
|
|
877
|
-
case "bibliography":
|
|
878
|
-
case "notes": return query.value;
|
|
879
|
-
case "property":
|
|
880
|
-
if (!("value" in query) || query.value == null || query.dataType === "IDREF") return null;
|
|
881
|
-
return query.value;
|
|
882
|
-
}
|
|
900
|
+
return getLeafSearchValue(query);
|
|
883
901
|
}
|
|
884
902
|
function isQueryLeaf(query) {
|
|
885
903
|
return "target" in query;
|
package/dist/schemas.d.mts
CHANGED
|
@@ -25,6 +25,11 @@ export declare const ochreLanguageCodeSchema: v.SchemaWithPipe<readonly [v.Strin
|
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
27
|
export declare const componentSchema: v.PicklistSchema<readonly ["3d-viewer", "advanced-search", "annotated-document", "annotated-image", "audio-player", "bibliography", "button", "collection", "empty-space", "entries", "iframe", "iiif-viewer", "image", "image-gallery", "map", "query", "search-bar", "table", "text", "timeline", "video"], "Invalid/unknown web element component">;
|
|
28
|
+
/**
|
|
29
|
+
* Valid variants for the "collection" component
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare const collectionVariantSchema: v.PicklistSchema<readonly ["slide", "table", "card", "tile", "showcase"], undefined>;
|
|
28
33
|
/**
|
|
29
34
|
* Schema for validating gallery parameters
|
|
30
35
|
* @internal
|
package/dist/schemas.mjs
CHANGED
|
@@ -61,6 +61,17 @@ const componentSchema = v.picklist([
|
|
|
61
61
|
"video"
|
|
62
62
|
], "Invalid/unknown web element component");
|
|
63
63
|
/**
|
|
64
|
+
* Valid variants for the "collection" component
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
const collectionVariantSchema = v.picklist([
|
|
68
|
+
"slide",
|
|
69
|
+
"table",
|
|
70
|
+
"card",
|
|
71
|
+
"tile",
|
|
72
|
+
"showcase"
|
|
73
|
+
]);
|
|
74
|
+
/**
|
|
64
75
|
* Schema for validating gallery parameters
|
|
65
76
|
* @internal
|
|
66
77
|
*/
|
|
@@ -290,4 +301,4 @@ const treeItemsParametersSchema = v.object({
|
|
|
290
301
|
treeScopeUuids: v.pipe(v.array(uuidSchema), v.minLength(1, "At least one tree scope UUID is required")),
|
|
291
302
|
...containerItemsParametersEntries
|
|
292
303
|
});
|
|
293
|
-
export { componentSchema, gallerySchema, isPseudoUuid, itemLocationsParametersSchema, itemOcrDataParametersSchema, ochreLanguageCodeSchema, renderOptionsSchema, setItemsParametersSchema, setPropertyValuesParametersSchema, treeItemsParametersSchema, uuidSchema };
|
|
304
|
+
export { collectionVariantSchema, componentSchema, gallerySchema, isPseudoUuid, itemLocationsParametersSchema, itemOcrDataParametersSchema, ochreLanguageCodeSchema, renderOptionsSchema, setItemsParametersSchema, setPropertyValuesParametersSchema, treeItemsParametersSchema, uuidSchema };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -893,6 +893,11 @@ export type SetItemsSort = {
|
|
|
893
893
|
* own word and `exact` matches the terms as an adjacent run of whole words. OCR
|
|
894
894
|
* text carries no language, so `ocr` leaves take no `language`.
|
|
895
895
|
*
|
|
896
|
+
* An `IDREF` property leaf matches by identity under `exact`, where `value` is
|
|
897
|
+
* the UUID of the linked item, and by the linked item's displayed name under
|
|
898
|
+
* `includes`, which OCHRE copies into the value's `content`. The `all` data
|
|
899
|
+
* type searches the text of every value, linked names included.
|
|
900
|
+
*
|
|
896
901
|
* `fallbackLanguage` searches a field in that language only when the field has
|
|
897
902
|
* no content in `language`, so a match follows the text a reader of `language`
|
|
898
903
|
* is shown. Leave it unset to search `language` alone.
|
package/dist/types/website.d.mts
CHANGED
|
@@ -78,6 +78,10 @@ export type WebSectionDisplay = {
|
|
|
78
78
|
isDisplayed: boolean;
|
|
79
79
|
isHeaderDisplayed: boolean;
|
|
80
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* How a collection displays its items
|
|
83
|
+
*/
|
|
84
|
+
export type WebCollectionVariant = "slide" | "table" | "card" | "tile" | "showcase";
|
|
81
85
|
/**
|
|
82
86
|
* How a website indicates that content is loading
|
|
83
87
|
*/
|
|
@@ -362,7 +366,8 @@ export type WebElementComponent<T extends LanguageCodes = LanguageCodes> = {
|
|
|
362
366
|
label: MultilingualString<T> | null;
|
|
363
367
|
variant: WebRelationVariant | null;
|
|
364
368
|
}>;
|
|
365
|
-
|
|
369
|
+
/** The accepted variants in OCHRE order; the first is the default */
|
|
370
|
+
variants: [WebCollectionVariant, ...Array<WebCollectionVariant>];
|
|
366
371
|
paginationVariant: "default" | "numeric";
|
|
367
372
|
loadingVariant: WebLoadingVariant;
|
|
368
373
|
image: {
|