MCPcopy Create free account
hub / github.com/SimplrJS/ts-docs-gen / ApiClassPlugin

Class ApiClassPlugin

packages/ts-docs-gen/src/plugins/api-class-plugin.ts:9–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7import { ApiClass } from "../api-items/definitions/api-class";
8
9export class ApiClassPlugin extends ContainerPlugin<Contracts.ApiClassDto> {
10 public SupportedApiDefinitionKind(): SupportedApiItemKindType[] {
11 return [GeneratorHelpers.ApiDefinitionKind.Class];
12 }
13
14 public static readonly MemberKindsList: ContainerMembersKindsGroup[] = [
15 {
16 Heading: "Index",
17 Kinds: [GeneratorHelpers.ApiDefinitionKind.Index]
18 },
19 {
20 Heading: "Constructor",
21 Kinds: [GeneratorHelpers.ApiDefinitionKind.ClassConstructor]
22 },
23 {
24 Heading: "Methods",
25 Kinds: [GeneratorHelpers.ApiDefinitionKind.ClassMethod]
26 },
27 {
28 Heading: "Properties",
29 Kinds: [
30 GeneratorHelpers.ApiDefinitionKind.ClassProperty,
31 GeneratorHelpers.ApiDefinitionKind.GetAccessor,
32 GeneratorHelpers.ApiDefinitionKind.SetAccessor,
33 ]
34 },
35 {
36 Heading: "Other",
37 Kinds: [
38 GeneratorHelpers.ApiDefinitionKind.Any
39 ]
40 }
41 ];
42
43 public Render(options: PluginOptions, apiItem: Contracts.ApiClassDto): PluginResult {
44 const serializedApiItem = new ApiClass(options.ExtractedData, apiItem, options.Reference);
45
46 const heading = serializedApiItem.ToHeadingText();
47 const pluginResult: PluginResult = {
48 ...GeneratorHelpers.GetDefaultPluginResultData(),
49 ApiItem: apiItem,
50 Reference: options.Reference,
51 UsedReferences: [options.Reference.Id]
52 };
53
54 // Header
55 pluginResult.Result = new MarkdownBuilder()
56 .Header(heading, 1)
57 .EmptyLine()
58 .Text(this.RenderApiItemMetadata(apiItem))
59 .Code(serializedApiItem.ToText(), GeneratorHelpers.DEFAULT_CODE_OPTIONS)
60 .GetOutput();
61
62 // TypeParameters
63 const typeParametersResult = this.RenderTypeParameters(options.ExtractedData, serializedApiItem.TypeParameters);
64 GeneratorHelpers.MergePluginResultData(pluginResult, typeParametersResult);
65
66 // ApiMembers

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected