import * as combobox from "@zag-js/combobox"; import type { ListCollection } from "@zag-js/collection"; import { VanillaMachine } from "@zag-js/vanilla"; import { Component } from "../lib"; type SearchItem = { label: string; code: string; url?: string; excerpt?: string; title?: string; }; export declare class SiteSearch extends Component { private pagefind; userOnInputValueChange?: combobox.Props["onInputValueChange"]; userOnOpenChange?: combobox.Props["onOpenChange"]; constructor(el: HTMLElement, props: combobox.Props); options: SearchItem[]; allItems: SearchItem[]; setItems(items: SearchItem[]): void; setPagefindInstance(pagefind: Pagefind): void; getCollection(items: SearchItem[]): ListCollection; performPagefindSearch(query: string): Promise; updateCollection(): void; initMachine(props: combobox.Props): VanillaMachine; initApi(): combobox.Api; renderItems(): void; render(): void; } export declare function initSiteSearch(pagefindInstance?: Pagefind, doc?: HTMLElement | Document, selector?: string): void; interface PagefindIndexOptions { basePath?: string; baseUrl?: string; excerptLength?: number; indexWeight?: number; mergeFilter?: Record; highlightParam?: string; language?: string; primary?: boolean; ranking?: PagefindRankingWeights; } interface PagefindRankingWeights { termSimilarity?: number; pageLength?: number; termSaturation?: number; termFrequency?: number; } interface PagefindSearchOptions { preload?: boolean; verbose?: boolean; filters?: Record; sort?: Record; } type PagefindFilterCounts = Record>; interface PagefindSearchResults { results: PagefindSearchResult[]; unfilteredResultCount: number; filters: PagefindFilterCounts; totalFilters: PagefindFilterCounts; timings: { preload: number; search: number; total: number; }; } interface PagefindSearchResult { id: string; score: number; words: number[]; data: () => Promise; } interface PagefindSearchFragment { url: string; raw_url?: string; content: string; raw_content?: string; excerpt: string; sub_results: PagefindSubResult[]; word_count: number; locations: number[]; weighted_locations: PagefindWordLocation[]; filters: Record; meta: Record; anchors: PagefindSearchAnchor[]; } interface PagefindSubResult { title: string; url: string; locations: number[]; weighted_locations: PagefindWordLocation[]; excerpt: string; anchor?: PagefindSearchAnchor; } interface PagefindWordLocation { weight: number; balanced_score: number; location: number; } interface PagefindSearchAnchor { element: string; id: string; text?: string; location: number; } interface Pagefind { debouncedSearch: (query: string, options?: PagefindSearchOptions, duration?: number) => Promise; destroy: () => Promise; filters: () => Promise; init: () => Promise; mergeIndex: (indexPath: string, options?: Record) => Promise; options: (options: PagefindIndexOptions) => Promise; preload: (term: string, options?: PagefindIndexOptions) => Promise; search: (term: string, options?: PagefindSearchOptions) => Promise; } export type { PagefindIndexOptions, PagefindRankingWeights, PagefindSearchOptions, PagefindFilterCounts, PagefindSearchResults, PagefindSearchResult, PagefindSearchFragment, PagefindSubResult, PagefindWordLocation, PagefindSearchAnchor, Pagefind, };