import { Plugin } from 'vuepress/core'; import { DocSearchProps } from '@docsearch/react'; import { LocaleConfig } from 'vuepress/shared'; import { DeepRequired } from '@vuepress/helper/shared'; type DocSearchLocaleData = DeepRequired>; /** * DocSearch locale options * * DocSearch 多语言选项 */ type DocSearchLocaleOptions = Partial>; /** * DocSearch options * * DocSearch 选项 */ interface DocSearchOptions extends DocSearchLocaleOptions { /** * Locale options * * 多语言选项 */ locales?: LocaleConfig; } /** * Options for @vuepress/plugin-docsearch * * @vuepress/plugin-docsearch 的配置项 */ interface DocSearchPluginOptions extends DocSearchOptions { /** * Base path of the search index * * 搜索索引的基础路径 * * @default app.siteData.base */ indexBase?: string; /** * Whether to inject docsearch default styles * * 是否注入 docsearch 的默认样式 * * @default true */ injectStyles?: boolean; } /** * DocSearch plugin * * DocSearch 插件 * * @param options - DocSearch plugin options / DocSearch 插件选项 * * @example * ```ts * import { docsearchPlugin } from '@vuepress/plugin-docsearch' * * export default { * plugins: [ * docsearchPlugin({ * appId: 'XXXXXX', * apiKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', * indexName: 'xxxxxxxx', * locales: { * '/': { * placeholder: 'Search Documentation', * }, * '/zh/': { * placeholder: '搜索文档', * }, * }, * }), * ], * } * ``` * * @returns Plugin object / 插件对象 */ declare const docsearchPlugin: ({ injectStyles, indexBase, locales, ...options }?: DocSearchPluginOptions) => Plugin; export { docsearchPlugin }; export type { DocSearchLocaleData, DocSearchLocaleOptions, DocSearchOptions, DocSearchPluginOptions };