Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _writeApiItemPage(apiItem: ApiItem): void {
const configuration: TSDocConfiguration = this._tsdocConfiguration;
const output: DocSection = new DocSection({ configuration: this._tsdocConfiguration });
this._writeHeaderSection(output, apiItem);
this._writeBreadcrumb(output, apiItem);
const scopedName: string = apiItem.getScopedNameWithinPackage();
// console.log(scopedName);
switch (apiItem.kind) {
case ApiItemKind.Class:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} class` }));
break;
case ApiItemKind.Enum:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} enum` }));
break;
case ApiItemKind.Interface:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} interface` }));
break;
private _createDescriptionCell(apiItem: ApiItem): DocTableCell {
const configuration: TSDocConfiguration = this._tsdocConfiguration;
const section: DocSection = new DocSection({ configuration });
if (ApiReleaseTagMixin.isBaseClassOf(apiItem)) {
if (apiItem.releaseTag === ReleaseTag.Beta) {
section.appendNodesInParagraph([
new DocEmphasisSpan({ configuration, bold: true, italic: true }, [
new DocPlainText({ configuration, text: '(BETA)' }),
]),
new DocPlainText({ configuration, text: ' ' }),
]);
}
}
if (apiItem instanceof ApiDocumentedItem) {
if (apiItem.tsdocComment !== undefined) {
this._appendAndMergeSection(section, apiItem.tsdocComment.summarySection);
}
private _createDescriptionCell(apiItem: ApiItem): DocTableCell {
const configuration: TSDocConfiguration = this._tsdocConfiguration;
const section: DocSection = new DocSection({ configuration });
if (ApiReleaseTagMixin.isBaseClassOf(apiItem)) {
if (apiItem.releaseTag === ReleaseTag.Beta) {
section.appendNodesInParagraph([
new DocEmphasisSpan({ configuration, bold: true, italic: true }, [
new DocPlainText({ configuration, text: '(BETA)' })
]),
new DocPlainText({ configuration, text: ' ' })
]);
}
}
if (apiItem instanceof ApiDocumentedItem) {
if (apiItem.tsdocComment !== undefined) {
this._appendAndMergeSection(section, apiItem.tsdocComment.summarySection);
}
private _writeApiItemPage(apiItem: ApiItem): void {
const configuration: TSDocConfiguration = this._tsdocConfiguration;
const output: DocSection = new DocSection({ configuration: this._tsdocConfiguration });
this._writeBreadcrumb(output, apiItem);
const scopedName: string = apiItem.getScopedNameWithinPackage();
switch (apiItem.kind) {
case ApiItemKind.Class:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} class` }));
break;
case ApiItemKind.Enum:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} enum` }));
break;
case ApiItemKind.Interface:
output.appendNode(new DocHeading({ configuration, title: `${scopedName} interface` }));
break;
case ApiItemKind.Constructor:
private _createModifiersCell(apiItem: ApiItem): DocTableCell {
const configuration: TSDocConfiguration = this._tsdocConfiguration;
const section: DocSection = new DocSection({ configuration });
if (ApiStaticMixin.isBaseClassOf(apiItem)) {
if (apiItem.isStatic) {
section.appendNodeInParagraph(new DocCodeSpan({ configuration, code: 'static' }));
}
}
return new DocTableCell({ configuration }, section.nodes);
}
private _createPropertyTypeCell(apiItem: ApiItem): DocTableCell {
const configuration: TSDocConfiguration = this._tsdocConfiguration;
const section: DocSection = new DocSection({ configuration });
if (apiItem instanceof ApiPropertyItem) {
section.appendNodeInParagraph(
new DocCodeSpan({ configuration, code: apiItem.propertyTypeExcerpt.text }),
);
}
return new DocTableCell({ configuration }, section.nodes);
}
private _createPropertyTypeCell(apiItem: ApiItem): DocTableCell {
const configuration: TSDocConfiguration = this._tsdocConfiguration;
const section: DocSection = new DocSection({ configuration });
if (apiItem instanceof ApiPropertyItem) {
section.appendNodeInParagraph(new DocCodeSpan({ configuration, code: apiItem.propertyTypeExcerpt.text }));
}
return new DocTableCell({ configuration }, section.nodes);
}
public constructor(parameters: IDocNoteBoxParameters, sectionChildNodes?: ReadonlyArray) {
super(parameters);
this.content = new DocSection({ configuration: this.configuration }, sectionChildNodes);
}
private _writeParameterTables(output: DocSection, apiParameterListMixin: ApiParameterListMixin): void {
const configuration: TSDocConfiguration = this._tsdocConfiguration;
const parametersTable: DocTable = new DocTable({ configuration,
headerTitles: [ 'Parameter', 'Type', 'Description' ]
});
for (const apiParameter of apiParameterListMixin.parameters) {
const parameterDescription: DocSection = new DocSection({ configuration } );
if (apiParameter.tsdocParamBlock) {
this._appendSection(parameterDescription, apiParameter.tsdocParamBlock.content);
}
parametersTable.addRow(
new DocTableRow({ configuration }, [
new DocTableCell({configuration}, [
new DocParagraph({ configuration }, [
new DocPlainText({ configuration, text: apiParameter.name })
])
]),
new DocTableCell({configuration}, [
new DocParagraph({ configuration }, [
new DocCodeSpan({ configuration, code: apiParameter.parameterTypeExcerpt.text })
])
]),
private _createModifiersCell(apiItem: ApiItem): DocTableCell {
const configuration: TSDocConfiguration = this._tsdocConfiguration;
const section: DocSection = new DocSection({ configuration });
if (ApiStaticMixin.isBaseClassOf(apiItem)) {
if (apiItem.isStatic) {
section.appendNodeInParagraph(new DocCodeSpan({ configuration, code: 'static' }));
}
}
return new DocTableCell({ configuration }, section.nodes);
}