UNPKG

fumadocs-core

Version:

The React.js library for building a documentation website

146 lines (145 loc) 3.64 kB
import "../definitions-DuxDer_c.js"; import "../remark-structure-RZD2gGKp.js"; import { t as BaseIndex } from "../algolia-CBBN8R6-.js"; import { SortedResult } from "./index.js"; import "../server-CPR_fgkH.js"; import "../index-2U6Tl4--.js"; import { DependencyList } from "react"; import { AnyOrama } from "@orama/orama"; import { LiteClient, SearchResponse } from "algoliasearch/lite"; import { OramaCloud, OramaCloudSearchParams } from "@orama/core"; import Mixedbread from "@mixedbread/sdk"; //#region src/search/client/fetch.d.ts interface FetchOptions { /** * API route for search endpoint, support absolute URLs. * * @defaultValue '/api/search' */ api?: string; /** * Filter results with specific tag(s). */ tag?: string | string[]; /** * Filter by locale */ locale?: string; } //#endregion //#region src/search/client/static.d.ts interface StaticOptions { /** * Where to download exported search indexes (URL) * * @defaultValue '/api/search' */ from?: string; initOrama?: (locale?: string) => AnyOrama | Promise<AnyOrama>; /** * Filter results with specific tag(s). */ tag?: string | string[]; /** * Filter by locale (unsupported at the moment) */ locale?: string; } //#endregion //#region src/search/client/algolia.d.ts interface AlgoliaOptions { indexName: string; client: LiteClient; /** * Filter results with specific tag. */ tag?: string; locale?: string; onSearch?: (query: string, tag?: string, locale?: string) => Promise<{ results: SearchResponse<BaseIndex>[]; }>; } //#endregion //#region src/search/client/orama-cloud.d.ts interface OramaCloudOptions { client: OramaCloud; /** * The type of your index. * * You can set it to `crawler` if you use crawler instead of the JSON index with schema provided by Fumadocs */ index?: 'default' | 'crawler'; params?: Partial<OramaCloudSearchParams>; /** * Filter results with specific tag. */ tag?: string; /** * Filter by locale (unsupported at the moment) */ locale?: string; } //#endregion //#region src/search/client/mixedbread.d.ts interface MixedbreadOptions { /** * The identifier of the store to search in */ storeIdentifier: string; /** * The Mixedbread SDK client instance */ client: Mixedbread; /** * Filter results with specific tag. */ tag?: string; /** * Filter by locale (unsupported at the moment) */ locale?: string; } //#endregion //#region src/search/client.d.ts interface UseDocsSearch { search: string; setSearch: (v: string) => void; query: { isLoading: boolean; data?: SortedResult[] | 'empty'; error?: Error; }; } type Client = ({ type: 'fetch'; } & FetchOptions) | ({ type: 'static'; } & StaticOptions) | ({ type: 'algolia'; } & AlgoliaOptions) | ({ type: 'orama-cloud'; } & OramaCloudOptions) | ({ type: 'mixedbread'; } & MixedbreadOptions); /** * Provide a hook to query different official search clients. * * Note: it will re-query when its parameters changed, make sure to use `useMemo()` on `clientOptions` or define `deps` array. */ declare function useDocsSearch(clientOptions: Client & { /** * The debounced delay for performing a search (in ms). * . * @defaultValue 100 */ delayMs?: number; /** * still perform search even if query is empty. * * @defaultValue false */ allowEmpty?: boolean; }, deps?: DependencyList): UseDocsSearch; //#endregion export { type AlgoliaOptions, Client, type FetchOptions, type OramaCloudOptions, type StaticOptions, useDocsSearch }; //# sourceMappingURL=client.d.ts.map