@searchcraft/javascript-sdk 0.9.2 → 0.9.4

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.
@@ -0,0 +1,2196 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import { HTMLStencilElement, JSXBase } from '@stencil/core/internal';
4
+
5
+ declare enum LogLevel {
6
+ DEBUG = 0,
7
+ INFO = 1,
8
+ WARN = 2,
9
+ ERROR = 3
10
+ }
11
+ export interface SDKDebuggerOptions {
12
+ logLevel: LogLevel;
13
+ logFormatter?: (level: LogLevel, message: string) => string;
14
+ }
15
+ declare class Logger {
16
+ private logLevel;
17
+ private logFormatter;
18
+ constructor(options: SDKDebuggerOptions);
19
+ private defaultFormatter;
20
+ debug(message: string): void;
21
+ info(message: string): void;
22
+ warn(message: string): void;
23
+ error(message: string): void;
24
+ log(level: LogLevel, message: string): void;
25
+ }
26
+ /**
27
+ * The SearchcraftConfig object is used to initialize Searchcraft in your application.
28
+ */
29
+ export interface SearchcraftConfig {
30
+ /**
31
+ * Host IP Address and port number configured and created using Vektron
32
+ */
33
+ endpointURL: string;
34
+ /**
35
+ * Name or names of search indices configured using Vektron. Given as an array of strings
36
+ */
37
+ index: string[];
38
+ /**
39
+ * A unique user identifier for the end user.
40
+ */
41
+ userId?: string;
42
+ /**
43
+ * The Index read key provided by Vektron.
44
+ */
45
+ readKey: string;
46
+ /**
47
+ * The amount of delay, in milliseconds, to debounce search requests. Defaults to `0`.
48
+ */
49
+ searchDebounceDelay?: number;
50
+ /**
51
+ * The maximum number of results to return per page.
52
+ */
53
+ searchResultsPerPage?: number;
54
+ /**
55
+ * Name of the ad source to use.
56
+ */
57
+ adSource?: "adMarketplace" | "Nativo" | "Custom" | "None";
58
+ /**
59
+ * The maximum number of product ads to show for a single search term.
60
+ */
61
+ admProductAdQuantity?: number;
62
+ /**
63
+ * The maximum number of text ads to show for a single search term.
64
+ */
65
+ admTextAdQuantity?: number;
66
+ /**
67
+ * The adm sub value.
68
+ */
69
+ admSub?: string;
70
+ /**
71
+ * The number of custom ads to render at the start of the search results page.
72
+ */
73
+ customAdStartQuantity?: number;
74
+ /**
75
+ * The number of custom ads to render at the end of the search results page.
76
+ */
77
+ customAdEndQuantity?: number;
78
+ /**
79
+ * Renders a custom ad in between search results, at the specified interval.
80
+ */
81
+ customAdInterstitialInterval?: number;
82
+ /**
83
+ * Specifies the number of ads to be rendered in each interstitial in between search results.
84
+ */
85
+ customAdInterstitialQuantity?: number;
86
+ /**
87
+ * A callback function responsible for rendering the custom ad containers.
88
+ */
89
+ customAdTemplate?: CustomAdTemplateRenderFunction;
90
+ }
91
+ export type SearchcraftAdSource = "adMarketplace" | "Nativo" | "Custom" | "None";
92
+ /**
93
+ * Used internally by consuming packages as part of the core sdk constructor.
94
+ */
95
+ export interface SearchcraftSDKInfo {
96
+ sdkName: string;
97
+ sdkVersion: string;
98
+ }
99
+ export interface CustomAdTemplateRenderData {
100
+ adContainerId: string;
101
+ searchTerm: string;
102
+ }
103
+ export type CustomAdTemplateRenderFunction = (data: CustomAdTemplateRenderData) => string;
104
+ export interface AdClientResponseItem {
105
+ id: string;
106
+ adSource: SearchcraftAdSource;
107
+ }
108
+ /**
109
+ * A Facet object returned in a search response.
110
+ */
111
+ export type FacetRoot = {
112
+ [key: string]: FacetChild[];
113
+ };
114
+ export type FacetPrime = FacetRoot[];
115
+ /**
116
+ * Represents the structure of facets, which group search results into categories.
117
+ */
118
+ export interface FacetChild {
119
+ count: number;
120
+ path: string;
121
+ children?: FacetChild[];
122
+ }
123
+ /**
124
+ * Types of measure requests that can be sent to the /measure/event endpoint.
125
+ */
126
+ export type MeasureEventName = "sdk_initialized" | "search_requested" | "search_response_received" | "document_clicked";
127
+ /**
128
+ * Properties attached to a measure request.
129
+ */
130
+ export interface MeasureRequestProperties {
131
+ searchcraft_organization_id?: string;
132
+ searchcraft_application_id?: string;
133
+ searchcraft_index_names: string[];
134
+ search_term?: string;
135
+ number_of_documents?: number;
136
+ external_document_id?: string;
137
+ document_position?: number;
138
+ session_id?: string;
139
+ }
140
+ /**
141
+ * User properties attached to a measure request.
142
+ */
143
+ export interface MeasureRequestUser {
144
+ user_id: string;
145
+ country?: string;
146
+ city?: string;
147
+ device_id?: string;
148
+ client_ip?: string;
149
+ locale?: string;
150
+ os?: string;
151
+ platform?: string;
152
+ region?: string;
153
+ sdk_name?: string;
154
+ sdk_version?: string;
155
+ user_agent?: string;
156
+ latitude?: number;
157
+ longitude?: number;
158
+ }
159
+ /**
160
+ * The structure of a response returned from a Searchcraft operation.
161
+ */
162
+ export interface SearchcraftResponse {
163
+ status: number;
164
+ data: SearchcraftResponseData | SearchcraftResponseError;
165
+ }
166
+ /**
167
+ * Error returned when a search is unsuccessful.
168
+ */
169
+ export type SearchcraftResponseError = {
170
+ status: number;
171
+ message?: string;
172
+ code?: number;
173
+ hits?: [
174
+ ];
175
+ facets?: null;
176
+ count?: number;
177
+ time_taken?: number;
178
+ };
179
+ /**
180
+ * Top-level result returned when a search is successful.
181
+ */
182
+ export interface SearchcraftResponseData {
183
+ count?: number;
184
+ facets?: FacetPrime;
185
+ hits?: SearchIndexEntry[];
186
+ time_taken?: number;
187
+ }
188
+ /**
189
+ * Represents an entry in the search index returned as part of a search result.
190
+ */
191
+ export interface SearchIndexEntry {
192
+ doc?: SearchDocument;
193
+ document_id?: string;
194
+ score?: number;
195
+ }
196
+ /**
197
+ * Data document returned within a SearchResult.
198
+ */
199
+ export interface SearchDocument extends Record<string, string | number> {
200
+ id: number;
201
+ [key: string]: string | number;
202
+ }
203
+ export interface SearchClientResponseItem {
204
+ id: string;
205
+ document: SearchDocument;
206
+ }
207
+ export type FacetPathsForIndexField = {
208
+ fieldName: string;
209
+ value: string;
210
+ };
211
+ export type RangeValueForIndexField = {
212
+ fieldName: string;
213
+ value: string;
214
+ };
215
+ /**
216
+ * Parameters required to make a successful Search request.
217
+ */
218
+ export type SearchParams = {
219
+ /**
220
+ * The search mode, which can be either 'fuzzy' or 'exact'.
221
+ */
222
+ mode: "fuzzy" | "exact";
223
+ /**
224
+ * The starting point for the results, used for pagination.
225
+ * Optional parameter.
226
+ */
227
+ offset?: number;
228
+ /**
229
+ * The number of results returned.
230
+ * Optional parameter.
231
+ */
232
+ limit?: number;
233
+ /**
234
+ * The field to order the results by (e.g., 'date_published', 'title', etc.).
235
+ * Optional parameter.
236
+ */
237
+ order_by?: string;
238
+ /**
239
+ * The search term provided by the user.
240
+ */
241
+ searchTerm: string;
242
+ /**
243
+ * The sort order, which can be either 'asc' or 'desc'.
244
+ * Optional parameter.
245
+ */
246
+ sort?: "asc" | "desc";
247
+ facetPathsForIndexFields?: Record<string, FacetPathsForIndexField>;
248
+ rangeValueForIndexFields?: Record<string, RangeValueForIndexField>;
249
+ };
250
+ export interface SubscriptionEventMap {
251
+ ad_container_rendered: AdContainerSubscriptionEvent;
252
+ query_submitted: QuerySubmittedEvent;
253
+ input_cleared: InputClearedEvent;
254
+ no_results_returned: NoResultsReturnedEvent;
255
+ }
256
+ export interface AdContainerSubscriptionEvent extends SubscriptionEvent {
257
+ name: "ad_container_rendered";
258
+ data: {
259
+ adContainerId: string;
260
+ adSource: SearchcraftAdSource;
261
+ searchTerm: string;
262
+ };
263
+ }
264
+ export interface QuerySubmittedEvent extends SubscriptionEvent {
265
+ name: "query_submitted";
266
+ data: {
267
+ searchTerm: string;
268
+ };
269
+ }
270
+ export interface InputClearedEvent extends SubscriptionEvent {
271
+ name: "input_cleared";
272
+ }
273
+ export interface NoResultsReturnedEvent extends SubscriptionEvent {
274
+ name: "no_results_returned";
275
+ }
276
+ export type SubscriptionEventName = keyof SubscriptionEventMap;
277
+ export type SubscriptionEventCallback<T extends SubscriptionEventName> = (event: SubscriptionEventMap[T]) => void;
278
+ export type UnsubscribeFunction = () => void;
279
+ export interface SubscriptionEvent {
280
+ name: SubscriptionEventName;
281
+ }
282
+ /**
283
+ * A data type representing an index field value, along with properties
284
+ * describing how to format and display the index field value.
285
+ */
286
+ export type SearchResultFieldName = {
287
+ /**
288
+ * The index field name.
289
+ */
290
+ fieldName: string;
291
+ /**
292
+ * The data type to treat this index field as.
293
+ */
294
+ dataType: "text" | "date" | "number";
295
+ /**
296
+ * The locale to use when formatting dataType: `number`
297
+ */
298
+ numberFormatLocale?: string;
299
+ /**
300
+ * If it's a number, the number format to apply.
301
+ * reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
302
+ */
303
+ numberFormatOptions?: Intl.NumberFormatOptions;
304
+ /**
305
+ * A scale factor to apply to a `number` value.
306
+ */
307
+ numberScale?: number;
308
+ /**
309
+ * TODO: Implement DateFormatOptions, for date formatting
310
+ */
311
+ dateFormatOptions?: unknown;
312
+ };
313
+ /**
314
+ * A data type representing the mapping of index fields, for the purpose of rendering them
315
+ * in search result item.
316
+ */
317
+ export type SearchResultMapping = {
318
+ /**
319
+ * The fields to map to.
320
+ */
321
+ fieldNames: SearchResultFieldName[];
322
+ /**
323
+ * The delimiter used to join them.
324
+ */
325
+ delimiter?: string;
326
+ };
327
+ export type SearchResultMappings = {
328
+ body?: SearchResultMapping;
329
+ buttonHref?: SearchResultMapping;
330
+ containerHref?: SearchResultMapping;
331
+ footer?: SearchResultMapping;
332
+ imageSource?: SearchResultMapping;
333
+ subtitle?: SearchResultMapping;
334
+ title?: SearchResultMapping;
335
+ };
336
+ export type PopoverResultMappings = {
337
+ title?: SearchResultMapping;
338
+ subtitle?: SearchResultMapping;
339
+ imageSource?: SearchResultMapping;
340
+ imageAlt?: SearchResultMapping;
341
+ href?: SearchResultMapping;
342
+ };
343
+ export interface FilterItem {
344
+ type: "facets" | "dateRange" | "numericRange" | "exactMatchToggle" | "mostRecentToggle";
345
+ label: string;
346
+ options: object | null;
347
+ }
348
+ export interface FacetsFilterItem extends FilterItem {
349
+ fieldName: string;
350
+ type: "facets";
351
+ options: {
352
+ showSublevel: boolean;
353
+ };
354
+ }
355
+ export interface NumericFilterItem extends FilterItem {
356
+ fieldName: string;
357
+ type: "numericRange";
358
+ options: {
359
+ min: number;
360
+ max: number;
361
+ granularity: number;
362
+ };
363
+ }
364
+ export interface DateRangeFilterItem extends FilterItem {
365
+ fieldName: string;
366
+ type: "dateRange";
367
+ options: {
368
+ minDate: Date;
369
+ maxDate: Date;
370
+ granularity: "year" | "month" | "day" | "hour";
371
+ };
372
+ }
373
+ export interface ExactMatchToggleFilterItem extends FilterItem {
374
+ type: "exactMatchToggle";
375
+ options: {
376
+ subLabel?: string;
377
+ };
378
+ }
379
+ export interface MostRecentToggleFilterItem extends FilterItem {
380
+ type: "mostRecentToggle";
381
+ options: {
382
+ subLabel?: string;
383
+ };
384
+ }
385
+ declare class AdClient {
386
+ config: SearchcraftConfig;
387
+ constructor(config: SearchcraftConfig);
388
+ getAdsForSearchParams(_params: SearchParams): Promise<AdClientResponseItem[]>;
389
+ }
390
+ declare class MeasureClient {
391
+ private measureRequestTimeout;
392
+ private measureRequestsBatched;
393
+ private config;
394
+ private sdkInfo;
395
+ private userId;
396
+ private sessionId;
397
+ constructor(config: SearchcraftConfig, sdkInfo: SearchcraftSDKInfo, userId: string);
398
+ /**
399
+ * Getter for the base url used by the /measure endpoints.
400
+ */
401
+ private get baseMeasureUrl();
402
+ /**
403
+ * Getter for the measure request user. Uses config values + navigator values.
404
+ */
405
+ private get measureRequestUser();
406
+ /**
407
+ * Sends a measure event to the `/measure/event` endpoint for analytics purposes.
408
+ *
409
+ * @param {MeasureEventName} eventName - Name of the event.
410
+ * @param {Partial<MeasureRequestProperties>} properties - Additional properties to send with the event.
411
+ * @param {Partial<MeasureRequestUser>} user - Additional user properites to send with the event.
412
+ */
413
+ sendMeasureEvent: (eventName: MeasureEventName, properties?: Partial<MeasureRequestProperties>, user?: Partial<MeasureRequestUser>) => void;
414
+ }
415
+ declare class SearchClient {
416
+ private config;
417
+ private userId;
418
+ private parent;
419
+ constructor(parent: SearchcraftCore, config: SearchcraftConfig, userId: string);
420
+ /**
421
+ * Getter for the base url used by the /search endpoint.
422
+ */
423
+ private get baseSearchUrl();
424
+ /**
425
+ * Performs a search operation.
426
+ * @param {SearchParams} searchParams - The parameters for the search.
427
+ */
428
+ getSearchResponse: (searchParams: SearchParams) => Promise<SearchcraftResponse>;
429
+ }
430
+ declare class SearchcraftCore {
431
+ config: SearchcraftConfig;
432
+ measureClient: MeasureClient | undefined;
433
+ searchClient: SearchClient | undefined;
434
+ adClient: AdClient | undefined;
435
+ userId: string;
436
+ private requestTimeout;
437
+ private subscriptionEvents;
438
+ constructor(config: SearchcraftConfig, sdkInfo: SearchcraftSDKInfo);
439
+ private initInputForms;
440
+ /**
441
+ * When changes happen in the DOM, we want to link any input forms found to the instance of the core.
442
+ */
443
+ private startObservingMutations;
444
+ private initClients;
445
+ emitEvent<T extends SubscriptionEventName>(eventName: T, event: SubscriptionEventMap[T]): void;
446
+ subscribe<T extends SubscriptionEventName>(eventName: T, callback: SubscriptionEventCallback<T>): UnsubscribeFunction;
447
+ /**
448
+ * Gets items from the SearchClient and the AdClient.
449
+ */
450
+ getItems: (searchParams: SearchParams, itemsCallback: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void, adCallback: (adClientResponseItems: AdClientResponseItem[]) => void) => void;
451
+ }
452
+ /**
453
+ * Callable functions made available by the SearchcraftStore.
454
+ */
455
+ export interface SearchcraftStateFunctions {
456
+ addFacetPathsForIndexField: (data: FacetPathsForIndexField) => void;
457
+ addRangeValueForIndexField: (data: RangeValueForIndexField) => void;
458
+ getSearchcraftInstance: () => SearchcraftCore | undefined;
459
+ initialize: (searchcraft: unknown, debug?: boolean) => void;
460
+ removeFacetPathsForIndexField: (fieldName: string) => void;
461
+ removeRangeValueForIndexField: (fieldName: string) => void;
462
+ resetFacetPaths: () => void;
463
+ search: () => Promise<void>;
464
+ setPopoverVisibility: (isVisible: boolean) => void;
465
+ setSearchClientResponseItems: (results: SearchClientResponseItem[]) => void;
466
+ setSearchResultsPage: (page: number) => void;
467
+ setSearchResultsPerPage: (perPage: number) => void;
468
+ setSearchTerm: (searchTerm: string) => void;
469
+ setSearchMode: (mode: "fuzzy" | "exact") => void;
470
+ setSortType: (type: "asc" | "desc") => void;
471
+ }
472
+ /**
473
+ * Values stored in SearchcraftStore.
474
+ */
475
+ export interface SearchcraftStateValues {
476
+ adClientResponseItems: AdClientResponseItem[];
477
+ core: SearchcraftCore | undefined;
478
+ logger: Logger | undefined;
479
+ facetPathsForIndexFields: Record<string, FacetPathsForIndexField>;
480
+ isPopoverVisible: boolean;
481
+ isSearchInProgress: boolean;
482
+ rangeValueForIndexFields: Record<string, RangeValueForIndexField>;
483
+ searchMode: "fuzzy" | "exact";
484
+ searchClientResponseItems: SearchClientResponseItem[];
485
+ searchResponseTimeTaken: number | undefined;
486
+ searchResponseFacetPrime: FacetPrime | undefined;
487
+ searchResultsCount: number;
488
+ searchResultsPage: number;
489
+ searchResultsPerPage: number;
490
+ searchTerm: string;
491
+ sortType: "asc" | "desc";
492
+ }
493
+ export interface SearchcraftState extends SearchcraftStateFunctions, SearchcraftStateValues {
494
+ }
495
+ export declare const searchcraftStore: import("zustand").StoreApi<SearchcraftState>;
496
+ export declare function parseCustomStyles(styles: string | Record<string, string>): Record<string, string>;
497
+ export declare function serializeStyles(styles: Record<string, Record<string, string>>): string;
498
+ export type SearchcraftSelectOption = {
499
+ label: string;
500
+ value: string | number;
501
+ selected?: boolean;
502
+ };
503
+ export namespace Components {
504
+ /**
505
+ * An inline ad meant to be rendered in a list of search results.
506
+ */
507
+ interface SearchcraftAd {
508
+ "adClientResponseItem"?: AdClientResponseItem;
509
+ "adSource": SearchcraftAdSource;
510
+ }
511
+ /**
512
+ * This web component is designed to display detailed information for a single search result.
513
+ * Once a query is submitted, the component formats and presents the result.
514
+ * It is consumed within the `searchcraft-base-search-results` component.
515
+ */
516
+ interface SearchcraftBaseSearchResult {
517
+ /**
518
+ * The relationship between the current document and the link for the button rendered when containerHref is not present.
519
+ */
520
+ "buttonRel"?: "noreferrer" | "noopener" | "nofollow";
521
+ /**
522
+ * Where to open the link for the button rendered when containerHref is not present.
523
+ */
524
+ "buttonTarget": "_blank" | "_self" | "_top" | "_parent";
525
+ /**
526
+ * The relationship between the current document and the link for the containing element.
527
+ */
528
+ "containerRel"?: "noreferrer" | "noopener" | "nofollow";
529
+ /**
530
+ * Where to open the link for the containing element.
531
+ */
532
+ "containerTarget": "_blank" | "_self" | "_top" | "_parent";
533
+ /**
534
+ * A custom styles object.
535
+ */
536
+ "customStyles"?: string;
537
+ /**
538
+ * The position in the document. Used with the "document_clicked" measure event.
539
+ */
540
+ "documentPosition": number;
541
+ /**
542
+ * The placement of the image.
543
+ */
544
+ "imagePlacement": "left" | "right";
545
+ "item"?: SearchClientResponseItem;
546
+ "searchResultMappings"?: SearchResultMappings;
547
+ }
548
+ /**
549
+ * This web component is responsible for displaying the results of a search query.
550
+ * Once a query is submitted, the component formats and presents an ordered list of the results.
551
+ * ## Usage
552
+ * ```html
553
+ * <!-- index.html -->
554
+ * <searchcraft-base-search-results
555
+ * ad-interval="4"
556
+ * place-ad-at-start="false"
557
+ * result-image-placement="right"
558
+ * />
559
+ * ```
560
+ * ```js
561
+ * // index.js
562
+ * const baseSearchResults = document.querySelector('searchcraft-base-search-results');
563
+ * baseSearchResults.searchResultMappings = containerHref: {
564
+ * fieldNames: [
565
+ * {
566
+ * fieldName: 'canonical_link',
567
+ * dataType: 'text',
568
+ * },
569
+ * ],
570
+ * };
571
+ * baseSearchResults.addEventListener('noResults', () => {
572
+ * console.log('No search results found');
573
+ * });
574
+ * ```
575
+ */
576
+ interface SearchcraftBaseSearchResults {
577
+ /**
578
+ * The label for the button rendered when containerHref is not present for each result.
579
+ */
580
+ "buttonLabel"?: string;
581
+ /**
582
+ * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.
583
+ */
584
+ "buttonRel"?: "noreferrer" | "noopener" | "nofollow";
585
+ /**
586
+ * Where to open the link for the button rendered when containerHref is not present for each result.
587
+ */
588
+ "buttonTarget": "_blank" | "_self" | "_top" | "_parent";
589
+ /**
590
+ * The relationship between the current document and the link for the containing element for each result.
591
+ */
592
+ "containerRel"?: "noreferrer" | "noopener" | "nofollow";
593
+ /**
594
+ * Where to open the link for the containing element for each result.
595
+ */
596
+ "containerTarget": "_blank" | "_self" | "_top" | "_parent";
597
+ /**
598
+ * A custom styles object.
599
+ */
600
+ "customStylesForResults"?: string | Record<string, Record<string, string>>;
601
+ /**
602
+ * The placement of the image for each result.
603
+ */
604
+ "resultImagePlacement": "left" | "right";
605
+ /**
606
+ * Formats the content rendered for each result.
607
+ */
608
+ "searchResultMappings"?: SearchResultMappings;
609
+ }
610
+ /**
611
+ * This web component represents a button to be consumed within the `search-input-form` component.
612
+ * It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.
613
+ * It is consumed within the `searchcraft-input-form` component.
614
+ */
615
+ interface SearchcraftButton {
616
+ /**
617
+ * Whether the button is disabled.
618
+ */
619
+ "disabled"?: boolean;
620
+ /**
621
+ * Controls the visual representation of the button.
622
+ */
623
+ "hierarchy"?: "primary" | "tertiary";
624
+ /**
625
+ * The icon element.
626
+ */
627
+ "icon"?: Element;
628
+ /**
629
+ * Should the button only display an icon.
630
+ */
631
+ "iconOnly"?: boolean;
632
+ /**
633
+ * The position of the icon.
634
+ */
635
+ "iconPosition"?: "left" | "right";
636
+ /**
637
+ * The label for the button.
638
+ */
639
+ "label": string;
640
+ /**
641
+ * The type of the button.
642
+ */
643
+ "type"?: "submit" | "reset" | "button";
644
+ }
645
+ /**
646
+ * This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.
647
+ * ## Usage
648
+ * ```html
649
+ * <!-- index.html -->
650
+ * <searchcraft-error-message error-message="No search results found for query" />
651
+ * ```
652
+ */
653
+ interface SearchcraftErrorMessage {
654
+ /**
655
+ * The error message.
656
+ */
657
+ "errorMessage"?: string;
658
+ }
659
+ /**
660
+ * This web component is designed to display facets in a search interface, allowing users to refine their search results by applying filters based on various attributes.
661
+ * It is consumed within the `searchcraft-filter-panel`.
662
+ * ## Usage
663
+ * ```html
664
+ * <!-- index.html -->
665
+ * <searchcraft-facet-list field-name="title" />
666
+ * ```
667
+ * ```js
668
+ * // index.js
669
+ * const facetList = document.querySelector('searchcraft-facet-list');
670
+ * facetList.addEventListener('facetSelectionUpdated', () => {
671
+ * console.log('Facet selection updated');
672
+ * });
673
+ * ```
674
+ */
675
+ interface SearchcraftFacetList {
676
+ /**
677
+ * The name of the field where facets are applied.
678
+ */
679
+ "fieldName": string;
680
+ }
681
+ /**
682
+ * This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.
683
+ * ## Usage
684
+ * ```html
685
+ * <!-- index.html -->
686
+ * <searchcraft-filter-panel />
687
+ * ```
688
+ */
689
+ interface SearchcraftFilterPanel {
690
+ /**
691
+ * The items to filter.
692
+ */
693
+ "items": FilterItem[];
694
+ }
695
+ /**
696
+ * This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.
697
+ * It abstracts the complexities of index-based searching, making it accessible to users of all technical levels.
698
+ * ## Usage
699
+ * ```html
700
+ * <!-- index.html -->
701
+ * <searchcraft-input-form placeholder-value="Search here" />
702
+ * ```
703
+ * ```js
704
+ * // index.js
705
+ * const searchInputForm = document.querySelector('searchcraft-input-form');
706
+ * ```
707
+ */
708
+ interface SearchcraftInputForm {
709
+ /**
710
+ * Whether or not to automatically submit the search term when the input changes.
711
+ */
712
+ "autoSearch": boolean;
713
+ /**
714
+ * The label for the submit button.
715
+ */
716
+ "buttonLabel"?: string;
717
+ /**
718
+ * Where to place the search button.
719
+ */
720
+ "buttonPlacement": "left" | "right" | "none";
721
+ "core"?: SearchcraftCore;
722
+ /**
723
+ * A custom styles object to be applied to the input element.
724
+ */
725
+ "customStyles": string | Record<string, string>;
726
+ /**
727
+ * The label rendered above the input.
728
+ */
729
+ "inputLabel"?: string;
730
+ /**
731
+ * The input element's placeholder value.
732
+ */
733
+ "placeholderValue": string;
734
+ /**
735
+ * The starting value of the input element.
736
+ */
737
+ "searchTerm": string;
738
+ }
739
+ /**
740
+ * This web component serves as the input label for the searchcraft-input-form component.
741
+ * ## Usage
742
+ * ```html
743
+ * <!-- index.html -->
744
+ * <searchcraft-input-label label="Search" />
745
+ * ```
746
+ */
747
+ interface SearchcraftInputLabel {
748
+ /**
749
+ * The classname applied to the label element.
750
+ */
751
+ "inputLabelClassName"?: string | undefined;
752
+ "label": string;
753
+ }
754
+ /**
755
+ * This web component is designed to facilitate pagination of search results.
756
+ * Once a query is submitted, calculates the number for pages.
757
+ * ## Usage
758
+ * ```html
759
+ * <!-- index.html -->
760
+ * <searchcraft-pagination />
761
+ * ```
762
+ */
763
+ interface SearchcraftPagination {
764
+ /**
765
+ * The custom styles object.
766
+ */
767
+ "customStyles"?: string;
768
+ }
769
+ /**
770
+ * Renders a button which, when clicked, turns on popover visibility.
771
+ */
772
+ interface SearchcraftPopoverButton {
773
+ }
774
+ /**
775
+ * This web component is designed to display search results in a popover container that dynamically appears when the user interacts with a search input field, or when a popover-button is pressed.
776
+ * ## Usage
777
+ * ```html
778
+ * <!-- index.html -->
779
+ * <searchcraft-popover-form type="fullscreen" />
780
+ * ```
781
+ * ```js
782
+ * // index.js
783
+ * const popoverForm = document.querySelector('searchcraft-popover-form');
784
+ * popoverForm.popoverResultMappings = {
785
+ * containerHref: {
786
+ * fieldNames: [
787
+ * {
788
+ * fieldName: 'canonical_link',
789
+ * dataType: 'text',
790
+ * },
791
+ * ],
792
+ * };
793
+ * ```
794
+ */
795
+ interface SearchcraftPopoverForm {
796
+ /**
797
+ * The hotkey that activates the popover.
798
+ */
799
+ "hotkey": string;
800
+ /**
801
+ * The hotkey modifier that activates the popover. Used together with the `hotkey` prop.
802
+ */
803
+ "hotkeyModifier": "ctrl" | "meta" | "alt" | "option";
804
+ /**
805
+ * Formats the content rendered for each result.
806
+ */
807
+ "popoverResultMappings"?: PopoverResultMappings;
808
+ /**
809
+ * The type of popover form to render. - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content. - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component. - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.
810
+ */
811
+ "type": "inline" | "fullscreen" | "modal";
812
+ }
813
+ /**
814
+ * A single list item rendered in a searchcraft-popover-list-view.
815
+ */
816
+ interface SearchcraftPopoverListItem {
817
+ /**
818
+ * The document position relative to the search results (For Measure)
819
+ */
820
+ "documentPosition": number;
821
+ "item": SearchClientResponseItem | undefined;
822
+ "popoverResultMappings": PopoverResultMappings | undefined;
823
+ }
824
+ /**
825
+ * This web component is designed to display a list of results within a popover interface.
826
+ * It is consumed within the `searchcraft-popover-form` component.
827
+ * ## Usage
828
+ * ```html
829
+ * <!-- index.html -->
830
+ * <searchcraft-popover-list-view />
831
+ * ```
832
+ */
833
+ interface SearchcraftPopoverListView {
834
+ "adClientResponseItems": AdClientResponseItem[] | undefined;
835
+ /**
836
+ * The mappings that define how the data in the documents are mapped to the list-view-item elements.
837
+ */
838
+ "popoverResultMappings": PopoverResultMappings | undefined;
839
+ /**
840
+ * The items to render in the list view.
841
+ */
842
+ "searchClientResponseItems": SearchClientResponseItem[] | undefined;
843
+ "searchResultsPage": number;
844
+ "searchResultsPerPage": number;
845
+ }
846
+ /**
847
+ * This web component is designed to display the number of results returned from a search query.
848
+ * ## Usage
849
+ * ```html
850
+ * <!-- index.html -->
851
+ * <script>
852
+ * const resultsInfo = document.querySelector('searchcraft-results-info');
853
+ * resultsInfo.customFormatter = (range, count, responseTime) =>
854
+ * `${range[0]}-${range[1]} of ${count} results in ${responseTime}ms`;
855
+ * </script>
856
+ * <searchcraft-results-info />
857
+ * ```
858
+ */
859
+ interface SearchcraftResultsInfo {
860
+ /**
861
+ * The custom formatter for the resulting string.
862
+ * @example ```ts resultsInfo.customFormatter = (range, count, responseTime) => `${range[0]}-${range[1]} of ${count} results in ${responseTime}ms`; ```
863
+ */
864
+ "customFormatter"?: (range: [
865
+ string,
866
+ string
867
+ ], count: string, responseTime: string) => void;
868
+ /**
869
+ * The custom styles object.
870
+ */
871
+ "customStyles"?: string;
872
+ }
873
+ /**
874
+ * This web component is designed to choose the number of search results displayed.
875
+ * ## Usage
876
+ * ```html
877
+ * <!-- index.html -->
878
+ * <searchcraft-search-results-per-page increment="20" />
879
+ * ```
880
+ */
881
+ interface SearchcraftSearchResultsPerPage {
882
+ /**
883
+ * The custom styles object.
884
+ */
885
+ "customStyles"?: string;
886
+ /**
887
+ * The amount the options will increase (e.g. 20 = [20, 40, 60, 80, 100]). The base value is defined by the `searchResultsPerPage` option in the configuration.
888
+ */
889
+ "increment": string | number;
890
+ }
891
+ /**
892
+ * This web component is designed to allow users to select between a group of options.
893
+ * ## Usage
894
+ * ```html
895
+ * <!-- index.html -->
896
+ * <searchcraft-select
897
+ * inputId="searchcraft-select"
898
+ * name="searchcraft-select"
899
+ * options="[{ label: 'label', value: 'value' }]"
900
+ * />
901
+ * ```
902
+ */
903
+ interface SearchcraftSelect {
904
+ /**
905
+ * The caption displayed below the select input.
906
+ */
907
+ "caption"?: string;
908
+ /**
909
+ * A custom styles object.
910
+ */
911
+ "customStyles"?: string;
912
+ /**
913
+ * Whether the select input is disabled.
914
+ */
915
+ "disabled"?: boolean;
916
+ /**
917
+ * The ID for the select input.
918
+ */
919
+ "inputId": string;
920
+ /**
921
+ * The label of the select input.
922
+ */
923
+ "label"?: string;
924
+ /**
925
+ * The ID for the label of the select input.
926
+ */
927
+ "labelId"?: string;
928
+ /**
929
+ * The name of the select input.
930
+ */
931
+ "name": string;
932
+ /**
933
+ * The options for the select input.
934
+ */
935
+ "options": SearchcraftSelectOption[] | string;
936
+ }
937
+ /**
938
+ * This web component is designed to allow users to select a value from a range defined by a minimum and maximum value.
939
+ * The component renders a slider interface, which can be used to visually choose a value between two boundaries.
940
+ * It is consumed by the `searchcraft-filter-panel` component.
941
+ */
942
+ interface SearchcraftSlider {
943
+ /**
944
+ * The type of data allowed.
945
+ */
946
+ "dataType": "number" | "date";
947
+ /**
948
+ * The granularity that the value must adhere to.
949
+ */
950
+ "granularity": number;
951
+ /**
952
+ * The maximum value allowed.
953
+ */
954
+ "max": number;
955
+ /**
956
+ * The minimum value allowed.
957
+ */
958
+ "min": number;
959
+ }
960
+ /**
961
+ * This web component adds Searchcraft's built-in css theme to your page's <head> tag.
962
+ * It does not render anything visible, its only function is to manage the css styles on the page.
963
+ * ## Usage
964
+ * ```html
965
+ * <!-- index.html -->
966
+ * <searchcraft-theme theme="light" custom-theme="{}" />
967
+ * ```
968
+ */
969
+ interface SearchcraftTheme {
970
+ /**
971
+ * The custom theme configuration object.
972
+ */
973
+ "customTheme"?: string;
974
+ /**
975
+ * The name of the theme.
976
+ */
977
+ "theme"?: string;
978
+ }
979
+ /**
980
+ * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.
981
+ * It is consumed within the `searchcraft-filter-panel` component.
982
+ */
983
+ interface SearchcraftToggleButton {
984
+ /**
985
+ * The label.
986
+ */
987
+ "label": string;
988
+ /**
989
+ * The secondary label displayed below the main label.
990
+ */
991
+ "subLabel": string | undefined;
992
+ }
993
+ }
994
+ export interface SearchcraftButtonCustomEvent<T> extends CustomEvent<T> {
995
+ detail: T;
996
+ target: HTMLSearchcraftButtonElement;
997
+ }
998
+ export interface SearchcraftFacetListCustomEvent<T> extends CustomEvent<T> {
999
+ detail: T;
1000
+ target: HTMLSearchcraftFacetListElement;
1001
+ }
1002
+ export interface SearchcraftInputFormCustomEvent<T> extends CustomEvent<T> {
1003
+ detail: T;
1004
+ target: HTMLSearchcraftInputFormElement;
1005
+ }
1006
+ export interface SearchcraftSelectCustomEvent<T> extends CustomEvent<T> {
1007
+ detail: T;
1008
+ target: HTMLSearchcraftSelectElement;
1009
+ }
1010
+ export interface SearchcraftSliderCustomEvent<T> extends CustomEvent<T> {
1011
+ detail: T;
1012
+ target: HTMLSearchcraftSliderElement;
1013
+ }
1014
+ export interface SearchcraftToggleButtonCustomEvent<T> extends CustomEvent<T> {
1015
+ detail: T;
1016
+ target: HTMLSearchcraftToggleButtonElement;
1017
+ }
1018
+ declare global {
1019
+ /**
1020
+ * An inline ad meant to be rendered in a list of search results.
1021
+ */
1022
+ interface HTMLSearchcraftAdElement extends Components.SearchcraftAd, HTMLStencilElement {
1023
+ }
1024
+ var HTMLSearchcraftAdElement: {
1025
+ prototype: HTMLSearchcraftAdElement;
1026
+ new (): HTMLSearchcraftAdElement;
1027
+ };
1028
+ /**
1029
+ * This web component is designed to display detailed information for a single search result.
1030
+ * Once a query is submitted, the component formats and presents the result.
1031
+ * It is consumed within the `searchcraft-base-search-results` component.
1032
+ */
1033
+ interface HTMLSearchcraftBaseSearchResultElement extends Components.SearchcraftBaseSearchResult, HTMLStencilElement {
1034
+ }
1035
+ var HTMLSearchcraftBaseSearchResultElement: {
1036
+ prototype: HTMLSearchcraftBaseSearchResultElement;
1037
+ new (): HTMLSearchcraftBaseSearchResultElement;
1038
+ };
1039
+ /**
1040
+ * This web component is responsible for displaying the results of a search query.
1041
+ * Once a query is submitted, the component formats and presents an ordered list of the results.
1042
+ * ## Usage
1043
+ * ```html
1044
+ * <!-- index.html -->
1045
+ * <searchcraft-base-search-results
1046
+ * ad-interval="4"
1047
+ * place-ad-at-start="false"
1048
+ * result-image-placement="right"
1049
+ * />
1050
+ * ```
1051
+ * ```js
1052
+ * // index.js
1053
+ * const baseSearchResults = document.querySelector('searchcraft-base-search-results');
1054
+ * baseSearchResults.searchResultMappings = containerHref: {
1055
+ * fieldNames: [
1056
+ * {
1057
+ * fieldName: 'canonical_link',
1058
+ * dataType: 'text',
1059
+ * },
1060
+ * ],
1061
+ * };
1062
+ * baseSearchResults.addEventListener('noResults', () => {
1063
+ * console.log('No search results found');
1064
+ * });
1065
+ * ```
1066
+ */
1067
+ interface HTMLSearchcraftBaseSearchResultsElement extends Components.SearchcraftBaseSearchResults, HTMLStencilElement {
1068
+ }
1069
+ var HTMLSearchcraftBaseSearchResultsElement: {
1070
+ prototype: HTMLSearchcraftBaseSearchResultsElement;
1071
+ new (): HTMLSearchcraftBaseSearchResultsElement;
1072
+ };
1073
+ interface HTMLSearchcraftButtonElementEventMap {
1074
+ "buttonClick": void;
1075
+ }
1076
+ /**
1077
+ * This web component represents a button to be consumed within the `search-input-form` component.
1078
+ * It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.
1079
+ * It is consumed within the `searchcraft-input-form` component.
1080
+ */
1081
+ interface HTMLSearchcraftButtonElement extends Components.SearchcraftButton, HTMLStencilElement {
1082
+ addEventListener<K extends keyof HTMLSearchcraftButtonElementEventMap>(type: K, listener: (this: HTMLSearchcraftButtonElement, ev: SearchcraftButtonCustomEvent<HTMLSearchcraftButtonElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
1083
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1084
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1085
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1086
+ removeEventListener<K extends keyof HTMLSearchcraftButtonElementEventMap>(type: K, listener: (this: HTMLSearchcraftButtonElement, ev: SearchcraftButtonCustomEvent<HTMLSearchcraftButtonElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
1087
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1088
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1089
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1090
+ }
1091
+ var HTMLSearchcraftButtonElement: {
1092
+ prototype: HTMLSearchcraftButtonElement;
1093
+ new (): HTMLSearchcraftButtonElement;
1094
+ };
1095
+ /**
1096
+ * This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.
1097
+ * ## Usage
1098
+ * ```html
1099
+ * <!-- index.html -->
1100
+ * <searchcraft-error-message error-message="No search results found for query" />
1101
+ * ```
1102
+ */
1103
+ interface HTMLSearchcraftErrorMessageElement extends Components.SearchcraftErrorMessage, HTMLStencilElement {
1104
+ }
1105
+ var HTMLSearchcraftErrorMessageElement: {
1106
+ prototype: HTMLSearchcraftErrorMessageElement;
1107
+ new (): HTMLSearchcraftErrorMessageElement;
1108
+ };
1109
+ interface HTMLSearchcraftFacetListElementEventMap {
1110
+ "facetSelectionUpdated": {
1111
+ paths: string[];
1112
+ };
1113
+ }
1114
+ /**
1115
+ * This web component is designed to display facets in a search interface, allowing users to refine their search results by applying filters based on various attributes.
1116
+ * It is consumed within the `searchcraft-filter-panel`.
1117
+ * ## Usage
1118
+ * ```html
1119
+ * <!-- index.html -->
1120
+ * <searchcraft-facet-list field-name="title" />
1121
+ * ```
1122
+ * ```js
1123
+ * // index.js
1124
+ * const facetList = document.querySelector('searchcraft-facet-list');
1125
+ * facetList.addEventListener('facetSelectionUpdated', () => {
1126
+ * console.log('Facet selection updated');
1127
+ * });
1128
+ * ```
1129
+ */
1130
+ interface HTMLSearchcraftFacetListElement extends Components.SearchcraftFacetList, HTMLStencilElement {
1131
+ addEventListener<K extends keyof HTMLSearchcraftFacetListElementEventMap>(type: K, listener: (this: HTMLSearchcraftFacetListElement, ev: SearchcraftFacetListCustomEvent<HTMLSearchcraftFacetListElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
1132
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1133
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1134
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1135
+ removeEventListener<K extends keyof HTMLSearchcraftFacetListElementEventMap>(type: K, listener: (this: HTMLSearchcraftFacetListElement, ev: SearchcraftFacetListCustomEvent<HTMLSearchcraftFacetListElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
1136
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1137
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1138
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1139
+ }
1140
+ var HTMLSearchcraftFacetListElement: {
1141
+ prototype: HTMLSearchcraftFacetListElement;
1142
+ new (): HTMLSearchcraftFacetListElement;
1143
+ };
1144
+ /**
1145
+ * This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.
1146
+ * ## Usage
1147
+ * ```html
1148
+ * <!-- index.html -->
1149
+ * <searchcraft-filter-panel />
1150
+ * ```
1151
+ */
1152
+ interface HTMLSearchcraftFilterPanelElement extends Components.SearchcraftFilterPanel, HTMLStencilElement {
1153
+ }
1154
+ var HTMLSearchcraftFilterPanelElement: {
1155
+ prototype: HTMLSearchcraftFilterPanelElement;
1156
+ new (): HTMLSearchcraftFilterPanelElement;
1157
+ };
1158
+ interface HTMLSearchcraftInputFormElementEventMap {
1159
+ "inputFocus": void;
1160
+ "inputBlur": void;
1161
+ "inputInit": void;
1162
+ }
1163
+ /**
1164
+ * This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.
1165
+ * It abstracts the complexities of index-based searching, making it accessible to users of all technical levels.
1166
+ * ## Usage
1167
+ * ```html
1168
+ * <!-- index.html -->
1169
+ * <searchcraft-input-form placeholder-value="Search here" />
1170
+ * ```
1171
+ * ```js
1172
+ * // index.js
1173
+ * const searchInputForm = document.querySelector('searchcraft-input-form');
1174
+ * ```
1175
+ */
1176
+ interface HTMLSearchcraftInputFormElement extends Components.SearchcraftInputForm, HTMLStencilElement {
1177
+ addEventListener<K extends keyof HTMLSearchcraftInputFormElementEventMap>(type: K, listener: (this: HTMLSearchcraftInputFormElement, ev: SearchcraftInputFormCustomEvent<HTMLSearchcraftInputFormElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
1178
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1179
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1180
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1181
+ removeEventListener<K extends keyof HTMLSearchcraftInputFormElementEventMap>(type: K, listener: (this: HTMLSearchcraftInputFormElement, ev: SearchcraftInputFormCustomEvent<HTMLSearchcraftInputFormElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
1182
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1183
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1184
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1185
+ }
1186
+ var HTMLSearchcraftInputFormElement: {
1187
+ prototype: HTMLSearchcraftInputFormElement;
1188
+ new (): HTMLSearchcraftInputFormElement;
1189
+ };
1190
+ /**
1191
+ * This web component serves as the input label for the searchcraft-input-form component.
1192
+ * ## Usage
1193
+ * ```html
1194
+ * <!-- index.html -->
1195
+ * <searchcraft-input-label label="Search" />
1196
+ * ```
1197
+ */
1198
+ interface HTMLSearchcraftInputLabelElement extends Components.SearchcraftInputLabel, HTMLStencilElement {
1199
+ }
1200
+ var HTMLSearchcraftInputLabelElement: {
1201
+ prototype: HTMLSearchcraftInputLabelElement;
1202
+ new (): HTMLSearchcraftInputLabelElement;
1203
+ };
1204
+ /**
1205
+ * This web component is designed to facilitate pagination of search results.
1206
+ * Once a query is submitted, calculates the number for pages.
1207
+ * ## Usage
1208
+ * ```html
1209
+ * <!-- index.html -->
1210
+ * <searchcraft-pagination />
1211
+ * ```
1212
+ */
1213
+ interface HTMLSearchcraftPaginationElement extends Components.SearchcraftPagination, HTMLStencilElement {
1214
+ }
1215
+ var HTMLSearchcraftPaginationElement: {
1216
+ prototype: HTMLSearchcraftPaginationElement;
1217
+ new (): HTMLSearchcraftPaginationElement;
1218
+ };
1219
+ /**
1220
+ * Renders a button which, when clicked, turns on popover visibility.
1221
+ */
1222
+ interface HTMLSearchcraftPopoverButtonElement extends Components.SearchcraftPopoverButton, HTMLStencilElement {
1223
+ }
1224
+ var HTMLSearchcraftPopoverButtonElement: {
1225
+ prototype: HTMLSearchcraftPopoverButtonElement;
1226
+ new (): HTMLSearchcraftPopoverButtonElement;
1227
+ };
1228
+ /**
1229
+ * This web component is designed to display search results in a popover container that dynamically appears when the user interacts with a search input field, or when a popover-button is pressed.
1230
+ * ## Usage
1231
+ * ```html
1232
+ * <!-- index.html -->
1233
+ * <searchcraft-popover-form type="fullscreen" />
1234
+ * ```
1235
+ * ```js
1236
+ * // index.js
1237
+ * const popoverForm = document.querySelector('searchcraft-popover-form');
1238
+ * popoverForm.popoverResultMappings = {
1239
+ * containerHref: {
1240
+ * fieldNames: [
1241
+ * {
1242
+ * fieldName: 'canonical_link',
1243
+ * dataType: 'text',
1244
+ * },
1245
+ * ],
1246
+ * };
1247
+ * ```
1248
+ */
1249
+ interface HTMLSearchcraftPopoverFormElement extends Components.SearchcraftPopoverForm, HTMLStencilElement {
1250
+ }
1251
+ var HTMLSearchcraftPopoverFormElement: {
1252
+ prototype: HTMLSearchcraftPopoverFormElement;
1253
+ new (): HTMLSearchcraftPopoverFormElement;
1254
+ };
1255
+ /**
1256
+ * A single list item rendered in a searchcraft-popover-list-view.
1257
+ */
1258
+ interface HTMLSearchcraftPopoverListItemElement extends Components.SearchcraftPopoverListItem, HTMLStencilElement {
1259
+ }
1260
+ var HTMLSearchcraftPopoverListItemElement: {
1261
+ prototype: HTMLSearchcraftPopoverListItemElement;
1262
+ new (): HTMLSearchcraftPopoverListItemElement;
1263
+ };
1264
+ /**
1265
+ * This web component is designed to display a list of results within a popover interface.
1266
+ * It is consumed within the `searchcraft-popover-form` component.
1267
+ * ## Usage
1268
+ * ```html
1269
+ * <!-- index.html -->
1270
+ * <searchcraft-popover-list-view />
1271
+ * ```
1272
+ */
1273
+ interface HTMLSearchcraftPopoverListViewElement extends Components.SearchcraftPopoverListView, HTMLStencilElement {
1274
+ }
1275
+ var HTMLSearchcraftPopoverListViewElement: {
1276
+ prototype: HTMLSearchcraftPopoverListViewElement;
1277
+ new (): HTMLSearchcraftPopoverListViewElement;
1278
+ };
1279
+ /**
1280
+ * This web component is designed to display the number of results returned from a search query.
1281
+ * ## Usage
1282
+ * ```html
1283
+ * <!-- index.html -->
1284
+ * <script>
1285
+ * const resultsInfo = document.querySelector('searchcraft-results-info');
1286
+ * resultsInfo.customFormatter = (range, count, responseTime) =>
1287
+ * `${range[0]}-${range[1]} of ${count} results in ${responseTime}ms`;
1288
+ * </script>
1289
+ * <searchcraft-results-info />
1290
+ * ```
1291
+ */
1292
+ interface HTMLSearchcraftResultsInfoElement extends Components.SearchcraftResultsInfo, HTMLStencilElement {
1293
+ }
1294
+ var HTMLSearchcraftResultsInfoElement: {
1295
+ prototype: HTMLSearchcraftResultsInfoElement;
1296
+ new (): HTMLSearchcraftResultsInfoElement;
1297
+ };
1298
+ /**
1299
+ * This web component is designed to choose the number of search results displayed.
1300
+ * ## Usage
1301
+ * ```html
1302
+ * <!-- index.html -->
1303
+ * <searchcraft-search-results-per-page increment="20" />
1304
+ * ```
1305
+ */
1306
+ interface HTMLSearchcraftSearchResultsPerPageElement extends Components.SearchcraftSearchResultsPerPage, HTMLStencilElement {
1307
+ }
1308
+ var HTMLSearchcraftSearchResultsPerPageElement: {
1309
+ prototype: HTMLSearchcraftSearchResultsPerPageElement;
1310
+ new (): HTMLSearchcraftSearchResultsPerPageElement;
1311
+ };
1312
+ interface HTMLSearchcraftSelectElementEventMap {
1313
+ "selectChange": string;
1314
+ }
1315
+ /**
1316
+ * This web component is designed to allow users to select between a group of options.
1317
+ * ## Usage
1318
+ * ```html
1319
+ * <!-- index.html -->
1320
+ * <searchcraft-select
1321
+ * inputId="searchcraft-select"
1322
+ * name="searchcraft-select"
1323
+ * options="[{ label: 'label', value: 'value' }]"
1324
+ * />
1325
+ * ```
1326
+ */
1327
+ interface HTMLSearchcraftSelectElement extends Components.SearchcraftSelect, HTMLStencilElement {
1328
+ addEventListener<K extends keyof HTMLSearchcraftSelectElementEventMap>(type: K, listener: (this: HTMLSearchcraftSelectElement, ev: SearchcraftSelectCustomEvent<HTMLSearchcraftSelectElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
1329
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1330
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1331
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1332
+ removeEventListener<K extends keyof HTMLSearchcraftSelectElementEventMap>(type: K, listener: (this: HTMLSearchcraftSelectElement, ev: SearchcraftSelectCustomEvent<HTMLSearchcraftSelectElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
1333
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1334
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1335
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1336
+ }
1337
+ var HTMLSearchcraftSelectElement: {
1338
+ prototype: HTMLSearchcraftSelectElement;
1339
+ new (): HTMLSearchcraftSelectElement;
1340
+ };
1341
+ interface HTMLSearchcraftSliderElementEventMap {
1342
+ "rangeChanged": any;
1343
+ }
1344
+ /**
1345
+ * This web component is designed to allow users to select a value from a range defined by a minimum and maximum value.
1346
+ * The component renders a slider interface, which can be used to visually choose a value between two boundaries.
1347
+ * It is consumed by the `searchcraft-filter-panel` component.
1348
+ */
1349
+ interface HTMLSearchcraftSliderElement extends Components.SearchcraftSlider, HTMLStencilElement {
1350
+ addEventListener<K extends keyof HTMLSearchcraftSliderElementEventMap>(type: K, listener: (this: HTMLSearchcraftSliderElement, ev: SearchcraftSliderCustomEvent<HTMLSearchcraftSliderElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
1351
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1352
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1353
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1354
+ removeEventListener<K extends keyof HTMLSearchcraftSliderElementEventMap>(type: K, listener: (this: HTMLSearchcraftSliderElement, ev: SearchcraftSliderCustomEvent<HTMLSearchcraftSliderElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
1355
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1356
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1357
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1358
+ }
1359
+ var HTMLSearchcraftSliderElement: {
1360
+ prototype: HTMLSearchcraftSliderElement;
1361
+ new (): HTMLSearchcraftSliderElement;
1362
+ };
1363
+ /**
1364
+ * This web component adds Searchcraft's built-in css theme to your page's <head> tag.
1365
+ * It does not render anything visible, its only function is to manage the css styles on the page.
1366
+ * ## Usage
1367
+ * ```html
1368
+ * <!-- index.html -->
1369
+ * <searchcraft-theme theme="light" custom-theme="{}" />
1370
+ * ```
1371
+ */
1372
+ interface HTMLSearchcraftThemeElement extends Components.SearchcraftTheme, HTMLStencilElement {
1373
+ }
1374
+ var HTMLSearchcraftThemeElement: {
1375
+ prototype: HTMLSearchcraftThemeElement;
1376
+ new (): HTMLSearchcraftThemeElement;
1377
+ };
1378
+ interface HTMLSearchcraftToggleButtonElementEventMap {
1379
+ "toggleUpdated": boolean;
1380
+ }
1381
+ /**
1382
+ * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.
1383
+ * It is consumed within the `searchcraft-filter-panel` component.
1384
+ */
1385
+ interface HTMLSearchcraftToggleButtonElement extends Components.SearchcraftToggleButton, HTMLStencilElement {
1386
+ addEventListener<K extends keyof HTMLSearchcraftToggleButtonElementEventMap>(type: K, listener: (this: HTMLSearchcraftToggleButtonElement, ev: SearchcraftToggleButtonCustomEvent<HTMLSearchcraftToggleButtonElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
1387
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1388
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1389
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1390
+ removeEventListener<K extends keyof HTMLSearchcraftToggleButtonElementEventMap>(type: K, listener: (this: HTMLSearchcraftToggleButtonElement, ev: SearchcraftToggleButtonCustomEvent<HTMLSearchcraftToggleButtonElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
1391
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1392
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1393
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1394
+ }
1395
+ var HTMLSearchcraftToggleButtonElement: {
1396
+ prototype: HTMLSearchcraftToggleButtonElement;
1397
+ new (): HTMLSearchcraftToggleButtonElement;
1398
+ };
1399
+ interface HTMLElementTagNameMap {
1400
+ "searchcraft-ad": HTMLSearchcraftAdElement;
1401
+ "searchcraft-base-search-result": HTMLSearchcraftBaseSearchResultElement;
1402
+ "searchcraft-base-search-results": HTMLSearchcraftBaseSearchResultsElement;
1403
+ "searchcraft-button": HTMLSearchcraftButtonElement;
1404
+ "searchcraft-error-message": HTMLSearchcraftErrorMessageElement;
1405
+ "searchcraft-facet-list": HTMLSearchcraftFacetListElement;
1406
+ "searchcraft-filter-panel": HTMLSearchcraftFilterPanelElement;
1407
+ "searchcraft-input-form": HTMLSearchcraftInputFormElement;
1408
+ "searchcraft-input-label": HTMLSearchcraftInputLabelElement;
1409
+ "searchcraft-pagination": HTMLSearchcraftPaginationElement;
1410
+ "searchcraft-popover-button": HTMLSearchcraftPopoverButtonElement;
1411
+ "searchcraft-popover-form": HTMLSearchcraftPopoverFormElement;
1412
+ "searchcraft-popover-list-item": HTMLSearchcraftPopoverListItemElement;
1413
+ "searchcraft-popover-list-view": HTMLSearchcraftPopoverListViewElement;
1414
+ "searchcraft-results-info": HTMLSearchcraftResultsInfoElement;
1415
+ "searchcraft-search-results-per-page": HTMLSearchcraftSearchResultsPerPageElement;
1416
+ "searchcraft-select": HTMLSearchcraftSelectElement;
1417
+ "searchcraft-slider": HTMLSearchcraftSliderElement;
1418
+ "searchcraft-theme": HTMLSearchcraftThemeElement;
1419
+ "searchcraft-toggle-button": HTMLSearchcraftToggleButtonElement;
1420
+ }
1421
+ }
1422
+ declare namespace LocalJSX {
1423
+ /**
1424
+ * An inline ad meant to be rendered in a list of search results.
1425
+ */
1426
+ interface SearchcraftAd {
1427
+ "adClientResponseItem"?: AdClientResponseItem;
1428
+ "adSource"?: SearchcraftAdSource;
1429
+ }
1430
+ /**
1431
+ * This web component is designed to display detailed information for a single search result.
1432
+ * Once a query is submitted, the component formats and presents the result.
1433
+ * It is consumed within the `searchcraft-base-search-results` component.
1434
+ */
1435
+ interface SearchcraftBaseSearchResult {
1436
+ /**
1437
+ * The relationship between the current document and the link for the button rendered when containerHref is not present.
1438
+ */
1439
+ "buttonRel"?: "noreferrer" | "noopener" | "nofollow";
1440
+ /**
1441
+ * Where to open the link for the button rendered when containerHref is not present.
1442
+ */
1443
+ "buttonTarget"?: "_blank" | "_self" | "_top" | "_parent";
1444
+ /**
1445
+ * The relationship between the current document and the link for the containing element.
1446
+ */
1447
+ "containerRel"?: "noreferrer" | "noopener" | "nofollow";
1448
+ /**
1449
+ * Where to open the link for the containing element.
1450
+ */
1451
+ "containerTarget"?: "_blank" | "_self" | "_top" | "_parent";
1452
+ /**
1453
+ * A custom styles object.
1454
+ */
1455
+ "customStyles"?: string;
1456
+ /**
1457
+ * The position in the document. Used with the "document_clicked" measure event.
1458
+ */
1459
+ "documentPosition"?: number;
1460
+ /**
1461
+ * The placement of the image.
1462
+ */
1463
+ "imagePlacement"?: "left" | "right";
1464
+ "item"?: SearchClientResponseItem;
1465
+ "searchResultMappings"?: SearchResultMappings;
1466
+ }
1467
+ /**
1468
+ * This web component is responsible for displaying the results of a search query.
1469
+ * Once a query is submitted, the component formats and presents an ordered list of the results.
1470
+ * ## Usage
1471
+ * ```html
1472
+ * <!-- index.html -->
1473
+ * <searchcraft-base-search-results
1474
+ * ad-interval="4"
1475
+ * place-ad-at-start="false"
1476
+ * result-image-placement="right"
1477
+ * />
1478
+ * ```
1479
+ * ```js
1480
+ * // index.js
1481
+ * const baseSearchResults = document.querySelector('searchcraft-base-search-results');
1482
+ * baseSearchResults.searchResultMappings = containerHref: {
1483
+ * fieldNames: [
1484
+ * {
1485
+ * fieldName: 'canonical_link',
1486
+ * dataType: 'text',
1487
+ * },
1488
+ * ],
1489
+ * };
1490
+ * baseSearchResults.addEventListener('noResults', () => {
1491
+ * console.log('No search results found');
1492
+ * });
1493
+ * ```
1494
+ */
1495
+ interface SearchcraftBaseSearchResults {
1496
+ /**
1497
+ * The label for the button rendered when containerHref is not present for each result.
1498
+ */
1499
+ "buttonLabel"?: string;
1500
+ /**
1501
+ * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.
1502
+ */
1503
+ "buttonRel"?: "noreferrer" | "noopener" | "nofollow";
1504
+ /**
1505
+ * Where to open the link for the button rendered when containerHref is not present for each result.
1506
+ */
1507
+ "buttonTarget"?: "_blank" | "_self" | "_top" | "_parent";
1508
+ /**
1509
+ * The relationship between the current document and the link for the containing element for each result.
1510
+ */
1511
+ "containerRel"?: "noreferrer" | "noopener" | "nofollow";
1512
+ /**
1513
+ * Where to open the link for the containing element for each result.
1514
+ */
1515
+ "containerTarget"?: "_blank" | "_self" | "_top" | "_parent";
1516
+ /**
1517
+ * A custom styles object.
1518
+ */
1519
+ "customStylesForResults"?: string | Record<string, Record<string, string>>;
1520
+ /**
1521
+ * The placement of the image for each result.
1522
+ */
1523
+ "resultImagePlacement"?: "left" | "right";
1524
+ /**
1525
+ * Formats the content rendered for each result.
1526
+ */
1527
+ "searchResultMappings"?: SearchResultMappings;
1528
+ }
1529
+ /**
1530
+ * This web component represents a button to be consumed within the `search-input-form` component.
1531
+ * It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.
1532
+ * It is consumed within the `searchcraft-input-form` component.
1533
+ */
1534
+ interface SearchcraftButton {
1535
+ /**
1536
+ * Whether the button is disabled.
1537
+ */
1538
+ "disabled"?: boolean;
1539
+ /**
1540
+ * Controls the visual representation of the button.
1541
+ */
1542
+ "hierarchy"?: "primary" | "tertiary";
1543
+ /**
1544
+ * The icon element.
1545
+ */
1546
+ "icon"?: Element;
1547
+ /**
1548
+ * Should the button only display an icon.
1549
+ */
1550
+ "iconOnly"?: boolean;
1551
+ /**
1552
+ * The position of the icon.
1553
+ */
1554
+ "iconPosition"?: "left" | "right";
1555
+ /**
1556
+ * The label for the button.
1557
+ */
1558
+ "label"?: string;
1559
+ /**
1560
+ * The event fired when the button is clicked.
1561
+ */
1562
+ "onButtonClick"?: (event: SearchcraftButtonCustomEvent<void>) => void;
1563
+ /**
1564
+ * The type of the button.
1565
+ */
1566
+ "type"?: "submit" | "reset" | "button";
1567
+ }
1568
+ /**
1569
+ * This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.
1570
+ * ## Usage
1571
+ * ```html
1572
+ * <!-- index.html -->
1573
+ * <searchcraft-error-message error-message="No search results found for query" />
1574
+ * ```
1575
+ */
1576
+ interface SearchcraftErrorMessage {
1577
+ /**
1578
+ * The error message.
1579
+ */
1580
+ "errorMessage"?: string;
1581
+ }
1582
+ /**
1583
+ * This web component is designed to display facets in a search interface, allowing users to refine their search results by applying filters based on various attributes.
1584
+ * It is consumed within the `searchcraft-filter-panel`.
1585
+ * ## Usage
1586
+ * ```html
1587
+ * <!-- index.html -->
1588
+ * <searchcraft-facet-list field-name="title" />
1589
+ * ```
1590
+ * ```js
1591
+ * // index.js
1592
+ * const facetList = document.querySelector('searchcraft-facet-list');
1593
+ * facetList.addEventListener('facetSelectionUpdated', () => {
1594
+ * console.log('Facet selection updated');
1595
+ * });
1596
+ * ```
1597
+ */
1598
+ interface SearchcraftFacetList {
1599
+ /**
1600
+ * The name of the field where facets are applied.
1601
+ */
1602
+ "fieldName"?: string;
1603
+ /**
1604
+ * When the facets are updated.
1605
+ */
1606
+ "onFacetSelectionUpdated"?: (event: SearchcraftFacetListCustomEvent<{
1607
+ paths: string[];
1608
+ }>) => void;
1609
+ }
1610
+ /**
1611
+ * This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.
1612
+ * ## Usage
1613
+ * ```html
1614
+ * <!-- index.html -->
1615
+ * <searchcraft-filter-panel />
1616
+ * ```
1617
+ */
1618
+ interface SearchcraftFilterPanel {
1619
+ /**
1620
+ * The items to filter.
1621
+ */
1622
+ "items"?: FilterItem[];
1623
+ }
1624
+ /**
1625
+ * This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.
1626
+ * It abstracts the complexities of index-based searching, making it accessible to users of all technical levels.
1627
+ * ## Usage
1628
+ * ```html
1629
+ * <!-- index.html -->
1630
+ * <searchcraft-input-form placeholder-value="Search here" />
1631
+ * ```
1632
+ * ```js
1633
+ * // index.js
1634
+ * const searchInputForm = document.querySelector('searchcraft-input-form');
1635
+ * ```
1636
+ */
1637
+ interface SearchcraftInputForm {
1638
+ /**
1639
+ * Whether or not to automatically submit the search term when the input changes.
1640
+ */
1641
+ "autoSearch"?: boolean;
1642
+ /**
1643
+ * The label for the submit button.
1644
+ */
1645
+ "buttonLabel"?: string;
1646
+ /**
1647
+ * Where to place the search button.
1648
+ */
1649
+ "buttonPlacement"?: "left" | "right" | "none";
1650
+ "core"?: SearchcraftCore;
1651
+ /**
1652
+ * A custom styles object to be applied to the input element.
1653
+ */
1654
+ "customStyles"?: string | Record<string, string>;
1655
+ /**
1656
+ * The label rendered above the input.
1657
+ */
1658
+ "inputLabel"?: string;
1659
+ /**
1660
+ * When the input becomes unfocused.
1661
+ */
1662
+ "onInputBlur"?: (event: SearchcraftInputFormCustomEvent<void>) => void;
1663
+ /**
1664
+ * When the input becomes focused.
1665
+ */
1666
+ "onInputFocus"?: (event: SearchcraftInputFormCustomEvent<void>) => void;
1667
+ /**
1668
+ * Event emitted when input initializes.
1669
+ */
1670
+ "onInputInit"?: (event: SearchcraftInputFormCustomEvent<void>) => void;
1671
+ /**
1672
+ * The input element's placeholder value.
1673
+ */
1674
+ "placeholderValue"?: string;
1675
+ /**
1676
+ * The starting value of the input element.
1677
+ */
1678
+ "searchTerm"?: string;
1679
+ }
1680
+ /**
1681
+ * This web component serves as the input label for the searchcraft-input-form component.
1682
+ * ## Usage
1683
+ * ```html
1684
+ * <!-- index.html -->
1685
+ * <searchcraft-input-label label="Search" />
1686
+ * ```
1687
+ */
1688
+ interface SearchcraftInputLabel {
1689
+ /**
1690
+ * The classname applied to the label element.
1691
+ */
1692
+ "inputLabelClassName"?: string | undefined;
1693
+ "label"?: string;
1694
+ }
1695
+ /**
1696
+ * This web component is designed to facilitate pagination of search results.
1697
+ * Once a query is submitted, calculates the number for pages.
1698
+ * ## Usage
1699
+ * ```html
1700
+ * <!-- index.html -->
1701
+ * <searchcraft-pagination />
1702
+ * ```
1703
+ */
1704
+ interface SearchcraftPagination {
1705
+ /**
1706
+ * The custom styles object.
1707
+ */
1708
+ "customStyles"?: string;
1709
+ }
1710
+ /**
1711
+ * Renders a button which, when clicked, turns on popover visibility.
1712
+ */
1713
+ interface SearchcraftPopoverButton {
1714
+ }
1715
+ /**
1716
+ * This web component is designed to display search results in a popover container that dynamically appears when the user interacts with a search input field, or when a popover-button is pressed.
1717
+ * ## Usage
1718
+ * ```html
1719
+ * <!-- index.html -->
1720
+ * <searchcraft-popover-form type="fullscreen" />
1721
+ * ```
1722
+ * ```js
1723
+ * // index.js
1724
+ * const popoverForm = document.querySelector('searchcraft-popover-form');
1725
+ * popoverForm.popoverResultMappings = {
1726
+ * containerHref: {
1727
+ * fieldNames: [
1728
+ * {
1729
+ * fieldName: 'canonical_link',
1730
+ * dataType: 'text',
1731
+ * },
1732
+ * ],
1733
+ * };
1734
+ * ```
1735
+ */
1736
+ interface SearchcraftPopoverForm {
1737
+ /**
1738
+ * The hotkey that activates the popover.
1739
+ */
1740
+ "hotkey"?: string;
1741
+ /**
1742
+ * The hotkey modifier that activates the popover. Used together with the `hotkey` prop.
1743
+ */
1744
+ "hotkeyModifier"?: "ctrl" | "meta" | "alt" | "option";
1745
+ /**
1746
+ * Formats the content rendered for each result.
1747
+ */
1748
+ "popoverResultMappings"?: PopoverResultMappings;
1749
+ /**
1750
+ * The type of popover form to render. - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content. - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component. - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.
1751
+ */
1752
+ "type"?: "inline" | "fullscreen" | "modal";
1753
+ }
1754
+ /**
1755
+ * A single list item rendered in a searchcraft-popover-list-view.
1756
+ */
1757
+ interface SearchcraftPopoverListItem {
1758
+ /**
1759
+ * The document position relative to the search results (For Measure)
1760
+ */
1761
+ "documentPosition"?: number;
1762
+ "item"?: SearchClientResponseItem | undefined;
1763
+ "popoverResultMappings"?: PopoverResultMappings | undefined;
1764
+ }
1765
+ /**
1766
+ * This web component is designed to display a list of results within a popover interface.
1767
+ * It is consumed within the `searchcraft-popover-form` component.
1768
+ * ## Usage
1769
+ * ```html
1770
+ * <!-- index.html -->
1771
+ * <searchcraft-popover-list-view />
1772
+ * ```
1773
+ */
1774
+ interface SearchcraftPopoverListView {
1775
+ "adClientResponseItems"?: AdClientResponseItem[] | undefined;
1776
+ /**
1777
+ * The mappings that define how the data in the documents are mapped to the list-view-item elements.
1778
+ */
1779
+ "popoverResultMappings"?: PopoverResultMappings | undefined;
1780
+ /**
1781
+ * The items to render in the list view.
1782
+ */
1783
+ "searchClientResponseItems"?: SearchClientResponseItem[] | undefined;
1784
+ "searchResultsPage": number;
1785
+ "searchResultsPerPage": number;
1786
+ }
1787
+ /**
1788
+ * This web component is designed to display the number of results returned from a search query.
1789
+ * ## Usage
1790
+ * ```html
1791
+ * <!-- index.html -->
1792
+ * <script>
1793
+ * const resultsInfo = document.querySelector('searchcraft-results-info');
1794
+ * resultsInfo.customFormatter = (range, count, responseTime) =>
1795
+ * `${range[0]}-${range[1]} of ${count} results in ${responseTime}ms`;
1796
+ * </script>
1797
+ * <searchcraft-results-info />
1798
+ * ```
1799
+ */
1800
+ interface SearchcraftResultsInfo {
1801
+ /**
1802
+ * The custom formatter for the resulting string.
1803
+ * @example ```ts resultsInfo.customFormatter = (range, count, responseTime) => `${range[0]}-${range[1]} of ${count} results in ${responseTime}ms`; ```
1804
+ */
1805
+ "customFormatter"?: (range: [
1806
+ string,
1807
+ string
1808
+ ], count: string, responseTime: string) => void;
1809
+ /**
1810
+ * The custom styles object.
1811
+ */
1812
+ "customStyles"?: string;
1813
+ }
1814
+ /**
1815
+ * This web component is designed to choose the number of search results displayed.
1816
+ * ## Usage
1817
+ * ```html
1818
+ * <!-- index.html -->
1819
+ * <searchcraft-search-results-per-page increment="20" />
1820
+ * ```
1821
+ */
1822
+ interface SearchcraftSearchResultsPerPage {
1823
+ /**
1824
+ * The custom styles object.
1825
+ */
1826
+ "customStyles"?: string;
1827
+ /**
1828
+ * The amount the options will increase (e.g. 20 = [20, 40, 60, 80, 100]). The base value is defined by the `searchResultsPerPage` option in the configuration.
1829
+ */
1830
+ "increment"?: string | number;
1831
+ }
1832
+ /**
1833
+ * This web component is designed to allow users to select between a group of options.
1834
+ * ## Usage
1835
+ * ```html
1836
+ * <!-- index.html -->
1837
+ * <searchcraft-select
1838
+ * inputId="searchcraft-select"
1839
+ * name="searchcraft-select"
1840
+ * options="[{ label: 'label', value: 'value' }]"
1841
+ * />
1842
+ * ```
1843
+ */
1844
+ interface SearchcraftSelect {
1845
+ /**
1846
+ * The caption displayed below the select input.
1847
+ */
1848
+ "caption"?: string;
1849
+ /**
1850
+ * A custom styles object.
1851
+ */
1852
+ "customStyles"?: string;
1853
+ /**
1854
+ * Whether the select input is disabled.
1855
+ */
1856
+ "disabled"?: boolean;
1857
+ /**
1858
+ * The ID for the select input.
1859
+ */
1860
+ "inputId": string;
1861
+ /**
1862
+ * The label of the select input.
1863
+ */
1864
+ "label"?: string;
1865
+ /**
1866
+ * The ID for the label of the select input.
1867
+ */
1868
+ "labelId"?: string;
1869
+ /**
1870
+ * The name of the select input.
1871
+ */
1872
+ "name": string;
1873
+ /**
1874
+ * The event fired when the select is changed.
1875
+ */
1876
+ "onSelectChange"?: (event: SearchcraftSelectCustomEvent<string>) => void;
1877
+ /**
1878
+ * The options for the select input.
1879
+ */
1880
+ "options"?: SearchcraftSelectOption[] | string;
1881
+ }
1882
+ /**
1883
+ * This web component is designed to allow users to select a value from a range defined by a minimum and maximum value.
1884
+ * The component renders a slider interface, which can be used to visually choose a value between two boundaries.
1885
+ * It is consumed by the `searchcraft-filter-panel` component.
1886
+ */
1887
+ interface SearchcraftSlider {
1888
+ /**
1889
+ * The type of data allowed.
1890
+ */
1891
+ "dataType"?: "number" | "date";
1892
+ /**
1893
+ * The granularity that the value must adhere to.
1894
+ */
1895
+ "granularity"?: number;
1896
+ /**
1897
+ * The maximum value allowed.
1898
+ */
1899
+ "max"?: number;
1900
+ /**
1901
+ * The minimum value allowed.
1902
+ */
1903
+ "min"?: number;
1904
+ /**
1905
+ * When the range has changed.
1906
+ */
1907
+ "onRangeChanged"?: (event: SearchcraftSliderCustomEvent<any>) => void;
1908
+ }
1909
+ /**
1910
+ * This web component adds Searchcraft's built-in css theme to your page's <head> tag.
1911
+ * It does not render anything visible, its only function is to manage the css styles on the page.
1912
+ * ## Usage
1913
+ * ```html
1914
+ * <!-- index.html -->
1915
+ * <searchcraft-theme theme="light" custom-theme="{}" />
1916
+ * ```
1917
+ */
1918
+ interface SearchcraftTheme {
1919
+ /**
1920
+ * The custom theme configuration object.
1921
+ */
1922
+ "customTheme"?: string;
1923
+ /**
1924
+ * The name of the theme.
1925
+ */
1926
+ "theme"?: string;
1927
+ }
1928
+ /**
1929
+ * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.
1930
+ * It is consumed within the `searchcraft-filter-panel` component.
1931
+ */
1932
+ interface SearchcraftToggleButton {
1933
+ /**
1934
+ * The label.
1935
+ */
1936
+ "label"?: string;
1937
+ /**
1938
+ * When the toggle element is changed.
1939
+ */
1940
+ "onToggleUpdated"?: (event: SearchcraftToggleButtonCustomEvent<boolean>) => void;
1941
+ /**
1942
+ * The secondary label displayed below the main label.
1943
+ */
1944
+ "subLabel"?: string | undefined;
1945
+ }
1946
+ interface IntrinsicElements {
1947
+ "searchcraft-ad": SearchcraftAd;
1948
+ "searchcraft-base-search-result": SearchcraftBaseSearchResult;
1949
+ "searchcraft-base-search-results": SearchcraftBaseSearchResults;
1950
+ "searchcraft-button": SearchcraftButton;
1951
+ "searchcraft-error-message": SearchcraftErrorMessage;
1952
+ "searchcraft-facet-list": SearchcraftFacetList;
1953
+ "searchcraft-filter-panel": SearchcraftFilterPanel;
1954
+ "searchcraft-input-form": SearchcraftInputForm;
1955
+ "searchcraft-input-label": SearchcraftInputLabel;
1956
+ "searchcraft-pagination": SearchcraftPagination;
1957
+ "searchcraft-popover-button": SearchcraftPopoverButton;
1958
+ "searchcraft-popover-form": SearchcraftPopoverForm;
1959
+ "searchcraft-popover-list-item": SearchcraftPopoverListItem;
1960
+ "searchcraft-popover-list-view": SearchcraftPopoverListView;
1961
+ "searchcraft-results-info": SearchcraftResultsInfo;
1962
+ "searchcraft-search-results-per-page": SearchcraftSearchResultsPerPage;
1963
+ "searchcraft-select": SearchcraftSelect;
1964
+ "searchcraft-slider": SearchcraftSlider;
1965
+ "searchcraft-theme": SearchcraftTheme;
1966
+ "searchcraft-toggle-button": SearchcraftToggleButton;
1967
+ }
1968
+ }
1969
+ declare module "@stencil/core" {
1970
+ export namespace JSX {
1971
+ interface IntrinsicElements {
1972
+ /**
1973
+ * An inline ad meant to be rendered in a list of search results.
1974
+ */
1975
+ "searchcraft-ad": LocalJSX.SearchcraftAd & JSXBase.HTMLAttributes<HTMLSearchcraftAdElement>;
1976
+ /**
1977
+ * This web component is designed to display detailed information for a single search result.
1978
+ * Once a query is submitted, the component formats and presents the result.
1979
+ * It is consumed within the `searchcraft-base-search-results` component.
1980
+ */
1981
+ "searchcraft-base-search-result": LocalJSX.SearchcraftBaseSearchResult & JSXBase.HTMLAttributes<HTMLSearchcraftBaseSearchResultElement>;
1982
+ /**
1983
+ * This web component is responsible for displaying the results of a search query.
1984
+ * Once a query is submitted, the component formats and presents an ordered list of the results.
1985
+ * ## Usage
1986
+ * ```html
1987
+ * <!-- index.html -->
1988
+ * <searchcraft-base-search-results
1989
+ * ad-interval="4"
1990
+ * place-ad-at-start="false"
1991
+ * result-image-placement="right"
1992
+ * />
1993
+ * ```
1994
+ * ```js
1995
+ * // index.js
1996
+ * const baseSearchResults = document.querySelector('searchcraft-base-search-results');
1997
+ * baseSearchResults.searchResultMappings = containerHref: {
1998
+ * fieldNames: [
1999
+ * {
2000
+ * fieldName: 'canonical_link',
2001
+ * dataType: 'text',
2002
+ * },
2003
+ * ],
2004
+ * };
2005
+ * baseSearchResults.addEventListener('noResults', () => {
2006
+ * console.log('No search results found');
2007
+ * });
2008
+ * ```
2009
+ */
2010
+ "searchcraft-base-search-results": LocalJSX.SearchcraftBaseSearchResults & JSXBase.HTMLAttributes<HTMLSearchcraftBaseSearchResultsElement>;
2011
+ /**
2012
+ * This web component represents a button to be consumed within the `search-input-form` component.
2013
+ * It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.
2014
+ * It is consumed within the `searchcraft-input-form` component.
2015
+ */
2016
+ "searchcraft-button": LocalJSX.SearchcraftButton & JSXBase.HTMLAttributes<HTMLSearchcraftButtonElement>;
2017
+ /**
2018
+ * This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.
2019
+ * ## Usage
2020
+ * ```html
2021
+ * <!-- index.html -->
2022
+ * <searchcraft-error-message error-message="No search results found for query" />
2023
+ * ```
2024
+ */
2025
+ "searchcraft-error-message": LocalJSX.SearchcraftErrorMessage & JSXBase.HTMLAttributes<HTMLSearchcraftErrorMessageElement>;
2026
+ /**
2027
+ * This web component is designed to display facets in a search interface, allowing users to refine their search results by applying filters based on various attributes.
2028
+ * It is consumed within the `searchcraft-filter-panel`.
2029
+ * ## Usage
2030
+ * ```html
2031
+ * <!-- index.html -->
2032
+ * <searchcraft-facet-list field-name="title" />
2033
+ * ```
2034
+ * ```js
2035
+ * // index.js
2036
+ * const facetList = document.querySelector('searchcraft-facet-list');
2037
+ * facetList.addEventListener('facetSelectionUpdated', () => {
2038
+ * console.log('Facet selection updated');
2039
+ * });
2040
+ * ```
2041
+ */
2042
+ "searchcraft-facet-list": LocalJSX.SearchcraftFacetList & JSXBase.HTMLAttributes<HTMLSearchcraftFacetListElement>;
2043
+ /**
2044
+ * This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.
2045
+ * ## Usage
2046
+ * ```html
2047
+ * <!-- index.html -->
2048
+ * <searchcraft-filter-panel />
2049
+ * ```
2050
+ */
2051
+ "searchcraft-filter-panel": LocalJSX.SearchcraftFilterPanel & JSXBase.HTMLAttributes<HTMLSearchcraftFilterPanelElement>;
2052
+ /**
2053
+ * This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.
2054
+ * It abstracts the complexities of index-based searching, making it accessible to users of all technical levels.
2055
+ * ## Usage
2056
+ * ```html
2057
+ * <!-- index.html -->
2058
+ * <searchcraft-input-form placeholder-value="Search here" />
2059
+ * ```
2060
+ * ```js
2061
+ * // index.js
2062
+ * const searchInputForm = document.querySelector('searchcraft-input-form');
2063
+ * ```
2064
+ */
2065
+ "searchcraft-input-form": LocalJSX.SearchcraftInputForm & JSXBase.HTMLAttributes<HTMLSearchcraftInputFormElement>;
2066
+ /**
2067
+ * This web component serves as the input label for the searchcraft-input-form component.
2068
+ * ## Usage
2069
+ * ```html
2070
+ * <!-- index.html -->
2071
+ * <searchcraft-input-label label="Search" />
2072
+ * ```
2073
+ */
2074
+ "searchcraft-input-label": LocalJSX.SearchcraftInputLabel & JSXBase.HTMLAttributes<HTMLSearchcraftInputLabelElement>;
2075
+ /**
2076
+ * This web component is designed to facilitate pagination of search results.
2077
+ * Once a query is submitted, calculates the number for pages.
2078
+ * ## Usage
2079
+ * ```html
2080
+ * <!-- index.html -->
2081
+ * <searchcraft-pagination />
2082
+ * ```
2083
+ */
2084
+ "searchcraft-pagination": LocalJSX.SearchcraftPagination & JSXBase.HTMLAttributes<HTMLSearchcraftPaginationElement>;
2085
+ /**
2086
+ * Renders a button which, when clicked, turns on popover visibility.
2087
+ */
2088
+ "searchcraft-popover-button": LocalJSX.SearchcraftPopoverButton & JSXBase.HTMLAttributes<HTMLSearchcraftPopoverButtonElement>;
2089
+ /**
2090
+ * This web component is designed to display search results in a popover container that dynamically appears when the user interacts with a search input field, or when a popover-button is pressed.
2091
+ * ## Usage
2092
+ * ```html
2093
+ * <!-- index.html -->
2094
+ * <searchcraft-popover-form type="fullscreen" />
2095
+ * ```
2096
+ * ```js
2097
+ * // index.js
2098
+ * const popoverForm = document.querySelector('searchcraft-popover-form');
2099
+ * popoverForm.popoverResultMappings = {
2100
+ * containerHref: {
2101
+ * fieldNames: [
2102
+ * {
2103
+ * fieldName: 'canonical_link',
2104
+ * dataType: 'text',
2105
+ * },
2106
+ * ],
2107
+ * };
2108
+ * ```
2109
+ */
2110
+ "searchcraft-popover-form": LocalJSX.SearchcraftPopoverForm & JSXBase.HTMLAttributes<HTMLSearchcraftPopoverFormElement>;
2111
+ /**
2112
+ * A single list item rendered in a searchcraft-popover-list-view.
2113
+ */
2114
+ "searchcraft-popover-list-item": LocalJSX.SearchcraftPopoverListItem & JSXBase.HTMLAttributes<HTMLSearchcraftPopoverListItemElement>;
2115
+ /**
2116
+ * This web component is designed to display a list of results within a popover interface.
2117
+ * It is consumed within the `searchcraft-popover-form` component.
2118
+ * ## Usage
2119
+ * ```html
2120
+ * <!-- index.html -->
2121
+ * <searchcraft-popover-list-view />
2122
+ * ```
2123
+ */
2124
+ "searchcraft-popover-list-view": LocalJSX.SearchcraftPopoverListView & JSXBase.HTMLAttributes<HTMLSearchcraftPopoverListViewElement>;
2125
+ /**
2126
+ * This web component is designed to display the number of results returned from a search query.
2127
+ * ## Usage
2128
+ * ```html
2129
+ * <!-- index.html -->
2130
+ * <script>
2131
+ * const resultsInfo = document.querySelector('searchcraft-results-info');
2132
+ * resultsInfo.customFormatter = (range, count, responseTime) =>
2133
+ * `${range[0]}-${range[1]} of ${count} results in ${responseTime}ms`;
2134
+ * </script>
2135
+ * <searchcraft-results-info />
2136
+ * ```
2137
+ */
2138
+ "searchcraft-results-info": LocalJSX.SearchcraftResultsInfo & JSXBase.HTMLAttributes<HTMLSearchcraftResultsInfoElement>;
2139
+ /**
2140
+ * This web component is designed to choose the number of search results displayed.
2141
+ * ## Usage
2142
+ * ```html
2143
+ * <!-- index.html -->
2144
+ * <searchcraft-search-results-per-page increment="20" />
2145
+ * ```
2146
+ */
2147
+ "searchcraft-search-results-per-page": LocalJSX.SearchcraftSearchResultsPerPage & JSXBase.HTMLAttributes<HTMLSearchcraftSearchResultsPerPageElement>;
2148
+ /**
2149
+ * This web component is designed to allow users to select between a group of options.
2150
+ * ## Usage
2151
+ * ```html
2152
+ * <!-- index.html -->
2153
+ * <searchcraft-select
2154
+ * inputId="searchcraft-select"
2155
+ * name="searchcraft-select"
2156
+ * options="[{ label: 'label', value: 'value' }]"
2157
+ * />
2158
+ * ```
2159
+ */
2160
+ "searchcraft-select": LocalJSX.SearchcraftSelect & JSXBase.HTMLAttributes<HTMLSearchcraftSelectElement>;
2161
+ /**
2162
+ * This web component is designed to allow users to select a value from a range defined by a minimum and maximum value.
2163
+ * The component renders a slider interface, which can be used to visually choose a value between two boundaries.
2164
+ * It is consumed by the `searchcraft-filter-panel` component.
2165
+ */
2166
+ "searchcraft-slider": LocalJSX.SearchcraftSlider & JSXBase.HTMLAttributes<HTMLSearchcraftSliderElement>;
2167
+ /**
2168
+ * This web component adds Searchcraft's built-in css theme to your page's <head> tag.
2169
+ * It does not render anything visible, its only function is to manage the css styles on the page.
2170
+ * ## Usage
2171
+ * ```html
2172
+ * <!-- index.html -->
2173
+ * <searchcraft-theme theme="light" custom-theme="{}" />
2174
+ * ```
2175
+ */
2176
+ "searchcraft-theme": LocalJSX.SearchcraftTheme & JSXBase.HTMLAttributes<HTMLSearchcraftThemeElement>;
2177
+ /**
2178
+ * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.
2179
+ * It is consumed within the `searchcraft-filter-panel` component.
2180
+ */
2181
+ "searchcraft-toggle-button": LocalJSX.SearchcraftToggleButton & JSXBase.HTMLAttributes<HTMLSearchcraftToggleButtonElement>;
2182
+ }
2183
+ }
2184
+ }
2185
+ /**
2186
+ * The consumer-facing `Searchcraft` class.
2187
+ */
2188
+ export declare class Searchcraft extends SearchcraftCore {
2189
+ constructor(config: SearchcraftConfig);
2190
+ }
2191
+
2192
+ export {
2193
+ LocalJSX as JSX,
2194
+ };
2195
+
2196
+ export {};