1 | "use strict";
|
2 | var __extends = (this && this.__extends) || (function () {
|
3 | var extendStatics = function (d, b) {
|
4 | extendStatics = Object.setPrototypeOf ||
|
5 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
7 | return extendStatics(d, b);
|
8 | };
|
9 | return function (d, b) {
|
10 | extendStatics(d, b);
|
11 | function __() { this.constructor = d; }
|
12 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13 | };
|
14 | })();
|
15 | var __spreadArrays = (this && this.__spreadArrays) || function () {
|
16 | for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
17 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
18 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
19 | r[k] = a[j];
|
20 | return r;
|
21 | };
|
22 | Object.defineProperty(exports, "__esModule", { value: true });
|
23 | exports.DocHtmlStartTag = void 0;
|
24 | var DocNode_1 = require("./DocNode");
|
25 | var DocExcerpt_1 = require("./DocExcerpt");
|
26 | var StringBuilder_1 = require("../emitters/StringBuilder");
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | var DocHtmlStartTag = (function (_super) {
|
33 | __extends(DocHtmlStartTag, _super);
|
34 | |
35 |
|
36 |
|
37 |
|
38 | function DocHtmlStartTag(parameters) {
|
39 | var _a;
|
40 | var _this = _super.call(this, parameters) || this;
|
41 | if (DocNode_1.DocNode.isParsedParameters(parameters)) {
|
42 | _this._openingDelimiterExcerpt = new DocExcerpt_1.DocExcerpt({
|
43 | configuration: _this.configuration,
|
44 | excerptKind: DocExcerpt_1.ExcerptKind.HtmlStartTag_OpeningDelimiter,
|
45 | content: parameters.openingDelimiterExcerpt
|
46 | });
|
47 | _this._nameExcerpt = new DocExcerpt_1.DocExcerpt({
|
48 | configuration: _this.configuration,
|
49 | excerptKind: DocExcerpt_1.ExcerptKind.HtmlStartTag_Name,
|
50 | content: parameters.nameExcerpt
|
51 | });
|
52 | if (parameters.spacingAfterNameExcerpt) {
|
53 | _this._spacingAfterNameExcerpt = new DocExcerpt_1.DocExcerpt({
|
54 | configuration: _this.configuration,
|
55 | excerptKind: DocExcerpt_1.ExcerptKind.Spacing,
|
56 | content: parameters.spacingAfterNameExcerpt
|
57 | });
|
58 | }
|
59 | _this._closingDelimiterExcerpt = new DocExcerpt_1.DocExcerpt({
|
60 | configuration: _this.configuration,
|
61 | excerptKind: DocExcerpt_1.ExcerptKind.HtmlStartTag_ClosingDelimiter,
|
62 | content: parameters.closingDelimiterExcerpt
|
63 | });
|
64 | }
|
65 | else {
|
66 | _this._name = parameters.name;
|
67 | _this._spacingAfterName = parameters.spacingAfterName;
|
68 | }
|
69 | _this._htmlAttributes = [];
|
70 | if (parameters.htmlAttributes) {
|
71 | (_a = _this._htmlAttributes).push.apply(_a, parameters.htmlAttributes);
|
72 | }
|
73 | _this._selfClosingTag = !!parameters.selfClosingTag;
|
74 | return _this;
|
75 | }
|
76 | Object.defineProperty(DocHtmlStartTag.prototype, "kind", {
|
77 |
|
78 | get: function () {
|
79 | return DocNode_1.DocNodeKind.HtmlStartTag;
|
80 | },
|
81 | enumerable: false,
|
82 | configurable: true
|
83 | });
|
84 | Object.defineProperty(DocHtmlStartTag.prototype, "name", {
|
85 | |
86 |
|
87 |
|
88 | get: function () {
|
89 | if (this._name === undefined) {
|
90 | this._name = this._nameExcerpt.content.toString();
|
91 | }
|
92 | return this._name;
|
93 | },
|
94 | enumerable: false,
|
95 | configurable: true
|
96 | });
|
97 | Object.defineProperty(DocHtmlStartTag.prototype, "htmlAttributes", {
|
98 | |
99 |
|
100 |
|
101 | get: function () {
|
102 | return this._htmlAttributes;
|
103 | },
|
104 | enumerable: false,
|
105 | configurable: true
|
106 | });
|
107 | Object.defineProperty(DocHtmlStartTag.prototype, "selfClosingTag", {
|
108 | |
109 |
|
110 |
|
111 | get: function () {
|
112 | return this._selfClosingTag;
|
113 | },
|
114 | enumerable: false,
|
115 | configurable: true
|
116 | });
|
117 | Object.defineProperty(DocHtmlStartTag.prototype, "spacingAfterName", {
|
118 | |
119 |
|
120 |
|
121 |
|
122 | get: function () {
|
123 | if (this._spacingAfterName === undefined) {
|
124 | if (this._spacingAfterNameExcerpt !== undefined) {
|
125 | this._spacingAfterName = this._spacingAfterNameExcerpt.content.toString();
|
126 | }
|
127 | }
|
128 | return this._spacingAfterName;
|
129 | },
|
130 | enumerable: false,
|
131 | configurable: true
|
132 | });
|
133 | |
134 |
|
135 |
|
136 | DocHtmlStartTag.prototype.emitAsHtml = function () {
|
137 |
|
138 | var stringBuilder = new StringBuilder_1.StringBuilder();
|
139 |
|
140 | var emitter = new TSDocEmitter_1.TSDocEmitter();
|
141 | emitter.renderHtmlTag(stringBuilder, this);
|
142 | return stringBuilder.toString();
|
143 | };
|
144 |
|
145 | DocHtmlStartTag.prototype.onGetChildNodes = function () {
|
146 | return __spreadArrays([
|
147 | this._openingDelimiterExcerpt,
|
148 | this._nameExcerpt,
|
149 | this._spacingAfterNameExcerpt
|
150 | ], this._htmlAttributes, [
|
151 | this._closingDelimiterExcerpt
|
152 | ]);
|
153 | };
|
154 | return DocHtmlStartTag;
|
155 | }(DocNode_1.DocNode));
|
156 | exports.DocHtmlStartTag = DocHtmlStartTag;
|
157 |
|
158 | var TSDocEmitter_1 = require("../emitters/TSDocEmitter");
|
159 |
|
\ | No newline at end of file |