wikiparser-node 0.11.0 → 1.0.0-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 (179) hide show
  1. package/README.md +10 -9
  2. package/bundle/bundle.min.js +37 -0
  3. package/config/llwiki.json +1 -35
  4. package/config/minimum.json +136 -0
  5. package/config/moegirl.json +1 -44
  6. package/config/zhwiki.json +1 -466
  7. package/extensions/dist/base.js +105 -0
  8. package/extensions/dist/editor.js +172 -0
  9. package/extensions/dist/highlight.js +46 -0
  10. package/extensions/dist/lint.js +43 -0
  11. package/extensions/editor.css +63 -0
  12. package/extensions/ui.css +119 -0
  13. package/i18n/zh-hans.json +1 -0
  14. package/i18n/zh-hant.json +1 -0
  15. package/package.json +38 -31
  16. package/config/.schema.json +0 -134
  17. package/dist/index.d.ts +0 -114
  18. package/dist/lib/element.d.ts +0 -162
  19. package/dist/lib/node.d.ts +0 -291
  20. package/dist/lib/ranges.d.ts +0 -37
  21. package/dist/lib/text.d.ts +0 -64
  22. package/dist/lib/title.d.ts +0 -21
  23. package/dist/mixin/attributeParent.d.ts +0 -9
  24. package/dist/mixin/fixedToken.d.ts +0 -8
  25. package/dist/mixin/hidden.d.ts +0 -8
  26. package/dist/mixin/singleLine.d.ts +0 -8
  27. package/dist/mixin/sol.d.ts +0 -8
  28. package/dist/parser/brackets.d.ts +0 -12
  29. package/dist/parser/commentAndExt.d.ts +0 -8
  30. package/dist/parser/converter.d.ts +0 -7
  31. package/dist/parser/externalLinks.d.ts +0 -7
  32. package/dist/parser/hrAndDoubleUnderscore.d.ts +0 -11
  33. package/dist/parser/html.d.ts +0 -7
  34. package/dist/parser/links.d.ts +0 -7
  35. package/dist/parser/list.d.ts +0 -7
  36. package/dist/parser/magicLinks.d.ts +0 -7
  37. package/dist/parser/quotes.d.ts +0 -7
  38. package/dist/parser/selector.d.ts +0 -12
  39. package/dist/parser/table.d.ts +0 -11
  40. package/dist/src/arg.d.ts +0 -54
  41. package/dist/src/atom/hidden.d.ts +0 -5
  42. package/dist/src/atom/index.d.ts +0 -15
  43. package/dist/src/attribute.d.ts +0 -65
  44. package/dist/src/attributes.d.ts +0 -112
  45. package/dist/src/charinsert.d.ts +0 -32
  46. package/dist/src/converter.d.ts +0 -103
  47. package/dist/src/converterFlags.d.ts +0 -83
  48. package/dist/src/converterRule.d.ts +0 -75
  49. package/dist/src/extLink.d.ts +0 -62
  50. package/dist/src/gallery.d.ts +0 -33
  51. package/dist/src/hasNowiki/index.d.ts +0 -14
  52. package/dist/src/hasNowiki/pre.d.ts +0 -13
  53. package/dist/src/heading.d.ts +0 -44
  54. package/dist/src/html.d.ts +0 -56
  55. package/dist/src/imageParameter.d.ts +0 -65
  56. package/dist/src/imagemap.d.ts +0 -37
  57. package/dist/src/imagemapLink.d.ts +0 -21
  58. package/dist/src/index.d.ts +0 -186
  59. package/dist/src/link/category.d.ts +0 -16
  60. package/dist/src/link/file.d.ts +0 -85
  61. package/dist/src/link/galleryImage.d.ts +0 -15
  62. package/dist/src/link/index.d.ts +0 -88
  63. package/dist/src/magicLink.d.ts +0 -36
  64. package/dist/src/nested/choose.d.ts +0 -13
  65. package/dist/src/nested/combobox.d.ts +0 -13
  66. package/dist/src/nested/index.d.ts +0 -18
  67. package/dist/src/nested/references.d.ts +0 -13
  68. package/dist/src/nowiki/comment.d.ts +0 -31
  69. package/dist/src/nowiki/dd.d.ts +0 -17
  70. package/dist/src/nowiki/doubleUnderscore.d.ts +0 -22
  71. package/dist/src/nowiki/hr.d.ts +0 -13
  72. package/dist/src/nowiki/index.d.ts +0 -27
  73. package/dist/src/nowiki/list.d.ts +0 -8
  74. package/dist/src/nowiki/noinclude.d.ts +0 -8
  75. package/dist/src/nowiki/quote.d.ts +0 -13
  76. package/dist/src/onlyinclude.d.ts +0 -24
  77. package/dist/src/paramTag/index.d.ts +0 -29
  78. package/dist/src/paramTag/inputbox.d.ts +0 -8
  79. package/dist/src/parameter.d.ts +0 -75
  80. package/dist/src/syntax.d.ts +0 -20
  81. package/dist/src/table/index.d.ts +0 -273
  82. package/dist/src/table/td.d.ts +0 -100
  83. package/dist/src/table/tr.d.ts +0 -91
  84. package/dist/src/tagPair/ext.d.ts +0 -18
  85. package/dist/src/tagPair/include.d.ts +0 -25
  86. package/dist/src/tagPair/index.d.ts +0 -41
  87. package/dist/src/transclude.d.ts +0 -199
  88. package/dist/tool/index.d.ts +0 -420
  89. package/dist/util/base.d.ts +0 -10
  90. package/dist/util/debug.d.ts +0 -20
  91. package/dist/util/diff.d.ts +0 -8
  92. package/dist/util/lint.d.ts +0 -28
  93. package/dist/util/string.d.ts +0 -55
  94. package/index.js +0 -333
  95. package/lib/element.js +0 -618
  96. package/lib/node.js +0 -730
  97. package/lib/ranges.js +0 -130
  98. package/lib/text.js +0 -265
  99. package/lib/title.js +0 -83
  100. package/mixin/attributeParent.js +0 -117
  101. package/mixin/fixedToken.js +0 -40
  102. package/mixin/hidden.js +0 -21
  103. package/mixin/singleLine.js +0 -31
  104. package/mixin/sol.js +0 -54
  105. package/parser/brackets.js +0 -128
  106. package/parser/commentAndExt.js +0 -62
  107. package/parser/converter.js +0 -46
  108. package/parser/externalLinks.js +0 -33
  109. package/parser/hrAndDoubleUnderscore.js +0 -49
  110. package/parser/html.js +0 -42
  111. package/parser/links.js +0 -94
  112. package/parser/list.js +0 -59
  113. package/parser/magicLinks.js +0 -41
  114. package/parser/quotes.js +0 -64
  115. package/parser/selector.js +0 -180
  116. package/parser/table.js +0 -114
  117. package/src/arg.js +0 -207
  118. package/src/atom/hidden.js +0 -13
  119. package/src/atom/index.js +0 -43
  120. package/src/attribute.js +0 -472
  121. package/src/attributes.js +0 -453
  122. package/src/charinsert.js +0 -97
  123. package/src/converter.js +0 -176
  124. package/src/converterFlags.js +0 -284
  125. package/src/converterRule.js +0 -256
  126. package/src/extLink.js +0 -180
  127. package/src/gallery.js +0 -149
  128. package/src/hasNowiki/index.js +0 -44
  129. package/src/hasNowiki/pre.js +0 -40
  130. package/src/heading.js +0 -134
  131. package/src/html.js +0 -254
  132. package/src/imageParameter.js +0 -303
  133. package/src/imagemap.js +0 -199
  134. package/src/imagemapLink.js +0 -41
  135. package/src/index.js +0 -938
  136. package/src/link/category.js +0 -44
  137. package/src/link/file.js +0 -287
  138. package/src/link/galleryImage.js +0 -120
  139. package/src/link/index.js +0 -388
  140. package/src/magicLink.js +0 -151
  141. package/src/nested/choose.js +0 -24
  142. package/src/nested/combobox.js +0 -23
  143. package/src/nested/index.js +0 -96
  144. package/src/nested/references.js +0 -23
  145. package/src/nowiki/comment.js +0 -71
  146. package/src/nowiki/dd.js +0 -59
  147. package/src/nowiki/doubleUnderscore.js +0 -56
  148. package/src/nowiki/hr.js +0 -41
  149. package/src/nowiki/index.js +0 -56
  150. package/src/nowiki/list.js +0 -16
  151. package/src/nowiki/noinclude.js +0 -28
  152. package/src/nowiki/quote.js +0 -69
  153. package/src/onlyinclude.js +0 -64
  154. package/src/paramTag/index.js +0 -89
  155. package/src/paramTag/inputbox.js +0 -35
  156. package/src/parameter.js +0 -239
  157. package/src/syntax.js +0 -91
  158. package/src/table/index.js +0 -985
  159. package/src/table/td.js +0 -343
  160. package/src/table/tr.js +0 -319
  161. package/src/tagPair/ext.js +0 -146
  162. package/src/tagPair/include.js +0 -50
  163. package/src/tagPair/index.js +0 -131
  164. package/src/transclude.js +0 -843
  165. package/tool/index.js +0 -1209
  166. package/typings/api.d.ts +0 -9
  167. package/typings/array.d.ts +0 -29
  168. package/typings/event.d.ts +0 -22
  169. package/typings/index.d.ts +0 -118
  170. package/typings/node.d.ts +0 -35
  171. package/typings/parser.d.ts +0 -12
  172. package/typings/table.d.ts +0 -10
  173. package/typings/token.d.ts +0 -31
  174. package/typings/tool.d.ts +0 -6
  175. package/util/base.js +0 -17
  176. package/util/debug.js +0 -73
  177. package/util/diff.js +0 -76
  178. package/util/lint.js +0 -57
  179. package/util/string.js +0 -126
package/dist/index.d.ts DELETED
@@ -1,114 +0,0 @@
1
- import AstElement = require("./lib/element.js")
2
- import AstNode = require("./lib/node.js")
3
- import Ranges = require("./lib/ranges.js")
4
- import AstText = require("./lib/text.js")
5
- import Title = require("./lib/title.js")
6
- import ArgToken = require("./src/arg.js")
7
- import HiddenToken = require("./src/atom/hidden.js")
8
- import AtomToken = require("./src/atom/index.js")
9
- import AttributeToken = require("./src/attribute.js")
10
- import AttributesToken = require("./src/attributes.js")
11
- import CharinsertToken = require("./src/charinsert.js")
12
- import ConverterToken = require("./src/converter.js")
13
- import ConverterFlagsToken = require("./src/converterFlags.js")
14
- import ConverterRuleToken = require("./src/converterRule.js")
15
- import ExtLinkToken = require("./src/extLink.js")
16
- import GalleryToken = require("./src/gallery.js")
17
- import HasNowikiToken = require("./src/hasNowiki/index.js")
18
- import PreToken = require("./src/hasNowiki/pre.js")
19
- import HeadingToken = require("./src/heading.js")
20
- import HtmlToken = require("./src/html.js")
21
- import ImageParameterToken = require("./src/imageParameter.js")
22
- import ImagemapToken = require("./src/imagemap.js")
23
- import ImagemapLinkToken = require("./src/imagemapLink.js")
24
- import Token = require("./src/index.js")
25
- import CategoryToken = require("./src/link/category.js")
26
- import FileToken = require("./src/link/file.js")
27
- import GalleryImageToken = require("./src/link/galleryImage.js")
28
- import LinkToken = require("./src/link/index.js")
29
- import MagicLinkToken = require("./src/magicLink.js")
30
- import ChooseToken = require("./src/nested/choose.js")
31
- import ComboboxToken = require("./src/nested/combobox.js")
32
- import NestedToken = require("./src/nested/index.js")
33
- import ReferencesToken = require("./src/nested/references.js")
34
- import CommentToken = require("./src/nowiki/comment.js")
35
- import DdToken = require("./src/nowiki/dd.js")
36
- import DoubleUnderscoreToken = require("./src/nowiki/doubleUnderscore.js")
37
- import HrToken = require("./src/nowiki/hr.js")
38
- import NowikiToken = require("./src/nowiki/index.js")
39
- import ListToken = require("./src/nowiki/list.js")
40
- import NoincludeToken = require("./src/nowiki/noinclude.js")
41
- import QuoteToken = require("./src/nowiki/quote.js")
42
- import OnlyincludeToken = require("./src/onlyinclude.js")
43
- import ParamTagToken = require("./src/paramTag/index.js")
44
- import InputboxToken = require("./src/paramTag/inputbox.js")
45
- import ParameterToken = require("./src/parameter.js")
46
- import SyntaxToken = require("./src/syntax.js")
47
- import TableToken = require("./src/table/index.js")
48
- import TdToken = require("./src/table/td.js")
49
- import TrToken = require("./src/table/tr.js")
50
- import ExtToken = require("./src/tagPair/ext.js")
51
- import IncludeToken = require("./src/tagPair/include.js")
52
- import TagPairToken = require("./src/tagPair/index.js")
53
- import TranscludeToken = require("./src/transclude.js")
54
-
55
- export = Parser;
56
- declare const Parser: import('./../typings');
57
-
58
- declare namespace Parser {
59
- export {
60
- AstElement,
61
- AstNode,
62
- Ranges,
63
- AstText,
64
- Title,
65
- ArgToken,
66
- HiddenToken,
67
- AtomToken,
68
- AttributeToken,
69
- AttributesToken,
70
- CharinsertToken,
71
- ConverterToken,
72
- ConverterFlagsToken,
73
- ConverterRuleToken,
74
- ExtLinkToken,
75
- GalleryToken,
76
- HasNowikiToken,
77
- PreToken,
78
- HeadingToken,
79
- HtmlToken,
80
- ImageParameterToken,
81
- ImagemapToken,
82
- ImagemapLinkToken,
83
- Token,
84
- CategoryToken,
85
- FileToken,
86
- GalleryImageToken,
87
- LinkToken,
88
- MagicLinkToken,
89
- ChooseToken,
90
- ComboboxToken,
91
- NestedToken,
92
- ReferencesToken,
93
- CommentToken,
94
- DdToken,
95
- DoubleUnderscoreToken,
96
- HrToken,
97
- NowikiToken,
98
- ListToken,
99
- NoincludeToken,
100
- QuoteToken,
101
- OnlyincludeToken,
102
- ParamTagToken,
103
- InputboxToken,
104
- ParameterToken,
105
- SyntaxToken,
106
- TableToken,
107
- TdToken,
108
- TrToken,
109
- ExtToken,
110
- IncludeToken,
111
- TagPairToken,
112
- TranscludeToken,
113
- }
114
- }
@@ -1,162 +0,0 @@
1
- export = AstElement;
2
- /** 类似HTMLElement */
3
- declare class AstElement extends AstNode {
4
- /** @type {string} */ name: string;
5
- /** 子节点总数 */
6
- get length(): number;
7
- /**
8
- * 全部非文本子节点
9
- * @complexity `n`
10
- */
11
- get children(): AstElement[];
12
- /**
13
- * 首位非文本子节点
14
- * @returns {this}
15
- */
16
- get firstElementChild(): AstElement;
17
- /**
18
- * 末位非文本子节点
19
- * @complexity `n`
20
- */
21
- get lastElementChild(): AstElement;
22
- /**
23
- * 非文本子节点总数
24
- * @complexity `n`
25
- */
26
- get childElementCount(): number;
27
- /** 父节点 */
28
- get parentElement(): this;
29
- /**
30
- * AstElement.prototype.text()的getter写法
31
- * @complexity `n`
32
- */
33
- get outerText(): string;
34
- /**
35
- * 不可见
36
- */
37
- get hidden(): boolean;
38
- /**
39
- * 后一个可见的兄弟节点
40
- * @complexity `n`
41
- */
42
- get nextVisibleSibling(): this;
43
- /**
44
- * 前一个可见的兄弟节点
45
- * @complexity `n`
46
- */
47
- get previousVisibleSibling(): this;
48
- /** 内部高度 */
49
- get clientHeight(): number;
50
- /** 内部宽度 */
51
- get clientWidth(): number;
52
- /**
53
- * 销毁
54
- * @complexity `n`
55
- */
56
- destroy(): void;
57
- /**
58
- * 检查是否符合选择器
59
- * @param {string|SelectorArray[]} selector
60
- * @returns {boolean}
61
- * @complexity `n`
62
- */
63
- matches(selector: string | SelectorArray[]): boolean;
64
- /**
65
- * 符合选择器的第一个后代节点
66
- * @param {string} selector
67
- * @returns {this|undefined}
68
- * @complexity `n`
69
- */
70
- querySelector(selector: string): this | undefined;
71
- /**
72
- * 符合选择器的所有后代节点
73
- * @param {string} selector
74
- * @complexity `n`
75
- */
76
- querySelectorAll(selector: string): AstElement[];
77
- /**
78
- * id选择器
79
- * @param {string} id id名
80
- */
81
- getElementById(id: string): AstElement;
82
- /**
83
- * 类选择器
84
- * @param {string} className 类名之一
85
- */
86
- getElementsByClassName(className: string): AstElement[];
87
- /**
88
- * 标签名选择器
89
- * @param {string} name 标签名
90
- */
91
- getElementsByTagName(name: string): AstElement[];
92
- /**
93
- * 获取某一行的wikitext
94
- * @param {number} n 行号
95
- */
96
- getLine(n: number): string;
97
- /**
98
- * 在开头批量插入子节点
99
- * @param {...this} elements 插入节点
100
- * @complexity `n`
101
- */
102
- prepend(...elements: AstElement[]): void;
103
- /**
104
- * 最近的祖先节点
105
- * @param {string} selector
106
- */
107
- closest(selector: string): this;
108
- /**
109
- * 在末尾批量插入子节点
110
- * @param {...this} elements 插入节点
111
- * @complexity `n`
112
- */
113
- append(...elements: AstElement[]): void;
114
- /**
115
- * 批量替换子节点
116
- * @param {...this} elements 新的子节点
117
- * @complexity `n`
118
- */
119
- replaceChildren(...elements: AstElement[]): void;
120
- /**
121
- * 修改文本子节点
122
- * @param {string} str 新文本
123
- * @param {number} i 子节点位置
124
- * @throws `RangeError` 对应位置的子节点不是文本节点
125
- */
126
- setText(str: string, i?: number): string;
127
- /**
128
- * 还原为wikitext
129
- * @param {string} selector
130
- * @param {string} separator 子节点间的连接符
131
- * @returns {string}
132
- */
133
- toString(selector: string, separator?: string): string;
134
- /**
135
- * Linter
136
- * @param {number} start 起始位置
137
- */
138
- lint(start?: number): import("../../typings/token").LintError[];
139
- /**
140
- * 以HTML格式打印
141
- * @param {import('../../typings/node').printOpt} opt 选项
142
- * @returns {string}
143
- */
144
- print(opt?: import('../../typings/node').printOpt): string;
145
- /**
146
- * 保存为JSON
147
- * @param {string} file 文件名
148
- * @returns {Record<string, *>}
149
- */
150
- json(file: string): Record<string, any>;
151
- /**
152
- * 输出AST
153
- * @param {number} depth 当前深度
154
- */
155
- echo(depth?: number): void;
156
- #private;
157
- }
158
- declare namespace AstElement {
159
- export { SelectorArray };
160
- }
161
- import AstNode = require("./node");
162
- type SelectorArray = import('../../typings/parser').SelectorArray;
@@ -1,291 +0,0 @@
1
- export = AstNode;
2
- /** 类似Node */
3
- declare class AstNode {
4
- /** @type {string} */ type: string;
5
- /** @type {this[]} */ childNodes: this[];
6
- /** 首位子节点 */
7
- get firstChild(): this;
8
- /** 末位子节点 */
9
- get lastChild(): this;
10
- /** 父节点 */
11
- get parentNode(): this;
12
- /**
13
- * 后一个兄弟节点
14
- * @complexity `n`
15
- */
16
- get nextSibling(): this;
17
- /**
18
- * 前一个兄弟节点
19
- * @complexity `n`
20
- */
21
- get previousSibling(): this;
22
- /**
23
- * 后一个非文本兄弟节点
24
- * @complexity `n`
25
- * @returns {this}
26
- */
27
- get nextElementSibling(): this;
28
- /**
29
- * 前一个非文本兄弟节点
30
- * @complexity `n`
31
- * @returns {this}
32
- */
33
- get previousElementSibling(): this;
34
- /** 是否具有根节点 */
35
- get isConnected(): any;
36
- /** 不是自身的根节点 */
37
- get ownerDocument(): any;
38
- /**
39
- * 后方是否还有其他节点(不含后代)
40
- * @returns {boolean}
41
- * @complexity `n`
42
- */
43
- get eof(): boolean;
44
- /**
45
- * 标记仅用于代码调试的方法
46
- * @param {string} method
47
- * @throws `Error`
48
- */
49
- debugOnly(method?: string): void;
50
- /**
51
- * 抛出`TypeError`
52
- * @param {string} method
53
- * @param {...string} types 可接受的参数类型
54
- */
55
- typeError(method: string, ...types: string[]): never;
56
- /**
57
- * 冻结部分属性
58
- * @param {string|string[]} keys 属性键
59
- * @param {boolean} permanent 是否永久
60
- */
61
- seal(keys: string | string[], permanent: boolean): void;
62
- /**
63
- * 是否是全同节点
64
- * @param {this} node 待比较的节点
65
- * @throws `assert.AssertionError`
66
- */
67
- isEqualNode(node: this): boolean;
68
- /**
69
- * 是否具有某属性
70
- * @param {PropertyKey} key 属性键
71
- */
72
- hasAttribute(key: PropertyKey): boolean;
73
- /**
74
- * 获取属性值。除非用于私有属性,否则总是返回字符串。
75
- * @template {string} T
76
- * @param {T} key 属性键
77
- * @returns {TokenAttribute<T>}
78
- */
79
- getAttribute<T extends string>(key: T): import("../../typings/node").TokenAttribute<T>;
80
- /**
81
- * 设置属性
82
- * @template {string} T
83
- * @param {T} key 属性键
84
- * @param {TokenAttribute<T>} value 属性值
85
- */
86
- setAttribute<T_1 extends string>(key: T_1, value: import("../../typings/node").TokenAttribute<T_1>): this;
87
- /**
88
- * 可见部分
89
- * @param {string} separator 子节点间的连接符
90
- * @returns {string}
91
- * @complexity `n`
92
- */
93
- text(separator?: string): string;
94
- /**
95
- * 移除子节点
96
- * @param {number} i 移除位置
97
- */
98
- removeAt(i: number): this;
99
- /**
100
- * 插入子节点
101
- * @template {this} T
102
- * @param {T} node 待插入的子节点
103
- * @param {number} i 插入位置
104
- * @complexity `n`
105
- * @throws `RangeError` 不能插入祖先节点
106
- */
107
- insertAt<T_2 extends AstNode>(node: T_2, i?: number): T_2;
108
- /**
109
- * 移除子节点
110
- * @template {this} T
111
- * @param {T} node 子节点
112
- * @complexity `n`
113
- */
114
- removeChild<T_3 extends AstNode>(node: T_3): T_3;
115
- /**
116
- * 在末尾插入子节点
117
- * @template {this} T
118
- * @param {T} node 插入节点
119
- * @complexity `n`
120
- */
121
- appendChild<T_4 extends AstNode>(node: T_4): T_4;
122
- /**
123
- * 在指定位置前插入子节点
124
- * @template {this} T
125
- * @param {T} child 插入节点
126
- * @param {this} reference 指定位置处的子节点
127
- * @complexity `n`
128
- */
129
- insertBefore<T_5 extends AstNode>(child: T_5, reference: AstNode): T_5;
130
- /**
131
- * 替换子节点
132
- * @template {this} T
133
- * @param {this} newChild 新子节点
134
- * @param {T} oldChild 原子节点
135
- * @complexity `n`
136
- */
137
- replaceChild<T_6 extends AstNode>(newChild: AstNode, oldChild: T_6): T_6;
138
- /**
139
- * 在后方批量插入兄弟节点
140
- * @param {...this} nodes 插入节点
141
- * @complexity `n`
142
- */
143
- after(...nodes: AstNode[]): void;
144
- /**
145
- * 在前方批量插入兄弟节点
146
- * @param {...this} nodes 插入节点
147
- * @complexity `n`
148
- */
149
- before(...nodes: AstNode[]): void;
150
- /**
151
- * 移除当前节点
152
- * @complexity `n`
153
- * @throws `Error` 不存在父节点
154
- */
155
- remove(): void;
156
- /**
157
- * 将当前节点批量替换为新的节点
158
- * @param {...this} nodes 插入节点
159
- * @complexity `n`
160
- */
161
- replaceWith(...nodes: AstNode[]): void;
162
- /**
163
- * 是自身或后代节点
164
- * @param {this} node 待检测节点
165
- * @returns {boolean}
166
- * @complexity `n`
167
- */
168
- contains(node: AstNode): boolean;
169
- /**
170
- * 添加事件监听
171
- * @param {string|string[]} types 事件类型
172
- * @param {AstListener} listener 监听函数
173
- * @param {{once: boolean}} options 选项
174
- */
175
- addEventListener(types: string | string[], listener: AstListener, options: {
176
- once: boolean;
177
- }): void;
178
- /**
179
- * 移除事件监听
180
- * @param {string|string[]} types 事件类型
181
- * @param {AstListener} listener 监听函数
182
- */
183
- removeEventListener(types: string | string[], listener: AstListener): void;
184
- /**
185
- * 移除事件的所有监听
186
- * @param {string|string[]} types 事件类型
187
- */
188
- removeAllEventListeners(types: string | string[]): void;
189
- /**
190
- * 列举事件监听
191
- * @param {string} type 事件类型
192
- * @returns {AstListener[]}
193
- */
194
- listEventListeners(type: string): AstListener[];
195
- /**
196
- * 触发事件
197
- * @param {import('../../typings/event').AstEvent} e 事件对象
198
- * @param {*} data 事件数据
199
- */
200
- dispatchEvent(e: import('../../typings/event').AstEvent, data: any): void;
201
- /** 获取所有祖先节点 */
202
- getAncestors(): AstNode[];
203
- /**
204
- * 比较和另一个节点的相对位置
205
- * @param {this} other 待比较的节点
206
- * @complexity `n`
207
- * @throws `Error` 不在同一个语法树
208
- */
209
- compareDocumentPosition(other: AstNode): number;
210
- /**
211
- * 合并相邻的文本子节点
212
- * @complexity `n`
213
- */
214
- normalize(): void;
215
- /** 获取根节点 */
216
- getRootNode(): any;
217
- /**
218
- * 将字符位置转换为行列号
219
- * @param {number} index 字符位置
220
- * @complexity `n`
221
- */
222
- posFromIndex(index: number): {
223
- top: number;
224
- left: number;
225
- };
226
- /**
227
- * 将行列号转换为字符位置
228
- * @param {number} top 行号
229
- * @param {number} left 列号
230
- * @complexity `n`
231
- */
232
- indexFromPos(top: number, left: number): number;
233
- /** 第一个子节点前的间距 */
234
- getPadding(): number;
235
- /** 子节点间距 */
236
- getGaps(): number;
237
- /**
238
- * 获取当前节点的相对字符位置,或其第`j`个子节点的相对字符位置
239
- * @param {number|undefined} j 子节点序号
240
- * @complexity `n`
241
- */
242
- getRelativeIndex(j: number | undefined): number;
243
- /**
244
- * 获取当前节点的绝对位置
245
- * @returns {number}
246
- * @complexity `n`
247
- */
248
- getAbsoluteIndex(): number;
249
- /**
250
- * 获取当前节点的行列位置和大小
251
- * @complexity `n`
252
- */
253
- getBoundingClientRect(): any;
254
- /**
255
- * 行数
256
- * @complexity `n`
257
- */
258
- get offsetHeight(): number;
259
- /**
260
- * 最后一行的列数
261
- * @complexity `n`
262
- */
263
- get offsetWidth(): number;
264
- /**
265
- * 相对于父容器的行号
266
- * @complexity `n`
267
- */
268
- get offsetTop(): number;
269
- /**
270
- * 相对于父容器的列号
271
- * @complexity `n`
272
- */
273
- get offsetLeft(): number;
274
- /**
275
- * 位置、大小和padding
276
- * @complexity `n`
277
- */
278
- get style(): {
279
- padding: number;
280
- height: number;
281
- width: number;
282
- top: number;
283
- left: number;
284
- };
285
- #private;
286
- }
287
- declare namespace AstNode {
288
- export { TokenAttribute, AstListener };
289
- }
290
- type AstListener = import('../../typings/event').AstListener;
291
- type TokenAttribute<T> = import('../../typings/node').TokenAttribute<T>;
@@ -1,37 +0,0 @@
1
- export = Ranges;
2
- /** @extends {Array<number|Range>} */
3
- declare class Ranges extends Array<number | Range> {
4
- /**
5
- * 检查某个下标是否符合表达式
6
- * @param {string} str 表达式
7
- * @param {number} i 待检查的下标
8
- */
9
- static nth(str: string, i: number): boolean;
10
- /** @param {number|string|Range|(number|string|Range)[]} arr 表达式数组 */
11
- constructor(arr: number | string | Range | (number | string | Range)[]);
12
- /**
13
- * 将Ranges转换为针对特定Array的下标集
14
- * @param {number|*[]} arr 参考数组
15
- * @complexity `n`
16
- */
17
- applyTo(arr: number | any[]): number[];
18
- }
19
- /** 模拟Python的Range对象。除`step`至少为`1`外,允许负数、小数或`end < start`的情形。 */
20
- declare class Range {
21
- /**
22
- * @param {string|Range} str 表达式
23
- * @throws `RangeError` 起点、终点和步长均应为整数
24
- * @throws `RangeError` n的系数不能为0
25
- * @throws `RangeError` 应使用CSS选择器或Python切片的格式
26
- */
27
- constructor(str: string | Range);
28
- start: number;
29
- end: number;
30
- step: number;
31
- /**
32
- * 将Range转换为针对特定数组的下标集
33
- * @param {number|*[]} arr 参考数组
34
- * @complexity `n`
35
- */
36
- applyTo(arr: number | any[]): number[];
37
- }
@@ -1,64 +0,0 @@
1
- export = AstText;
2
- /** 文本节点 */
3
- declare class AstText extends AstNode {
4
- /** @param {string} text 包含文本 */
5
- constructor(text?: string);
6
- /** @type {string} */ data: string;
7
- /** 文本长度 */
8
- get length(): number;
9
- /** @override */
10
- override text(): string;
11
- /**
12
- * Linter
13
- * @this {AstText & {parentNode: AstElement}}
14
- * @param {number} start 起始位置
15
- * @returns {LintError[]}
16
- */
17
- lint(this: AstText & {
18
- parentNode: AstElement;
19
- }, start?: number): LintError[];
20
- /**
21
- * 替换字符串
22
- * @param {string} text 替换的字符串
23
- */
24
- replaceData(text?: string): void;
25
- /** 复制 */
26
- cloneNode(): AstText;
27
- /**
28
- * 在后方添加字符串
29
- * @param {string} text 添加的字符串
30
- */
31
- appendData(text: string): void;
32
- /**
33
- * 删减字符串
34
- * @param {number} offset 起始位置
35
- * @param {number} count 删减字符数
36
- */
37
- deleteData(offset: number, count: number): void;
38
- /**
39
- * 插入字符串
40
- * @param {number} offset 插入位置
41
- * @param {string} text 待插入的字符串
42
- */
43
- insertData(offset: number, text: string): void;
44
- /**
45
- * 提取子串
46
- * @param {number} offset 起始位置
47
- * @param {number} count 字符数
48
- */
49
- substringData(offset: number, count: number): string;
50
- /**
51
- * 将文本子节点分裂为两部分
52
- * @param {number} offset 分裂位置
53
- * @throws `RangeError` 错误的断开位置
54
- * @throws `Error` 没有父节点
55
- */
56
- splitText(offset: number): AstText;
57
- #private;
58
- }
59
- declare namespace AstText {
60
- export { LintError };
61
- }
62
- import AstNode = require("./node");
63
- import AstElement = require("./element");
64
- type LintError = import('../../typings/token').LintError;
@@ -1,21 +0,0 @@
1
- export = Title;
2
- /** MediaWiki页面标题对象 */
3
- declare class Title {
4
- /**
5
- * @param {string} title 标题(含或不含命名空间前缀)
6
- * @param {number} defaultNs 命名空间
7
- * @param {boolean} decode 是否需要解码
8
- * @param {boolean} selfLink 是否允许selfLink
9
- */
10
- constructor(title: string, defaultNs?: number, config?: import("../../typings/token").ParserConfig, decode?: boolean, selfLink?: boolean);
11
- valid: boolean;
12
- ns: number;
13
- fragment: string;
14
- encoded: boolean;
15
- title: string;
16
- main: string;
17
- prefix: string;
18
- interwiki: string;
19
- /** @override */
20
- override toString(): string;
21
- }
@@ -1,9 +0,0 @@
1
- export = attributeParent;
2
- /**
3
- * 子节点含有AttributesToken的类
4
- * @template T
5
- * @param {T} Constructor 基类
6
- * @param {number} i AttributesToken子节点的位置
7
- * @returns {T}
8
- */
9
- declare function attributeParent<T>(Constructor: T, i?: number): T;