diff --git a/packages/website/src/DocModel/DocItem.ts b/packages/website/src/DocModel/DocItem.ts index e11a337e0..c6e6c5afe 100644 --- a/packages/website/src/DocModel/DocItem.ts +++ b/packages/website/src/DocModel/DocItem.ts @@ -17,6 +17,7 @@ export class DocItem { public readonly kind: string; public readonly remarks: DocNodeContainerJSON | null; public readonly summary: DocNodeContainerJSON | null; + public readonly deprecated: DocNodeContainerJSON | null; public readonly containerKey: string; public readonly comment: AnyDocNodeJSON | null; @@ -34,6 +35,9 @@ export class DocItem { this.summary = item.tsdocComment?.summarySection ? (createCommentNode(item.tsdocComment.summarySection, model, item.parent) as DocNodeContainerJSON) : null; + this.deprecated = item.tsdocComment?.deprecatedBlock + ? (createCommentNode(item.tsdocComment.deprecatedBlock, model, item.parent) as DocNodeContainerJSON) + : null; this.containerKey = item.containerKey; this.comment = item.tsdocComment ? createCommentNode(item.tsdocComment, model, item.parent) : null; } @@ -63,6 +67,7 @@ export class DocItem { excerptTokens: this.excerptTokens, kind: this.kind, remarks: this.remarks, + deprecated: this.deprecated, path: this.path, containerKey: this.containerKey, comment: this.comment, diff --git a/packages/website/src/DocModel/comment/RootComment.ts b/packages/website/src/DocModel/comment/RootComment.ts index 5ac2a4a15..459fc940b 100644 --- a/packages/website/src/DocModel/comment/RootComment.ts +++ b/packages/website/src/DocModel/comment/RootComment.ts @@ -7,6 +7,7 @@ import { DocNodeJSON, node } from './CommentNode'; export interface DocCommentJSON extends DocNodeJSON { summary: DocNodeJSON[]; remarks: DocNodeJSON[]; + deprecated: DocNodeJSON[]; customBlocks: DocBlockJSON[]; } @@ -15,6 +16,7 @@ export function comment(comment: DocComment, model: ApiModel, parentItem?: ApiIt ...node(comment), summary: comment.summarySection.nodes.map((node) => createCommentNode(node, model, parentItem)), remarks: comment.remarksBlock?.content.nodes.map((node) => createCommentNode(node, model, parentItem)) ?? [], + deprecated: comment.deprecatedBlock?.content.nodes.map((node) => createCommentNode(node, model, parentItem)) ?? [], customBlocks: comment.customBlocks.map((_block) => block(_block, model, parentItem)), }; } diff --git a/packages/website/src/components/CodeListing.tsx b/packages/website/src/components/CodeListing.tsx index 3a3ccd554..f5b5469b8 100644 --- a/packages/website/src/components/CodeListing.tsx +++ b/packages/website/src/components/CodeListing.tsx @@ -18,8 +18,9 @@ export function CodeListing({ readonly = false, optional = false, summary, - comment, children, + comment, + deprecation, }: { name: string; separator?: CodeListingSeparatorType; @@ -29,6 +30,7 @@ export function CodeListing({ summary?: ReturnType['summary']; comment?: AnyDocNodeJSON | null; children?: ReactNode; + deprecation?: AnyDocNodeJSON | null; }) { return ( @@ -44,9 +46,12 @@ export function CodeListing({ - {summary && } - {comment && } - {children} + + {deprecation ? : null} + {summary && } + {comment && } + {children} + ); diff --git a/packages/website/src/components/MethodItem.tsx b/packages/website/src/components/MethodItem.tsx index 202532617..37fd1ebcf 100644 --- a/packages/website/src/components/MethodItem.tsx +++ b/packages/website/src/components/MethodItem.tsx @@ -43,9 +43,13 @@ export function MethodItem({ data }: { data: MethodResolvable }) { - {data.summary ? : null} - {data.comment ? : null} - {data.parameters.length ? : null} + + {data.deprecated ? : null} + {data.summary ? : null} + {data.remarks ? : null} + {data.comment ? : null} + {data.parameters.length ? : null} + ); diff --git a/packages/website/src/components/PropertyList.tsx b/packages/website/src/components/PropertyList.tsx index ecfb1f06b..79f3ca646 100644 --- a/packages/website/src/components/PropertyList.tsx +++ b/packages/website/src/components/PropertyList.tsx @@ -14,6 +14,7 @@ export function PropertyList({ data }: { data: ReturnType optional={prop.optional} summary={prop.summary} comment={prop.comment} + deprecation={prop.deprecated} /> ))} diff --git a/packages/website/src/components/tsdoc/BlockComment.tsx b/packages/website/src/components/tsdoc/BlockComment.tsx index 5f870ab70..1c0e2458a 100644 --- a/packages/website/src/components/tsdoc/BlockComment.tsx +++ b/packages/website/src/components/tsdoc/BlockComment.tsx @@ -1,5 +1,7 @@ +import { Alert } from '@mantine/core'; import { StandardTags } from '@microsoft/tsdoc'; import type { ReactNode } from 'react'; +import { VscWarning } from 'react-icons/vsc'; export interface BlockProps { children: ReactNode; @@ -30,10 +32,26 @@ export function ExampleBlock({ children, exampleIndex }: ExampleBlockProps): JSX return {children}; } +export function DeprecatedBlock({ children }: { children: ReactNode }): JSX.Element { + return ( + } title="Deprecated" color="red" radius="xs"> + {children} + + ); +} + +export function RemarksBlock({ children }: { children: ReactNode }): JSX.Element { + return {children}; +} + export function BlockComment({ children, tagName, index }: BlockCommentProps): JSX.Element { switch (tagName.toUpperCase()) { case StandardTags.example.tagNameWithUpperCase: return {children}; + case StandardTags.deprecated.tagNameWithUpperCase: + return {children}; + case StandardTags.remarks.tagNameWithUpperCase: + return {children}; default: // TODO: Support more blocks in the future. return <>; } diff --git a/packages/website/src/components/tsdoc/TSDoc.tsx b/packages/website/src/components/tsdoc/TSDoc.tsx index e6f1dcb0b..cb705a50e 100644 --- a/packages/website/src/components/tsdoc/TSDoc.tsx +++ b/packages/website/src/components/tsdoc/TSDoc.tsx @@ -32,7 +32,7 @@ export function TSDoc({ node }: { node: AnyDocNodeJSON }): JSX.Element { ); case DocNodeKind.SoftBreak: - return
; + return <>; case DocNodeKind.LinkTag: { const { codeDestination, urlDestination, text } = node as DocLinkTagJSON;