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