mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-20 13:33:30 +01:00
refactor: reset state and code cleanup
This commit is contained in:
@@ -1,36 +1,36 @@
|
|||||||
import {
|
import {
|
||||||
ApiModel,
|
type ApiModel,
|
||||||
ApiDeclaredItem,
|
ApiDeclaredItem,
|
||||||
ApiPropertyItem,
|
type ApiPropertyItem,
|
||||||
ApiMethod,
|
type ApiMethod,
|
||||||
ApiParameterListMixin,
|
type ApiParameterListMixin,
|
||||||
ApiTypeParameterListMixin,
|
type ApiTypeParameterListMixin,
|
||||||
ApiClass,
|
type ApiClass,
|
||||||
ApiFunction,
|
type ApiFunction,
|
||||||
ApiItemKind,
|
ApiItemKind,
|
||||||
ApiTypeAlias,
|
type ApiTypeAlias,
|
||||||
ApiEnum,
|
type ApiEnum,
|
||||||
ApiInterface,
|
type ApiInterface,
|
||||||
ApiMethodSignature,
|
type ApiMethodSignature,
|
||||||
ApiPropertySignature,
|
type ApiPropertySignature,
|
||||||
ApiVariable,
|
type ApiVariable,
|
||||||
ApiItem,
|
type ApiItem,
|
||||||
ApiConstructor,
|
type ApiConstructor,
|
||||||
ApiItemContainerMixin,
|
type ApiItemContainerMixin,
|
||||||
} from '@microsoft/api-extractor-model';
|
} from '@microsoft/api-extractor-model';
|
||||||
import { generateTypeParamData } from './TypeParameterMixin';
|
import { generateTypeParamData } from './TypeParameterMixin';
|
||||||
import { Visibility } from './Visibility';
|
import { Visibility } from './Visibility';
|
||||||
import { createCommentNode } from './comment';
|
import { createCommentNode } from './comment';
|
||||||
import type { DocBlockJSON } from './comment/CommentBlock';
|
import type { DocBlockJSON } from './comment/CommentBlock';
|
||||||
import type { AnyDocNodeJSON } from './comment/CommentNode';
|
import type { AnyDocNodeJSON } from './comment/CommentNode';
|
||||||
import { DocNodeContainerJSON, nodeContainer } from './comment/CommentNodeContainer';
|
import { type DocNodeContainerJSON, nodeContainer } from './comment/CommentNodeContainer';
|
||||||
import {
|
import {
|
||||||
generatePath,
|
generatePath,
|
||||||
genParameter,
|
genParameter,
|
||||||
genReference,
|
genReference,
|
||||||
genToken,
|
genToken,
|
||||||
resolveName,
|
resolveName,
|
||||||
TokenDocumentation,
|
type TokenDocumentation,
|
||||||
} from '~/util/parse.server';
|
} from '~/util/parse.server';
|
||||||
|
|
||||||
export interface ReferenceData {
|
export interface ReferenceData {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { ApiItem, ApiModel, TypeParameter } from '@microsoft/api-extractor-model';
|
import type { ApiItem, ApiModel, TypeParameter } from '@microsoft/api-extractor-model';
|
||||||
import { block, DocBlockJSON } from './comment/CommentBlock';
|
import { block, type DocBlockJSON } from './comment/CommentBlock';
|
||||||
import { genToken, TokenDocumentation } from '~/util/parse.server';
|
import { genToken, type TokenDocumentation } from '~/util/parse.server';
|
||||||
|
|
||||||
export interface TypeParameterData {
|
export interface TypeParameterData {
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { ApiModel, ApiItem } from '@microsoft/api-extractor-model';
|
import type { ApiModel, ApiItem } from '@microsoft/api-extractor-model';
|
||||||
import type { DocBlock } from '@microsoft/tsdoc';
|
import type { DocBlock } from '@microsoft/tsdoc';
|
||||||
import { createCommentNode } from '.';
|
import { createCommentNode } from '.';
|
||||||
import { blockTag, DocBlockTagJSON } from './CommentBlockTag';
|
import { blockTag, type DocBlockTagJSON } from './CommentBlockTag';
|
||||||
import { AnyDocNodeJSON, DocNodeJSON, node } from './CommentNode';
|
import { type AnyDocNodeJSON, type DocNodeJSON, node } from './CommentNode';
|
||||||
|
|
||||||
export interface DocBlockJSON extends DocNodeJSON {
|
export interface DocBlockJSON extends DocNodeJSON {
|
||||||
content: AnyDocNodeJSON[];
|
content: AnyDocNodeJSON[];
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { DocCodeSpan } from '@microsoft/tsdoc';
|
import type { DocCodeSpan } from '@microsoft/tsdoc';
|
||||||
import { DocNodeJSON, node } from './CommentNode';
|
import { type DocNodeJSON, node } from './CommentNode';
|
||||||
|
|
||||||
export interface DocCodeSpanJSON extends DocNodeJSON {
|
export interface DocCodeSpanJSON extends DocNodeJSON {
|
||||||
code: string;
|
code: string;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
|
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
|
||||||
import type { DocNodeContainer } from '@microsoft/tsdoc';
|
import type { DocNodeContainer } from '@microsoft/tsdoc';
|
||||||
import { createCommentNode } from '.';
|
import { createCommentNode } from '.';
|
||||||
import { AnyDocNodeJSON, DocNodeJSON, node } from './CommentNode';
|
import { type AnyDocNodeJSON, type DocNodeJSON, node } from './CommentNode';
|
||||||
|
|
||||||
export interface DocNodeContainerJSON extends DocNodeJSON {
|
export interface DocNodeContainerJSON extends DocNodeJSON {
|
||||||
nodes: AnyDocNodeJSON[];
|
nodes: AnyDocNodeJSON[];
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { DocFencedCode } from '@microsoft/tsdoc';
|
import type { DocFencedCode } from '@microsoft/tsdoc';
|
||||||
import { DocNodeJSON, node } from './CommentNode';
|
import { type DocNodeJSON, node } from './CommentNode';
|
||||||
|
|
||||||
export interface DocFencedCodeJSON extends DocNodeJSON {
|
export interface DocFencedCodeJSON extends DocNodeJSON {
|
||||||
code: string;
|
code: string;
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
|
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
|
||||||
import type { DocDeclarationReference, DocLinkTag } from '@microsoft/tsdoc';
|
import type { DocDeclarationReference, DocLinkTag } from '@microsoft/tsdoc';
|
||||||
import { DocNodeJSON, node } from './CommentNode';
|
import { type DocNodeJSON, node } from './CommentNode';
|
||||||
import { generatePath, resolveName } from '~/util/parse.server';
|
import { generatePath, resolveName } from '~/util/parse.server';
|
||||||
|
|
||||||
|
interface LinkTagCodeLink {
|
||||||
|
name: string;
|
||||||
|
kind: string;
|
||||||
|
path: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface DocLinkTagJSON extends DocNodeJSON {
|
export interface DocLinkTagJSON extends DocNodeJSON {
|
||||||
text: string | null;
|
text: string | null;
|
||||||
codeDestination: LinkTagCodeLink | null;
|
codeDestination: LinkTagCodeLink | null;
|
||||||
@@ -28,12 +34,6 @@ export function genToken(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LinkTagCodeLink {
|
|
||||||
name: string;
|
|
||||||
kind: string;
|
|
||||||
path: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function linkTagNode(
|
export function linkTagNode(
|
||||||
linkNode: DocLinkTag,
|
linkNode: DocLinkTag,
|
||||||
model: ApiModel,
|
model: ApiModel,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
|
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
|
||||||
import type { DocParamBlock } from '@microsoft/tsdoc';
|
import type { DocParamBlock } from '@microsoft/tsdoc';
|
||||||
import { block, DocBlockJSON } from './CommentBlock';
|
import { block, type DocBlockJSON } from './CommentBlock';
|
||||||
|
|
||||||
export interface DocParamBlockJSON extends DocBlockJSON {
|
interface DocParamBlockJSON extends DocBlockJSON {
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { DocPlainText } from '@microsoft/tsdoc';
|
import type { DocPlainText } from '@microsoft/tsdoc';
|
||||||
import { DocNodeJSON, node } from './CommentNode';
|
import { type DocNodeJSON, node } from './CommentNode';
|
||||||
|
|
||||||
export interface DocPlainTextJSON extends DocNodeJSON {
|
export interface DocPlainTextJSON extends DocNodeJSON {
|
||||||
text: string;
|
text: string;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
|
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
|
||||||
import type { DocComment } from '@microsoft/tsdoc';
|
import type { DocComment } from '@microsoft/tsdoc';
|
||||||
import { createCommentNode } from '.';
|
import { createCommentNode } from '.';
|
||||||
import { block, DocBlockJSON } from './CommentBlock';
|
import { block, type DocBlockJSON } from './CommentBlock';
|
||||||
import { DocNodeJSON, node } from './CommentNode';
|
import { type DocNodeJSON, node } from './CommentNode';
|
||||||
|
|
||||||
export interface DocCommentJSON extends DocNodeJSON {
|
export interface DocCommentJSON extends DocNodeJSON {
|
||||||
summary: DocNodeJSON[];
|
summary: DocNodeJSON[];
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import {
|
|||||||
type DocFencedCode,
|
type DocFencedCode,
|
||||||
DocNodeKind,
|
DocNodeKind,
|
||||||
type DocBlock,
|
type DocBlock,
|
||||||
DocComment,
|
type DocComment,
|
||||||
DocCodeSpan,
|
type DocCodeSpan,
|
||||||
DocParamBlock,
|
type DocParamBlock,
|
||||||
} from '@microsoft/tsdoc';
|
} from '@microsoft/tsdoc';
|
||||||
import { block } from './CommentBlock';
|
import { block } from './CommentBlock';
|
||||||
import { codeSpan } from './CommentCodeSpan';
|
import { codeSpan } from './CommentCodeSpan';
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import type { TypeParameterData } from '~/DocModel/TypeParameterMixin';
|
|||||||
import type { AnyDocNodeJSON } from '~/DocModel/comment/CommentNode';
|
import type { AnyDocNodeJSON } from '~/DocModel/comment/CommentNode';
|
||||||
import type { TokenDocumentation } from '~/util/parse.server';
|
import type { TokenDocumentation } from '~/util/parse.server';
|
||||||
|
|
||||||
export interface DocContainerProps {
|
interface DocContainerProps {
|
||||||
name: string;
|
name: string;
|
||||||
kind: string;
|
kind: string;
|
||||||
excerpt: string;
|
excerpt: string;
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ import { TSDoc } from './tsdoc/TSDoc';
|
|||||||
import type { ApiMethodJSON, ApiMethodSignatureJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
import type { ApiMethodJSON, ApiMethodSignatureJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
||||||
import { Visibility } from '~/DocModel/Visibility';
|
import { Visibility } from '~/DocModel/Visibility';
|
||||||
|
|
||||||
type MethodResolvable = ApiMethodJSON | ApiMethodSignatureJSON;
|
function getShorthandName(data: ApiMethodJSON | ApiMethodSignatureJSON) {
|
||||||
|
|
||||||
function getShorthandName(data: MethodResolvable) {
|
|
||||||
return `${data.name}${data.optional ? '?' : ''}(${data.parameters.reduce((prev, cur, index) => {
|
return `${data.name}${data.optional ? '?' : ''}(${data.parameters.reduce((prev, cur, index) => {
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
return `${prev}${cur.isOptional ? `${cur.name}?` : cur.name}`;
|
return `${prev}${cur.isOptional ? `${cur.name}?` : cur.name}`;
|
||||||
@@ -18,7 +16,7 @@ function getShorthandName(data: MethodResolvable) {
|
|||||||
}, '')})`;
|
}, '')})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MethodItem({ data }: { data: MethodResolvable }) {
|
export function MethodItem({ data }: { data: ApiMethodJSON | ApiMethodSignatureJSON }) {
|
||||||
const method = data as ApiMethodJSON;
|
const method = data as ApiMethodJSON;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ import { Table } from './Table';
|
|||||||
import { TSDoc } from './tsdoc/TSDoc';
|
import { TSDoc } from './tsdoc/TSDoc';
|
||||||
import type { ParameterDocumentation } from '~/util/parse.server';
|
import type { ParameterDocumentation } from '~/util/parse.server';
|
||||||
|
|
||||||
|
const columnStyles = {
|
||||||
|
Name: 'font-mono whitespace-nowrap',
|
||||||
|
Type: 'font-mono whitespace-pre-wrap break-normal',
|
||||||
|
};
|
||||||
|
|
||||||
export function ParameterTable({ data }: { data: ParameterDocumentation[] }) {
|
export function ParameterTable({ data }: { data: ParameterDocumentation[] }) {
|
||||||
const rows = data.map((param) => ({
|
const rows = data.map((param) => ({
|
||||||
Name: param.name,
|
Name: param.name,
|
||||||
@@ -12,11 +17,6 @@ export function ParameterTable({ data }: { data: ParameterDocumentation[] }) {
|
|||||||
Description: param.paramCommentBlock ? <TSDoc node={param.paramCommentBlock} /> : 'None',
|
Description: param.paramCommentBlock ? <TSDoc node={param.paramCommentBlock} /> : 'None',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const columnStyles = {
|
|
||||||
Name: 'font-mono whitespace-nowrap',
|
|
||||||
Type: 'font-mono whitespace-pre-wrap break-normal',
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<ScrollArea pb="xs" offsetScrollbars>
|
<ScrollArea pb="xs" offsetScrollbars>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
useMantineColorScheme,
|
useMantineColorScheme,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { type ReactNode, useState } from 'react';
|
import { type ReactNode, useState, useEffect } from 'react';
|
||||||
import { VscChevronDown } from 'react-icons/vsc';
|
import { VscChevronDown } from 'react-icons/vsc';
|
||||||
|
|
||||||
const useStyles = createStyles((theme, { opened }: { opened: boolean }) => ({
|
const useStyles = createStyles((theme, { opened }: { opened: boolean }) => ({
|
||||||
@@ -51,6 +51,11 @@ export function Section({
|
|||||||
const { colorScheme } = useMantineColorScheme();
|
const { colorScheme } = useMantineColorScheme();
|
||||||
const { classes } = useStyles({ opened });
|
const { classes } = useStyles({ opened });
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setOpened(!defaultClosed);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ wordBreak: 'break-all' }}>
|
<Box sx={{ wordBreak: 'break-all' }}>
|
||||||
<UnstyledButton className={classes.control} onClick={() => setOpened((o) => !o)}>
|
<UnstyledButton className={classes.control} onClick={() => setOpened((o) => !o)}>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Stack, Group, Badge, Title } from '@mantine/core';
|
import { Stack, Group, Badge, Title } from '@mantine/core';
|
||||||
import { useMediaQuery } from '@mantine/hooks';
|
import { useMediaQuery } from '@mantine/hooks';
|
||||||
import { VscSymbolConstant, VscSymbolMethod, VscSymbolProperty } from 'react-icons/vsc';
|
import { VscSymbolConstant, VscSymbolMethod, VscSymbolProperty } from 'react-icons/vsc';
|
||||||
|
|
||||||
import { MethodList } from './MethodList';
|
import { MethodList } from './MethodList';
|
||||||
import { ParameterTable } from './ParameterTable';
|
import { ParameterTable } from './ParameterTable';
|
||||||
import { PropertyList } from './PropertyList';
|
import { PropertyList } from './PropertyList';
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import type { MDXRemoteSerializeResult } from 'next-mdx-remote';
|
|||||||
import Image from 'next/future/image';
|
import Image from 'next/future/image';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { type PropsWithChildren, useState } from 'react';
|
import { type PropsWithChildren, useState, useEffect } from 'react';
|
||||||
import { VscChevronDown, VscGithubInverted, VscPackage, VscVersions } from 'react-icons/vsc';
|
import { VscChevronDown, VscGithubInverted, VscPackage, VscVersions } from 'react-icons/vsc';
|
||||||
import { WiDaySunny, WiNightClear } from 'react-icons/wi';
|
import { WiDaySunny, WiNightClear } from 'react-icons/wi';
|
||||||
import useSWR from 'swr';
|
import useSWR from 'swr';
|
||||||
@@ -99,6 +99,12 @@ const libraries = [
|
|||||||
{ label: 'ws', value: 'ws' },
|
{ label: 'ws', value: 'ws' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const libraryMenuItems = libraries.map((item) => (
|
||||||
|
<Menu.Item key={item.label} component={NextLink} href={`/docs/packages/${item.value}/main`}>
|
||||||
|
{item.label}
|
||||||
|
</Menu.Item>
|
||||||
|
));
|
||||||
|
|
||||||
export function SidebarLayout({
|
export function SidebarLayout({
|
||||||
packageName,
|
packageName,
|
||||||
branchName,
|
branchName,
|
||||||
@@ -117,13 +123,13 @@ export function SidebarLayout({
|
|||||||
const [openedLibPicker, setOpenedLibPicker] = useState(false);
|
const [openedLibPicker, setOpenedLibPicker] = useState(false);
|
||||||
const [openedVersionPicker, setOpenedVersionPicker] = useState(false);
|
const [openedVersionPicker, setOpenedVersionPicker] = useState(false);
|
||||||
|
|
||||||
const { classes } = useStyles({ openedLib: openedLibPicker, openedVersion: openedVersionPicker });
|
useEffect(() => {
|
||||||
|
setOpened(false);
|
||||||
|
setOpenedLibPicker(false);
|
||||||
|
setOpenedVersionPicker(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const libraryMenuItems = libraries.map((item) => (
|
const { classes } = useStyles({ openedLib: openedLibPicker, openedVersion: openedVersionPicker });
|
||||||
<Menu.Item key={item.label} component={NextLink} href={`/docs/packages/${item.value}/main`}>
|
|
||||||
{item.label}
|
|
||||||
</Menu.Item>
|
|
||||||
));
|
|
||||||
|
|
||||||
const versionMenuItems =
|
const versionMenuItems =
|
||||||
versions?.map((item) => (
|
versions?.map((item) => (
|
||||||
|
|||||||
@@ -4,6 +4,12 @@ import { Table } from './Table';
|
|||||||
import { TSDoc } from './tsdoc/TSDoc';
|
import { TSDoc } from './tsdoc/TSDoc';
|
||||||
import type { TypeParameterData } from '~/DocModel/TypeParameterMixin';
|
import type { TypeParameterData } from '~/DocModel/TypeParameterMixin';
|
||||||
|
|
||||||
|
const rowElements = {
|
||||||
|
Name: 'font-mono whitespace-nowrap',
|
||||||
|
Constraints: 'font-mono whitespace-pre break-normal',
|
||||||
|
Default: 'font-mono whitespace-pre break-normal',
|
||||||
|
};
|
||||||
|
|
||||||
export function TypeParamTable({ data }: { data: TypeParameterData[] }) {
|
export function TypeParamTable({ data }: { data: TypeParameterData[] }) {
|
||||||
const rows = data.map((typeParam) => ({
|
const rows = data.map((typeParam) => ({
|
||||||
Name: typeParam.name,
|
Name: typeParam.name,
|
||||||
@@ -13,12 +19,6 @@ export function TypeParamTable({ data }: { data: TypeParameterData[] }) {
|
|||||||
Description: typeParam.commentBlock ? <TSDoc node={typeParam.commentBlock} /> : 'None',
|
Description: typeParam.commentBlock ? <TSDoc node={typeParam.commentBlock} /> : 'None',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const rowElements = {
|
|
||||||
Name: 'font-mono whitespace-nowrap',
|
|
||||||
Constraints: 'font-mono whitespace-pre break-normal',
|
|
||||||
Default: 'font-mono whitespace-pre break-normal',
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollArea pb="xs" offsetScrollbars>
|
<ScrollArea pb="xs" offsetScrollbars>
|
||||||
<Table
|
<Table
|
||||||
|
|||||||
@@ -3,12 +3,7 @@ import { StandardTags } from '@microsoft/tsdoc';
|
|||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { VscWarning } from 'react-icons/vsc';
|
import { VscWarning } from 'react-icons/vsc';
|
||||||
|
|
||||||
export interface BlockProps {
|
export function Block({ children, title }: { children: ReactNode; title: string }) {
|
||||||
children: ReactNode;
|
|
||||||
title: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function Block({ children, title }: BlockProps) {
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<Title order={5}>{title}</Title>
|
<Title order={5}>{title}</Title>
|
||||||
@@ -17,18 +12,13 @@ export function Block({ children, title }: BlockProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BlockCommentProps {
|
export function ExampleBlock({
|
||||||
tagName: string;
|
children,
|
||||||
children: ReactNode;
|
exampleIndex,
|
||||||
index?: number | undefined;
|
}: {
|
||||||
}
|
|
||||||
|
|
||||||
export interface ExampleBlockProps {
|
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
exampleIndex?: number | undefined;
|
exampleIndex?: number | undefined;
|
||||||
}
|
}): JSX.Element {
|
||||||
|
|
||||||
export function ExampleBlock({ children, exampleIndex }: ExampleBlockProps): JSX.Element {
|
|
||||||
return <Block title={`Example ${exampleIndex ? exampleIndex : ''}`}>{children}</Block>;
|
return <Block title={`Example ${exampleIndex ? exampleIndex : ''}`}>{children}</Block>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +38,15 @@ export function RemarksBlock({ children }: { children: ReactNode }): JSX.Element
|
|||||||
return <Block title="Remarks">{children}</Block>;
|
return <Block title="Remarks">{children}</Block>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function BlockComment({ children, tagName, index }: BlockCommentProps): JSX.Element {
|
export function BlockComment({
|
||||||
|
children,
|
||||||
|
tagName,
|
||||||
|
index,
|
||||||
|
}: {
|
||||||
|
tagName: string;
|
||||||
|
children: ReactNode;
|
||||||
|
index?: number | undefined;
|
||||||
|
}): JSX.Element {
|
||||||
switch (tagName.toUpperCase()) {
|
switch (tagName.toUpperCase()) {
|
||||||
case StandardTags.example.tagNameWithUpperCase:
|
case StandardTags.example.tagNameWithUpperCase:
|
||||||
return <ExampleBlock exampleIndex={index}>{children}</ExampleBlock>;
|
return <ExampleBlock exampleIndex={index}>{children}</ExampleBlock>;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ColorScheme, ColorSchemeProvider, MantineProvider } from '@mantine/core';
|
import { ColorScheme, ColorSchemeProvider, MantineProvider } from '@mantine/core';
|
||||||
import { useColorScheme } from '@mantine/hooks';
|
import { useColorScheme } from '@mantine/hooks';
|
||||||
import { SpotlightAction, SpotlightProvider } from '@mantine/spotlight';
|
import { type SpotlightAction, SpotlightProvider } from '@mantine/spotlight';
|
||||||
import type { AppProps } from 'next/app';
|
import type { AppProps } from 'next/app';
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import { type NextRouter, useRouter } from 'next/router';
|
import { type NextRouter, useRouter } from 'next/router';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { createStylesServer, ServerStyles } from '@mantine/next';
|
import { createStylesServer, ServerStyles } from '@mantine/next';
|
||||||
import Document, { Html, Head, Main, NextScript, DocumentContext, DocumentInitialProps } from 'next/document';
|
import Document, { Html, Head, Main, NextScript, type DocumentContext, type DocumentInitialProps } from 'next/document';
|
||||||
|
|
||||||
const stylesServer = createStylesServer();
|
const stylesServer = createStylesServer();
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { readFile } from 'node:fs/promises';
|
|||||||
import { join } from 'node:path';
|
import { join } from 'node:path';
|
||||||
import { Affix, Box, Button, LoadingOverlay, Transition } from '@mantine/core';
|
import { Affix, Box, Button, LoadingOverlay, Transition } from '@mantine/core';
|
||||||
import { useMediaQuery, useWindowScroll } from '@mantine/hooks';
|
import { useMediaQuery, useWindowScroll } from '@mantine/hooks';
|
||||||
import { ApiFunction, ApiPackage } from '@microsoft/api-extractor-model';
|
import { ApiFunction, type ApiPackage } from '@microsoft/api-extractor-model';
|
||||||
import { MDXRemote } from 'next-mdx-remote';
|
import { MDXRemote } from 'next-mdx-remote';
|
||||||
import { serialize } from 'next-mdx-remote/serialize';
|
import { serialize } from 'next-mdx-remote/serialize';
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
@@ -175,7 +175,6 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
|
|||||||
memberName && containerKey ? findMemberByKey(model, packageName, containerKey, branchName) ?? null : null,
|
memberName && containerKey ? findMemberByKey(model, packageName, containerKey, branchName) ?? null : null,
|
||||||
source: mdxSource,
|
source: mdxSource,
|
||||||
},
|
},
|
||||||
key: `${memberName ?? 'index'}-${branchName}`,
|
|
||||||
revalidate: 3600,
|
revalidate: 3600,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
import { ApiItem, ApiModel, ApiPackage } from '~/util/api-extractor.server';
|
import { ApiItem, ApiModel, type ApiPackage } from '~/util/api-extractor.server';
|
||||||
import { TSDocConfigFile } from '~/util/tsdoc-config.server';
|
import { TSDocConfigFile } from '~/util/tsdoc-config.server';
|
||||||
import { TSDocConfiguration } from '~/util/tsdoc.server';
|
import { TSDocConfiguration } from '~/util/tsdoc.server';
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import {
|
|||||||
type ApiPropertyItem,
|
type ApiPropertyItem,
|
||||||
type ExcerptToken,
|
type ExcerptToken,
|
||||||
type Parameter,
|
type Parameter,
|
||||||
ApiFunction,
|
type ApiFunction,
|
||||||
} from '@microsoft/api-extractor-model';
|
} from '@microsoft/api-extractor-model';
|
||||||
import type { DocNode, DocParagraph, DocPlainText } from '@microsoft/tsdoc';
|
import type { DocNode, DocParagraph, DocPlainText } from '@microsoft/tsdoc';
|
||||||
import { Meaning, ModuleSource } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
|
import { type Meaning, ModuleSource } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
|
||||||
import { createCommentNode } from '~/DocModel/comment';
|
import { createCommentNode } from '~/DocModel/comment';
|
||||||
import type { DocBlockJSON } from '~/DocModel/comment/CommentBlock';
|
import type { DocBlockJSON } from '~/DocModel/comment/CommentBlock';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user