fuc-new/doc/node_modules/@vuepress/plugin-docsearch/lib/client/index.d.ts
hellcat 6adbc04d4b 1
2025-10-03 17:17:08 +08:00

117 lines
3.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import * as vue from 'vue';
import { PropType, MaybeRefOrGetter } from 'vue';
import { DocSearchProps } from '@docsearch/react';
import { LocaleConfig } from 'vuepress/shared';
import { DeepRequired } from '@vuepress/helper/shared';
type DocSearchLocaleData = DeepRequired<Pick<DocSearchProps, 'placeholder' | 'translations'>>;
/**
* DocSearch locale options
*
* DocSearch 多语言选项
*/
type DocSearchLocaleOptions = Partial<Pick<DocSearchProps, 'apiKey' | 'appId' | 'disableUserPersonalization' | 'indexName' | 'initialQuery' | 'maxResultsPerGroup' | 'placeholder' | 'searchParameters' | 'translations'>>;
/**
* DocSearch options
*
* DocSearch 选项
*/
interface DocSearchOptions extends DocSearchLocaleOptions {
/**
* Locale options
*
* 多语言选项
*/
locales?: LocaleConfig<DocSearchLocaleOptions>;
}
declare const DocSearch: vue.DefineComponent<vue.ExtractPropTypes<{
containerId: {
type: StringConstructor;
default: string;
};
options: {
type: PropType<DocSearchOptions>;
default: () => {};
};
}>, () => (vue.VNode<vue.RendererNode, vue.RendererElement, {
[key: string]: any;
}> | null)[], {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
containerId: {
type: StringConstructor;
default: string;
};
options: {
type: PropType<DocSearchOptions>;
default: () => {};
};
}>> & Readonly<{}>, {
containerId: string;
options: DocSearchOptions;
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
/**
* DocSearch client locale options
*
* DocSearch 客户端多语言选项
*/
type DocSearchClientLocaleOptions = Partial<DocSearchProps>;
/**
* DocSearch client options
*
* DocSearch 客户端选项
*/
interface DocSearchClientOptions extends DocSearchClientLocaleOptions {
/**
* Locale options
*
* 多语言选项
*/
locales?: Record<string, DocSearchClientLocaleOptions>;
}
/**
* Customize DocSearch options
*
* 自定义 DocSearch 选项
*
* @param options - DocSearch options, support plain object, ref or getter / DocSearch 选项支持普通对象Ref 或 Getter
*
* @example
* ```ts
* import { defineDocSearchConfig } from '@vuepress/plugin-docsearch/client'
*
* // Use plain object
* defineDocSearchConfig({
* translations: {
* button: {
* buttonText: 'Search',
* },
* },
* })
*
* // Use ref
* const options = ref({
* translations: {
* button: {
* buttonText: 'Search',
* },
* },
* })
* defineDocSearchConfig(options)
*
* // Use getter
* defineDocSearchConfig(() => ({
* translations: {
* button: {
* buttonText: isDarkMode.value ? 'Search in dark' : 'Search in light',
* },
* },
* }))
* ```
*/
declare const defineDocSearchConfig: (options: MaybeRefOrGetter<DocSearchClientOptions>) => void;
export { DocSearch, defineDocSearchConfig };
export type { DocSearchClientLocaleOptions, DocSearchClientOptions, DocSearchLocaleData, DocSearchLocaleOptions, DocSearchOptions };