wikiparser-node 1.13.1 → 1.13.2-b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/bundle/bundle.min.js +37 -0
  2. package/config/default.json +31 -32
  3. package/config/enwiki.json +15 -829
  4. package/config/llwiki.json +21 -56
  5. package/config/moegirl.json +21 -65
  6. package/config/zhwiki.json +32 -498
  7. package/extensions/dist/base.js +163 -0
  8. package/extensions/dist/codejar.js +53 -0
  9. package/extensions/dist/editor.js +159 -0
  10. package/extensions/dist/highlight.js +30 -0
  11. package/extensions/dist/lint.js +72 -0
  12. package/extensions/editor.css +59 -0
  13. package/extensions/ui.css +162 -0
  14. package/package.json +28 -21
  15. package/config/.schema.json +0 -203
  16. package/dist/addon/table.js +0 -494
  17. package/dist/addon/token.js +0 -392
  18. package/dist/addon/transclude.js +0 -184
  19. package/dist/base.d.ts +0 -110
  20. package/dist/base.js +0 -67
  21. package/dist/index.d.ts +0 -33
  22. package/dist/index.js +0 -279
  23. package/dist/internal.d.ts +0 -47
  24. package/dist/lib/element.d.ts +0 -125
  25. package/dist/lib/element.js +0 -364
  26. package/dist/lib/node.d.ts +0 -173
  27. package/dist/lib/node.js +0 -478
  28. package/dist/lib/range.d.ts +0 -105
  29. package/dist/lib/range.js +0 -406
  30. package/dist/lib/ranges.d.ts +0 -28
  31. package/dist/lib/ranges.js +0 -126
  32. package/dist/lib/rect.d.ts +0 -18
  33. package/dist/lib/rect.js +0 -36
  34. package/dist/lib/text.d.ts +0 -58
  35. package/dist/lib/text.js +0 -414
  36. package/dist/lib/title.d.ts +0 -49
  37. package/dist/lib/title.js +0 -251
  38. package/dist/mixin/attributesParent.d.ts +0 -49
  39. package/dist/mixin/attributesParent.js +0 -80
  40. package/dist/mixin/fixed.d.ts +0 -5
  41. package/dist/mixin/fixed.js +0 -32
  42. package/dist/mixin/flagsParent.d.ts +0 -43
  43. package/dist/mixin/flagsParent.js +0 -64
  44. package/dist/mixin/hidden.d.ts +0 -7
  45. package/dist/mixin/hidden.js +0 -39
  46. package/dist/mixin/magicLinkParent.d.ts +0 -19
  47. package/dist/mixin/magicLinkParent.js +0 -43
  48. package/dist/mixin/singleLine.d.ts +0 -5
  49. package/dist/mixin/singleLine.js +0 -25
  50. package/dist/mixin/sol.d.ts +0 -6
  51. package/dist/mixin/sol.js +0 -45
  52. package/dist/mixin/syntax.d.ts +0 -8
  53. package/dist/mixin/syntax.js +0 -46
  54. package/dist/parser/braces.js +0 -152
  55. package/dist/parser/commentAndExt.js +0 -84
  56. package/dist/parser/converter.js +0 -41
  57. package/dist/parser/externalLinks.js +0 -39
  58. package/dist/parser/hrAndDoubleUnderscore.js +0 -44
  59. package/dist/parser/html.js +0 -40
  60. package/dist/parser/links.js +0 -103
  61. package/dist/parser/list.js +0 -116
  62. package/dist/parser/magicLinks.js +0 -55
  63. package/dist/parser/quotes.js +0 -69
  64. package/dist/parser/redirect.js +0 -28
  65. package/dist/parser/selector.js +0 -443
  66. package/dist/parser/table.js +0 -125
  67. package/dist/src/arg.d.ts +0 -49
  68. package/dist/src/arg.js +0 -220
  69. package/dist/src/atom.d.ts +0 -14
  70. package/dist/src/atom.js +0 -54
  71. package/dist/src/attribute.d.ts +0 -64
  72. package/dist/src/attribute.js +0 -482
  73. package/dist/src/attributes.d.ts +0 -103
  74. package/dist/src/attributes.js +0 -383
  75. package/dist/src/converter.d.ts +0 -28
  76. package/dist/src/converter.js +0 -153
  77. package/dist/src/converterFlags.d.ts +0 -80
  78. package/dist/src/converterFlags.js +0 -241
  79. package/dist/src/converterRule.d.ts +0 -71
  80. package/dist/src/converterRule.js +0 -218
  81. package/dist/src/extLink.d.ts +0 -36
  82. package/dist/src/extLink.js +0 -223
  83. package/dist/src/gallery.d.ts +0 -51
  84. package/dist/src/gallery.js +0 -166
  85. package/dist/src/heading.d.ts +0 -44
  86. package/dist/src/heading.js +0 -222
  87. package/dist/src/hidden.d.ts +0 -9
  88. package/dist/src/hidden.js +0 -82
  89. package/dist/src/html.d.ts +0 -61
  90. package/dist/src/html.js +0 -344
  91. package/dist/src/imageParameter.d.ts +0 -60
  92. package/dist/src/imageParameter.js +0 -262
  93. package/dist/src/imagemap.d.ts +0 -47
  94. package/dist/src/imagemap.js +0 -148
  95. package/dist/src/imagemapLink.d.ts +0 -35
  96. package/dist/src/imagemapLink.js +0 -99
  97. package/dist/src/index.d.ts +0 -136
  98. package/dist/src/index.js +0 -790
  99. package/dist/src/link/base.d.ts +0 -52
  100. package/dist/src/link/base.js +0 -258
  101. package/dist/src/link/category.d.ts +0 -22
  102. package/dist/src/link/category.js +0 -36
  103. package/dist/src/link/file.d.ts +0 -102
  104. package/dist/src/link/file.js +0 -345
  105. package/dist/src/link/galleryImage.d.ts +0 -29
  106. package/dist/src/link/galleryImage.js +0 -133
  107. package/dist/src/link/index.d.ts +0 -39
  108. package/dist/src/link/index.js +0 -100
  109. package/dist/src/link/redirectTarget.d.ts +0 -27
  110. package/dist/src/link/redirectTarget.js +0 -71
  111. package/dist/src/magicLink.d.ts +0 -57
  112. package/dist/src/magicLink.js +0 -261
  113. package/dist/src/nested.d.ts +0 -40
  114. package/dist/src/nested.js +0 -108
  115. package/dist/src/nowiki/base.d.ts +0 -28
  116. package/dist/src/nowiki/base.js +0 -90
  117. package/dist/src/nowiki/comment.d.ts +0 -14
  118. package/dist/src/nowiki/comment.js +0 -123
  119. package/dist/src/nowiki/dd.d.ts +0 -8
  120. package/dist/src/nowiki/dd.js +0 -74
  121. package/dist/src/nowiki/doubleUnderscore.d.ts +0 -15
  122. package/dist/src/nowiki/doubleUnderscore.js +0 -101
  123. package/dist/src/nowiki/hr.d.ts +0 -5
  124. package/dist/src/nowiki/hr.js +0 -72
  125. package/dist/src/nowiki/index.d.ts +0 -14
  126. package/dist/src/nowiki/index.js +0 -30
  127. package/dist/src/nowiki/list.d.ts +0 -5
  128. package/dist/src/nowiki/list.js +0 -67
  129. package/dist/src/nowiki/listBase.d.ts +0 -23
  130. package/dist/src/nowiki/listBase.js +0 -100
  131. package/dist/src/nowiki/noinclude.d.ts +0 -6
  132. package/dist/src/nowiki/noinclude.js +0 -77
  133. package/dist/src/nowiki/quote.d.ts +0 -14
  134. package/dist/src/nowiki/quote.js +0 -149
  135. package/dist/src/onlyinclude.d.ts +0 -13
  136. package/dist/src/onlyinclude.js +0 -60
  137. package/dist/src/paramTag/index.d.ts +0 -28
  138. package/dist/src/paramTag/index.js +0 -80
  139. package/dist/src/paramTag/inputbox.d.ts +0 -8
  140. package/dist/src/paramTag/inputbox.js +0 -38
  141. package/dist/src/parameter.d.ts +0 -60
  142. package/dist/src/parameter.js +0 -267
  143. package/dist/src/pre.d.ts +0 -28
  144. package/dist/src/pre.js +0 -70
  145. package/dist/src/redirect.d.ts +0 -30
  146. package/dist/src/redirect.js +0 -128
  147. package/dist/src/syntax.d.ts +0 -15
  148. package/dist/src/syntax.js +0 -87
  149. package/dist/src/table/base.d.ts +0 -28
  150. package/dist/src/table/base.js +0 -81
  151. package/dist/src/table/index.d.ts +0 -230
  152. package/dist/src/table/index.js +0 -506
  153. package/dist/src/table/td.d.ts +0 -72
  154. package/dist/src/table/td.js +0 -375
  155. package/dist/src/table/tr.d.ts +0 -30
  156. package/dist/src/table/tr.js +0 -61
  157. package/dist/src/table/trBase.d.ts +0 -49
  158. package/dist/src/table/trBase.js +0 -165
  159. package/dist/src/tagPair/ext.d.ts +0 -29
  160. package/dist/src/tagPair/ext.js +0 -229
  161. package/dist/src/tagPair/include.d.ts +0 -33
  162. package/dist/src/tagPair/include.js +0 -145
  163. package/dist/src/tagPair/index.d.ts +0 -23
  164. package/dist/src/tagPair/index.js +0 -130
  165. package/dist/src/transclude.d.ts +0 -159
  166. package/dist/src/transclude.js +0 -598
  167. package/dist/util/constants.js +0 -26
  168. package/dist/util/debug.js +0 -95
  169. package/dist/util/diff.js +0 -83
  170. package/dist/util/html.js +0 -146
  171. package/dist/util/lint.js +0 -32
  172. package/dist/util/string.js +0 -107
  173. package/errors/README +0 -3
  174. package/printed/README +0 -3
@@ -1,222 +0,0 @@
1
- "use strict";
2
- var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
- var _, done = false;
8
- for (var i = decorators.length - 1; i >= 0; i--) {
9
- var context = {};
10
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
- if (kind === "accessor") {
15
- if (result === void 0) continue;
16
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
- if (_ = accept(result.get)) descriptor.get = _;
18
- if (_ = accept(result.set)) descriptor.set = _;
19
- if (_ = accept(result.init)) initializers.unshift(_);
20
- }
21
- else if (_ = accept(result)) {
22
- if (kind === "field") initializers.unshift(_);
23
- else descriptor[key] = _;
24
- }
25
- }
26
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
- done = true;
28
- };
29
- var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
- var useValue = arguments.length > 2;
31
- for (var i = 0; i < initializers.length; i++) {
32
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
- }
34
- return useValue ? value : void 0;
35
- };
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.HeadingToken = void 0;
38
- const lint_1 = require("../util/lint");
39
- const debug_1 = require("../util/debug");
40
- const rect_1 = require("../lib/rect");
41
- const index_1 = require("../index");
42
- const index_2 = require("./index");
43
- const syntax_1 = require("./syntax");
44
- /* NOT FOR BROWSER */
45
- const constants_1 = require("../util/constants");
46
- const string_1 = require("../util/string");
47
- const fixed_1 = require("../mixin/fixed");
48
- const sol_1 = require("../mixin/sol");
49
- /* NOT FOR BROWSER END */
50
- /**
51
- * 章节标题
52
- * @classdesc `{childNodes: [Token, SyntaxToken]}`
53
- */
54
- let HeadingToken = (() => {
55
- let _classDecorators = [fixed_1.fixedToken, (0, sol_1.sol)()];
56
- let _classDescriptor;
57
- let _classExtraInitializers = [];
58
- let _classThis;
59
- let _classSuper = index_2.Token;
60
- var HeadingToken = class extends _classSuper {
61
- static { _classThis = this; }
62
- static {
63
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
64
- __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
65
- HeadingToken = _classThis = _classDescriptor.value;
66
- if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
67
- __runInitializers(_classThis, _classExtraInitializers);
68
- }
69
- #level;
70
- /* NOT FOR BROWSER END */
71
- get type() {
72
- return 'heading';
73
- }
74
- /** 标题格式的等号 */
75
- get #equals() {
76
- return '='.repeat(this.level);
77
- }
78
- /** 标题层级 */
79
- get level() {
80
- return this.#level;
81
- }
82
- /* NOT FOR BROWSER */
83
- set level(n) {
84
- this.setLevel(n);
85
- }
86
- /** 内部wikitext */
87
- get innerText() {
88
- return this.firstChild.text().trim();
89
- }
90
- /** @throws `Error` 首尾包含`=` */
91
- set innerText(text) {
92
- if (text.length > 1 && text.startsWith('=') && text.endsWith('=')) {
93
- throw new Error('Please use HeadingToken.setLevel method to change the level of the heading!');
94
- }
95
- const { childNodes } = index_1.default.parse(text, this.getAttribute('include'), undefined, this.getAttribute('config'));
96
- this.firstChild.replaceChildren(...childNodes);
97
- }
98
- /** id属性 */
99
- get id() {
100
- return this.#getId(true);
101
- }
102
- /* NOT FOR BROWSER END */
103
- /**
104
- * @param level 标题层级
105
- * @param input 标题文字
106
- */
107
- constructor(level, input, config = index_1.default.getConfig(), accum = []) {
108
- super(undefined, config, accum);
109
- this.#level = level;
110
- const token = new index_2.Token(input[0], config, accum);
111
- token.type = 'heading-title';
112
- token.setAttribute('stage', 2);
113
- const trail = new syntax_1.SyntaxToken(input[1], /^\s*$/u, 'heading-trail', config, accum, {
114
- 'Stage-1': ':', '!ExtToken': '',
115
- });
116
- this.append(token, trail);
117
- }
118
- /** @private */
119
- toString(skip) {
120
- const equals = this.#equals;
121
- return equals + this.firstChild.toString(skip) + equals + this.lastChild.toString(skip);
122
- }
123
- /** @private */
124
- text() {
125
- const equals = this.#equals;
126
- return equals + this.firstChild.text() + equals;
127
- }
128
- /** @private */
129
- getAttribute(key) {
130
- return key === 'padding' ? this.level : super.getAttribute(key);
131
- }
132
- /** @private */
133
- getGaps() {
134
- return this.level;
135
- }
136
- /** @private */
137
- lint(start = this.getAbsoluteIndex(), re) {
138
- const errors = super.lint(start, re), { firstChild, level } = this, innerStr = firstChild.toString(), quotes = firstChild.childNodes.filter((0, debug_1.isToken)('quote')), boldQuotes = quotes.filter(({ bold }) => bold), italicQuotes = quotes.filter(({ italic }) => italic), rect = new rect_1.BoundingRect(this, start);
139
- if (this.level === 1) {
140
- errors.push((0, lint_1.generateForChild)(firstChild, rect, 'h1', '<h1>'));
141
- }
142
- if (innerStr.startsWith('=') || innerStr.endsWith('=')) {
143
- errors.push((0, lint_1.generateForChild)(firstChild, rect, 'unbalanced-header', index_1.default.msg('unbalanced $1 in a section header', '"="')));
144
- }
145
- if (this.closest('html-attrs,table-attrs')) {
146
- errors.push((0, lint_1.generateForSelf)(this, rect, 'parsing-order', 'section header in a HTML tag'));
147
- }
148
- if (boldQuotes.length % 2) {
149
- errors.push((0, lint_1.generateForChild)(boldQuotes[boldQuotes.length - 1], { ...rect, start: start + level, left: rect.left + level }, 'format-leakage', index_1.default.msg('unbalanced $1 in a section header', 'bold apostrophes')));
150
- }
151
- if (italicQuotes.length % 2) {
152
- errors.push((0, lint_1.generateForChild)(italicQuotes[italicQuotes.length - 1], { start: start + level }, 'format-leakage', index_1.default.msg('unbalanced $1 in a section header', 'italic apostrophes')));
153
- }
154
- return errors;
155
- }
156
- /** @private */
157
- print() {
158
- const equals = this.#equals;
159
- return super.print({ pre: equals, sep: equals });
160
- }
161
- /** @override */
162
- json() {
163
- const json = super.json();
164
- json['level'] = this.level;
165
- return json;
166
- }
167
- /* NOT FOR BROWSER */
168
- cloneNode() {
169
- const [title, trail] = this.cloneChildNodes();
170
- return debug_1.Shadow.run(() => {
171
- // @ts-expect-error abstract class
172
- const token = new HeadingToken(this.level, [], this.getAttribute('config'));
173
- token.firstChild.safeReplaceWith(title);
174
- token.lastChild.safeReplaceWith(trail);
175
- return token;
176
- });
177
- }
178
- /**
179
- * 设置标题层级
180
- * @param n 标题层级
181
- */
182
- setLevel(n) {
183
- this.#level = Math.min(Math.max(n, 1), 6);
184
- }
185
- /** 移除标题后的不可见内容 */
186
- removeTrail() {
187
- this.lastChild.replaceChildren();
188
- }
189
- /**
190
- * id属性
191
- * @param expand 是否展开模板
192
- */
193
- #getId(expand) {
194
- const token = expand ? this.firstChild.expand() : this.firstChild;
195
- let id = (0, string_1.decodeHtml)((0, string_1.sanitizeAlt)(token.toHtmlInternal(false, true))).replace(/[\s_]+/gu, '_');
196
- if (id.endsWith('_')) {
197
- id = id.slice(0, -1);
198
- }
199
- return id;
200
- }
201
- /** @private */
202
- toHtmlInternal() {
203
- let id = this.#getId();
204
- const { level, firstChild } = this, lcId = id.toLowerCase(), headings = constants_1.states.get(this.getRootNode())?.headings;
205
- if (headings?.has(lcId)) {
206
- let i = 2;
207
- for (; headings.has(`${lcId}_${i}`); i++) {
208
- // pass
209
- }
210
- id = `${id}_${i}`;
211
- headings.add(`${lcId}_${i}`);
212
- }
213
- else {
214
- headings?.add(lcId);
215
- }
216
- return `<div class="mw-heading mw-heading${level}"><h${level} id="${(0, string_1.sanitizeId)(id)}">${firstChild.toHtmlInternal().trim()}</h${level}></div>`;
217
- }
218
- };
219
- return HeadingToken = _classThis;
220
- })();
221
- exports.HeadingToken = HeadingToken;
222
- constants_1.classes['HeadingToken'] = __filename;
@@ -1,9 +0,0 @@
1
- import { Token } from './index';
2
- import type { Config } from '../base';
3
- /** 不可见的节点 */
4
- export declare class HiddenToken extends Token {
5
- get type(): 'hidden';
6
- /** @class */
7
- constructor(wikitext?: string, config?: Config, accum?: Token[]);
8
- cloneNode(): this;
9
- }
@@ -1,82 +0,0 @@
1
- "use strict";
2
- var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
- var _, done = false;
8
- for (var i = decorators.length - 1; i >= 0; i--) {
9
- var context = {};
10
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
- if (kind === "accessor") {
15
- if (result === void 0) continue;
16
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
- if (_ = accept(result.get)) descriptor.get = _;
18
- if (_ = accept(result.set)) descriptor.set = _;
19
- if (_ = accept(result.init)) initializers.unshift(_);
20
- }
21
- else if (_ = accept(result)) {
22
- if (kind === "field") initializers.unshift(_);
23
- else descriptor[key] = _;
24
- }
25
- }
26
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
- done = true;
28
- };
29
- var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
- var useValue = arguments.length > 2;
31
- for (var i = 0; i < initializers.length; i++) {
32
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
- }
34
- return useValue ? value : void 0;
35
- };
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.HiddenToken = void 0;
38
- const hidden_1 = require("../mixin/hidden");
39
- const index_1 = require("./index");
40
- /* NOT FOR BROWSER */
41
- const debug_1 = require("../util/debug");
42
- const constants_1 = require("../util/constants");
43
- /* NOT FOR BROWSER END */
44
- /** 不可见的节点 */
45
- let HiddenToken = (() => {
46
- let _classDecorators = [(0, hidden_1.hiddenToken)()];
47
- let _classDescriptor;
48
- let _classExtraInitializers = [];
49
- let _classThis;
50
- let _classSuper = index_1.Token;
51
- var HiddenToken = class extends _classSuper {
52
- static { _classThis = this; }
53
- static {
54
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
55
- __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
56
- HiddenToken = _classThis = _classDescriptor.value;
57
- if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
58
- __runInitializers(_classThis, _classExtraInitializers);
59
- }
60
- get type() {
61
- return 'hidden';
62
- }
63
- /* NOT FOR BROWSER */
64
- /** @class */
65
- constructor(wikitext, config, accum) {
66
- super(wikitext, config, accum, {
67
- 'Stage-2': ':', '!HeadingToken': '',
68
- });
69
- }
70
- cloneNode() {
71
- const cloned = this.cloneChildNodes(), config = this.getAttribute('config');
72
- return debug_1.Shadow.run(() => {
73
- const token = new HiddenToken(undefined, config, []);
74
- token.append(...cloned);
75
- return token;
76
- });
77
- }
78
- };
79
- return HiddenToken = _classThis;
80
- })();
81
- exports.HiddenToken = HiddenToken;
82
- constants_1.classes['HiddenToken'] = __filename;
@@ -1,61 +0,0 @@
1
- import { Token } from './index';
2
- import type { Config, LintError, AST } from '../base';
3
- import type { AttributesToken } from '../internal';
4
- import type { AttributesParentBase } from '../mixin/attributesParent';
5
- export interface HtmlToken extends AttributesParentBase {
6
- }
7
- /**
8
- * HTML标签
9
- * @classdesc `{childNodes: [AttributesToken]}`
10
- */
11
- export declare abstract class HtmlToken extends Token {
12
- #private;
13
- readonly name: string;
14
- readonly childNodes: readonly [AttributesToken];
15
- abstract get firstChild(): AttributesToken;
16
- abstract get lastChild(): AttributesToken;
17
- abstract get children(): [AttributesToken];
18
- abstract get firstElementChild(): AttributesToken;
19
- abstract get lastElementChild(): AttributesToken;
20
- get type(): 'html';
21
- /** 是否自封闭 */
22
- get selfClosing(): boolean;
23
- /** 是否是闭合标签 */
24
- get closing(): boolean;
25
- /** @throws `Error` 自封闭标签或空标签 */
26
- set closing(value: boolean);
27
- /** @throws `Error` 闭合标签或无效自封闭标签 */
28
- set selfClosing(value: boolean);
29
- get font(): {
30
- bold: boolean;
31
- italic: boolean;
32
- };
33
- /**
34
- * @param name 标签名
35
- * @param attr 标签属性
36
- * @param closing 是否闭合
37
- * @param selfClosing 是否自封闭
38
- */
39
- constructor(name: string, attr: AttributesToken, closing: boolean, selfClosing: boolean, config?: Config, accum?: Token[]);
40
- /**
41
- * 搜索匹配的标签
42
- * @throws `SyntaxError` 同时闭合和自封闭的标签
43
- * @throws `SyntaxError` 无效自封闭标签
44
- * @throws `SyntaxError` 未匹配的标签
45
- */
46
- findMatchingTag(): this | undefined;
47
- /** @override */
48
- json(): AST;
49
- cloneNode(): this;
50
- /**
51
- * 更换标签名
52
- * @param tag 标签名
53
- * @throws `RangeError` 非法的HTML标签
54
- */
55
- replaceTag(tag: string): void;
56
- /**
57
- * 修复无效自封闭标签
58
- * @throws `Error` 无法修复无效自封闭标签
59
- */
60
- fix(): void;
61
- }