ochre-sdk 1.0.13 → 1.0.15
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/constants.d.mts +17 -0
- package/dist/constants.mjs +85 -0
- package/dist/fetchers/gallery.d.mts +38 -0
- package/dist/fetchers/gallery.mjs +91 -0
- package/dist/fetchers/item-links.d.mts +32 -0
- package/dist/fetchers/item-links.mjs +120 -0
- package/dist/fetchers/item.d.mts +74 -0
- package/dist/fetchers/item.mjs +146 -0
- package/dist/fetchers/set/items.d.mts +48 -0
- package/dist/fetchers/set/items.mjs +268 -0
- package/dist/fetchers/set/property-values.d.mts +46 -0
- package/dist/fetchers/set/property-values.mjs +514 -0
- package/dist/fetchers/website.d.mts +25 -0
- package/dist/fetchers/website.mjs +38 -0
- package/dist/getters.d.mts +193 -0
- package/dist/getters.mjs +341 -0
- package/dist/helpers.d.mts +18 -0
- package/dist/helpers.mjs +33 -0
- package/dist/index.d.mts +12 -1971
- package/dist/index.mjs +9 -7236
- package/dist/parsers/helpers.d.mts +27 -0
- package/dist/parsers/helpers.mjs +53 -0
- package/dist/parsers/index.d.mts +65 -0
- package/dist/parsers/index.mjs +1338 -0
- package/dist/parsers/mdx.d.mts +4 -0
- package/dist/parsers/mdx.mjs +9 -0
- package/dist/parsers/multilingual.d.mts +189 -0
- package/dist/parsers/multilingual.mjs +410 -0
- package/dist/parsers/string.d.mts +29 -0
- package/dist/parsers/string.mjs +445 -0
- package/dist/parsers/website/index.d.mts +20 -0
- package/dist/parsers/website/index.mjs +1245 -0
- package/dist/parsers/website/reader.d.mts +29 -0
- package/dist/parsers/website/reader.mjs +75 -0
- package/dist/query.d.mts +13 -0
- package/dist/query.mjs +827 -0
- package/dist/schemas.d.mts +79 -0
- package/dist/schemas.mjs +223 -0
- package/dist/types/index.d.mts +840 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/website.d.mts +501 -0
- package/dist/types/website.mjs +1 -0
- package/dist/utils.d.mts +34 -0
- package/dist/utils.mjs +172 -0
- package/dist/xml/metadata.d.mts +5 -0
- package/dist/xml/metadata.mjs +30 -0
- package/dist/xml/schemas.d.mts +13 -0
- package/dist/xml/schemas.mjs +849 -0
- package/dist/xml/types.d.mts +901 -0
- package/dist/xml/types.mjs +1 -0
- package/package.json +19 -17
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import { MultilingualString } from "../parsers/multilingual.mjs";
|
|
2
|
+
import { Bibliography, Identification, ItemCategory, LanguageCodes, License, Metadata, Person, QueryablePropertyValueDataType } from "./index.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/types/website.d.ts
|
|
5
|
+
type WebsitePropertyValueDataType = QueryablePropertyValueDataType;
|
|
6
|
+
/**
|
|
7
|
+
* Represents a context tree level item with a variable and value
|
|
8
|
+
*/
|
|
9
|
+
type ContextTreeLevelItem = {
|
|
10
|
+
variableUuid: string;
|
|
11
|
+
valueUuid: string | null;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Represents a context tree level with a context item
|
|
15
|
+
*/
|
|
16
|
+
type ContextTreeLevel<T extends LanguageCodes = LanguageCodes> = {
|
|
17
|
+
context: Array<ContextTreeLevelItem>;
|
|
18
|
+
identification: Identification<T>;
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Represents a filter context tree level with a context item
|
|
23
|
+
*/
|
|
24
|
+
type ContextTreeFilterLevel<T extends LanguageCodes = LanguageCodes> = {
|
|
25
|
+
context: Array<ContextTreeLevelItem>;
|
|
26
|
+
identification: Identification<T>;
|
|
27
|
+
type: string;
|
|
28
|
+
filterType: "property" | "coordinates" | "bibliography" | "period";
|
|
29
|
+
isInlineDisplayed: boolean;
|
|
30
|
+
isSidebarDisplayed: boolean;
|
|
31
|
+
isSidebarOpen: boolean;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Represents a context tree with levels grouped by behavior
|
|
35
|
+
*/
|
|
36
|
+
type ContextTree<T extends LanguageCodes = LanguageCodes> = {
|
|
37
|
+
flatten: Array<ContextTreeLevel<T>>;
|
|
38
|
+
suppress: Array<ContextTreeLevel<T>>;
|
|
39
|
+
filter: Array<ContextTreeFilterLevel<T>>;
|
|
40
|
+
sort: Array<ContextTreeLevel<T>>;
|
|
41
|
+
detail: Array<ContextTreeLevel<T>>;
|
|
42
|
+
download: Array<ContextTreeLevel<T>>;
|
|
43
|
+
label: Array<ContextTreeLevel<T>>;
|
|
44
|
+
prominent: Array<ContextTreeLevel<T>>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Represents a scope with its UUID, type and identification
|
|
48
|
+
*/
|
|
49
|
+
type Scope<T extends LanguageCodes = LanguageCodes> = {
|
|
50
|
+
uuid: string;
|
|
51
|
+
type: string;
|
|
52
|
+
identification: Identification<T>;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Represents a stylesheet item with its UUID and category
|
|
56
|
+
*/
|
|
57
|
+
type StylesheetCategory = Extract<ItemCategory, "propertyVariable" | "propertyValue">;
|
|
58
|
+
type StylesheetItem = {
|
|
59
|
+
uuid: string;
|
|
60
|
+
category: "propertyVariable";
|
|
61
|
+
icon: string | null;
|
|
62
|
+
styles: {
|
|
63
|
+
default: Array<Style>;
|
|
64
|
+
tablet: Array<Style>;
|
|
65
|
+
mobile: Array<Style>;
|
|
66
|
+
};
|
|
67
|
+
} | {
|
|
68
|
+
uuid: string;
|
|
69
|
+
category: "propertyValue";
|
|
70
|
+
variableUuid: string;
|
|
71
|
+
icon: string | null;
|
|
72
|
+
styles: {
|
|
73
|
+
default: Array<Style>;
|
|
74
|
+
tablet: Array<Style>;
|
|
75
|
+
mobile: Array<Style>;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
type WebsitePropertyQueryNode<T extends LanguageCodes = LanguageCodes> = {
|
|
79
|
+
target: "property";
|
|
80
|
+
propertyVariable: string;
|
|
81
|
+
dataType: WebsitePropertyValueDataType;
|
|
82
|
+
matchMode: "includes" | "exact";
|
|
83
|
+
isCaseSensitive: boolean;
|
|
84
|
+
language: T[number];
|
|
85
|
+
};
|
|
86
|
+
type WebsitePropertyQuery<T extends LanguageCodes = LanguageCodes> = WebsitePropertyQueryNode<T> | {
|
|
87
|
+
and: Array<WebsitePropertyQuery<T>>;
|
|
88
|
+
} | {
|
|
89
|
+
or: Array<WebsitePropertyQuery<T>>;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Represents the OCHRE website type
|
|
93
|
+
*/
|
|
94
|
+
type WebsiteType = "traditional" | "digital-collection" | "plum" | "cedar" | "elm" | "maple" | "oak" | "palm";
|
|
95
|
+
/**
|
|
96
|
+
* Represents a website with its properties and elements
|
|
97
|
+
*/
|
|
98
|
+
type Website<T extends LanguageCodes = LanguageCodes> = {
|
|
99
|
+
uuid: string;
|
|
100
|
+
type: "website" | "segment";
|
|
101
|
+
belongsTo: {
|
|
102
|
+
uuid: string;
|
|
103
|
+
abbreviation: string;
|
|
104
|
+
} | null;
|
|
105
|
+
metadata: Metadata<T>;
|
|
106
|
+
publicationDateTime: Date | null;
|
|
107
|
+
identification: Identification<T>;
|
|
108
|
+
creators: Array<Person<T, "embedded">>;
|
|
109
|
+
license: License | null;
|
|
110
|
+
items: Array<Webpage<T>>;
|
|
111
|
+
properties: {
|
|
112
|
+
type: WebsiteType;
|
|
113
|
+
status: "development" | "preview" | "production";
|
|
114
|
+
versionLabel: "experimental" | "alpha" | "beta" | "test" | "staging" | "pre-release" | "release";
|
|
115
|
+
privacy: "public" | "password" | "private";
|
|
116
|
+
contact: {
|
|
117
|
+
name: string;
|
|
118
|
+
email: string | null;
|
|
119
|
+
} | null;
|
|
120
|
+
loadingVariant: "spinner" | "skeleton" | "animation" | "none";
|
|
121
|
+
theme: {
|
|
122
|
+
isThemeToggleDisplayed: boolean;
|
|
123
|
+
defaultTheme: "light" | "dark" | "system";
|
|
124
|
+
};
|
|
125
|
+
icon: {
|
|
126
|
+
logoUuid: string | null;
|
|
127
|
+
faviconUuid: string | null;
|
|
128
|
+
appleTouchIconUuid: string | null;
|
|
129
|
+
};
|
|
130
|
+
navbar: {
|
|
131
|
+
isDisplayed: boolean;
|
|
132
|
+
variant: "default" | "floating" | "inline";
|
|
133
|
+
alignment: "start" | "center" | "end";
|
|
134
|
+
isProjectDisplayed: boolean;
|
|
135
|
+
searchBarBoundElementUuid: string | null;
|
|
136
|
+
items: Array<WebElement<T> | WebBlock<T>> | null;
|
|
137
|
+
};
|
|
138
|
+
footer: {
|
|
139
|
+
isDisplayed: boolean;
|
|
140
|
+
logoUuid: string | null;
|
|
141
|
+
items: Array<WebElement<T> | WebBlock<T>> | null;
|
|
142
|
+
};
|
|
143
|
+
sidebar: {
|
|
144
|
+
isDisplayed: boolean;
|
|
145
|
+
items: Array<WebElement<T> | WebBlock<T>>;
|
|
146
|
+
title: WebTitle<T>;
|
|
147
|
+
layout: "start" | "end";
|
|
148
|
+
mobileLayout: "default" | "inline";
|
|
149
|
+
cssStyles: {
|
|
150
|
+
default: Array<Style>;
|
|
151
|
+
tablet: Array<Style>;
|
|
152
|
+
mobile: Array<Style>;
|
|
153
|
+
};
|
|
154
|
+
} | null;
|
|
155
|
+
itemPage: {
|
|
156
|
+
isMainContentDisplayed: boolean;
|
|
157
|
+
isDescriptionDisplayed: boolean;
|
|
158
|
+
isDocumentDisplayed: boolean;
|
|
159
|
+
isNotesDisplayed: boolean;
|
|
160
|
+
isEventsDisplayed: boolean;
|
|
161
|
+
isPeriodsDisplayed: boolean;
|
|
162
|
+
isPropertiesDisplayed: boolean;
|
|
163
|
+
isBibliographyDisplayed: boolean;
|
|
164
|
+
isPropertyValuesGrouped: boolean;
|
|
165
|
+
isPublicationDateTimeDisplayed: boolean;
|
|
166
|
+
isPersistentIdentifierDisplayed: boolean;
|
|
167
|
+
iiifViewer: "universal-viewer" | "clover";
|
|
168
|
+
};
|
|
169
|
+
options: {
|
|
170
|
+
contextTree: ContextTree<T> | null;
|
|
171
|
+
scopes: Array<Scope<T>> | null;
|
|
172
|
+
labels: {
|
|
173
|
+
title: MultilingualString<T> | null;
|
|
174
|
+
};
|
|
175
|
+
stylesheets: {
|
|
176
|
+
properties: Array<StylesheetItem>;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
type WebsiteSegment<T extends LanguageCodes = LanguageCodes> = Website<T> & {
|
|
182
|
+
type: "segment";
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Represents a webpage with its title, slug, properties, items and subpages
|
|
186
|
+
*/
|
|
187
|
+
type Webpage<T extends LanguageCodes = LanguageCodes> = {
|
|
188
|
+
uuid: string;
|
|
189
|
+
type: "page";
|
|
190
|
+
title: MultilingualString<T>;
|
|
191
|
+
slug: string;
|
|
192
|
+
publicationDateTime: Date | null;
|
|
193
|
+
items: Array<WebElement<T> | WebBlock<T>>;
|
|
194
|
+
segments: Array<WebsiteSegment<T>>;
|
|
195
|
+
properties: {
|
|
196
|
+
width: "full" | "large" | "narrow" | "default";
|
|
197
|
+
variant: "default" | "no-background";
|
|
198
|
+
isBreadcrumbsDisplayed: boolean;
|
|
199
|
+
isSidebarDisplayed: boolean;
|
|
200
|
+
isDisplayedInNavbar: boolean;
|
|
201
|
+
isNavbarSearchBarDisplayed: boolean;
|
|
202
|
+
backgroundImage: WebImage<T> | null;
|
|
203
|
+
cssStyles: {
|
|
204
|
+
default: Array<Style>;
|
|
205
|
+
tablet: Array<Style>;
|
|
206
|
+
mobile: Array<Style>;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
webpages: Array<Webpage<T>>;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Represents a title with its label and variant
|
|
213
|
+
*/
|
|
214
|
+
type WebTitle<T extends LanguageCodes = LanguageCodes> = {
|
|
215
|
+
label: MultilingualString<T>;
|
|
216
|
+
variant: "default" | "simple";
|
|
217
|
+
properties: {
|
|
218
|
+
isNameDisplayed: boolean;
|
|
219
|
+
isDescriptionDisplayed: boolean;
|
|
220
|
+
isDateDisplayed: boolean;
|
|
221
|
+
isCreatorsDisplayed: boolean;
|
|
222
|
+
isCountDisplayed: boolean;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Base properties for web elements
|
|
227
|
+
*/
|
|
228
|
+
type WebElement<T extends LanguageCodes = LanguageCodes> = {
|
|
229
|
+
uuid: string;
|
|
230
|
+
type: "element";
|
|
231
|
+
title: WebTitle<T>;
|
|
232
|
+
cssStyles: {
|
|
233
|
+
default: Array<Style>;
|
|
234
|
+
tablet: Array<Style>;
|
|
235
|
+
mobile: Array<Style>;
|
|
236
|
+
};
|
|
237
|
+
} & WebElementComponent<T>;
|
|
238
|
+
/**
|
|
239
|
+
* Union type of all possible web element components
|
|
240
|
+
*/
|
|
241
|
+
type WebElementComponent<T extends LanguageCodes = LanguageCodes> = {
|
|
242
|
+
component: "3d-viewer";
|
|
243
|
+
linkUuid: string;
|
|
244
|
+
fileSize: number | null;
|
|
245
|
+
isInteractive: boolean;
|
|
246
|
+
isControlsDisplayed: boolean;
|
|
247
|
+
} | {
|
|
248
|
+
component: "advanced-search";
|
|
249
|
+
boundElementUuid: string | null;
|
|
250
|
+
href: string | null;
|
|
251
|
+
} | {
|
|
252
|
+
component: "annotated-document";
|
|
253
|
+
linkUuid: string;
|
|
254
|
+
} | {
|
|
255
|
+
component: "annotated-image";
|
|
256
|
+
linkUuid: string;
|
|
257
|
+
isFilterInputDisplayed: boolean;
|
|
258
|
+
isOptionsDisplayed: boolean;
|
|
259
|
+
isAnnotationHighlightsDisplayed: boolean;
|
|
260
|
+
isAnnotationTooltipsDisplayed: boolean;
|
|
261
|
+
} | {
|
|
262
|
+
component: "audio-player";
|
|
263
|
+
linkUuid: string;
|
|
264
|
+
isSpeedControlsDisplayed: boolean;
|
|
265
|
+
isVolumeControlsDisplayed: boolean;
|
|
266
|
+
isSeekBarDisplayed: boolean;
|
|
267
|
+
} | {
|
|
268
|
+
component: "bibliography";
|
|
269
|
+
linkUuids: Array<string>;
|
|
270
|
+
bibliographies: Array<Bibliography<T, "embedded">>;
|
|
271
|
+
layout: "long" | "short";
|
|
272
|
+
isSourceDocumentDisplayed: boolean;
|
|
273
|
+
} | {
|
|
274
|
+
component: "entries";
|
|
275
|
+
linkUuid: string;
|
|
276
|
+
variant: "entry" | "item";
|
|
277
|
+
isFilterInputDisplayed: boolean;
|
|
278
|
+
} | {
|
|
279
|
+
component: "button";
|
|
280
|
+
variant: "default" | "transparent" | "link";
|
|
281
|
+
href: string;
|
|
282
|
+
isExternal: boolean;
|
|
283
|
+
label: MultilingualString<T> | null;
|
|
284
|
+
startIcon: string | null;
|
|
285
|
+
endIcon: string | null;
|
|
286
|
+
image: WebImage<T> | null;
|
|
287
|
+
} | {
|
|
288
|
+
component: "collection";
|
|
289
|
+
linkUuids: Array<string>;
|
|
290
|
+
displayedProperties: Array<{
|
|
291
|
+
uuid: string;
|
|
292
|
+
label: MultilingualString<T> | null;
|
|
293
|
+
}> | null;
|
|
294
|
+
variant: "slide" | "table" | "card" | "tile" | "showcase";
|
|
295
|
+
paginationVariant: "default" | "numeric";
|
|
296
|
+
loadingVariant: "spinner" | "skeleton" | "animation" | "none";
|
|
297
|
+
imageLayout: "top" | "bottom" | "start" | "end" | null;
|
|
298
|
+
expectedItemCount: number | null;
|
|
299
|
+
isSortDisplayed: boolean;
|
|
300
|
+
isUsingQueryParams: boolean;
|
|
301
|
+
filter: {
|
|
302
|
+
isSidebarDisplayed: boolean;
|
|
303
|
+
isResultsBarDisplayed: boolean;
|
|
304
|
+
isInputDisplayed: boolean;
|
|
305
|
+
isLimitedToInputFilter: boolean;
|
|
306
|
+
isLimitedToLeafPropertyValues: boolean;
|
|
307
|
+
sidebarSort: "default" | "alphabetical";
|
|
308
|
+
};
|
|
309
|
+
options: {
|
|
310
|
+
scopes: Array<Scope<T>> | null;
|
|
311
|
+
contextTree: ContextTree<T> | null;
|
|
312
|
+
labels: {
|
|
313
|
+
title: MultilingualString<T> | null;
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
} | {
|
|
317
|
+
component: "empty-space";
|
|
318
|
+
height: string | null;
|
|
319
|
+
width: string | null;
|
|
320
|
+
} | {
|
|
321
|
+
component: "iframe";
|
|
322
|
+
href: string;
|
|
323
|
+
height: string | null;
|
|
324
|
+
width: string | null;
|
|
325
|
+
} | {
|
|
326
|
+
component: "iiif-viewer";
|
|
327
|
+
linkUuid: string;
|
|
328
|
+
variant: "universal-viewer" | "clover";
|
|
329
|
+
} | {
|
|
330
|
+
component: "image";
|
|
331
|
+
images: Array<WebImage<T>>;
|
|
332
|
+
variant: "default" | "carousel" | "grid" | "hero";
|
|
333
|
+
width: number | null;
|
|
334
|
+
height: number | null;
|
|
335
|
+
isFullWidth: boolean;
|
|
336
|
+
isFullHeight: boolean;
|
|
337
|
+
imageQuality: "high" | "low";
|
|
338
|
+
captionSource: "name" | "abbreviation" | "description";
|
|
339
|
+
captionLayout: "top" | "bottom" | "inset" | "suppress";
|
|
340
|
+
altTextSource: "name" | "abbreviation" | "description";
|
|
341
|
+
isTransparentBackground: boolean;
|
|
342
|
+
isCover: boolean;
|
|
343
|
+
carouselOptions: {
|
|
344
|
+
secondsPerImage: number;
|
|
345
|
+
} | null;
|
|
346
|
+
heroOptions: {
|
|
347
|
+
isBackgroundImageDisplayed: boolean;
|
|
348
|
+
isDocumentDisplayed: boolean;
|
|
349
|
+
} | null;
|
|
350
|
+
} | {
|
|
351
|
+
component: "image-gallery";
|
|
352
|
+
linkUuid: string;
|
|
353
|
+
isFilterInputDisplayed: boolean;
|
|
354
|
+
} | {
|
|
355
|
+
component: "map";
|
|
356
|
+
linkUuid: string;
|
|
357
|
+
customBasemap: string | null;
|
|
358
|
+
initialBounds: [[number, number], [number, number]] | null;
|
|
359
|
+
maximumBounds: [[number, number], [number, number]] | null;
|
|
360
|
+
isControlsDisplayed: boolean;
|
|
361
|
+
isInteractive: boolean;
|
|
362
|
+
isClustered: boolean;
|
|
363
|
+
isUsingPins: boolean;
|
|
364
|
+
isFullHeight: boolean;
|
|
365
|
+
} | {
|
|
366
|
+
component: "query";
|
|
367
|
+
linkUuids: Array<string>;
|
|
368
|
+
items: Array<{
|
|
369
|
+
label: MultilingualString<T>;
|
|
370
|
+
queries: Array<WebsitePropertyQuery<T>>;
|
|
371
|
+
startIcon: string | null;
|
|
372
|
+
endIcon: string | null;
|
|
373
|
+
}>;
|
|
374
|
+
options: {
|
|
375
|
+
scopes: Array<Scope<T>> | null;
|
|
376
|
+
contextTree: ContextTree<T> | null;
|
|
377
|
+
labels: {
|
|
378
|
+
title: MultilingualString<T> | null;
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
collectionProperties: {
|
|
382
|
+
displayedProperties: Extract<WebElementComponent<T>, {
|
|
383
|
+
component: "collection";
|
|
384
|
+
}>["displayedProperties"];
|
|
385
|
+
variant: Extract<WebElementComponent<T>, {
|
|
386
|
+
component: "collection";
|
|
387
|
+
}>["variant"];
|
|
388
|
+
paginationVariant: Extract<WebElementComponent<T>, {
|
|
389
|
+
component: "collection";
|
|
390
|
+
}>["paginationVariant"];
|
|
391
|
+
loadingVariant: Extract<WebElementComponent<T>, {
|
|
392
|
+
component: "collection";
|
|
393
|
+
}>["loadingVariant"];
|
|
394
|
+
imageLayout: Extract<WebElementComponent<T>, {
|
|
395
|
+
component: "collection";
|
|
396
|
+
}>["imageLayout"];
|
|
397
|
+
};
|
|
398
|
+
} | {
|
|
399
|
+
component: "search-bar";
|
|
400
|
+
queryVariant: "submit" | "change";
|
|
401
|
+
placeholder: MultilingualString<T> | null;
|
|
402
|
+
baseFilterQueries: string | null;
|
|
403
|
+
boundElementUuid: string | null;
|
|
404
|
+
href: string | null;
|
|
405
|
+
} | {
|
|
406
|
+
component: "table";
|
|
407
|
+
linkUuid: string;
|
|
408
|
+
} | {
|
|
409
|
+
component: "text";
|
|
410
|
+
variant: {
|
|
411
|
+
name: "title" | "block" | "banner";
|
|
412
|
+
} | {
|
|
413
|
+
name: "paragraph";
|
|
414
|
+
size: "xs" | "sm" | "md" | "lg";
|
|
415
|
+
} | {
|
|
416
|
+
name: "label";
|
|
417
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
418
|
+
} | {
|
|
419
|
+
name: "heading";
|
|
420
|
+
size: "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
421
|
+
} | {
|
|
422
|
+
name: "display";
|
|
423
|
+
size: "xs" | "sm" | "md" | "lg";
|
|
424
|
+
};
|
|
425
|
+
headingLevel: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | null;
|
|
426
|
+
content: MultilingualString<T>;
|
|
427
|
+
} | {
|
|
428
|
+
component: "timeline";
|
|
429
|
+
linkUuid: string;
|
|
430
|
+
} | {
|
|
431
|
+
component: "video";
|
|
432
|
+
linkUuid: string;
|
|
433
|
+
isChaptersDisplayed: boolean;
|
|
434
|
+
};
|
|
435
|
+
type WebElementComponentName = WebElementComponent["component"];
|
|
436
|
+
type WebElementComponentOf<U extends WebElementComponentName, T extends LanguageCodes = LanguageCodes> = Extract<WebElementComponent<T>, {
|
|
437
|
+
component: U;
|
|
438
|
+
}>;
|
|
439
|
+
type WebElementOf<U extends WebElementComponentName, T extends LanguageCodes = LanguageCodes> = Extract<WebElement<T>, {
|
|
440
|
+
component: U;
|
|
441
|
+
}>;
|
|
442
|
+
/**
|
|
443
|
+
* Represents an image used in web elements
|
|
444
|
+
*/
|
|
445
|
+
type WebImage<T extends LanguageCodes = LanguageCodes> = {
|
|
446
|
+
uuid: string | null;
|
|
447
|
+
label: MultilingualString<T> | null;
|
|
448
|
+
description: MultilingualString<T> | null;
|
|
449
|
+
width: number;
|
|
450
|
+
height: number;
|
|
451
|
+
quality: "low" | "high";
|
|
452
|
+
};
|
|
453
|
+
/**
|
|
454
|
+
* Represents a CSS style with label and value
|
|
455
|
+
*/
|
|
456
|
+
type Style = {
|
|
457
|
+
label: string;
|
|
458
|
+
value: string;
|
|
459
|
+
};
|
|
460
|
+
type WebBlockLayout = "vertical" | "horizontal" | "grid" | "vertical-flex" | "horizontal-flex" | "accordion";
|
|
461
|
+
/**
|
|
462
|
+
* Represents a block of vertical or horizontal content alignment
|
|
463
|
+
*/
|
|
464
|
+
type WebBlock<T extends LanguageCodes = LanguageCodes, U extends WebBlockLayout = WebBlockLayout> = {
|
|
465
|
+
uuid: string;
|
|
466
|
+
type: "block";
|
|
467
|
+
title: WebTitle<T>;
|
|
468
|
+
items: U extends "accordion" ? Array<Extract<WebElement<T>, {
|
|
469
|
+
component: "text";
|
|
470
|
+
}> & {
|
|
471
|
+
items: Array<WebElement<T> | WebBlock<T>>;
|
|
472
|
+
}> : Array<WebElement<T> | WebBlock<T>>;
|
|
473
|
+
properties: {
|
|
474
|
+
default: {
|
|
475
|
+
layout: U;
|
|
476
|
+
wrap: "nowrap" | "wrap" | "wrap-reverse";
|
|
477
|
+
/**
|
|
478
|
+
* valid `gridTemplateColumns` or `gridTemplateRows` CSS property value
|
|
479
|
+
*/
|
|
480
|
+
spacing: string | null;
|
|
481
|
+
/**
|
|
482
|
+
* `gap` CSS property value
|
|
483
|
+
*/
|
|
484
|
+
gap: string | null;
|
|
485
|
+
isAccordionEnabled: U extends "accordion" ? boolean : never;
|
|
486
|
+
isAccordionExpandedByDefault: U extends "accordion" ? boolean : never;
|
|
487
|
+
isAccordionSidebarDisplayed: U extends "accordion" ? boolean : never;
|
|
488
|
+
};
|
|
489
|
+
tablet: Partial<WebBlock<T>["properties"]["default"]> | null;
|
|
490
|
+
mobile: Partial<WebBlock<T>["properties"]["default"]> | null;
|
|
491
|
+
};
|
|
492
|
+
cssStyles: {
|
|
493
|
+
default: Array<Style>;
|
|
494
|
+
tablet: Array<Style>;
|
|
495
|
+
mobile: Array<Style>;
|
|
496
|
+
};
|
|
497
|
+
};
|
|
498
|
+
type WebBlockByLayout<U extends WebBlockLayout = WebBlockLayout, T extends LanguageCodes = LanguageCodes> = WebBlock<T, U>;
|
|
499
|
+
type AccordionWebBlock<T extends LanguageCodes = LanguageCodes> = WebBlock<T, "accordion">;
|
|
500
|
+
//#endregion
|
|
501
|
+
export { AccordionWebBlock, ContextTree, ContextTreeFilterLevel, ContextTreeLevel, ContextTreeLevelItem, Scope, Style, StylesheetCategory, StylesheetItem, WebBlock, WebBlockByLayout, WebBlockLayout, WebElement, WebElementComponent, WebElementComponentName, WebElementComponentOf, WebElementOf, WebImage, WebTitle, Webpage, Website, WebsitePropertyQuery, WebsitePropertyQueryNode, WebsiteSegment, WebsiteType };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/utils.d.mts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LanguageCodes, Property, SetItemProperty } from "./types/index.mjs";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
|
|
4
|
+
//#region src/utils.d.ts
|
|
5
|
+
type SchemaValidationIssue = v.BaseIssue<unknown>;
|
|
6
|
+
declare function getErrorMessage(error: unknown, fallbackMessage: string): string;
|
|
7
|
+
declare function getDetailedError(error: unknown, fallbackMessage?: string): string;
|
|
8
|
+
declare function getErrorOutput(error: unknown, fallbackMessage: string): {
|
|
9
|
+
error: string;
|
|
10
|
+
detailedError: string;
|
|
11
|
+
};
|
|
12
|
+
declare function createSchemaValidationError(message: string, issues: ReadonlyArray<SchemaValidationIssue>): Error;
|
|
13
|
+
/**
|
|
14
|
+
* Validates a pseudo-UUID string
|
|
15
|
+
* @param value - The string to validate
|
|
16
|
+
* @returns True if the string is a valid pseudo-UUID, false otherwise
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
declare function isPseudoUuid(value: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Build a string literal for an XQuery string
|
|
22
|
+
* @param value - The string value to escape
|
|
23
|
+
* @returns The escaped string literal
|
|
24
|
+
*/
|
|
25
|
+
declare function stringLiteral(value: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Flatten a properties array
|
|
28
|
+
* @param properties - The properties to flatten
|
|
29
|
+
* @returns The flattened properties
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
declare function flattenProperties<T extends LanguageCodes = LanguageCodes>(properties: ReadonlyArray<Property<T> | SetItemProperty<T>>): Array<SetItemProperty<T>>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { createSchemaValidationError, flattenProperties, getDetailedError, getErrorMessage, getErrorOutput, isPseudoUuid, stringLiteral };
|