2024-08-02 16:42:23 +00:00
|
|
|
/*!
|
|
|
|
|
* @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';
|
2025-05-06 20:59:30 +00:00
|
|
|
import {PipeEntry} from '../entities.mjs';
|
2025-10-20 12:40:23 +00:00
|
|
|
import {
|
|
|
|
|
ClassEntryRenderable,
|
|
|
|
|
InterfaceEntryRenderable,
|
|
|
|
|
PipeEntryRenderable,
|
|
|
|
|
} from '../entities/renderables.mjs';
|
2025-05-06 20:59:30 +00:00
|
|
|
import {ClassMemberList} from './class-member-list';
|
|
|
|
|
import {HeaderApi} from './header-api';
|
2025-04-19 19:08:13 +00:00
|
|
|
import {
|
|
|
|
|
API_REFERENCE_CONTAINER,
|
|
|
|
|
REFERENCE_MEMBERS,
|
|
|
|
|
SECTION_CONTAINER,
|
2025-05-06 20:59:30 +00:00
|
|
|
} from '../styling/css-classes.mjs';
|
2025-05-05 22:10:49 +00:00
|
|
|
import {SectionDescription} from './section-description';
|
|
|
|
|
import {SectionUsageNotes} from './section-usage-notes';
|
2025-05-06 20:59:30 +00:00
|
|
|
import {SectionApi} from './section-api';
|
|
|
|
|
import {SectionHeading} from './section-heading';
|
|
|
|
|
import {RawHtml} from './raw-html';
|
2025-07-02 09:52:09 +00:00
|
|
|
import {DeprecationWarning} from './deprecation-warning';
|
2025-08-25 01:59:16 +00:00
|
|
|
import {codeToHtml} from '../../../shared/shiki.mjs';
|
|
|
|
|
import {getHighlighterInstance} from '../shiki/shiki.mjs';
|
2026-01-15 22:41:41 +00:00
|
|
|
import {getSymbolsAsApiEntries} from '../symbol-context.mjs';
|
2024-08-02 16:42:23 +00:00
|
|
|
|
|
|
|
|
/** Component to render a class API reference document. */
|
2025-10-20 12:40:23 +00:00
|
|
|
export function ClassReference(
|
|
|
|
|
entry: ClassEntryRenderable | InterfaceEntryRenderable | PipeEntryRenderable,
|
|
|
|
|
) {
|
2024-08-02 16:42:23 +00:00
|
|
|
return (
|
2024-11-12 07:35:24 +00:00
|
|
|
<div className={API_REFERENCE_CONTAINER}>
|
2024-08-02 16:42:23 +00:00
|
|
|
<HeaderApi entry={entry} />
|
2025-04-19 19:08:13 +00:00
|
|
|
{entry.entryType === 'pipe' ? (
|
|
|
|
|
<>
|
|
|
|
|
<div className={SECTION_CONTAINER + ' docs-reference-api-section'}>
|
|
|
|
|
<SectionHeading name="Pipe usage" />
|
2025-08-25 01:59:16 +00:00
|
|
|
<RawHtml
|
2025-11-20 20:31:12 +00:00
|
|
|
value={codeToHtml(getHighlighterInstance(), (entry as PipeEntry).usage, {
|
|
|
|
|
language: 'angular-html',
|
2026-01-15 22:41:41 +00:00
|
|
|
apiEntries: getSymbolsAsApiEntries(),
|
2025-11-20 20:31:12 +00:00
|
|
|
})}
|
2025-08-25 01:59:16 +00:00
|
|
|
/>
|
2025-04-19 19:08:13 +00:00
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
) : (
|
|
|
|
|
''
|
|
|
|
|
)}
|
2025-07-02 09:52:09 +00:00
|
|
|
<DeprecationWarning entry={entry} />
|
2024-11-12 07:35:24 +00:00
|
|
|
<SectionApi entry={entry} />
|
2024-08-20 23:46:30 +00:00
|
|
|
{entry.members.length > 0 ? (
|
2024-11-12 07:35:24 +00:00
|
|
|
<div class={REFERENCE_MEMBERS}>
|
2024-08-20 23:46:30 +00:00
|
|
|
<ClassMemberList members={entry.members} />
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<></>
|
|
|
|
|
)}
|
2024-11-12 07:35:24 +00:00
|
|
|
<SectionDescription entry={entry} />
|
|
|
|
|
<SectionUsageNotes entry={entry} />
|
2024-08-02 16:42:23 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|