// https://github.com/TypeStrong/typedoc-default-themes/blob/master/src/default/partials/members.hbs
import { Fragment, useContext } from 'react';
import type { JSONOutput } from 'typedoc';
import { useRequiredReflection } from '../hooks/useReflection';
import { useReflectionMap } from '../hooks/useReflectionMap';
import { escapeMdx } from '../utils/helpers';
import { hasOwnDocument } from '../utils/visibility';
import { AnchorLink } from './AnchorLink';
import { ApiOptionsContext } from './ApiItem';
import { CommentBadges, isCommentWithModifiers } from './CommentBadges';
import { Flags } from './Flags';
import { MemberDeclaration } from './MemberDeclaration';
import { MemberGetterSetter } from './MemberGetterSetter';
import { MemberReference } from './MemberReference';
import { MemberSignatures } from './MemberSignatures';
import { SourceLink } from './SourceLink';
export interface MemberProps {
id: number;
}
export function Member({ id }: MemberProps) {
const reflections = useReflectionMap();
const reflection = useRequiredReflection(id);
const { comment } = reflection;
let content: React.ReactNode = null;
const apiOptions = useContext(ApiOptionsContext);
const shouldHideInherited = reflection.inheritedFrom ? apiOptions.hideInherited : false;
if (reflection.signatures) {
content = ;
} else if (reflection.getSignature || reflection.setSignature) {
content = (
);
} else if ('target' in reflection && (reflection as JSONOutput.ReferenceReflection).target) {
content = ;
} else {
content = ;
}
return (
!shouldHideInherited &&
{escapeMdx(reflection.name)}
{isCommentWithModifiers(comment) && }
{content}
{reflection.groups?.map((group) => (
{group.children?.map((child) =>
hasOwnDocument(child, reflections) ? null : ,
)}
))}
);
}