wikiparser-node 1.12.4 → 1.12.5-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 (175) hide show
  1. package/bundle/bundle.min.js +37 -0
  2. package/config/default.json +29 -30
  3. package/config/enwiki.json +15 -829
  4. package/config/llwiki.json +21 -56
  5. package/config/minimum.json +6 -1
  6. package/config/moegirl.json +21 -65
  7. package/config/zhwiki.json +28 -494
  8. package/extensions/dist/base.js +163 -0
  9. package/extensions/dist/codejar.js +52 -0
  10. package/extensions/dist/editor.js +159 -0
  11. package/extensions/dist/highlight.js +30 -0
  12. package/extensions/dist/lint.js +72 -0
  13. package/extensions/editor.css +59 -0
  14. package/extensions/ui.css +162 -0
  15. package/package.json +28 -21
  16. package/config/.schema.json +0 -203
  17. package/dist/addon/table.js +0 -494
  18. package/dist/addon/token.js +0 -392
  19. package/dist/addon/transclude.js +0 -184
  20. package/dist/base.d.ts +0 -81
  21. package/dist/base.js +0 -40
  22. package/dist/index.d.ts +0 -33
  23. package/dist/index.js +0 -275
  24. package/dist/internal.d.ts +0 -47
  25. package/dist/lib/element.d.ts +0 -125
  26. package/dist/lib/element.js +0 -377
  27. package/dist/lib/node.d.ts +0 -173
  28. package/dist/lib/node.js +0 -478
  29. package/dist/lib/range.d.ts +0 -105
  30. package/dist/lib/range.js +0 -406
  31. package/dist/lib/ranges.d.ts +0 -28
  32. package/dist/lib/ranges.js +0 -126
  33. package/dist/lib/rect.d.ts +0 -18
  34. package/dist/lib/rect.js +0 -36
  35. package/dist/lib/text.d.ts +0 -58
  36. package/dist/lib/text.js +0 -414
  37. package/dist/lib/title.d.ts +0 -49
  38. package/dist/lib/title.js +0 -253
  39. package/dist/mixin/attributesParent.d.ts +0 -49
  40. package/dist/mixin/attributesParent.js +0 -80
  41. package/dist/mixin/fixed.d.ts +0 -5
  42. package/dist/mixin/fixed.js +0 -32
  43. package/dist/mixin/flagsParent.d.ts +0 -43
  44. package/dist/mixin/flagsParent.js +0 -64
  45. package/dist/mixin/hidden.d.ts +0 -7
  46. package/dist/mixin/hidden.js +0 -39
  47. package/dist/mixin/magicLinkParent.d.ts +0 -19
  48. package/dist/mixin/magicLinkParent.js +0 -43
  49. package/dist/mixin/singleLine.d.ts +0 -5
  50. package/dist/mixin/singleLine.js +0 -25
  51. package/dist/mixin/sol.d.ts +0 -6
  52. package/dist/mixin/sol.js +0 -45
  53. package/dist/mixin/syntax.d.ts +0 -8
  54. package/dist/mixin/syntax.js +0 -46
  55. package/dist/parser/braces.js +0 -152
  56. package/dist/parser/commentAndExt.js +0 -84
  57. package/dist/parser/converter.js +0 -41
  58. package/dist/parser/externalLinks.js +0 -39
  59. package/dist/parser/hrAndDoubleUnderscore.js +0 -44
  60. package/dist/parser/html.js +0 -40
  61. package/dist/parser/links.js +0 -103
  62. package/dist/parser/list.js +0 -116
  63. package/dist/parser/magicLinks.js +0 -55
  64. package/dist/parser/quotes.js +0 -69
  65. package/dist/parser/redirect.js +0 -28
  66. package/dist/parser/selector.js +0 -393
  67. package/dist/parser/table.js +0 -125
  68. package/dist/src/arg.d.ts +0 -49
  69. package/dist/src/arg.js +0 -219
  70. package/dist/src/atom.d.ts +0 -14
  71. package/dist/src/atom.js +0 -54
  72. package/dist/src/attribute.d.ts +0 -64
  73. package/dist/src/attribute.js +0 -478
  74. package/dist/src/attributes.d.ts +0 -103
  75. package/dist/src/attributes.js +0 -380
  76. package/dist/src/converter.d.ts +0 -28
  77. package/dist/src/converter.js +0 -153
  78. package/dist/src/converterFlags.d.ts +0 -80
  79. package/dist/src/converterFlags.js +0 -241
  80. package/dist/src/converterRule.d.ts +0 -71
  81. package/dist/src/converterRule.js +0 -218
  82. package/dist/src/extLink.d.ts +0 -36
  83. package/dist/src/extLink.js +0 -223
  84. package/dist/src/gallery.d.ts +0 -47
  85. package/dist/src/gallery.js +0 -145
  86. package/dist/src/heading.d.ts +0 -44
  87. package/dist/src/heading.js +0 -222
  88. package/dist/src/hidden.d.ts +0 -9
  89. package/dist/src/hidden.js +0 -82
  90. package/dist/src/html.d.ts +0 -61
  91. package/dist/src/html.js +0 -344
  92. package/dist/src/imageParameter.d.ts +0 -60
  93. package/dist/src/imageParameter.js +0 -262
  94. package/dist/src/imagemap.d.ts +0 -47
  95. package/dist/src/imagemap.js +0 -148
  96. package/dist/src/imagemapLink.d.ts +0 -35
  97. package/dist/src/imagemapLink.js +0 -99
  98. package/dist/src/index.d.ts +0 -136
  99. package/dist/src/index.js +0 -790
  100. package/dist/src/link/base.d.ts +0 -52
  101. package/dist/src/link/base.js +0 -258
  102. package/dist/src/link/category.d.ts +0 -22
  103. package/dist/src/link/category.js +0 -36
  104. package/dist/src/link/file.d.ts +0 -102
  105. package/dist/src/link/file.js +0 -335
  106. package/dist/src/link/galleryImage.d.ts +0 -29
  107. package/dist/src/link/galleryImage.js +0 -133
  108. package/dist/src/link/index.d.ts +0 -39
  109. package/dist/src/link/index.js +0 -100
  110. package/dist/src/link/redirectTarget.d.ts +0 -27
  111. package/dist/src/link/redirectTarget.js +0 -71
  112. package/dist/src/magicLink.d.ts +0 -57
  113. package/dist/src/magicLink.js +0 -261
  114. package/dist/src/nested.d.ts +0 -40
  115. package/dist/src/nested.js +0 -108
  116. package/dist/src/nowiki/base.d.ts +0 -28
  117. package/dist/src/nowiki/base.js +0 -90
  118. package/dist/src/nowiki/comment.d.ts +0 -14
  119. package/dist/src/nowiki/comment.js +0 -123
  120. package/dist/src/nowiki/dd.d.ts +0 -8
  121. package/dist/src/nowiki/dd.js +0 -74
  122. package/dist/src/nowiki/doubleUnderscore.d.ts +0 -15
  123. package/dist/src/nowiki/doubleUnderscore.js +0 -101
  124. package/dist/src/nowiki/hr.d.ts +0 -5
  125. package/dist/src/nowiki/hr.js +0 -72
  126. package/dist/src/nowiki/index.d.ts +0 -14
  127. package/dist/src/nowiki/index.js +0 -30
  128. package/dist/src/nowiki/list.d.ts +0 -5
  129. package/dist/src/nowiki/list.js +0 -67
  130. package/dist/src/nowiki/listBase.d.ts +0 -23
  131. package/dist/src/nowiki/listBase.js +0 -100
  132. package/dist/src/nowiki/noinclude.d.ts +0 -6
  133. package/dist/src/nowiki/noinclude.js +0 -77
  134. package/dist/src/nowiki/quote.d.ts +0 -14
  135. package/dist/src/nowiki/quote.js +0 -149
  136. package/dist/src/onlyinclude.d.ts +0 -13
  137. package/dist/src/onlyinclude.js +0 -60
  138. package/dist/src/paramTag/index.d.ts +0 -28
  139. package/dist/src/paramTag/index.js +0 -80
  140. package/dist/src/paramTag/inputbox.d.ts +0 -8
  141. package/dist/src/paramTag/inputbox.js +0 -24
  142. package/dist/src/parameter.d.ts +0 -60
  143. package/dist/src/parameter.js +0 -267
  144. package/dist/src/pre.d.ts +0 -28
  145. package/dist/src/pre.js +0 -62
  146. package/dist/src/redirect.d.ts +0 -30
  147. package/dist/src/redirect.js +0 -128
  148. package/dist/src/syntax.d.ts +0 -15
  149. package/dist/src/syntax.js +0 -87
  150. package/dist/src/table/base.d.ts +0 -28
  151. package/dist/src/table/base.js +0 -81
  152. package/dist/src/table/index.d.ts +0 -230
  153. package/dist/src/table/index.js +0 -506
  154. package/dist/src/table/td.d.ts +0 -72
  155. package/dist/src/table/td.js +0 -375
  156. package/dist/src/table/tr.d.ts +0 -30
  157. package/dist/src/table/tr.js +0 -61
  158. package/dist/src/table/trBase.d.ts +0 -49
  159. package/dist/src/table/trBase.js +0 -165
  160. package/dist/src/tagPair/ext.d.ts +0 -29
  161. package/dist/src/tagPair/ext.js +0 -217
  162. package/dist/src/tagPair/include.d.ts +0 -33
  163. package/dist/src/tagPair/include.js +0 -132
  164. package/dist/src/tagPair/index.d.ts +0 -23
  165. package/dist/src/tagPair/index.js +0 -130
  166. package/dist/src/transclude.d.ts +0 -159
  167. package/dist/src/transclude.js +0 -598
  168. package/dist/util/constants.js +0 -26
  169. package/dist/util/debug.js +0 -95
  170. package/dist/util/diff.js +0 -83
  171. package/dist/util/html.js +0 -146
  172. package/dist/util/lint.js +0 -32
  173. package/dist/util/string.js +0 -107
  174. package/errors/README +0 -3
  175. package/printed/README +0 -3
package/dist/lib/title.js DELETED
@@ -1,253 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Title = void 0;
4
- const string_1 = require("../util/string");
5
- /* NOT FOR BROWSER */
6
- const constants_1 = require("../util/constants");
7
- const index_1 = require("../index");
8
- /* NOT FOR BROWSER END */
9
- /** MediaWiki页面标题对象 */
10
- class Title {
11
- #main;
12
- #namespaces;
13
- #ns;
14
- #fragment;
15
- interwiki = '';
16
- valid;
17
- /** @private */
18
- encoded = false;
19
- /* NOT FOR BROWSER */
20
- #redirectFragment;
21
- #path;
22
- /** @private */
23
- conversionTable = new Map();
24
- /** @private */
25
- redirects = new Map();
26
- /* NOT FOR BROWSER END */
27
- /** 命名空间 */
28
- get ns() {
29
- return this.#ns;
30
- }
31
- /** 片段标识符 */
32
- get fragment() {
33
- return this.#fragment;
34
- }
35
- /** 不含命名空间的标题主体部分 */
36
- get main() {
37
- return this.#main;
38
- }
39
- set main(title) {
40
- title = title.replace(/_/gu, ' ').trim();
41
- this.#main = title && title[0].toUpperCase() + title.slice(1);
42
- }
43
- /** 命名空间前缀 */
44
- get prefix() {
45
- const namespace = this.#namespaces[this.ns];
46
- return namespace + (namespace && ':');
47
- }
48
- /** 完整标题 */
49
- get title() {
50
- return this.getRedirection()[1];
51
- }
52
- /** 扩展名 */
53
- get extension() {
54
- const { main } = this, i = main.lastIndexOf('.');
55
- return i === -1 ? undefined : main.slice(i + 1).toLowerCase();
56
- }
57
- /* NOT FOR BROWSER */
58
- set extension(extension) {
59
- extension ||= '';
60
- const { main } = this, i = main.lastIndexOf('.');
61
- this.main = (i === -1 ? main : main.slice(0, i)) + (extension && '.') + extension;
62
- }
63
- /** @throws `RangeError` undefined namespace */
64
- set ns(ns) {
65
- if (!(this.ns in this.#namespaces)) {
66
- throw new RangeError('Undefined namespace!');
67
- }
68
- this.#ns = Number(ns);
69
- }
70
- set fragment(fragment) {
71
- if (fragment === undefined) {
72
- this.#fragment = undefined;
73
- }
74
- else {
75
- fragment = (0, string_1.decodeHtml)(fragment);
76
- if (fragment.includes('%')) {
77
- try {
78
- fragment = (0, string_1.rawurldecode)(fragment);
79
- }
80
- catch { }
81
- }
82
- this.#fragment = fragment.replace(/[_ ]+/gu, ' ').trimEnd().replaceAll(' ', '_');
83
- }
84
- }
85
- /* NOT FOR BROWSER END */
86
- /**
87
- * @see MediaWikiTitleCodec::splitTitleString
88
- *
89
- * @param title 标题(含或不含命名空间前缀)
90
- * @param defaultNs 命名空间
91
- * @param decode 是否需要解码
92
- * @param selfLink 是否允许selfLink
93
- */
94
- constructor(title, defaultNs, config, decode, selfLink) {
95
- const subpage = title.trim().startsWith('../');
96
- title = (0, string_1.decodeHtml)(title);
97
- if (decode && title.includes('%')) {
98
- try {
99
- const encoded = /%(?!21|3[ce]|5[bd]|7[b-d])[\da-f]{2}/iu.test(title);
100
- title = (0, string_1.rawurldecode)(title);
101
- this.encoded = encoded;
102
- }
103
- catch { }
104
- }
105
- title = title.replace(/[_ ]+/gu, ' ').trim();
106
- if (subpage) {
107
- this.#ns = 0;
108
- }
109
- else {
110
- let ns = defaultNs;
111
- if (title.startsWith(':')) {
112
- ns = 0;
113
- title = title.slice(1).trim();
114
- }
115
- /* NOT FOR BROWSER */
116
- const iw = defaultNs ? null : index_1.default.isInterwiki(title, config);
117
- if (iw) {
118
- this.interwiki = iw[1].toLowerCase();
119
- title = title.slice(iw.indices[0][1]);
120
- }
121
- /* NOT FOR BROWSER END */
122
- const m = title.split(':');
123
- if (m.length > 1) {
124
- const k = m[0].trim().toLowerCase(), id = Object.prototype.hasOwnProperty.call(config.nsid, k) && config.nsid[k];
125
- if (id) {
126
- ns = id;
127
- title = m.slice(1).join(':').trim();
128
- }
129
- }
130
- this.#ns = ns;
131
- }
132
- const i = title.indexOf('#');
133
- if (i !== -1) {
134
- let fragment = title.slice(i + 1).trimEnd();
135
- if (fragment.includes('%')) {
136
- try {
137
- fragment = (0, string_1.rawurldecode)(fragment);
138
- }
139
- catch { }
140
- }
141
- this.#fragment = fragment.replace(/ /gu, '_');
142
- title = title.slice(0, i).trim();
143
- }
144
- this.valid = Boolean(title || this.interwiki || selfLink && this.ns === 0 && this.#fragment !== undefined)
145
- && (0, string_1.decodeHtml)(title) === title
146
- && !/^:|\0\d+[eh!+-]\x7F|[<>[\]{}|\n]|%[\da-f]{2}|(?:^|\/)\.{1,2}(?:$|\/)/iu.test(subpage ? /^(?:\.\.\/)+(.*)/u.exec(title)[1] : title);
147
- this.main = title;
148
- Object.defineProperties(this, {
149
- encoded: { enumerable: false, writable: false },
150
- /* NOT FOR BROWSER */
151
- valid: { writable: false },
152
- conversionTable: { enumerable: false },
153
- redirects: { enumerable: false },
154
- });
155
- this.#namespaces = config.namespaces;
156
- this.#path = config.articlePath || '/wiki/$1';
157
- }
158
- /** @private */
159
- toString(display) {
160
- return `${display ? this.title.replace(/_/gu, ' ') : this.title}${this.#fragment === undefined
161
- && this.#redirectFragment === undefined
162
- ? ''
163
- : `#${this.#fragment
164
- ?? this.#redirectFragment}`}`;
165
- }
166
- /** 检测是否是重定向 */
167
- getRedirection() {
168
- const prefix = this.interwiki + (this.interwiki && ':') + this.prefix;
169
- let title = (prefix + this.main).replace(/ /gu, '_');
170
- /* NOT FOR BROWSER */
171
- let redirected = this.#redirect(title);
172
- if (redirected) {
173
- return [true, redirected];
174
- }
175
- this.autoConvert();
176
- title = (prefix + this.main).replaceAll(' ', '_');
177
- redirected = this.#redirect(title);
178
- if (redirected) {
179
- return [true, redirected];
180
- }
181
- /* NOT FOR BROWSER END */
182
- return [false, title];
183
- }
184
- /** @private */
185
- setFragment(fragment) {
186
- this.#fragment = fragment;
187
- }
188
- /* NOT FOR BROWSER */
189
- /**
190
- * 处理重定向
191
- * @param title 原标题
192
- */
193
- #redirect(title) {
194
- const media = title.startsWith('Media:');
195
- if (media) {
196
- title = `File:${title.slice(6)}`;
197
- }
198
- const redirected = this.redirects.get(title);
199
- if (redirected) {
200
- [title, this.#redirectFragment] = redirected.split('#', 2);
201
- return media ? title.replace(/^File:/u, 'Media:') : title;
202
- }
203
- return '';
204
- }
205
- /** 执行单向转换 */
206
- autoConvert() {
207
- const { conversionTable } = this;
208
- if (conversionTable.size > 0) {
209
- const regex = new RegExp([...conversionTable.keys()].sort().reverse().map(string_1.escapeRegExp).join('|'), 'gu');
210
- this.main = this.main.replace(regex, p => conversionTable.get(p));
211
- }
212
- }
213
- /** 转换为主页面 */
214
- toSubjectPage() {
215
- if (this.isTalkPage()) {
216
- this.#ns--;
217
- }
218
- }
219
- /** 转换为讨论页面 */
220
- toTalkPage() {
221
- if (!this.isTalkPage()) {
222
- this.#ns++;
223
- }
224
- }
225
- /** 是否是讨论页 */
226
- isTalkPage() {
227
- return this.ns % 2 === 1;
228
- }
229
- /** 转换为上一级页面 */
230
- toBasePage() {
231
- this.main = this.main.replace(/\/[^/]*$/u, '');
232
- }
233
- /** 转换为根页面 */
234
- toRootPage() {
235
- this.main = this.main.replace(/\/.*/u, '');
236
- }
237
- /** 生成URL */
238
- getUrl() {
239
- const { title, fragment } = this;
240
- if (title) {
241
- return this.#path.replace('$1', `${encodeURIComponent(title)}${fragment === undefined && this.#redirectFragment === undefined
242
- ? ''
243
- : `#${encodeURIComponent(fragment ?? this.#redirectFragment)}`}`);
244
- }
245
- return fragment === undefined ? '' : `#${encodeURIComponent(fragment)}`;
246
- }
247
- /** @private */
248
- getTitleAttr() {
249
- return this.title.replace(/^Media:/u, '').replace(/["_]/gu, p => p === '"' ? '&quot;' : ' ');
250
- }
251
- }
252
- exports.Title = Title;
253
- constants_1.classes['Title'] = __filename;
@@ -1,49 +0,0 @@
1
- export interface AttributesParentBase {
2
- /** getAttrs()方法的getter写法 */
3
- attributes: Record<string, string | true>;
4
- /** 以字符串表示的class属性 */
5
- className: string;
6
- /** 以Set表示的class属性 */
7
- classList: Set<string>;
8
- /** id属性 */
9
- id: string;
10
- /**
11
- * 获取AttributesToken子节点的属性
12
- * @param key 属性键
13
- */
14
- getAttr(key: string): string | true | undefined;
15
- /**
16
- * AttributesToken子节点是否具有某属性
17
- * @param key 属性键
18
- */
19
- hasAttr(key: string): boolean;
20
- /** 列举AttributesToken子节点的属性键 */
21
- getAttrNames(): Set<string>;
22
- /** 获取AttributesToken子节点的全部标签属性 */
23
- getAttrs(): Record<string, string | true>;
24
- /**
25
- * 对AttributesToken子节点设置属性
26
- * @param key 属性键
27
- * @param value 属性值
28
- * @param prop 属性对象
29
- */
30
- setAttr(key: string, value: string | boolean): void;
31
- setAttr(prop: Record<string, string | boolean>): void;
32
- /**
33
- * 移除AttributesToken子节点的某属性
34
- * @param key 属性键
35
- */
36
- removeAttr(key: string): void;
37
- /**
38
- * 开关AttributesToken子节点的某属性
39
- * @param key 属性键
40
- * @param force 强制开启或关闭
41
- */
42
- toggleAttr(key: string, force?: boolean): void;
43
- }
44
- /**
45
- * 子节点含有AttributesToken的类
46
- * @param i AttributesToken子节点的位置
47
- * @param constructor 基类
48
- * @param _ context
49
- */
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.attributesParent = void 0;
4
- const debug_1 = require("../util/debug");
5
- /* NOT FOR BROWSER */
6
- const constants_1 = require("../util/constants");
7
- /**
8
- * 子节点含有AttributesToken的类
9
- * @param i AttributesToken子节点的位置
10
- * @param constructor 基类
11
- * @param _ context
12
- */
13
- const attributesParent = (i = 0) => (constructor, _) => {
14
- /** 子节点含有AttributesToken的类 */
15
- class AttributesParent extends constructor {
16
- /** AttributesToken子节点 */
17
- get #attributesChild() {
18
- return this.childNodes[i];
19
- }
20
- /* NOT FOR BROWSER */
21
- /** @implements */
22
- get attributes() {
23
- return this.#attributesChild.attributes;
24
- }
25
- set attributes(attributes) {
26
- this.#attributesChild.attributes = attributes;
27
- }
28
- /** @implements */
29
- get className() {
30
- return this.#attributesChild.className;
31
- }
32
- set className(className) {
33
- this.#attributesChild.className = className;
34
- }
35
- /** @implements */
36
- get classList() {
37
- return this.#attributesChild.classList;
38
- }
39
- /** @implements */
40
- get id() {
41
- return this.#attributesChild.id;
42
- }
43
- set id(id) {
44
- this.#attributesChild.id = id;
45
- }
46
- /* NOT FOR BROWSER END */
47
- /** @implements */
48
- getAttr(key) {
49
- return this.#attributesChild.getAttr(key);
50
- }
51
- /* NOT FOR BROWSER */
52
- /** @implements */
53
- hasAttr(key) {
54
- return this.#attributesChild.hasAttr(key);
55
- }
56
- /** @implements */
57
- getAttrNames() {
58
- return this.#attributesChild.getAttrNames();
59
- }
60
- /** @implements */
61
- getAttrs() {
62
- return this.#attributesChild.getAttrs();
63
- }
64
- setAttr(keyOrProp, value) {
65
- this.#attributesChild.setAttr(keyOrProp, value);
66
- }
67
- /** @implements */
68
- removeAttr(key) {
69
- this.#attributesChild.removeAttr(key);
70
- }
71
- /** @implements */
72
- toggleAttr(key, force) {
73
- this.#attributesChild.toggleAttr(key, force);
74
- }
75
- }
76
- (0, debug_1.mixin)(AttributesParent, constructor);
77
- return AttributesParent;
78
- };
79
- exports.attributesParent = attributesParent;
80
- constants_1.mixins['attributesParent'] = __filename;
@@ -1,5 +0,0 @@
1
- /**
2
- * 不可增删子节点的类
3
- * @param constructor 基类
4
- * @param _ context
5
- */
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fixedToken = void 0;
4
- const debug_1 = require("../util/debug");
5
- const constants_1 = require("../util/constants");
6
- /**
7
- * 不可增删子节点的类
8
- * @param constructor 基类
9
- * @param _ context
10
- */
11
- const fixedToken = (constructor, _) => {
12
- /** 不可增删子节点的类 */
13
- class FixedToken extends constructor {
14
- /** @private */
15
- get fixed() {
16
- return true;
17
- }
18
- /** @override */
19
- removeAt() {
20
- this.constructorError('cannot remove child nodes');
21
- }
22
- insertAt(token, i) {
23
- return debug_1.Shadow.running
24
- ? super.insertAt(token, i)
25
- : this.constructorError('cannot insert child nodes');
26
- }
27
- }
28
- (0, debug_1.mixin)(FixedToken, constructor);
29
- return FixedToken;
30
- };
31
- exports.fixedToken = fixedToken;
32
- constants_1.mixins['fixedToken'] = __filename;
@@ -1,43 +0,0 @@
1
- import type { ConverterFlagsToken } from '../src/converterFlags';
2
- export interface FlagsParentBase {
3
- /** 所有转换类型标记 */
4
- flags: Set<string>;
5
- /** 获取所有转换类型标记 */
6
- getAllFlags(): Set<string>;
7
- /** 获取有效的转换类型标记 */
8
- getEffectiveFlags(): Set<string>;
9
- /** 获取未知的转换类型标记 */
10
- getUnknownFlags(): Set<string>;
11
- /** 获取指定语言变体的转换标记 */
12
- getVariantFlags(): Set<string>;
13
- /**
14
- * 是否具有某转换类型标记
15
- * @param flag 转换类型标记
16
- */
17
- hasFlag(flag: string): boolean;
18
- /**
19
- * 是否具有某有效的转换类型标记
20
- * @param flag 转换类型标记
21
- */
22
- hasEffectiveFlag(flag: string): boolean;
23
- /**
24
- * 移除转换类型标记
25
- * @param flag 转换类型标记
26
- */
27
- removeFlag(flag: string): void;
28
- /**
29
- * 设置转换类型标记
30
- * @param flag 转换类型标记
31
- */
32
- setFlag(flag: string): void;
33
- /**
34
- * 开关某转换类型标记
35
- * @param flag 转换类型标记
36
- */
37
- toggleFlag(flag: string): void;
38
- }
39
- /**
40
- * ConverterToken
41
- * @param constructor 基类
42
- * @param _ context
43
- */
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.flagsParent = void 0;
4
- const debug_1 = require("../util/debug");
5
- const constants_1 = require("../util/constants");
6
- /* NOT FOR BROWSER END */
7
- /**
8
- * ConverterToken
9
- * @param constructor 基类
10
- * @param _ context
11
- */
12
- const flagsParent = (constructor, _) => {
13
- /** 子节点含有ConverterFlagsToken的类 */
14
- class FlagsParent extends constructor {
15
- /* NOT FOR BROWSER */
16
- /** @implements */
17
- get flags() {
18
- return this.firstChild.flags;
19
- }
20
- set flags(value) {
21
- this.firstChild.flags = value;
22
- }
23
- /** @implements */
24
- getAllFlags() {
25
- return this.firstChild.getAllFlags();
26
- }
27
- /** @implements */
28
- getEffectiveFlags() {
29
- return this.firstChild.getEffectiveFlags();
30
- }
31
- /** @implements */
32
- getUnknownFlags() {
33
- return this.firstChild.getUnknownFlags();
34
- }
35
- /** @implements */
36
- getVariantFlags() {
37
- return this.firstChild.getVariantFlags();
38
- }
39
- /** @implements */
40
- hasFlag(flag) {
41
- return this.firstChild.hasFlag(flag);
42
- }
43
- /** @implements */
44
- hasEffectiveFlag(flag) {
45
- return this.firstChild.hasEffectiveFlag(flag);
46
- }
47
- /** @implements */
48
- removeFlag(flag) {
49
- this.firstChild.removeFlag(flag);
50
- }
51
- /** @implements */
52
- setFlag(flag) {
53
- this.firstChild.setFlag(flag);
54
- }
55
- /** @implements */
56
- toggleFlag(flag) {
57
- this.firstChild.toggleFlag(flag);
58
- }
59
- }
60
- (0, debug_1.mixin)(FlagsParent, constructor);
61
- return FlagsParent;
62
- };
63
- exports.flagsParent = flagsParent;
64
- constants_1.mixins['flagsParent'] = __filename;
@@ -1,7 +0,0 @@
1
- /**
2
- * 解析后不可见的类
3
- * @param linter 是否覆写 lint 方法
4
- * @param html 是否覆写 toHtml 方法
5
- * @param constructor 基类
6
- * @param _ context
7
- */
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hiddenToken = void 0;
4
- const debug_1 = require("../util/debug");
5
- /* NOT FOR BROWSER */
6
- const constants_1 = require("../util/constants");
7
- /* NOT FOR BROWSER END */
8
- /**
9
- * 解析后不可见的类
10
- * @param linter 是否覆写 lint 方法
11
- * @param html 是否覆写 toHtml 方法
12
- * @param constructor 基类
13
- * @param _ context
14
- */
15
- const hiddenToken = (linter = true, html = true) => (constructor, _) => {
16
- /** 解析后不可见的类 */
17
- class AnyHiddenToken extends constructor {
18
- /** 没有可见部分 */
19
- text() {
20
- return '';
21
- }
22
- lint(start) {
23
- // @ts-expect-error private argument
24
- return linter ? [] : super.lint(start);
25
- }
26
- /* NOT FOR BROWSER */
27
- /** @private */
28
- dispatchEvent() {
29
- //
30
- }
31
- toHtmlInternal() {
32
- return html ? '' : super.toHtmlInternal();
33
- }
34
- }
35
- (0, debug_1.mixin)(AnyHiddenToken, constructor);
36
- return AnyHiddenToken;
37
- };
38
- exports.hiddenToken = hiddenToken;
39
- constants_1.mixins['hiddenToken'] = __filename;
@@ -1,19 +0,0 @@
1
- import type { MagicLinkToken } from '../src/magicLink';
2
- export interface MagicLinkParentBase {
3
- /** 协议 */
4
- protocol: string | undefined;
5
- /** 和内链保持一致 */
6
- link: string;
7
- /** 获取网址 */
8
- getUrl(): URL;
9
- /**
10
- * 设置链接目标
11
- * @param url 网址
12
- */
13
- setTarget(url: string): void;
14
- }
15
- /**
16
- * ExtLinkToken
17
- * @param constructor 基类
18
- * @param _ context
19
- */
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.magicLinkParent = void 0;
4
- const debug_1 = require("../util/debug");
5
- const constants_1 = require("../util/constants");
6
- /* NOT FOR BROWSER END */
7
- /**
8
- * ExtLinkToken
9
- * @param constructor 基类
10
- * @param _ context
11
- */
12
- const magicLinkParent = (constructor, _) => {
13
- /** 子节点含有MagicLinkParent的类 */
14
- class MagicLinkParent extends constructor {
15
- /* NOT FOR BROWSER */
16
- /** @implements */
17
- get protocol() {
18
- return this.firstChild.protocol;
19
- }
20
- set protocol(value) {
21
- this.firstChild.protocol = value;
22
- }
23
- /** @implements */
24
- get link() {
25
- return this.firstChild.link;
26
- }
27
- set link(url) {
28
- this.firstChild.link = url;
29
- }
30
- /** @implements */
31
- getUrl() {
32
- return this.firstChild.getUrl();
33
- }
34
- /** @implements */
35
- setTarget(url) {
36
- this.firstChild.setTarget(url);
37
- }
38
- }
39
- (0, debug_1.mixin)(MagicLinkParent, constructor);
40
- return MagicLinkParent;
41
- };
42
- exports.magicLinkParent = magicLinkParent;
43
- constants_1.mixins['magicLinkParent'] = __filename;
@@ -1,5 +0,0 @@
1
- /**
2
- * 不可包含换行符的类
3
- * @param constructor 基类
4
- * @param _ context
5
- */
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.singleLine = void 0;
4
- const debug_1 = require("../util/debug");
5
- const constants_1 = require("../util/constants");
6
- /**
7
- * 不可包含换行符的类
8
- * @param constructor 基类
9
- * @param _ context
10
- */
11
- const singleLine = (constructor, _) => {
12
- /** 不可包含换行符的类 */
13
- class SingleLineToken extends constructor {
14
- toString(skip) {
15
- return super.toString(skip).replaceAll('\n', ' ');
16
- }
17
- text() {
18
- return super.text().replaceAll('\n', ' ');
19
- }
20
- }
21
- (0, debug_1.mixin)(SingleLineToken, constructor);
22
- return SingleLineToken;
23
- };
24
- exports.singleLine = singleLine;
25
- constants_1.mixins['singleLine'] = __filename;
@@ -1,6 +0,0 @@
1
- /**
2
- * 只能位于行首的类
3
- * @param self 是否允许同类节点相邻
4
- * @param constructor 基类
5
- * @param _ context
6
- */