import {CardProps} from '@sanity/ui' import {MouseEvent as MouseEvent_2} from 'react' import {TooltipProps} from '@sanity/ui' import {TSDocAPIMember} from '@sanity/tsdoc/store' import {TSDocAppParams} from '@sanity/tsdoc/store' import {TSDocExportData} from '@sanity/tsdoc/store' import {TSDocStore} from '@sanity/tsdoc/store' /** @public */ declare interface APICallSignature { _type: 'api.callSignature' comment?: TSDocComment parameters: SanityArrayItem[] releaseTag?: APIReleaseTag returnType: SanityArrayItem[] typeParameters: SanityArrayItem[] } /** @public */ declare interface APIClass { _id?: string _type: 'api.class' comment?: TSDocComment export: APIExport isReactComponentType: boolean members: SanityArrayItem[] name: string package: APIPackage release: APIRelease releaseTag?: APIReleaseTag slug: SanitySlugValue typeParameters: SanityArrayItem[] } /** @public */ declare interface APIConstructor { _type: 'api.constructor' comment?: TSDocComment parameters: SanityArrayItem[] releaseTag?: APIReleaseTag } /** @public */ declare interface APIConstructSignature { _type: 'api.constructSignature' comment?: TSDocComment parameters: SanityArrayItem[] releaseTag?: APIReleaseTag returnType: SanityArrayItem[] typeParameters: SanityArrayItem[] } /** @public */ declare type APIDocument = | APIMemberDocument | APIPackageDocument | APIReleaseDocument | APIExportDocument | APISymbolDocument /** @public */ declare interface APIEnum { _id?: string _type: 'api.enum' comment?: TSDocComment export: APIExport members: SanityArrayItem[] name: string package: APIPackage release: APIRelease releaseTag?: APIReleaseTag slug: SanitySlugValue } /** @public */ declare interface APIEnumMember { _type: 'api.enumMember' name: string releaseTag?: APIReleaseTag } /** @public */ declare interface APIExport { _type: 'api.export' members: SanityArrayItem[] name: string package: APIPackage path: string release: APIRelease } /** @public */ declare type APIExportDocument = SanityDocumentValue /** @public */ declare interface APIFunction { _id?: string _type: 'api.function' comment?: TSDocComment export: APIExport isReactComponentType: boolean isReactHook: boolean isOverloading: boolean name: string package: APIPackage parameters: SanityArrayItem[] propsType?: APIInterface release: APIRelease releaseTag?: APIReleaseTag returnType: SanityArrayItem[] slug: SanitySlugValue typeParameters: SanityArrayItem[] } /** @public */ declare interface APIIndexSignature { _type: 'api.indexSignature' comment?: TSDocComment parameters: SanityArrayItem[] releaseTag?: APIReleaseTag returnType: SanityArrayItem[] } /** @public */ declare interface APIInterface { _id?: string _type: 'api.interface' comment?: TSDocComment export: APIExport extends: { _type: 'api.extend' type: SanityArrayItem[] }[] members: SanityArrayItem< | APICallSignature | APIConstructSignature | APIMethodSignature | APIPropertySignature | APIIndexSignature >[] name: string package: APIPackage release: APIRelease releaseTag?: APIReleaseTag slug: SanitySlugValue typeParameters: SanityArrayItem[] } /** @public */ declare type APIMember = | APIClass | APIEnum | APIFunction | APIInterface | APINamespace | APITypeAlias | APIVariable /** @public */ declare type APIMemberDocument = SanityDocumentValue /** @public */ declare interface APIMethod { _type: 'api.method' comment?: TSDocComment isOptional: boolean isStatic: boolean name: string parameters: SanityArrayItem[] releaseTag?: APIReleaseTag returnType: SanityArrayItem[] typeParameters: SanityArrayItem[] } /** @public */ declare interface APIMethodSignature { _type: 'api.methodSignature' comment?: TSDocComment isOptional: boolean name: string parameters: SanityArrayItem[] releaseTag?: APIReleaseTag returnType: SanityArrayItem[] typeParameters: SanityArrayItem[] } /** @public */ declare interface APINamespace { _id?: string _type: 'api.namespace' comment?: TSDocComment export: APIExport members: SanityArrayItem[] name: string package: APIPackage release: APIRelease releaseTag?: APIReleaseTag slug: SanitySlugValue } /** @public */ declare interface APIPackage { _type: 'api.package' scope?: string name: string latestRelease: APIRelease releases: APIRelease[] } /** @public */ declare type APIPackageDocument = SanityDocumentValue /** @public */ declare interface APIParameter { _type: 'api.parameter' comment?: TSDocComment name: string releaseTag?: APIReleaseTag type: SanityArrayItem[] isOptional: boolean } /** @public */ declare interface APIProperty { _type: 'api.property' comment?: TSDocComment isEventProperty: boolean isOptional: boolean isStatic: boolean name: string releaseTag?: APIReleaseTag type: SanityArrayItem[] } /** @public */ declare interface APIPropertySignature { _type: 'api.propertySignature' comment?: TSDocComment isOptional: boolean name: string releaseTag?: APIReleaseTag type: SanityArrayItem[] } /** @public */ declare interface APIRelease { _type: 'api.release' exports: SanityArrayItem[] package: APIPackage memberNames: string[] version: string } /** @public */ declare type APIReleaseDocument = SanityDocumentValue /** @public */ declare type APIReleaseTag = 'internal' | 'alpha' | 'beta' | 'public' | 'experimental' /** @public */ declare interface APISymbol { _type: 'api.symbol' name: string package: APIPackage } /** @public */ declare type APISymbolDocument = SanityDocumentValue /** @public */ declare interface APIToken { _type: 'api.token' member?: APIMember & { _id: string } text: string } /** @public */ declare interface APITypeAlias { _id?: string _type: 'api.typeAlias' comment?: TSDocComment export: APIExport name: string package: APIPackage release: APIRelease releaseTag?: APIReleaseTag slug: SanitySlugValue type: SanityArrayItem[] typeParameters: SanityArrayItem[] } /** @public */ declare interface APITypeParameter { _type: 'api.typeParameter' constraintType?: SanityArrayItem[] defaultType: SanityArrayItem[] name: string } /** @public */ declare interface APIVariable { _id?: string _type: 'api.variable' comment?: TSDocComment export: APIExport isReactComponentType: boolean name: string package: APIPackage propsType?: APIMember release: APIRelease releaseTag?: APIReleaseTag slug: SanitySlugValue type: SanityArrayItem[] } /** @beta */ export declare function mount(options: { docs: APIDocument[] releaseVersion?: string element: HTMLElement | null }): void /** @beta */ export declare function parsePath( path: string, options?: { basePath?: string version?: string }, ): TSDocAppParams /** * @public */ declare interface PortableTextBlockNode { _type: 'block' style: string children: SanityArrayItem[] markDefs: SanityArrayItem[] } /** * @public */ declare interface PortableTextCodeNode { _type: 'code' code: string language: string } /** * @public */ declare type PortableTextNode = PortableTextSpanNode | PortableTextCodeNode | PortableTextBlockNode /** * @public */ declare interface PortableTextSpanNode { _type: 'span' _markDef?: { _key?: string _type: 'link' href: string } marks?: string[] text: string } /** @alpha */ export declare function ReferenceTooltip(props: { children: React.ReactElement member: APIMember }): React.ReactNode /** @alpha */ export declare function ReferenceTooltipContent(props: {data: APIMember}): React.ReactNode /** @public */ declare type SanityArrayItem = T & { _key: string } /** @public */ declare type SanityDocumentValue = T & { _type: string _id: string _rev?: string _updatedAt?: string _createdAt?: string } /** @public */ declare interface SanityReferenceValue { _type: 'reference' _ref: string _weak?: boolean } /** @public */ declare interface SanitySlugValue { _type: 'slug' current: string } /** @public */ declare interface SerializedAPICallSignature extends Omit { parameters: SanityArrayItem[] returnType: SanityArrayItem[] typeParameters: SanityArrayItem[] } /** @public */ declare interface SerializedAPIClass extends Omit { export: SanityReferenceValue members: SanityArrayItem[] package: SanityReferenceValue release: SanityReferenceValue typeParameters: SanityArrayItem[] } /** @public */ declare type SerializedAPIClassMember = | SerializedAPIConstructor | SerializedAPIPropertyMember | SerializedAPIMethodMember /** @public */ declare interface SerializedAPIConstructor extends Omit { parameters: SanityArrayItem[] } /** @public */ declare interface SerializedAPIConstructSignature extends Omit { parameters: SanityArrayItem[] returnType: SanityArrayItem[] typeParameters: SanityArrayItem[] } /** @public */ declare interface SerializedAPIEnum extends Omit { export: SanityReferenceValue package: SanityReferenceValue release: SanityReferenceValue } /** @public */ declare interface SerializedAPIExport extends Omit { members: SanityArrayItem[] package: SanityReferenceValue release: SanityReferenceValue } /** @public */ declare interface SerializedAPIFunction extends Omit< APIFunction, 'export' | 'package' | 'parameters' | 'propsType' | 'release' | 'returnType' | 'typeParameters' > { export: SanityReferenceValue package: SanityReferenceValue parameters: SanityArrayItem[] propsType?: SanityReferenceValue release: SanityReferenceValue returnType: SanityArrayItem[] typeParameters: SanityArrayItem[] /** * Used to store if the function is overloading another function */ isOverloading: boolean } /** @public */ declare interface SerializedAPIIndexSignature extends Omit { parameters: SanityArrayItem[] returnType: SanityArrayItem[] } /** @public */ declare interface SerializedAPIInterface extends Omit< APIInterface, 'export' | 'extends' | 'members' | 'package' | 'release' | 'typeParameters' > { _type: 'api.interface' export: SanityReferenceValue extends: { _type: 'api.extend' type: SanityArrayItem[] }[] members: SanityArrayItem[] package: SanityReferenceValue release: SanityReferenceValue typeParameters: SanityArrayItem[] } /** @public */ declare type SerializedAPIInterfaceMember = | SerializedAPICallSignature | SerializedAPIConstructSignature | SerializedAPIMethodSignature | SerializedAPIPropertySignature | SerializedAPIIndexSignature /** * All API member types. * * @public */ declare type SerializedAPIMember = | SerializedAPIClass | SerializedAPIEnum | SerializedAPIFunction | SerializedAPIInterface | SerializedAPINamespace | SerializedAPITypeAlias | SerializedAPIVariable /** @public */ declare interface SerializedAPIMethodMember extends Omit { parameters: SanityArrayItem[] returnType: SanityArrayItem[] typeParameters: SanityArrayItem[] } /** @public */ declare interface SerializedAPIMethodSignature extends Omit { parameters: SanityArrayItem[] returnType: SanityArrayItem[] typeParameters: SanityArrayItem[] } /** @public */ declare interface SerializedAPINamespace extends Omit { export: SanityReferenceValue members: SanityArrayItem[] package: SanityReferenceValue release: SanityReferenceValue } /** @public */ declare interface SerializedAPIPackage extends Omit { latestRelease: SanityReferenceValue releases: SanityArrayItem[] } /** @public */ declare interface SerializedAPIParameter extends Omit { type: SanityArrayItem[] } /** @public */ declare interface SerializedAPIPropertyMember extends Omit { type: SanityArrayItem[] } /** @public */ declare interface SerializedAPIPropertySignature extends Omit { type: SanityArrayItem[] } /** @public */ declare interface SerializedAPIRelease extends Omit { exports: SanityArrayItem[] package: SanityReferenceValue } /** @public */ declare interface SerializedAPISymbol extends Omit { package: SanityReferenceValue } /** @public */ declare interface SerializedAPIToken extends Omit { member?: SanityReferenceValue } /** @public */ declare interface SerializedAPITypeAlias extends Omit { export: SanityReferenceValue type: SanityArrayItem[] package: SanityReferenceValue release: SanityReferenceValue typeParameters: SanityArrayItem[] } /** @public */ declare interface SerializedAPITypeParameter extends Omit { constraintType?: SanityArrayItem[] defaultType: SanityArrayItem[] } /** @public */ declare interface SerializedAPIVariable extends Omit { export: SanityReferenceValue type: SanityArrayItem[] package: SanityReferenceValue propsType?: SanityReferenceValue release: SanityReferenceValue } /** * @example * ```tsx * import {TSDocApp, createTSDocMemoryStore} from '@sanity/tsdoc/react' * import {useState} from 'react' * * const store = createTSDocMemoryStore({docs: []}) * const [path, setPath] = useState(null) * * * ``` * * @beta * */ export declare function TSDocApp(props: TSDocAppProps): React.ReactNode /** @beta */ export declare interface TSDocAppProps { basePath?: string onPathChange: (value: string, replace?: boolean) => void path: string store: TSDocStore releaseVersion?: string } /** @beta */ export declare function TSDocArticle(props: { data: APIMember & { versions: string[] } }): React.ReactNode /** @public */ declare interface TSDocComment { _type: 'tsdoc.docComment' customBlocks?: SanityArrayItem[] deprecated?: TSDocDeprecatedBlock exampleBlocks?: SanityArrayItem[] modifierTags?: SanityArrayItem[] parameters?: SanityArrayItem[] remarks?: TSDocRemarksBlock returns?: TSDocReturnsBlock seeBlocks?: SanityArrayItem[] summary?: SanityArrayItem[] } /** @beta */ export declare interface TSDocContextValue { basePath: string path: string params: TSDocAppParams updateParams: (fn: (params: TSDocAppParams) => TSDocAppParams) => void onPathChange: (nextPath: string, replace?: boolean) => void store: TSDocStore } /** @public */ declare interface TSDocCustomBlock { _type: 'tsdoc.customBlock' content?: PortableTextNode[] tag: string } /** @public */ declare interface TSDocDeprecatedBlock { _type: 'tsdoc.deprecatedBlock' content?: PortableTextNode[] } /** @beta */ export declare function TSDocDetail(): React.ReactNode /** @public */ declare interface TSDocExampleBlock { _type: 'tsdoc.exampleBlock' content?: PortableTextNode[] } /** @beta */ export declare function TSDocMemberTitle(props: {data: APIMember}): React.ReactNode /** @public */ declare interface TSDocModifierTag { _type: 'tsdoc.modifierTag' name: string } /** @beta */ export declare function TSDocNav(props: { showVersionMenu?: boolean expandPackages?: boolean expandSubPackages?: boolean }): React.ReactNode /** @internal */ export declare interface TSDocNavExportData extends Omit, TSDocNavGroupedMembers {} /** @internal */ export declare interface TSDocNavGroupedMembers { classes: APIClass[] enums: APIEnum[] functions: APIFunction[] interfaces: APIInterface[] namespaces: APINamespace[] reactComponents: (APIClass | APIFunction | APIVariable)[] reactHooks: APIFunction[] typeAliases: APITypeAlias[] variables: APIVariable[] } /** @public */ declare interface TSDocParamBlock { _type: 'tsdoc.paramBlock' content?: PortableTextNode[] name: string } /** @beta */ export declare function TSDocProvider(props: TSDocProviderProps): React.ReactNode /** @beta */ export declare interface TSDocProviderProps { basePath?: string children: React.ReactNode onPathChange: (nextPath: string, replace?: boolean) => void params?: TSDocAppParams path: string store: TSDocStore } /** @public */ declare interface TSDocRemarksBlock { _type: 'tsdoc.remarksBlock' content?: PortableTextNode[] } /** @public */ declare interface TSDocReturnsBlock { _type: 'tsdoc.returnsBlock' content?: PortableTextNode[] } /** @beta */ export declare function TSDocSearch(): React.ReactNode /** @public */ declare interface TSDocSeeBlock { _type: 'tsdoc.seeBlock' content?: PortableTextNode[] } /** @beta */ export declare function TSDocSymbol( props: Omit & { member?: APIMember fontSize?: number name: string packageScope?: string | null packageName?: string | null tooltip?: Omit }, ): React.ReactNode /** @beta */ export declare function TSDocSymbolPreview( props: Omit & { fontSize?: number member?: APIMember name: string packageName?: string packageScope?: string | null }, ): React.ReactNode /** @beta */ export declare function useExports(): { data: TSDocExportData[] | null error: Error | null loading: boolean } /** @beta */ export declare function useMember(props: {params: TSDocAppParams | null}): { data?: TSDocAPIMember[] | null error: Error | null loading: boolean } /** @beta */ export declare function useMemberLink(props: {params: TSDocAppParams | null}): { href: string onClick: (event: MouseEvent_2 | KeyboardEvent) => void } /** @beta */ export declare function usePackage(props: {params: TSDocAppParams | null}): { data: APIPackage | null | undefined error: Error | null loading: boolean } /** @beta */ export declare function usePackages(): { data: APIPackage[] | null error: Error | null loading: boolean } /** @beta */ export declare function useSymbol(props: UseSymbolProps): { data?: UseSymbolData | null error: Error | null loading: boolean } /** @beta */ export declare interface UseSymbolData extends APISymbol { members: APIMember[] } /** @beta */ export declare interface UseSymbolProps { member?: APIMember name: string packageScope?: string | null packageName?: string | null } /** @beta */ export declare function useSymbolSearch(props: {query: string | null}): { data: (APISymbol & { _id: string members: { exportPath: string releaseVersion: string }[] })[] error: Error | null loading: boolean } /** @beta */ export declare function useTSDoc(): TSDocContextValue export {}