import { StateCreator } from 'zustand'; import { SearchMatch, SearchQuery, SearchResult } from '../types.js'; import { DocumentSlice } from './documentSlice.js'; import { NavigationSlice } from './navigationSlice.js'; import { ViewportSlice } from './viewportSlice.js'; export type SearchState = 'idle' | 'searching' | 'done' | 'error'; export interface SearchSlice { searchQuery: SearchQuery | null; searchState: SearchState; searchResult: SearchResult | null; currentMatchIndex: number; /** Bumped every time the active match changes so UI layers can re-scroll it into view. */ matchNonce: number; search: (query: SearchQuery) => void; clearSearch: () => void; nextMatch: () => void; prevMatch: () => void; goToMatch: (index: number) => void; /** Supply matches computed outside the adapter (e.g. DOM-based search for reflowable formats). */ applySearchMatches: (matches: SearchMatch[]) => void; _setSearchResult: (result: SearchResult) => void; _setSearchState: (state: SearchState) => void; _searchController: AbortController | null; } export declare const createSearchSlice: StateCreator;