import { cn } from '@/lib/utils' import { colors, surfaces, effects } from '@/lib/theme' import type { DocItem } from '@/lib/docs/types' import CodeBlock from './CodeBlock' import TypeLink from './TypeLink' import { ExternalLink, TriangleAlert } from 'lucide-react' import ReactMarkdown from 'react-markdown' import remarkGfm from 'remark-gfm' interface FunctionDocProps { item: DocItem className?: string availableTypeIds?: Set } export default function FunctionDoc({ item, className, availableTypeIds }: FunctionDocProps) { return (
{/* Header */}

{item.name}

{item.kind} {item.category} {item.deprecated && ( Deprecated )}
{item.description && (

{item.description}

)}
{item.source && ( { e.currentTarget.style.borderColor = colors.borders.hover e.currentTarget.style.color = colors.text.secondary }} onMouseLeave={(e) => { e.currentTarget.style.borderColor = colors.borders.default e.currentTarget.style.color = colors.text.muted }} > Source )}
{/* Remarks */} {item.remarks && (

Remarks

{item.remarks}
)} {/* Signature */} {item.signature && (

Signature

)} {/* Parameters */} {item.parameters && item.parameters.length > 0 && (

Parameters

{item.parameters.map((param, index) => ( ))}
Name Type Description
{param.name} {param.optional && ( ? )} {param.description || '—'} {param.defaultValue && (
Default: {param.defaultValue}
)}
)} {/* Returns */} {item.returns && (

Returns

{item.returns.description && (

{item.returns.description}

)}
)} {/* Throws */} {item.throws && item.throws.length > 0 && (

Throws

{item.throws.map((throwsDoc, index) => (

{throwsDoc}

))}
)} {/* Examples */} {item.examples && item.examples.length > 0 && (

Examples

{item.examples.map((example, index) => ( ))}
)} {/* Tags */} {item.tags && item.tags.length > 0 && (
{item.tags.map((tag) => ( {tag} ))}
)} {/* See Also */} {item.see && item.see.length > 0 && (

See Also

{item.see.map((ref, index) => (
{ref}
))}
)}
) }