import { BrowserFetcherOptions } from "./fetcher.js"; import { DefaultResultDisplay, ResultDisplayProps } from "./components/result-display.js"; import { ParsedSchema } from "../utils/schema.js"; import { HttpMethods, OperationObject, ParameterObject, PathItemObject } from "../types.js"; import { ComponentProps, FC, ReactNode } from "react"; import { Collapsible } from "@fumadocs/api-docs/components/collapsible"; import { FieldKey } from "@fumari/stf"; //#region src/playground/client.d.ts interface FormValues extends Record { path: Record; query: Record; header: Record; cookie: Record; body: unknown; } interface PlaygroundClientProps extends Omit, 'method'> { route: string; method: HttpMethods; operation: OperationObject; pathItem: PathItemObject; writeOnly: boolean; readOnly: boolean; } interface CollapsiblePanelProps extends Omit, 'title'> { 'data-type': 'authorization' | 'body' | ParamType; title: ReactNode; } interface PlaygroundClientOptions { /** * transform fields for auth-specific parameters (e.g. header) */ transformAuthInputs?: (fields: AuthField[]) => AuthField[]; fetchOptions?: BrowserFetcherOptions; components?: { ResultDisplay?: FC; CollapsiblePanel?: FC; }; /** * render the parameter inputs of API endpoint. * * for updating values, use: * - the `Custom.useController()` from `fumadocs-openapi/playground/client`. * * Recommended types packages: `json-schema-typed`. */ renderParameterField?: (fieldName: FieldKey, param: ParameterObject) => ReactNode; /** * render the input for API endpoint body. * * @see renderParameterField for customization tips */ renderBodyField?: (fieldName: 'body', info: RequestBodyInfo) => ReactNode; } interface RequestBodyInfo { schema: ParsedSchema; mediaType: string; } declare function PlaygroundClient({ route, method, operation, pathItem, writeOnly, readOnly, ...rest }: PlaygroundClientProps): import("react").JSX.Element; declare const ParamTypes: readonly ["path", "header", "cookie", "query"]; type ParamType = (typeof ParamTypes)[number]; interface AuthField { fieldName: FieldKey; schemeId: string; storageKey: string; defaultValue: unknown; children: ReactNode; mapOutput?: (values: unknown) => unknown; } declare function DefaultCollapsiblePanel({ title, children, ...props }: CollapsiblePanelProps): import("react").JSX.Element; declare const Custom: { useController(fieldName: FieldKey, options?: { defaultValue?: unknown; }): { value: unknown; setValue: (newValue: unknown) => boolean; }; }; //#endregion export { AuthField, CollapsiblePanelProps, Custom, DefaultCollapsiblePanel, DefaultResultDisplay, FormValues, PlaygroundClientOptions, PlaygroundClientProps, type ResultDisplayProps, PlaygroundClient as default };