43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { Options } from "minisearch";
|
|
import { LocaleConfig, Page } from "vuepress/core";
|
|
|
|
//#region src/shared/index.d.ts
|
|
interface SearchLocaleOptions {
|
|
placeholder: string;
|
|
buttonText: string;
|
|
resetButtonTitle: string;
|
|
backButtonTitle: string;
|
|
noResultsText: string;
|
|
footer: {
|
|
selectText: string;
|
|
selectKeyAriaLabel: string;
|
|
navigateText: string;
|
|
navigateUpKeyAriaLabel: string;
|
|
navigateDownKeyAriaLabel: string;
|
|
closeText: string;
|
|
closeKeyAriaLabel: string;
|
|
};
|
|
}
|
|
type SearchBoxLocales = LocaleConfig<SearchLocaleOptions>;
|
|
interface SearchPluginOptions extends SearchOptions {
|
|
locales?: SearchBoxLocales;
|
|
isSearchable?: (page: Page) => boolean;
|
|
}
|
|
interface SearchOptions {
|
|
/**
|
|
* @default false
|
|
*/
|
|
disableQueryPersistence?: boolean;
|
|
miniSearch?: {
|
|
/**
|
|
* @see https://lucaong.github.io/minisearch/modules/_minisearch_.html#options
|
|
*/
|
|
options?: Pick<Options, "extractField" | "tokenize" | "processTerm">;
|
|
/**
|
|
* @see https://lucaong.github.io/minisearch/modules/_minisearch_.html#searchoptions-1
|
|
*/
|
|
searchOptions?: Options["searchOptions"];
|
|
};
|
|
}
|
|
//#endregion
|
|
export { SearchBoxLocales, SearchLocaleOptions, SearchOptions, SearchPluginOptions }; |