/*! * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Fragment, h} from 'preact'; import { FunctionEntryRenderable, FunctionSignatureMetadataRenderable, } from '../entities/renderables.mjs'; import { API_REFERENCE_CONTAINER, REFERENCE_MEMBERS, REFERENCE_MEMBER_CARD, REFERENCE_MEMBER_CARD_BODY, REFERENCE_MEMBER_CARD_HEADER, } from '../styling/css-classes.mjs'; import {printInitializerFunctionSignatureLine} from '../transforms/code-transforms.mjs'; import {getFunctionMetadataRenderable} from '../transforms/function-transforms.mjs'; import {ClassMethodInfo} from './class-method-info'; import {CodeSymbol} from './code-symbols'; import {DeprecationWarning} from './deprecation-warning'; import {HeaderApi} from './header-api'; import {HighlightTypeScript} from './highlight-ts'; import {SectionApi} from './section-api'; import {SectionDescription} from './section-description'; import {SectionUsageNotes} from './section-usage-notes'; export const signatureCard = ( name: string, signature: FunctionSignatureMetadataRenderable, opts: {id: string; printSignaturesAsHeader: boolean; hideUsageNotes?: boolean}, ) => { return (
{opts.printSignaturesAsHeader ? ( ) : ( <>

{name}

)}
); }; /** Component to render a function API reference document. */ export function FunctionReference(entry: FunctionEntryRenderable) { // Use signatures as header if there are multiple signatures. const printSignaturesAsHeader = entry.signatures.length > 1; return (
{entry.signatures.length > 1 && entry.signatures.map((s, i) => signatureCard(s.name, getFunctionMetadataRenderable(s, entry.moduleName, entry.repo), { id: `${s.name}_${i}`, printSignaturesAsHeader, hideUsageNotes: true, }), )}
); }