mirror of
https://github.com/discordjs/discord.js.git
synced 2024-08-21 02:44:42 +12:00
chore: format
This commit is contained in:
parent
488aa58b29
commit
447652ec8a
69 changed files with 158 additions and 138 deletions
|
@ -3,7 +3,7 @@
|
|||
import { Providers } from './providers';
|
||||
import { inter } from '~/util/fonts';
|
||||
|
||||
export default function GlobalError({ error }: { error: Error }) {
|
||||
export default function GlobalError({ error }: { readonly error: Error }) {
|
||||
console.error(error);
|
||||
|
||||
return (
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
export default function Error({ error }: { error: Error }) {
|
||||
export default function Error({ error }: { readonly error: Error }) {
|
||||
console.error(error);
|
||||
|
||||
return (
|
||||
|
|
|
@ -6,7 +6,7 @@ export async function generateStaticParams() {
|
|||
return allContents.map((content) => ({ slug: [content.slug] }));
|
||||
}
|
||||
|
||||
export default function Page({ params }: { params: { slug: string[] } }) {
|
||||
export default function Page({ params }: { readonly params: { slug: string[] } }) {
|
||||
const content = allContents.find((content) => content.slug === params.slug?.join('/'));
|
||||
|
||||
if (!content) {
|
||||
|
|
|
@ -12,26 +12,26 @@ interface DiscordAPITypesLinkOptions {
|
|||
*
|
||||
* @example `'RESTJSONErrorCodes'`
|
||||
*/
|
||||
parent?: string;
|
||||
readonly parent?: string;
|
||||
/**
|
||||
* The scope of where this link lives.
|
||||
*
|
||||
* @remarks API does not have a scope.
|
||||
*/
|
||||
scope?: 'gateway' | 'globals' | 'payloads' | 'rest' | 'rpc' | 'utils' | 'voice';
|
||||
readonly scope?: 'gateway' | 'globals' | 'payloads' | 'rest' | 'rpc' | 'utils' | 'voice';
|
||||
/**
|
||||
* The symbol belonging to the parent.
|
||||
*
|
||||
* @example '`MaximumNumberOfGuildsReached'`
|
||||
*/
|
||||
symbol?: string;
|
||||
readonly symbol?: string;
|
||||
/**
|
||||
* The type of the {@link DiscordAPITypesLinkOptions.parent}.
|
||||
*
|
||||
* @example `'enum'`
|
||||
* @example `'interface'`
|
||||
*/
|
||||
type?: string;
|
||||
readonly type?: string;
|
||||
}
|
||||
|
||||
export function DiscordAPITypesLink({
|
||||
|
|
|
@ -8,19 +8,19 @@ interface DocsLinkOptions {
|
|||
*
|
||||
* @remarks Functions automatically infer this.
|
||||
*/
|
||||
brackets?: boolean;
|
||||
readonly brackets?: boolean;
|
||||
/**
|
||||
* The package.
|
||||
*
|
||||
* @defaultValue `'discord.js'`
|
||||
*/
|
||||
package?: (typeof PACKAGES)[number];
|
||||
readonly package?: (typeof PACKAGES)[number];
|
||||
/**
|
||||
* The initial documentation class, function, interface etc.
|
||||
*
|
||||
* @example `'Client'`
|
||||
*/
|
||||
parent?: string;
|
||||
readonly parent?: string;
|
||||
/**
|
||||
* Whether to reference a static property.
|
||||
*
|
||||
|
@ -28,20 +28,20 @@ interface DocsLinkOptions {
|
|||
* This should only be used for the https://discord.js.org domain
|
||||
* as static properties are not identified in the URL.
|
||||
*/
|
||||
static?: boolean;
|
||||
readonly static?: boolean;
|
||||
/**
|
||||
* The symbol belonging to the parent.
|
||||
*
|
||||
* @example '`login'`
|
||||
*/
|
||||
symbol?: string;
|
||||
readonly symbol?: string;
|
||||
/**
|
||||
* The type of the {@link DocsLinkOptions.parent}.
|
||||
*
|
||||
* @example `'class'`
|
||||
* @example `'Function'`
|
||||
*/
|
||||
type?: string;
|
||||
readonly type?: string;
|
||||
}
|
||||
|
||||
export function DocsLink({
|
||||
|
|
|
@ -10,7 +10,7 @@ import { H4 } from './H4';
|
|||
import { DocsLink } from '~/components/DocsLink';
|
||||
import { ResultingCode } from '~/components/ResultingCode';
|
||||
|
||||
export function Mdx({ code }: { code: string }) {
|
||||
export function Mdx({ code }: { readonly code: string }) {
|
||||
const Component = useMDXComponent(code);
|
||||
|
||||
return (
|
||||
|
|
|
@ -5,7 +5,7 @@ const LINK_HEIGHT = 30;
|
|||
const INDICATOR_SIZE = 10;
|
||||
const INDICATOR_OFFSET = (LINK_HEIGHT - INDICATOR_SIZE) / 2;
|
||||
|
||||
export function Outline({ headings }: { headings: any[] }) {
|
||||
export function Outline({ headings }: { readonly headings: any[] }) {
|
||||
// eslint-disable-next-line react/hook-use-state
|
||||
const [active /* setActive */] = useState(0);
|
||||
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
export function PageButton({ url, title, direction }: { direction: 'next' | 'prev'; title: string; url: string }) {
|
||||
export function PageButton({
|
||||
url,
|
||||
title,
|
||||
direction,
|
||||
}: {
|
||||
readonly direction: 'next' | 'prev';
|
||||
readonly title: string;
|
||||
readonly url: string;
|
||||
}) {
|
||||
return (
|
||||
<a
|
||||
className="flex flex-row flex-col transform-gpu cursor-pointer select-none appearance-none place-items-center gap-2 rounded bg-light-600 px-4 py-3 leading-none no-underline outline-none active:translate-y-px active:bg-light-800 dark:bg-dark-600 hover:bg-light-700 focus:ring focus:ring-width-2 focus:ring-blurple dark:active:bg-dark-400 dark:hover:bg-dark-500"
|
||||
|
|
|
@ -73,7 +73,7 @@ export const metadata: Metadata = {
|
|||
},
|
||||
};
|
||||
|
||||
export default function GlobalError({ error }: { error: Error }) {
|
||||
export default function GlobalError({ error }: { readonly error: Error }) {
|
||||
console.error(error);
|
||||
|
||||
return (
|
||||
|
|
|
@ -116,7 +116,7 @@ export async function generateStaticParams({ params: { package: packageName, ver
|
|||
}));
|
||||
}
|
||||
|
||||
function Member({ member }: { member?: ApiItem }) {
|
||||
function Member({ member }: { readonly member?: ApiItem }) {
|
||||
switch (member?.kind) {
|
||||
case 'Class':
|
||||
return <Class clazz={member as ApiClass} />;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
export default function Error({ error }: { error: Error }) {
|
||||
export default function Error({ error }: { readonly error: Error }) {
|
||||
console.error(error);
|
||||
|
||||
return (
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
export default function Error({ error }: { error: Error }) {
|
||||
export default function Error({ error }: { readonly error: Error }) {
|
||||
console.error(error);
|
||||
|
||||
return (
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { FiLink } from '@react-icons/all-files/fi/FiLink';
|
||||
|
||||
export function Anchor({ href }: { href: string }) {
|
||||
export function Anchor({ href }: { readonly href: string }) {
|
||||
return (
|
||||
<a className="mr-1 inline-block rounded outline-none focus:ring focus:ring-width-2 focus:ring-blurple" href={href}>
|
||||
<FiLink size={20} />
|
||||
|
|
|
@ -8,7 +8,10 @@ export enum BadgeColor {
|
|||
Warning = 'bg-yellow-500',
|
||||
}
|
||||
|
||||
export function Badge({ children, color = BadgeColor.Primary }: PropsWithChildren<{ color?: BadgeColor | undefined }>) {
|
||||
export function Badge({
|
||||
children,
|
||||
color = BadgeColor.Primary,
|
||||
}: PropsWithChildren<{ readonly color?: BadgeColor | undefined }>) {
|
||||
return (
|
||||
<span
|
||||
className={`h-5 flex flex-row place-content-center place-items-center rounded-full px-3 text-center text-xs font-semibold uppercase text-white ${color}`}
|
||||
|
@ -18,7 +21,7 @@ export function Badge({ children, color = BadgeColor.Primary }: PropsWithChildre
|
|||
);
|
||||
}
|
||||
|
||||
export function Badges({ item }: { item: ApiDocumentedItem }) {
|
||||
export function Badges({ item }: { readonly item: ApiDocumentedItem }) {
|
||||
const isStatic = ApiStaticMixin.isBaseClassOf(item) && item.isStatic;
|
||||
const isProtected = ApiProtectedMixin.isBaseClassOf(item) && item.isProtected;
|
||||
const isReadonly = ApiReadonlyMixin.isBaseClassOf(item) && item.isReadonly;
|
||||
|
|
|
@ -5,15 +5,15 @@ export interface CodeListingProps {
|
|||
/**
|
||||
* The value of this heading.
|
||||
*/
|
||||
children: ReactNode;
|
||||
readonly children: ReactNode;
|
||||
/**
|
||||
* Additional class names to apply to the root element.
|
||||
*/
|
||||
className?: string | undefined;
|
||||
readonly className?: string | undefined;
|
||||
/**
|
||||
* The href of this heading.
|
||||
*/
|
||||
href?: string | undefined;
|
||||
readonly href?: string | undefined;
|
||||
}
|
||||
|
||||
export function CodeHeading({ href, className, children }: CodeListingProps) {
|
||||
|
|
|
@ -8,11 +8,11 @@ export interface ExcerptTextProps {
|
|||
/**
|
||||
* The tokens to render.
|
||||
*/
|
||||
excerpt: Excerpt;
|
||||
readonly excerpt: Excerpt;
|
||||
/**
|
||||
* The model to resolve item references from.
|
||||
*/
|
||||
model: ApiModel;
|
||||
readonly model: ApiModel;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@ import type { ApiDeclaredItem } from '@microsoft/api-extractor-model';
|
|||
import { ItemLink } from './ItemLink';
|
||||
import { resolveItemURI } from './documentation/util';
|
||||
|
||||
export function InheritanceText({ parent }: { parent: ApiDeclaredItem }) {
|
||||
export function InheritanceText({ parent }: { readonly parent: ApiDeclaredItem }) {
|
||||
return (
|
||||
<span className="font-semibold">
|
||||
Inherited from{' '}
|
||||
|
|
|
@ -10,17 +10,17 @@ export interface ItemLinkProps
|
|||
extends Omit<LinkProps, 'href'>,
|
||||
RefAttributes<HTMLAnchorElement>,
|
||||
Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps> {
|
||||
className?: string;
|
||||
readonly className?: string;
|
||||
|
||||
/**
|
||||
* The URI of the api item to link to. (e.g. `/RestManager`)
|
||||
*/
|
||||
itemURI: string;
|
||||
readonly itemURI: string;
|
||||
|
||||
/**
|
||||
* The name of the package the item belongs to.
|
||||
*/
|
||||
packageName?: string | undefined;
|
||||
readonly packageName?: string | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,7 +9,7 @@ import { useNav } from '~/contexts/nav';
|
|||
const PackageSelect = dynamic(async () => import('./PackageSelect'));
|
||||
const VersionSelect = dynamic(async () => import('./VersionSelect'));
|
||||
|
||||
export function Nav({ members }: { members: SidebarSectionItemData[] }) {
|
||||
export function Nav({ members }: { readonly members: SidebarSectionItemData[] }) {
|
||||
const { opened } = useNav();
|
||||
|
||||
return (
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Scrollbars } from './Scrollbars';
|
|||
import type { TableOfContentsSerialized } from './TableOfContentItems';
|
||||
import { TableOfContentItems } from './TableOfContentItems';
|
||||
|
||||
export function Outline({ members }: { members: TableOfContentsSerialized[] }) {
|
||||
export function Outline({ members }: { readonly members: TableOfContentsSerialized[] }) {
|
||||
return (
|
||||
<aside className="fixed bottom-0 right-0 top-[50px] z-20 hidden h-[calc(100vh_-_65px)] w-64 border-l border-light-800 bg-white pr-2 xl:block dark:border-dark-100 dark:bg-dark-600">
|
||||
<Scrollbars
|
||||
|
|
|
@ -15,7 +15,7 @@ export default function OverloadSwitcher({
|
|||
methodName,
|
||||
overloads,
|
||||
children,
|
||||
}: PropsWithChildren<{ methodName: string; overloads: ReactNode[] }>) {
|
||||
}: PropsWithChildren<{ readonly methodName: string; readonly overloads: ReactNode[] }>) {
|
||||
const [hash, setHash] = useState(() => (typeof window === 'undefined' ? '' : window.location.hash));
|
||||
const hashChangeHandler = useCallback(() => {
|
||||
setHash(window.location.hash);
|
||||
|
|
|
@ -10,7 +10,7 @@ const columnStyles = {
|
|||
Type: 'font-mono whitespace-pre-wrap break-normal',
|
||||
};
|
||||
|
||||
export function ParameterTable({ item }: { item: ApiDocumentedItem & ApiParameterListMixin }) {
|
||||
export function ParameterTable({ item }: { readonly item: ApiDocumentedItem & ApiParameterListMixin }) {
|
||||
const params = resolveParameters(item);
|
||||
|
||||
const rows = useMemo(
|
||||
|
|
|
@ -16,8 +16,8 @@ export function Property({
|
|||
children,
|
||||
inheritedFrom,
|
||||
}: PropsWithChildren<{
|
||||
inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined;
|
||||
item: ApiProperty | ApiPropertySignature;
|
||||
readonly inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined;
|
||||
readonly item: ApiProperty | ApiPropertySignature;
|
||||
}>) {
|
||||
const hasSummary = Boolean(item.tsdocComment?.summarySection);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ export function isPropertyLike(item: ApiItem): item is ApiProperty | ApiProperty
|
|||
return item.kind === ApiItemKind.Property || item.kind === ApiItemKind.PropertySignature;
|
||||
}
|
||||
|
||||
export function PropertyList({ item }: { item: ApiItemContainerMixin }) {
|
||||
export function PropertyList({ item }: { readonly item: ApiItemContainerMixin }) {
|
||||
const members = resolveMembers(item, isPropertyLike);
|
||||
|
||||
const propertyItems = useMemo(
|
||||
|
|
|
@ -80,7 +80,7 @@ function resolveIcon(item: string) {
|
|||
}
|
||||
}
|
||||
|
||||
export function Sidebar({ members }: { members: SidebarSectionItemData[] }) {
|
||||
export function Sidebar({ members }: { readonly members: SidebarSectionItemData[] }) {
|
||||
const segment = useSelectedLayoutSegment();
|
||||
const { setOpened } = useNav();
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { ApiModel, Excerpt } from '@microsoft/api-extractor-model';
|
||||
import { ExcerptText } from './ExcerptText';
|
||||
|
||||
export function SignatureText({ excerpt, model }: { excerpt: Excerpt; model: ApiModel }) {
|
||||
export function SignatureText({ excerpt, model }: { readonly excerpt: Excerpt; readonly model: ApiModel }) {
|
||||
return (
|
||||
<h4 className="break-all text-lg font-bold font-mono">
|
||||
<ExcerptText excerpt={excerpt} model={model} />
|
||||
|
|
|
@ -7,9 +7,9 @@ export function Table({
|
|||
columns,
|
||||
columnStyles,
|
||||
}: {
|
||||
columnStyles?: Record<string, string>;
|
||||
columns: string[];
|
||||
rows: Record<string, ReactNode>[];
|
||||
readonly columnStyles?: Record<string, string>;
|
||||
readonly columns: string[];
|
||||
readonly rows: Record<string, ReactNode>[];
|
||||
}) {
|
||||
const cols = useMemo(
|
||||
() =>
|
||||
|
|
|
@ -19,10 +19,10 @@ export interface TableOfContentsSerializedProperty {
|
|||
export type TableOfContentsSerialized = TableOfContentsSerializedMethod | TableOfContentsSerializedProperty;
|
||||
|
||||
export interface TableOfContentsItemProps {
|
||||
serializedMembers: TableOfContentsSerialized[];
|
||||
readonly serializedMembers: TableOfContentsSerialized[];
|
||||
}
|
||||
|
||||
export function TableOfContentsPropertyItem({ property }: { property: TableOfContentsSerializedProperty }) {
|
||||
export function TableOfContentsPropertyItem({ property }: { readonly property: TableOfContentsSerializedProperty }) {
|
||||
return (
|
||||
<a
|
||||
className="ml-[10px] border-l border-light-800 p-[5px] pl-6.5 text-sm outline-none focus:border-0 dark:border-dark-100 focus:rounded active:bg-light-800 hover:bg-light-700 focus:ring focus:ring-width-2 focus:ring-blurple dark:active:bg-dark-100 dark:hover:bg-dark-200"
|
||||
|
@ -35,7 +35,7 @@ export function TableOfContentsPropertyItem({ property }: { property: TableOfCon
|
|||
);
|
||||
}
|
||||
|
||||
export function TableOfContentsMethodItem({ method }: { method: TableOfContentsSerializedMethod }) {
|
||||
export function TableOfContentsMethodItem({ method }: { readonly method: TableOfContentsSerializedMethod }) {
|
||||
if (method.overloadIndex && method.overloadIndex > 1) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ const rowElements = {
|
|||
Default: 'font-mono whitespace-pre break-normal',
|
||||
};
|
||||
|
||||
export function TypeParamTable({ item }: { item: ApiTypeParameterListMixin }) {
|
||||
export function TypeParamTable({ item }: { readonly item: ApiTypeParameterListMixin }) {
|
||||
const model = item.getAssociatedModel()!;
|
||||
const rows = useMemo(
|
||||
() =>
|
||||
|
|
|
@ -30,7 +30,7 @@ export function Header({
|
|||
kind,
|
||||
name,
|
||||
sourceURL,
|
||||
}: PropsWithChildren<{ kind: ApiItemKind; name: string; sourceURL?: string | undefined }>) {
|
||||
}: PropsWithChildren<{ readonly kind: ApiItemKind; readonly name: string; readonly sourceURL?: string | undefined }>) {
|
||||
return (
|
||||
<div className="flex flex-col">
|
||||
<h2 className="flex flex-row place-items-center justify-between gap-2 break-all text-2xl font-bold">
|
||||
|
|
|
@ -2,7 +2,13 @@ import type { ApiClass, ApiInterface, Excerpt } from '@microsoft/api-extractor-m
|
|||
import { ApiItemKind } from '@microsoft/api-extractor-model';
|
||||
import { ExcerptText } from '../ExcerptText';
|
||||
|
||||
export function HierarchyText({ item, type }: { item: ApiClass | ApiInterface; type: 'Extends' | 'Implements' }) {
|
||||
export function HierarchyText({
|
||||
item,
|
||||
type,
|
||||
}: {
|
||||
readonly item: ApiClass | ApiInterface;
|
||||
readonly type: 'Extends' | 'Implements';
|
||||
}) {
|
||||
const model = item.getAssociatedModel()!;
|
||||
|
||||
if (
|
||||
|
|
|
@ -3,7 +3,7 @@ import { MethodsSection } from './section/MethodsSection';
|
|||
import { PropertiesSection } from './section/PropertiesSection';
|
||||
import { hasProperties, hasMethods } from './util';
|
||||
|
||||
export function Members({ item }: { item: ApiDeclaredItem & ApiItemContainerMixin }) {
|
||||
export function Members({ item }: { readonly item: ApiDeclaredItem & ApiItemContainerMixin }) {
|
||||
return (
|
||||
<>
|
||||
{hasProperties(item) ? <PropertiesSection item={item} /> : null}
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Header } from './Header';
|
|||
import { SummarySection } from './section/SummarySection';
|
||||
|
||||
export interface ObjectHeaderProps {
|
||||
item: ApiDeclaredItem;
|
||||
readonly item: ApiDeclaredItem;
|
||||
}
|
||||
|
||||
export function ObjectHeader({ item }: ObjectHeaderProps) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import { parametersString } from '../util';
|
|||
import { DocumentationSection } from './DocumentationSection';
|
||||
import { CodeHeading } from '~/components/CodeHeading';
|
||||
|
||||
export function ConstructorSection({ item }: { item: ApiConstructor }) {
|
||||
export function ConstructorSection({ item }: { readonly item: ApiConstructor }) {
|
||||
return (
|
||||
<DocumentationSection icon={<VscSymbolMethod size={20} />} padded title="Constructor">
|
||||
<div className="flex flex-col gap-2">
|
||||
|
|
|
@ -19,7 +19,7 @@ function isMethodLike(item: ApiItem): item is ApiMethod | ApiMethodSignature {
|
|||
);
|
||||
}
|
||||
|
||||
export function MethodsSection({ item }: { item: ApiItemContainerMixin }) {
|
||||
export function MethodsSection({ item }: { readonly item: ApiItemContainerMixin }) {
|
||||
const members = resolveMembers(item, isMethodLike);
|
||||
|
||||
const methodItems = useMemo(
|
||||
|
|
|
@ -3,7 +3,7 @@ import { VscSymbolParameter } from '@react-icons/all-files/vsc/VscSymbolParamete
|
|||
import { ParameterTable } from '../../ParameterTable';
|
||||
import { DocumentationSection } from './DocumentationSection';
|
||||
|
||||
export function ParameterSection({ item }: { item: ApiDocumentedItem & ApiParameterListMixin }) {
|
||||
export function ParameterSection({ item }: { readonly item: ApiDocumentedItem & ApiParameterListMixin }) {
|
||||
return (
|
||||
<DocumentationSection icon={<VscSymbolParameter size={20} />} padded title="Parameters">
|
||||
<ParameterTable item={item} />
|
||||
|
|
|
@ -3,7 +3,7 @@ import { VscSymbolProperty } from '@react-icons/all-files/vsc/VscSymbolProperty'
|
|||
import { PropertyList } from '../../PropertyList';
|
||||
import { DocumentationSection } from './DocumentationSection';
|
||||
|
||||
export function PropertiesSection({ item }: { item: ApiItemContainerMixin }) {
|
||||
export function PropertiesSection({ item }: { readonly item: ApiItemContainerMixin }) {
|
||||
return (
|
||||
<DocumentationSection icon={<VscSymbolProperty size={20} />} padded title="Properties">
|
||||
<PropertyList item={item} />
|
||||
|
|
|
@ -3,7 +3,7 @@ import { VscListSelection } from '@react-icons/all-files/vsc/VscListSelection';
|
|||
import { TSDoc } from '../tsdoc/TSDoc';
|
||||
import { DocumentationSection } from './DocumentationSection';
|
||||
|
||||
export function SummarySection({ item }: { item: ApiDeclaredItem }) {
|
||||
export function SummarySection({ item }: { readonly item: ApiDeclaredItem }) {
|
||||
return (
|
||||
<DocumentationSection icon={<VscListSelection size={20} />} padded separator title="Summary">
|
||||
{item.tsdocComment?.summarySection ? (
|
||||
|
|
|
@ -3,7 +3,7 @@ import { VscSymbolParameter } from '@react-icons/all-files/vsc/VscSymbolParamete
|
|||
import { TypeParamTable } from '../../TypeParamTable';
|
||||
import { DocumentationSection } from './DocumentationSection';
|
||||
|
||||
export function TypeParameterSection({ item }: { item: ApiTypeParameterListMixin }) {
|
||||
export function TypeParameterSection({ item }: { readonly item: ApiTypeParameterListMixin }) {
|
||||
return (
|
||||
<DocumentationSection icon={<VscSymbolParameter size={20} />} padded title="Type Parameters">
|
||||
<TypeParamTable item={item} />
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Alert } from '@discordjs/ui';
|
||||
import type { PropsWithChildren } from 'react';
|
||||
|
||||
export function Block({ children, title }: PropsWithChildren<{ title: string }>) {
|
||||
export function Block({ children, title }: PropsWithChildren<{ readonly title: string }>) {
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
<h5 className="font-bold">{title}</h5>
|
||||
|
@ -13,7 +13,7 @@ export function Block({ children, title }: PropsWithChildren<{ title: string }>)
|
|||
export function ExampleBlock({
|
||||
children,
|
||||
exampleIndex,
|
||||
}: PropsWithChildren<{ exampleIndex?: number | undefined }>): JSX.Element {
|
||||
}: PropsWithChildren<{ readonly exampleIndex?: number | undefined }>): JSX.Element {
|
||||
return <Block title={`Example ${exampleIndex ? exampleIndex : ''}`}>{children}</Block>;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import { SyntaxHighlighter } from '../../SyntaxHighlighter';
|
|||
import { resolveItemURI } from '../util';
|
||||
import { DefaultValueBlock, DeprecatedBlock, ExampleBlock, RemarksBlock, ReturnsBlock, SeeBlock } from './BlockComment';
|
||||
|
||||
export function TSDoc({ item, tsdoc }: { item: ApiItem; tsdoc: DocNode }): JSX.Element {
|
||||
export function TSDoc({ item, tsdoc }: { readonly item: ApiItem; readonly tsdoc: DocNode }): JSX.Element {
|
||||
const createNode = useCallback(
|
||||
(tsdoc: DocNode, idx?: number): ReactNode => {
|
||||
switch (tsdoc.kind) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { ConstructorSection } from '../documentation/section/ConstructorSection'
|
|||
import { TypeParameterSection } from '../documentation/section/TypeParametersSection';
|
||||
// import { serializeMembers } from '../documentation/util';
|
||||
|
||||
export function Class({ clazz }: { clazz: ApiClass }) {
|
||||
export function Class({ clazz }: { readonly clazz: ApiClass }) {
|
||||
const constructor = clazz.members.find((member) => member.kind === ApiItemKind.Constructor) as
|
||||
| ApiConstructor
|
||||
| undefined;
|
||||
|
|
|
@ -7,7 +7,7 @@ import { ObjectHeader } from '../documentation/ObjectHeader';
|
|||
import { TypeParameterSection } from '../documentation/section/TypeParametersSection';
|
||||
// import { serializeMembers } from '../documentation/util';
|
||||
|
||||
export function Interface({ item }: { item: ApiInterface }) {
|
||||
export function Interface({ item }: { readonly item: ApiInterface }) {
|
||||
return (
|
||||
<Documentation>
|
||||
<ObjectHeader item={item} />
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Documentation } from '../documentation/Documentation';
|
|||
import { Header } from '../documentation/Header';
|
||||
import { SummarySection } from '../documentation/section/SummarySection';
|
||||
|
||||
export function TypeAlias({ item }: { item: ApiTypeAlias }) {
|
||||
export function TypeAlias({ item }: { readonly item: ApiTypeAlias }) {
|
||||
return (
|
||||
<Documentation>
|
||||
<Header kind={item.kind} name={item.displayName} sourceURL={item.sourceLocation.fileUrl} />
|
||||
|
|
|
@ -2,7 +2,7 @@ import type { ApiVariable } from '@microsoft/api-extractor-model';
|
|||
import { Documentation } from '../documentation/Documentation';
|
||||
import { ObjectHeader } from '../documentation/ObjectHeader';
|
||||
|
||||
export function Variable({ item }: { item: ApiVariable }) {
|
||||
export function Variable({ item }: { readonly item: ApiVariable }) {
|
||||
return (
|
||||
<Documentation>
|
||||
<ObjectHeader item={item} />
|
||||
|
|
|
@ -6,7 +6,7 @@ import { ObjectHeader } from '../../documentation/ObjectHeader';
|
|||
import { DocumentationSection } from '../../documentation/section/DocumentationSection';
|
||||
import { EnumMember } from './EnumMember';
|
||||
|
||||
export function Enum({ item }: { item: ApiEnum }) {
|
||||
export function Enum({ item }: { readonly item: ApiEnum }) {
|
||||
return (
|
||||
<Documentation>
|
||||
<ObjectHeader item={item} />
|
||||
|
|
|
@ -3,7 +3,7 @@ import { SignatureText } from '../../SignatureText';
|
|||
import { TSDoc } from '../../documentation/tsdoc/TSDoc';
|
||||
import { CodeHeading } from '~/components/CodeHeading';
|
||||
|
||||
export function EnumMember({ member }: { member: ApiEnumMember }) {
|
||||
export function EnumMember({ member }: { readonly member: ApiEnumMember }) {
|
||||
return (
|
||||
<div className="flex flex-col scroll-mt-30" id={member.displayName}>
|
||||
<CodeHeading className="md:-ml-8.5" href={`#${member.displayName}`}>
|
||||
|
|
|
@ -5,7 +5,7 @@ import { FunctionBody } from './FunctionBody';
|
|||
|
||||
const OverloadSwitcher = dynamic(async () => import('../../OverloadSwitcher'));
|
||||
|
||||
export function Function({ item }: { item: ApiFunction }) {
|
||||
export function Function({ item }: { readonly item: ApiFunction }) {
|
||||
const header = <Header kind={item.kind} name={item.name} sourceURL={item.sourceLocation.fileUrl} />;
|
||||
|
||||
if (item.getMergedSiblings().length > 1) {
|
||||
|
|
|
@ -10,7 +10,7 @@ export interface FunctionBodyProps {
|
|||
overloadDocumentation: React.ReactNode[];
|
||||
}
|
||||
|
||||
export function FunctionBody({ item }: { item: ApiFunction }) {
|
||||
export function FunctionBody({ item }: { readonly item: ApiFunction }) {
|
||||
return (
|
||||
<Documentation>
|
||||
{/* @ts-expect-error async component */}
|
||||
|
|
|
@ -15,8 +15,8 @@ export function Method({
|
|||
method,
|
||||
inheritedFrom,
|
||||
}: {
|
||||
inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined;
|
||||
method: ApiMethod | ApiMethodSignature;
|
||||
readonly inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined;
|
||||
readonly method: ApiMethod | ApiMethodSignature;
|
||||
}) {
|
||||
if (method.getMergedSiblings().length > 1) {
|
||||
// We have overloads, use the overload switcher, but render
|
||||
|
|
|
@ -9,8 +9,8 @@ import { ParameterTable } from '../../ParameterTable';
|
|||
import { TSDoc } from '../../documentation/tsdoc/TSDoc';
|
||||
|
||||
export interface MethodDocumentationProps {
|
||||
inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined;
|
||||
method: ApiMethod | ApiMethodSignature;
|
||||
readonly inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined;
|
||||
readonly method: ApiMethod | ApiMethodSignature;
|
||||
}
|
||||
|
||||
export function MethodDocumentation({ method, inheritedFrom }: MethodDocumentationProps) {
|
||||
|
|
|
@ -5,7 +5,7 @@ import { CodeHeading } from '~/components/CodeHeading';
|
|||
import { ExcerptText } from '~/components/ExcerptText';
|
||||
import { parametersString } from '~/components/documentation/util';
|
||||
|
||||
export function MethodHeader({ method }: { method: ApiMethod | ApiMethodSignature }) {
|
||||
export function MethodHeader({ method }: { readonly method: ApiMethod | ApiMethodSignature }) {
|
||||
const key = useMemo(
|
||||
() => `${method.displayName}${method.overloadIndex && method.overloadIndex > 1 ? `:${method.overloadIndex}` : ''}`,
|
||||
[method.displayName, method.overloadIndex],
|
||||
|
|
|
@ -4,8 +4,8 @@ import { VscWarning } from '@react-icons/all-files/vsc/VscWarning';
|
|||
import type { PropsWithChildren } from 'react';
|
||||
|
||||
export interface IAlert {
|
||||
title?: string | undefined;
|
||||
type: 'danger' | 'info' | 'success' | 'warning';
|
||||
readonly title?: string | undefined;
|
||||
readonly type: 'danger' | 'info' | 'success' | 'warning';
|
||||
}
|
||||
|
||||
function resolveType(type: IAlert['type']) {
|
||||
|
|
|
@ -5,14 +5,14 @@ import { Disclosure, DisclosureContent, useDisclosureState } from 'ariakit/discl
|
|||
import type { PropsWithChildren } from 'react';
|
||||
|
||||
export interface SectionOptions {
|
||||
background?: boolean | undefined;
|
||||
buttonClassName?: string;
|
||||
className?: string;
|
||||
defaultClosed?: boolean | undefined;
|
||||
gutter?: boolean | undefined;
|
||||
icon?: JSX.Element | undefined;
|
||||
padded?: boolean | undefined;
|
||||
title: string;
|
||||
readonly background?: boolean | undefined;
|
||||
readonly buttonClassName?: string;
|
||||
readonly className?: string;
|
||||
readonly defaultClosed?: boolean | undefined;
|
||||
readonly gutter?: boolean | undefined;
|
||||
readonly icon?: JSX.Element | undefined;
|
||||
readonly padded?: boolean | undefined;
|
||||
readonly title: string;
|
||||
}
|
||||
|
||||
export function Section({
|
||||
|
|
|
@ -4,14 +4,14 @@ import { DiscordMessageInteraction, type IDiscordMessageInteraction } from './Me
|
|||
import { DiscordMessageReply, type IDiscordMessageReply } from './MessageReply.js';
|
||||
|
||||
export interface IDiscordMessage {
|
||||
author?: IDiscordMessageAuthor | undefined;
|
||||
authorNode?: ReactNode | undefined;
|
||||
followUp?: boolean;
|
||||
interaction?: IDiscordMessageInteraction | undefined;
|
||||
interactionNode?: ReactNode | undefined;
|
||||
reply?: IDiscordMessageReply | undefined;
|
||||
replyNode?: ReactNode | undefined;
|
||||
time?: string | undefined;
|
||||
readonly author?: IDiscordMessageAuthor | undefined;
|
||||
readonly authorNode?: ReactNode | undefined;
|
||||
readonly followUp?: boolean;
|
||||
readonly interaction?: IDiscordMessageInteraction | undefined;
|
||||
readonly interactionNode?: ReactNode | undefined;
|
||||
readonly reply?: IDiscordMessageReply | undefined;
|
||||
readonly replyNode?: ReactNode | undefined;
|
||||
readonly time?: string | undefined;
|
||||
}
|
||||
|
||||
export function DiscordMessage({
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { FiCheck } from '@react-icons/all-files/fi/FiCheck';
|
||||
|
||||
export interface IDiscordMessageAuthor {
|
||||
avatar: string;
|
||||
bot?: boolean;
|
||||
color?: string;
|
||||
time: string;
|
||||
username: string;
|
||||
verified?: boolean;
|
||||
readonly avatar: string;
|
||||
readonly bot?: boolean;
|
||||
readonly color?: string;
|
||||
readonly time: string;
|
||||
readonly username: string;
|
||||
readonly verified?: boolean;
|
||||
}
|
||||
|
||||
export function DiscordMessageAuthor({ avatar, bot, verified, color, time, username }: IDiscordMessageAuthor) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { FiCheck } from '@react-icons/all-files/fi/FiCheck';
|
||||
|
||||
export interface IDiscordMessageAuthorReply {
|
||||
avatar: string;
|
||||
bot?: boolean;
|
||||
color?: string;
|
||||
username: string;
|
||||
verified?: boolean;
|
||||
readonly avatar: string;
|
||||
readonly bot?: boolean;
|
||||
readonly color?: string;
|
||||
readonly username: string;
|
||||
readonly verified?: boolean;
|
||||
}
|
||||
|
||||
export function DiscordMessageAuthorReply({ avatar, bot, verified, color, username }: IDiscordMessageAuthorReply) {
|
||||
|
|
|
@ -5,7 +5,10 @@ export function DiscordMessageBaseReply({
|
|||
author,
|
||||
authorNode,
|
||||
children,
|
||||
}: PropsWithChildren<{ author?: IDiscordMessageAuthorReply | undefined; authorNode?: ReactNode | undefined }>) {
|
||||
}: PropsWithChildren<{
|
||||
readonly author?: IDiscordMessageAuthorReply | undefined;
|
||||
readonly authorNode?: ReactNode | undefined;
|
||||
}>) {
|
||||
return (
|
||||
<div
|
||||
className="relative mb-1 flex place-items-center before:absolute before:bottom-0 before:left-[-36px] before:right-full before:top-[50%] before:mr-1 before:block before:border-l-2 before:border-t-2 before:border-[rgb(79_84_92)] before:rounded-tl-1.5 before:content-none"
|
||||
|
|
|
@ -8,15 +8,15 @@ import { DiscordMessageEmbedThumbnail, type IDiscordMessageEmbedThumbnail } from
|
|||
import { DiscordMessageEmbedTitle, type IDiscordMessageEmbedTitle } from './MessageEmbedTitle.js';
|
||||
|
||||
export interface IDiscordMessageEmbed {
|
||||
author?: IDiscordMessageEmbedAuthor | undefined;
|
||||
authorNode?: ReactNode | undefined;
|
||||
fields?: IDiscordMessageEmbedField[];
|
||||
footer?: IDiscordMessageEmbedFooter | undefined;
|
||||
footerNode?: ReactNode | undefined;
|
||||
image?: IDiscordMessageEmbedImage;
|
||||
thumbnail?: IDiscordMessageEmbedThumbnail;
|
||||
title?: IDiscordMessageEmbedTitle | undefined;
|
||||
titleNode?: ReactNode | undefined;
|
||||
readonly author?: IDiscordMessageEmbedAuthor | undefined;
|
||||
readonly authorNode?: ReactNode | undefined;
|
||||
readonly fields?: IDiscordMessageEmbedField[];
|
||||
readonly footer?: IDiscordMessageEmbedFooter | undefined;
|
||||
readonly footerNode?: ReactNode | undefined;
|
||||
readonly image?: IDiscordMessageEmbedImage;
|
||||
readonly thumbnail?: IDiscordMessageEmbedThumbnail;
|
||||
readonly title?: IDiscordMessageEmbedTitle | undefined;
|
||||
readonly titleNode?: ReactNode | undefined;
|
||||
}
|
||||
|
||||
export function DiscordMessageEmbed({
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export interface IDiscordMessageEmbedAuthor {
|
||||
avatar: string;
|
||||
url?: string;
|
||||
username: string;
|
||||
readonly avatar: string;
|
||||
readonly url?: string;
|
||||
readonly username: string;
|
||||
}
|
||||
|
||||
export function DiscordMessageEmbedAuthor({ avatar, url, username }: IDiscordMessageEmbedAuthor) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export interface IDiscordMessageEmbedField {
|
||||
inline?: boolean;
|
||||
name: string;
|
||||
value: string;
|
||||
readonly inline?: boolean;
|
||||
readonly name: string;
|
||||
readonly value: string;
|
||||
}
|
||||
|
||||
export function DiscordMessageEmbedField({ name, value, inline }: IDiscordMessageEmbedField) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { DiscordMessageEmbedField, type IDiscordMessageEmbedField } from './MessageEmbedField.js';
|
||||
|
||||
export interface IDiscordMessageEmbedFields {
|
||||
fields: IDiscordMessageEmbedField[];
|
||||
readonly fields: IDiscordMessageEmbedField[];
|
||||
}
|
||||
|
||||
export function DiscordMessageEmbedFields({ fields }: IDiscordMessageEmbedFields) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export interface IDiscordMessageEmbedFooter {
|
||||
content?: string;
|
||||
icon?: string;
|
||||
timestamp?: string;
|
||||
readonly content?: string;
|
||||
readonly icon?: string;
|
||||
readonly timestamp?: string;
|
||||
}
|
||||
|
||||
export function DiscordMessageEmbedFooter({ content, icon, timestamp }: IDiscordMessageEmbedFooter) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
export interface IDiscordMessageEmbedImage {
|
||||
alt: string;
|
||||
height: number;
|
||||
url: string;
|
||||
width: number;
|
||||
readonly alt: string;
|
||||
readonly height: number;
|
||||
readonly url: string;
|
||||
readonly width: number;
|
||||
}
|
||||
|
||||
export function DiscordMessageEmbedImage({ alt, height, url, width }: IDiscordMessageEmbedImage) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export interface IDiscordMessageEmbedThumbnail {
|
||||
alt: string;
|
||||
image: string;
|
||||
readonly alt: string;
|
||||
readonly image: string;
|
||||
}
|
||||
|
||||
export function DiscordMessageEmbedThumbnail({ alt, image }: IDiscordMessageEmbedThumbnail) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export interface IDiscordMessageEmbedTitle {
|
||||
title: string;
|
||||
url?: string;
|
||||
readonly title: string;
|
||||
readonly url?: string;
|
||||
}
|
||||
|
||||
export function DiscordMessageEmbedTitle({ title, url }: IDiscordMessageEmbedTitle) {
|
||||
|
|
|
@ -3,9 +3,9 @@ import type { IDiscordMessageAuthorReply } from './MessageAuthorReply.js';
|
|||
import { DiscordMessageBaseReply } from './MessageBaseReply.js';
|
||||
|
||||
export interface IDiscordMessageInteraction {
|
||||
author?: IDiscordMessageAuthorReply | undefined;
|
||||
authorNode?: ReactNode | undefined;
|
||||
command?: string;
|
||||
readonly author?: IDiscordMessageAuthorReply | undefined;
|
||||
readonly authorNode?: ReactNode | undefined;
|
||||
readonly command?: string;
|
||||
}
|
||||
|
||||
export function DiscordMessageInteraction({ author, authorNode, command }: IDiscordMessageInteraction) {
|
||||
|
|
|
@ -3,9 +3,9 @@ import type { IDiscordMessageAuthorReply } from './MessageAuthorReply.js';
|
|||
import { DiscordMessageBaseReply } from './MessageBaseReply.js';
|
||||
|
||||
export interface IDiscordMessageReply {
|
||||
author?: IDiscordMessageAuthorReply | undefined;
|
||||
authorNode?: ReactNode | undefined;
|
||||
content: string;
|
||||
readonly author?: IDiscordMessageAuthorReply | undefined;
|
||||
readonly authorNode?: ReactNode | undefined;
|
||||
readonly content: string;
|
||||
}
|
||||
|
||||
export function DiscordMessageReply({ author, authorNode, content }: IDiscordMessageReply) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { PropsWithChildren } from 'react';
|
||||
|
||||
export interface IDiscordMessages {
|
||||
rounded?: boolean;
|
||||
readonly rounded?: boolean;
|
||||
}
|
||||
|
||||
export function DiscordMessages({ rounded, children }: PropsWithChildren<IDiscordMessages>) {
|
||||
|
|
Loading…
Reference in a new issue