chore: format

This commit is contained in:
iCrawl
2023-07-31 21:08:13 +02:00
parent 488aa58b29
commit 447652ec8a
69 changed files with 158 additions and 138 deletions

View File

@@ -3,7 +3,7 @@
import { Providers } from './providers'; import { Providers } from './providers';
import { inter } from '~/util/fonts'; import { inter } from '~/util/fonts';
export default function GlobalError({ error }: { error: Error }) { export default function GlobalError({ error }: { readonly error: Error }) {
console.error(error); console.error(error);
return ( return (

View File

@@ -1,6 +1,6 @@
'use client'; 'use client';
export default function Error({ error }: { error: Error }) { export default function Error({ error }: { readonly error: Error }) {
console.error(error); console.error(error);
return ( return (

View File

@@ -6,7 +6,7 @@ export async function generateStaticParams() {
return allContents.map((content) => ({ slug: [content.slug] })); 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('/')); const content = allContents.find((content) => content.slug === params.slug?.join('/'));
if (!content) { if (!content) {

View File

@@ -12,26 +12,26 @@ interface DiscordAPITypesLinkOptions {
* *
* @example `'RESTJSONErrorCodes'` * @example `'RESTJSONErrorCodes'`
*/ */
parent?: string; readonly parent?: string;
/** /**
* The scope of where this link lives. * The scope of where this link lives.
* *
* @remarks API does not have a scope. * @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. * The symbol belonging to the parent.
* *
* @example '`MaximumNumberOfGuildsReached'` * @example '`MaximumNumberOfGuildsReached'`
*/ */
symbol?: string; readonly symbol?: string;
/** /**
* The type of the {@link DiscordAPITypesLinkOptions.parent}. * The type of the {@link DiscordAPITypesLinkOptions.parent}.
* *
* @example `'enum'` * @example `'enum'`
* @example `'interface'` * @example `'interface'`
*/ */
type?: string; readonly type?: string;
} }
export function DiscordAPITypesLink({ export function DiscordAPITypesLink({

View File

@@ -8,19 +8,19 @@ interface DocsLinkOptions {
* *
* @remarks Functions automatically infer this. * @remarks Functions automatically infer this.
*/ */
brackets?: boolean; readonly brackets?: boolean;
/** /**
* The package. * The package.
* *
* @defaultValue `'discord.js'` * @defaultValue `'discord.js'`
*/ */
package?: (typeof PACKAGES)[number]; readonly package?: (typeof PACKAGES)[number];
/** /**
* The initial documentation class, function, interface etc. * The initial documentation class, function, interface etc.
* *
* @example `'Client'` * @example `'Client'`
*/ */
parent?: string; readonly parent?: string;
/** /**
* Whether to reference a static property. * Whether to reference a static property.
* *
@@ -28,20 +28,20 @@ interface DocsLinkOptions {
* This should only be used for the https://discord.js.org domain * This should only be used for the https://discord.js.org domain
* as static properties are not identified in the URL. * as static properties are not identified in the URL.
*/ */
static?: boolean; readonly static?: boolean;
/** /**
* The symbol belonging to the parent. * The symbol belonging to the parent.
* *
* @example '`login'` * @example '`login'`
*/ */
symbol?: string; readonly symbol?: string;
/** /**
* The type of the {@link DocsLinkOptions.parent}. * The type of the {@link DocsLinkOptions.parent}.
* *
* @example `'class'` * @example `'class'`
* @example `'Function'` * @example `'Function'`
*/ */
type?: string; readonly type?: string;
} }
export function DocsLink({ export function DocsLink({

View File

@@ -10,7 +10,7 @@ import { H4 } from './H4';
import { DocsLink } from '~/components/DocsLink'; import { DocsLink } from '~/components/DocsLink';
import { ResultingCode } from '~/components/ResultingCode'; import { ResultingCode } from '~/components/ResultingCode';
export function Mdx({ code }: { code: string }) { export function Mdx({ code }: { readonly code: string }) {
const Component = useMDXComponent(code); const Component = useMDXComponent(code);
return ( return (

View File

@@ -5,7 +5,7 @@ const LINK_HEIGHT = 30;
const INDICATOR_SIZE = 10; const INDICATOR_SIZE = 10;
const INDICATOR_OFFSET = (LINK_HEIGHT - INDICATOR_SIZE) / 2; 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 // eslint-disable-next-line react/hook-use-state
const [active /* setActive */] = useState(0); const [active /* setActive */] = useState(0);

View File

@@ -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 ( return (
<a <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" 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"

View File

@@ -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); console.error(error);
return ( return (

View File

@@ -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) { switch (member?.kind) {
case 'Class': case 'Class':
return <Class clazz={member as ApiClass} />; return <Class clazz={member as ApiClass} />;

View File

@@ -1,6 +1,6 @@
'use client'; 'use client';
export default function Error({ error }: { error: Error }) { export default function Error({ error }: { readonly error: Error }) {
console.error(error); console.error(error);
return ( return (

View File

@@ -1,6 +1,6 @@
'use client'; 'use client';
export default function Error({ error }: { error: Error }) { export default function Error({ error }: { readonly error: Error }) {
console.error(error); console.error(error);
return ( return (

View File

@@ -1,6 +1,6 @@
import { FiLink } from '@react-icons/all-files/fi/FiLink'; import { FiLink } from '@react-icons/all-files/fi/FiLink';
export function Anchor({ href }: { href: string }) { export function Anchor({ href }: { readonly href: string }) {
return ( return (
<a className="mr-1 inline-block rounded outline-none focus:ring focus:ring-width-2 focus:ring-blurple" href={href}> <a className="mr-1 inline-block rounded outline-none focus:ring focus:ring-width-2 focus:ring-blurple" href={href}>
<FiLink size={20} /> <FiLink size={20} />

View File

@@ -8,7 +8,10 @@ export enum BadgeColor {
Warning = 'bg-yellow-500', 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 ( return (
<span <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}`} 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 isStatic = ApiStaticMixin.isBaseClassOf(item) && item.isStatic;
const isProtected = ApiProtectedMixin.isBaseClassOf(item) && item.isProtected; const isProtected = ApiProtectedMixin.isBaseClassOf(item) && item.isProtected;
const isReadonly = ApiReadonlyMixin.isBaseClassOf(item) && item.isReadonly; const isReadonly = ApiReadonlyMixin.isBaseClassOf(item) && item.isReadonly;

View File

@@ -5,15 +5,15 @@ export interface CodeListingProps {
/** /**
* The value of this heading. * The value of this heading.
*/ */
children: ReactNode; readonly children: ReactNode;
/** /**
* Additional class names to apply to the root element. * Additional class names to apply to the root element.
*/ */
className?: string | undefined; readonly className?: string | undefined;
/** /**
* The href of this heading. * The href of this heading.
*/ */
href?: string | undefined; readonly href?: string | undefined;
} }
export function CodeHeading({ href, className, children }: CodeListingProps) { export function CodeHeading({ href, className, children }: CodeListingProps) {

View File

@@ -8,11 +8,11 @@ export interface ExcerptTextProps {
/** /**
* The tokens to render. * The tokens to render.
*/ */
excerpt: Excerpt; readonly excerpt: Excerpt;
/** /**
* The model to resolve item references from. * The model to resolve item references from.
*/ */
model: ApiModel; readonly model: ApiModel;
} }
/** /**

View File

@@ -2,7 +2,7 @@ import type { ApiDeclaredItem } from '@microsoft/api-extractor-model';
import { ItemLink } from './ItemLink'; import { ItemLink } from './ItemLink';
import { resolveItemURI } from './documentation/util'; import { resolveItemURI } from './documentation/util';
export function InheritanceText({ parent }: { parent: ApiDeclaredItem }) { export function InheritanceText({ parent }: { readonly parent: ApiDeclaredItem }) {
return ( return (
<span className="font-semibold"> <span className="font-semibold">
Inherited from{' '} Inherited from{' '}

View File

@@ -10,17 +10,17 @@ export interface ItemLinkProps
extends Omit<LinkProps, 'href'>, extends Omit<LinkProps, 'href'>,
RefAttributes<HTMLAnchorElement>, RefAttributes<HTMLAnchorElement>,
Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps> { Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps> {
className?: string; readonly className?: string;
/** /**
* The URI of the api item to link to. (e.g. `/RestManager`) * 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. * The name of the package the item belongs to.
*/ */
packageName?: string | undefined; readonly packageName?: string | undefined;
} }
/** /**

View File

@@ -9,7 +9,7 @@ import { useNav } from '~/contexts/nav';
const PackageSelect = dynamic(async () => import('./PackageSelect')); const PackageSelect = dynamic(async () => import('./PackageSelect'));
const VersionSelect = dynamic(async () => import('./VersionSelect')); const VersionSelect = dynamic(async () => import('./VersionSelect'));
export function Nav({ members }: { members: SidebarSectionItemData[] }) { export function Nav({ members }: { readonly members: SidebarSectionItemData[] }) {
const { opened } = useNav(); const { opened } = useNav();
return ( return (

View File

@@ -4,7 +4,7 @@ import { Scrollbars } from './Scrollbars';
import type { TableOfContentsSerialized } from './TableOfContentItems'; import type { TableOfContentsSerialized } from './TableOfContentItems';
import { TableOfContentItems } from './TableOfContentItems'; import { TableOfContentItems } from './TableOfContentItems';
export function Outline({ members }: { members: TableOfContentsSerialized[] }) { export function Outline({ members }: { readonly members: TableOfContentsSerialized[] }) {
return ( 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"> <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 <Scrollbars

View File

@@ -15,7 +15,7 @@ export default function OverloadSwitcher({
methodName, methodName,
overloads, overloads,
children, children,
}: PropsWithChildren<{ methodName: string; overloads: ReactNode[] }>) { }: PropsWithChildren<{ readonly methodName: string; readonly overloads: ReactNode[] }>) {
const [hash, setHash] = useState(() => (typeof window === 'undefined' ? '' : window.location.hash)); const [hash, setHash] = useState(() => (typeof window === 'undefined' ? '' : window.location.hash));
const hashChangeHandler = useCallback(() => { const hashChangeHandler = useCallback(() => {
setHash(window.location.hash); setHash(window.location.hash);

View File

@@ -10,7 +10,7 @@ const columnStyles = {
Type: 'font-mono whitespace-pre-wrap break-normal', 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 params = resolveParameters(item);
const rows = useMemo( const rows = useMemo(

View File

@@ -16,8 +16,8 @@ export function Property({
children, children,
inheritedFrom, inheritedFrom,
}: PropsWithChildren<{ }: PropsWithChildren<{
inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined; readonly inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined;
item: ApiProperty | ApiPropertySignature; readonly item: ApiProperty | ApiPropertySignature;
}>) { }>) {
const hasSummary = Boolean(item.tsdocComment?.summarySection); const hasSummary = Boolean(item.tsdocComment?.summarySection);

View File

@@ -14,7 +14,7 @@ export function isPropertyLike(item: ApiItem): item is ApiProperty | ApiProperty
return item.kind === ApiItemKind.Property || item.kind === ApiItemKind.PropertySignature; 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 members = resolveMembers(item, isPropertyLike);
const propertyItems = useMemo( const propertyItems = useMemo(

View File

@@ -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 segment = useSelectedLayoutSegment();
const { setOpened } = useNav(); const { setOpened } = useNav();

View File

@@ -1,7 +1,7 @@
import type { ApiModel, Excerpt } from '@microsoft/api-extractor-model'; import type { ApiModel, Excerpt } from '@microsoft/api-extractor-model';
import { ExcerptText } from './ExcerptText'; 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 ( return (
<h4 className="break-all text-lg font-bold font-mono"> <h4 className="break-all text-lg font-bold font-mono">
<ExcerptText excerpt={excerpt} model={model} /> <ExcerptText excerpt={excerpt} model={model} />

View File

@@ -7,9 +7,9 @@ export function Table({
columns, columns,
columnStyles, columnStyles,
}: { }: {
columnStyles?: Record<string, string>; readonly columnStyles?: Record<string, string>;
columns: string[]; readonly columns: string[];
rows: Record<string, ReactNode>[]; readonly rows: Record<string, ReactNode>[];
}) { }) {
const cols = useMemo( const cols = useMemo(
() => () =>

View File

@@ -19,10 +19,10 @@ export interface TableOfContentsSerializedProperty {
export type TableOfContentsSerialized = TableOfContentsSerializedMethod | TableOfContentsSerializedProperty; export type TableOfContentsSerialized = TableOfContentsSerializedMethod | TableOfContentsSerializedProperty;
export interface TableOfContentsItemProps { export interface TableOfContentsItemProps {
serializedMembers: TableOfContentsSerialized[]; readonly serializedMembers: TableOfContentsSerialized[];
} }
export function TableOfContentsPropertyItem({ property }: { property: TableOfContentsSerializedProperty }) { export function TableOfContentsPropertyItem({ property }: { readonly property: TableOfContentsSerializedProperty }) {
return ( return (
<a <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" 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) { if (method.overloadIndex && method.overloadIndex > 1) {
return null; return null;
} }

View File

@@ -10,7 +10,7 @@ const rowElements = {
Default: 'font-mono whitespace-pre break-normal', 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 model = item.getAssociatedModel()!;
const rows = useMemo( const rows = useMemo(
() => () =>

View File

@@ -30,7 +30,7 @@ export function Header({
kind, kind,
name, name,
sourceURL, sourceURL,
}: PropsWithChildren<{ kind: ApiItemKind; name: string; sourceURL?: string | undefined }>) { }: PropsWithChildren<{ readonly kind: ApiItemKind; readonly name: string; readonly sourceURL?: string | undefined }>) {
return ( return (
<div className="flex flex-col"> <div className="flex flex-col">
<h2 className="flex flex-row place-items-center justify-between gap-2 break-all text-2xl font-bold"> <h2 className="flex flex-row place-items-center justify-between gap-2 break-all text-2xl font-bold">

View File

@@ -2,7 +2,13 @@ import type { ApiClass, ApiInterface, Excerpt } from '@microsoft/api-extractor-m
import { ApiItemKind } from '@microsoft/api-extractor-model'; import { ApiItemKind } from '@microsoft/api-extractor-model';
import { ExcerptText } from '../ExcerptText'; 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()!; const model = item.getAssociatedModel()!;
if ( if (

View File

@@ -3,7 +3,7 @@ import { MethodsSection } from './section/MethodsSection';
import { PropertiesSection } from './section/PropertiesSection'; import { PropertiesSection } from './section/PropertiesSection';
import { hasProperties, hasMethods } from './util'; import { hasProperties, hasMethods } from './util';
export function Members({ item }: { item: ApiDeclaredItem & ApiItemContainerMixin }) { export function Members({ item }: { readonly item: ApiDeclaredItem & ApiItemContainerMixin }) {
return ( return (
<> <>
{hasProperties(item) ? <PropertiesSection item={item} /> : null} {hasProperties(item) ? <PropertiesSection item={item} /> : null}

View File

@@ -4,7 +4,7 @@ import { Header } from './Header';
import { SummarySection } from './section/SummarySection'; import { SummarySection } from './section/SummarySection';
export interface ObjectHeaderProps { export interface ObjectHeaderProps {
item: ApiDeclaredItem; readonly item: ApiDeclaredItem;
} }
export function ObjectHeader({ item }: ObjectHeaderProps) { export function ObjectHeader({ item }: ObjectHeaderProps) {

View File

@@ -6,7 +6,7 @@ import { parametersString } from '../util';
import { DocumentationSection } from './DocumentationSection'; import { DocumentationSection } from './DocumentationSection';
import { CodeHeading } from '~/components/CodeHeading'; import { CodeHeading } from '~/components/CodeHeading';
export function ConstructorSection({ item }: { item: ApiConstructor }) { export function ConstructorSection({ item }: { readonly item: ApiConstructor }) {
return ( return (
<DocumentationSection icon={<VscSymbolMethod size={20} />} padded title="Constructor"> <DocumentationSection icon={<VscSymbolMethod size={20} />} padded title="Constructor">
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">

View File

@@ -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 members = resolveMembers(item, isMethodLike);
const methodItems = useMemo( const methodItems = useMemo(

View File

@@ -3,7 +3,7 @@ import { VscSymbolParameter } from '@react-icons/all-files/vsc/VscSymbolParamete
import { ParameterTable } from '../../ParameterTable'; import { ParameterTable } from '../../ParameterTable';
import { DocumentationSection } from './DocumentationSection'; import { DocumentationSection } from './DocumentationSection';
export function ParameterSection({ item }: { item: ApiDocumentedItem & ApiParameterListMixin }) { export function ParameterSection({ item }: { readonly item: ApiDocumentedItem & ApiParameterListMixin }) {
return ( return (
<DocumentationSection icon={<VscSymbolParameter size={20} />} padded title="Parameters"> <DocumentationSection icon={<VscSymbolParameter size={20} />} padded title="Parameters">
<ParameterTable item={item} /> <ParameterTable item={item} />

View File

@@ -3,7 +3,7 @@ import { VscSymbolProperty } from '@react-icons/all-files/vsc/VscSymbolProperty'
import { PropertyList } from '../../PropertyList'; import { PropertyList } from '../../PropertyList';
import { DocumentationSection } from './DocumentationSection'; import { DocumentationSection } from './DocumentationSection';
export function PropertiesSection({ item }: { item: ApiItemContainerMixin }) { export function PropertiesSection({ item }: { readonly item: ApiItemContainerMixin }) {
return ( return (
<DocumentationSection icon={<VscSymbolProperty size={20} />} padded title="Properties"> <DocumentationSection icon={<VscSymbolProperty size={20} />} padded title="Properties">
<PropertyList item={item} /> <PropertyList item={item} />

View File

@@ -3,7 +3,7 @@ import { VscListSelection } from '@react-icons/all-files/vsc/VscListSelection';
import { TSDoc } from '../tsdoc/TSDoc'; import { TSDoc } from '../tsdoc/TSDoc';
import { DocumentationSection } from './DocumentationSection'; import { DocumentationSection } from './DocumentationSection';
export function SummarySection({ item }: { item: ApiDeclaredItem }) { export function SummarySection({ item }: { readonly item: ApiDeclaredItem }) {
return ( return (
<DocumentationSection icon={<VscListSelection size={20} />} padded separator title="Summary"> <DocumentationSection icon={<VscListSelection size={20} />} padded separator title="Summary">
{item.tsdocComment?.summarySection ? ( {item.tsdocComment?.summarySection ? (

View File

@@ -3,7 +3,7 @@ import { VscSymbolParameter } from '@react-icons/all-files/vsc/VscSymbolParamete
import { TypeParamTable } from '../../TypeParamTable'; import { TypeParamTable } from '../../TypeParamTable';
import { DocumentationSection } from './DocumentationSection'; import { DocumentationSection } from './DocumentationSection';
export function TypeParameterSection({ item }: { item: ApiTypeParameterListMixin }) { export function TypeParameterSection({ item }: { readonly item: ApiTypeParameterListMixin }) {
return ( return (
<DocumentationSection icon={<VscSymbolParameter size={20} />} padded title="Type Parameters"> <DocumentationSection icon={<VscSymbolParameter size={20} />} padded title="Type Parameters">
<TypeParamTable item={item} /> <TypeParamTable item={item} />

View File

@@ -1,7 +1,7 @@
import { Alert } from '@discordjs/ui'; import { Alert } from '@discordjs/ui';
import type { PropsWithChildren } from 'react'; import type { PropsWithChildren } from 'react';
export function Block({ children, title }: PropsWithChildren<{ title: string }>) { export function Block({ children, title }: PropsWithChildren<{ readonly title: string }>) {
return ( return (
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<h5 className="font-bold">{title}</h5> <h5 className="font-bold">{title}</h5>
@@ -13,7 +13,7 @@ export function Block({ children, title }: PropsWithChildren<{ title: string }>)
export function ExampleBlock({ export function ExampleBlock({
children, children,
exampleIndex, exampleIndex,
}: PropsWithChildren<{ exampleIndex?: number | undefined }>): JSX.Element { }: PropsWithChildren<{ readonly exampleIndex?: number | undefined }>): JSX.Element {
return <Block title={`Example ${exampleIndex ? exampleIndex : ''}`}>{children}</Block>; return <Block title={`Example ${exampleIndex ? exampleIndex : ''}`}>{children}</Block>;
} }

View File

@@ -8,7 +8,7 @@ import { SyntaxHighlighter } from '../../SyntaxHighlighter';
import { resolveItemURI } from '../util'; import { resolveItemURI } from '../util';
import { DefaultValueBlock, DeprecatedBlock, ExampleBlock, RemarksBlock, ReturnsBlock, SeeBlock } from './BlockComment'; 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( const createNode = useCallback(
(tsdoc: DocNode, idx?: number): ReactNode => { (tsdoc: DocNode, idx?: number): ReactNode => {
switch (tsdoc.kind) { switch (tsdoc.kind) {

View File

@@ -10,7 +10,7 @@ import { ConstructorSection } from '../documentation/section/ConstructorSection'
import { TypeParameterSection } from '../documentation/section/TypeParametersSection'; import { TypeParameterSection } from '../documentation/section/TypeParametersSection';
// import { serializeMembers } from '../documentation/util'; // 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 const constructor = clazz.members.find((member) => member.kind === ApiItemKind.Constructor) as
| ApiConstructor | ApiConstructor
| undefined; | undefined;

View File

@@ -7,7 +7,7 @@ import { ObjectHeader } from '../documentation/ObjectHeader';
import { TypeParameterSection } from '../documentation/section/TypeParametersSection'; import { TypeParameterSection } from '../documentation/section/TypeParametersSection';
// import { serializeMembers } from '../documentation/util'; // import { serializeMembers } from '../documentation/util';
export function Interface({ item }: { item: ApiInterface }) { export function Interface({ item }: { readonly item: ApiInterface }) {
return ( return (
<Documentation> <Documentation>
<ObjectHeader item={item} /> <ObjectHeader item={item} />

View File

@@ -4,7 +4,7 @@ import { Documentation } from '../documentation/Documentation';
import { Header } from '../documentation/Header'; import { Header } from '../documentation/Header';
import { SummarySection } from '../documentation/section/SummarySection'; import { SummarySection } from '../documentation/section/SummarySection';
export function TypeAlias({ item }: { item: ApiTypeAlias }) { export function TypeAlias({ item }: { readonly item: ApiTypeAlias }) {
return ( return (
<Documentation> <Documentation>
<Header kind={item.kind} name={item.displayName} sourceURL={item.sourceLocation.fileUrl} /> <Header kind={item.kind} name={item.displayName} sourceURL={item.sourceLocation.fileUrl} />

View File

@@ -2,7 +2,7 @@ import type { ApiVariable } from '@microsoft/api-extractor-model';
import { Documentation } from '../documentation/Documentation'; import { Documentation } from '../documentation/Documentation';
import { ObjectHeader } from '../documentation/ObjectHeader'; import { ObjectHeader } from '../documentation/ObjectHeader';
export function Variable({ item }: { item: ApiVariable }) { export function Variable({ item }: { readonly item: ApiVariable }) {
return ( return (
<Documentation> <Documentation>
<ObjectHeader item={item} /> <ObjectHeader item={item} />

View File

@@ -6,7 +6,7 @@ import { ObjectHeader } from '../../documentation/ObjectHeader';
import { DocumentationSection } from '../../documentation/section/DocumentationSection'; import { DocumentationSection } from '../../documentation/section/DocumentationSection';
import { EnumMember } from './EnumMember'; import { EnumMember } from './EnumMember';
export function Enum({ item }: { item: ApiEnum }) { export function Enum({ item }: { readonly item: ApiEnum }) {
return ( return (
<Documentation> <Documentation>
<ObjectHeader item={item} /> <ObjectHeader item={item} />

View File

@@ -3,7 +3,7 @@ import { SignatureText } from '../../SignatureText';
import { TSDoc } from '../../documentation/tsdoc/TSDoc'; import { TSDoc } from '../../documentation/tsdoc/TSDoc';
import { CodeHeading } from '~/components/CodeHeading'; import { CodeHeading } from '~/components/CodeHeading';
export function EnumMember({ member }: { member: ApiEnumMember }) { export function EnumMember({ member }: { readonly member: ApiEnumMember }) {
return ( return (
<div className="flex flex-col scroll-mt-30" id={member.displayName}> <div className="flex flex-col scroll-mt-30" id={member.displayName}>
<CodeHeading className="md:-ml-8.5" href={`#${member.displayName}`}> <CodeHeading className="md:-ml-8.5" href={`#${member.displayName}`}>

View File

@@ -5,7 +5,7 @@ import { FunctionBody } from './FunctionBody';
const OverloadSwitcher = dynamic(async () => import('../../OverloadSwitcher')); 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} />; const header = <Header kind={item.kind} name={item.name} sourceURL={item.sourceLocation.fileUrl} />;
if (item.getMergedSiblings().length > 1) { if (item.getMergedSiblings().length > 1) {

View File

@@ -10,7 +10,7 @@ export interface FunctionBodyProps {
overloadDocumentation: React.ReactNode[]; overloadDocumentation: React.ReactNode[];
} }
export function FunctionBody({ item }: { item: ApiFunction }) { export function FunctionBody({ item }: { readonly item: ApiFunction }) {
return ( return (
<Documentation> <Documentation>
{/* @ts-expect-error async component */} {/* @ts-expect-error async component */}

View File

@@ -15,8 +15,8 @@ export function Method({
method, method,
inheritedFrom, inheritedFrom,
}: { }: {
inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined; readonly inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined;
method: ApiMethod | ApiMethodSignature; readonly method: ApiMethod | ApiMethodSignature;
}) { }) {
if (method.getMergedSiblings().length > 1) { if (method.getMergedSiblings().length > 1) {
// We have overloads, use the overload switcher, but render // We have overloads, use the overload switcher, but render

View File

@@ -9,8 +9,8 @@ import { ParameterTable } from '../../ParameterTable';
import { TSDoc } from '../../documentation/tsdoc/TSDoc'; import { TSDoc } from '../../documentation/tsdoc/TSDoc';
export interface MethodDocumentationProps { export interface MethodDocumentationProps {
inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined; readonly inheritedFrom?: (ApiDeclaredItem & ApiItemContainerMixin) | undefined;
method: ApiMethod | ApiMethodSignature; readonly method: ApiMethod | ApiMethodSignature;
} }
export function MethodDocumentation({ method, inheritedFrom }: MethodDocumentationProps) { export function MethodDocumentation({ method, inheritedFrom }: MethodDocumentationProps) {

View File

@@ -5,7 +5,7 @@ import { CodeHeading } from '~/components/CodeHeading';
import { ExcerptText } from '~/components/ExcerptText'; import { ExcerptText } from '~/components/ExcerptText';
import { parametersString } from '~/components/documentation/util'; import { parametersString } from '~/components/documentation/util';
export function MethodHeader({ method }: { method: ApiMethod | ApiMethodSignature }) { export function MethodHeader({ method }: { readonly method: ApiMethod | ApiMethodSignature }) {
const key = useMemo( const key = useMemo(
() => `${method.displayName}${method.overloadIndex && method.overloadIndex > 1 ? `:${method.overloadIndex}` : ''}`, () => `${method.displayName}${method.overloadIndex && method.overloadIndex > 1 ? `:${method.overloadIndex}` : ''}`,
[method.displayName, method.overloadIndex], [method.displayName, method.overloadIndex],

View File

@@ -4,8 +4,8 @@ import { VscWarning } from '@react-icons/all-files/vsc/VscWarning';
import type { PropsWithChildren } from 'react'; import type { PropsWithChildren } from 'react';
export interface IAlert { export interface IAlert {
title?: string | undefined; readonly title?: string | undefined;
type: 'danger' | 'info' | 'success' | 'warning'; readonly type: 'danger' | 'info' | 'success' | 'warning';
} }
function resolveType(type: IAlert['type']) { function resolveType(type: IAlert['type']) {

View File

@@ -5,14 +5,14 @@ import { Disclosure, DisclosureContent, useDisclosureState } from 'ariakit/discl
import type { PropsWithChildren } from 'react'; import type { PropsWithChildren } from 'react';
export interface SectionOptions { export interface SectionOptions {
background?: boolean | undefined; readonly background?: boolean | undefined;
buttonClassName?: string; readonly buttonClassName?: string;
className?: string; readonly className?: string;
defaultClosed?: boolean | undefined; readonly defaultClosed?: boolean | undefined;
gutter?: boolean | undefined; readonly gutter?: boolean | undefined;
icon?: JSX.Element | undefined; readonly icon?: JSX.Element | undefined;
padded?: boolean | undefined; readonly padded?: boolean | undefined;
title: string; readonly title: string;
} }
export function Section({ export function Section({

View File

@@ -4,14 +4,14 @@ import { DiscordMessageInteraction, type IDiscordMessageInteraction } from './Me
import { DiscordMessageReply, type IDiscordMessageReply } from './MessageReply.js'; import { DiscordMessageReply, type IDiscordMessageReply } from './MessageReply.js';
export interface IDiscordMessage { export interface IDiscordMessage {
author?: IDiscordMessageAuthor | undefined; readonly author?: IDiscordMessageAuthor | undefined;
authorNode?: ReactNode | undefined; readonly authorNode?: ReactNode | undefined;
followUp?: boolean; readonly followUp?: boolean;
interaction?: IDiscordMessageInteraction | undefined; readonly interaction?: IDiscordMessageInteraction | undefined;
interactionNode?: ReactNode | undefined; readonly interactionNode?: ReactNode | undefined;
reply?: IDiscordMessageReply | undefined; readonly reply?: IDiscordMessageReply | undefined;
replyNode?: ReactNode | undefined; readonly replyNode?: ReactNode | undefined;
time?: string | undefined; readonly time?: string | undefined;
} }
export function DiscordMessage({ export function DiscordMessage({

View File

@@ -1,12 +1,12 @@
import { FiCheck } from '@react-icons/all-files/fi/FiCheck'; import { FiCheck } from '@react-icons/all-files/fi/FiCheck';
export interface IDiscordMessageAuthor { export interface IDiscordMessageAuthor {
avatar: string; readonly avatar: string;
bot?: boolean; readonly bot?: boolean;
color?: string; readonly color?: string;
time: string; readonly time: string;
username: string; readonly username: string;
verified?: boolean; readonly verified?: boolean;
} }
export function DiscordMessageAuthor({ avatar, bot, verified, color, time, username }: IDiscordMessageAuthor) { export function DiscordMessageAuthor({ avatar, bot, verified, color, time, username }: IDiscordMessageAuthor) {

View File

@@ -1,11 +1,11 @@
import { FiCheck } from '@react-icons/all-files/fi/FiCheck'; import { FiCheck } from '@react-icons/all-files/fi/FiCheck';
export interface IDiscordMessageAuthorReply { export interface IDiscordMessageAuthorReply {
avatar: string; readonly avatar: string;
bot?: boolean; readonly bot?: boolean;
color?: string; readonly color?: string;
username: string; readonly username: string;
verified?: boolean; readonly verified?: boolean;
} }
export function DiscordMessageAuthorReply({ avatar, bot, verified, color, username }: IDiscordMessageAuthorReply) { export function DiscordMessageAuthorReply({ avatar, bot, verified, color, username }: IDiscordMessageAuthorReply) {

View File

@@ -5,7 +5,10 @@ export function DiscordMessageBaseReply({
author, author,
authorNode, authorNode,
children, children,
}: PropsWithChildren<{ author?: IDiscordMessageAuthorReply | undefined; authorNode?: ReactNode | undefined }>) { }: PropsWithChildren<{
readonly author?: IDiscordMessageAuthorReply | undefined;
readonly authorNode?: ReactNode | undefined;
}>) {
return ( return (
<div <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" 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"

View File

@@ -8,15 +8,15 @@ import { DiscordMessageEmbedThumbnail, type IDiscordMessageEmbedThumbnail } from
import { DiscordMessageEmbedTitle, type IDiscordMessageEmbedTitle } from './MessageEmbedTitle.js'; import { DiscordMessageEmbedTitle, type IDiscordMessageEmbedTitle } from './MessageEmbedTitle.js';
export interface IDiscordMessageEmbed { export interface IDiscordMessageEmbed {
author?: IDiscordMessageEmbedAuthor | undefined; readonly author?: IDiscordMessageEmbedAuthor | undefined;
authorNode?: ReactNode | undefined; readonly authorNode?: ReactNode | undefined;
fields?: IDiscordMessageEmbedField[]; readonly fields?: IDiscordMessageEmbedField[];
footer?: IDiscordMessageEmbedFooter | undefined; readonly footer?: IDiscordMessageEmbedFooter | undefined;
footerNode?: ReactNode | undefined; readonly footerNode?: ReactNode | undefined;
image?: IDiscordMessageEmbedImage; readonly image?: IDiscordMessageEmbedImage;
thumbnail?: IDiscordMessageEmbedThumbnail; readonly thumbnail?: IDiscordMessageEmbedThumbnail;
title?: IDiscordMessageEmbedTitle | undefined; readonly title?: IDiscordMessageEmbedTitle | undefined;
titleNode?: ReactNode | undefined; readonly titleNode?: ReactNode | undefined;
} }
export function DiscordMessageEmbed({ export function DiscordMessageEmbed({

View File

@@ -1,7 +1,7 @@
export interface IDiscordMessageEmbedAuthor { export interface IDiscordMessageEmbedAuthor {
avatar: string; readonly avatar: string;
url?: string; readonly url?: string;
username: string; readonly username: string;
} }
export function DiscordMessageEmbedAuthor({ avatar, url, username }: IDiscordMessageEmbedAuthor) { export function DiscordMessageEmbedAuthor({ avatar, url, username }: IDiscordMessageEmbedAuthor) {

View File

@@ -1,7 +1,7 @@
export interface IDiscordMessageEmbedField { export interface IDiscordMessageEmbedField {
inline?: boolean; readonly inline?: boolean;
name: string; readonly name: string;
value: string; readonly value: string;
} }
export function DiscordMessageEmbedField({ name, value, inline }: IDiscordMessageEmbedField) { export function DiscordMessageEmbedField({ name, value, inline }: IDiscordMessageEmbedField) {

View File

@@ -1,7 +1,7 @@
import { DiscordMessageEmbedField, type IDiscordMessageEmbedField } from './MessageEmbedField.js'; import { DiscordMessageEmbedField, type IDiscordMessageEmbedField } from './MessageEmbedField.js';
export interface IDiscordMessageEmbedFields { export interface IDiscordMessageEmbedFields {
fields: IDiscordMessageEmbedField[]; readonly fields: IDiscordMessageEmbedField[];
} }
export function DiscordMessageEmbedFields({ fields }: IDiscordMessageEmbedFields) { export function DiscordMessageEmbedFields({ fields }: IDiscordMessageEmbedFields) {

View File

@@ -1,7 +1,7 @@
export interface IDiscordMessageEmbedFooter { export interface IDiscordMessageEmbedFooter {
content?: string; readonly content?: string;
icon?: string; readonly icon?: string;
timestamp?: string; readonly timestamp?: string;
} }
export function DiscordMessageEmbedFooter({ content, icon, timestamp }: IDiscordMessageEmbedFooter) { export function DiscordMessageEmbedFooter({ content, icon, timestamp }: IDiscordMessageEmbedFooter) {

View File

@@ -1,8 +1,8 @@
export interface IDiscordMessageEmbedImage { export interface IDiscordMessageEmbedImage {
alt: string; readonly alt: string;
height: number; readonly height: number;
url: string; readonly url: string;
width: number; readonly width: number;
} }
export function DiscordMessageEmbedImage({ alt, height, url, width }: IDiscordMessageEmbedImage) { export function DiscordMessageEmbedImage({ alt, height, url, width }: IDiscordMessageEmbedImage) {

View File

@@ -1,6 +1,6 @@
export interface IDiscordMessageEmbedThumbnail { export interface IDiscordMessageEmbedThumbnail {
alt: string; readonly alt: string;
image: string; readonly image: string;
} }
export function DiscordMessageEmbedThumbnail({ alt, image }: IDiscordMessageEmbedThumbnail) { export function DiscordMessageEmbedThumbnail({ alt, image }: IDiscordMessageEmbedThumbnail) {

View File

@@ -1,6 +1,6 @@
export interface IDiscordMessageEmbedTitle { export interface IDiscordMessageEmbedTitle {
title: string; readonly title: string;
url?: string; readonly url?: string;
} }
export function DiscordMessageEmbedTitle({ title, url }: IDiscordMessageEmbedTitle) { export function DiscordMessageEmbedTitle({ title, url }: IDiscordMessageEmbedTitle) {

View File

@@ -3,9 +3,9 @@ import type { IDiscordMessageAuthorReply } from './MessageAuthorReply.js';
import { DiscordMessageBaseReply } from './MessageBaseReply.js'; import { DiscordMessageBaseReply } from './MessageBaseReply.js';
export interface IDiscordMessageInteraction { export interface IDiscordMessageInteraction {
author?: IDiscordMessageAuthorReply | undefined; readonly author?: IDiscordMessageAuthorReply | undefined;
authorNode?: ReactNode | undefined; readonly authorNode?: ReactNode | undefined;
command?: string; readonly command?: string;
} }
export function DiscordMessageInteraction({ author, authorNode, command }: IDiscordMessageInteraction) { export function DiscordMessageInteraction({ author, authorNode, command }: IDiscordMessageInteraction) {

View File

@@ -3,9 +3,9 @@ import type { IDiscordMessageAuthorReply } from './MessageAuthorReply.js';
import { DiscordMessageBaseReply } from './MessageBaseReply.js'; import { DiscordMessageBaseReply } from './MessageBaseReply.js';
export interface IDiscordMessageReply { export interface IDiscordMessageReply {
author?: IDiscordMessageAuthorReply | undefined; readonly author?: IDiscordMessageAuthorReply | undefined;
authorNode?: ReactNode | undefined; readonly authorNode?: ReactNode | undefined;
content: string; readonly content: string;
} }
export function DiscordMessageReply({ author, authorNode, content }: IDiscordMessageReply) { export function DiscordMessageReply({ author, authorNode, content }: IDiscordMessageReply) {

View File

@@ -1,7 +1,7 @@
import type { PropsWithChildren } from 'react'; import type { PropsWithChildren } from 'react';
export interface IDiscordMessages { export interface IDiscordMessages {
rounded?: boolean; readonly rounded?: boolean;
} }
export function DiscordMessages({ rounded, children }: PropsWithChildren<IDiscordMessages>) { export function DiscordMessages({ rounded, children }: PropsWithChildren<IDiscordMessages>) {