@cloudbase/weda-ui 0.2.7 → 0.2.8

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 (114) hide show
  1. package/package.json +1 -3
  2. package/src/configs/components/container.json +2 -1
  3. package/src/configs/components/form/richText.json +2 -1
  4. package/src/configs/components/form/uploader.json +4 -4
  5. package/src/configs/components/image.json +2 -1
  6. package/src/configs/components/link.json +2 -1
  7. package/src/configs/components/richtextview.json +2 -1
  8. package/src/configs/components/scrollVeiw.json +2 -1
  9. package/src/configs/components/swiper.json +2 -1
  10. package/src/configs/components/tabs.json +2 -1
  11. package/src/configs/components/text.json +2 -1
  12. package/src/configs/index.js +3 -5
  13. package/src/mp/components/form/uploader/index.js +15 -8
  14. package/src/mp/components/form/uploader/index.wxml +1 -1
  15. package/src/web/components/form/select/region/{cities.json → cities.js} +2 -2
  16. package/src/web/components/form/select/region/index.js +3 -3
  17. package/src/web/components/form/select/region/{provinces.json → provinces.js} +2 -2
  18. package/src/web/components/form/select/region/{regions.json → regions.js} +2 -2
  19. package/src/web/components/form/switch/index.jsx +1 -0
  20. package/src/web/components/form/uploader/uploader.h5.jsx +42 -16
  21. package/src/web/components/form/uploader/uploader.pc.jsx +1 -1
  22. package/src/web/components/image/image.jsx +0 -1
  23. package/src/web/components/index.js +0 -1
  24. package/src/configs/components/markdown.json +0 -17
  25. package/src/mp/components/markdown/index.js +0 -27
  26. package/src/mp/components/markdown/index.json +0 -6
  27. package/src/mp/components/markdown/index.wxml +0 -1
  28. package/src/mp/components/markdown/towxml/audio-player/Audio.js +0 -99
  29. package/src/mp/components/markdown/towxml/audio-player/audio-player.js +0 -102
  30. package/src/mp/components/markdown/towxml/audio-player/audio-player.json +0 -5
  31. package/src/mp/components/markdown/towxml/audio-player/audio-player.wxml +0 -14
  32. package/src/mp/components/markdown/towxml/audio-player/audio-player.wxss +0 -175
  33. package/src/mp/components/markdown/towxml/audio-player/loading.svg +0 -1
  34. package/src/mp/components/markdown/towxml/config.js +0 -285
  35. package/src/mp/components/markdown/towxml/decode.js +0 -26
  36. package/src/mp/components/markdown/towxml/decode.json +0 -12
  37. package/src/mp/components/markdown/towxml/decode.wxml +0 -1
  38. package/src/mp/components/markdown/towxml/decode.wxss +0 -0
  39. package/src/mp/components/markdown/towxml/img/img.js +0 -98
  40. package/src/mp/components/markdown/towxml/img/img.json +0 -3
  41. package/src/mp/components/markdown/towxml/img/img.wxml +0 -1
  42. package/src/mp/components/markdown/towxml/img/img.wxss +0 -0
  43. package/src/mp/components/markdown/towxml/index.js +0 -19
  44. package/src/mp/components/markdown/towxml/latex/latex.js +0 -53
  45. package/src/mp/components/markdown/towxml/latex/latex.json +0 -5
  46. package/src/mp/components/markdown/towxml/latex/latex.wxml +0 -1
  47. package/src/mp/components/markdown/towxml/latex/latex.wxss +0 -0
  48. package/src/mp/components/markdown/towxml/parse/highlight/highlight.js +0 -729
  49. package/src/mp/components/markdown/towxml/parse/highlight/index.js +0 -7
  50. package/src/mp/components/markdown/towxml/parse/highlight/languages/bash.js +0 -91
  51. package/src/mp/components/markdown/towxml/parse/highlight/languages/c-like.js +0 -244
  52. package/src/mp/components/markdown/towxml/parse/highlight/languages/c.js +0 -20
  53. package/src/mp/components/markdown/towxml/parse/highlight/languages/css.js +0 -138
  54. package/src/mp/components/markdown/towxml/parse/highlight/languages/dart.js +0 -135
  55. package/src/mp/components/markdown/towxml/parse/highlight/languages/go.js +0 -57
  56. package/src/mp/components/markdown/towxml/parse/highlight/languages/htmlbars.js +0 -79
  57. package/src/mp/components/markdown/towxml/parse/highlight/languages/java.js +0 -126
  58. package/src/mp/components/markdown/towxml/parse/highlight/languages/javascript.js +0 -263
  59. package/src/mp/components/markdown/towxml/parse/highlight/languages/json.js +0 -51
  60. package/src/mp/components/markdown/towxml/parse/highlight/languages/less.js +0 -177
  61. package/src/mp/components/markdown/towxml/parse/highlight/languages/nginx.js +0 -103
  62. package/src/mp/components/markdown/towxml/parse/highlight/languages/php.js +0 -152
  63. package/src/mp/components/markdown/towxml/parse/highlight/languages/python-repl.js +0 -27
  64. package/src/mp/components/markdown/towxml/parse/highlight/languages/python.js +0 -146
  65. package/src/mp/components/markdown/towxml/parse/highlight/languages/scss.js +0 -137
  66. package/src/mp/components/markdown/towxml/parse/highlight/languages/shell.js +0 -23
  67. package/src/mp/components/markdown/towxml/parse/highlight/languages/typescript.js +0 -198
  68. package/src/mp/components/markdown/towxml/parse/highlight/languages/xml.js +0 -143
  69. package/src/mp/components/markdown/towxml/parse/highlight/style/github.wxss +0 -99
  70. package/src/mp/components/markdown/towxml/parse/highlight/style/monokai.wxss +0 -70
  71. package/src/mp/components/markdown/towxml/parse/index.js +0 -106
  72. package/src/mp/components/markdown/towxml/parse/markdown/index.js +0 -53
  73. package/src/mp/components/markdown/towxml/parse/markdown/markdown.js +0 -5834
  74. package/src/mp/components/markdown/towxml/parse/markdown/plugins/emoji.js +0 -1773
  75. package/src/mp/components/markdown/towxml/parse/markdown/plugins/ins.js +0 -120
  76. package/src/mp/components/markdown/towxml/parse/markdown/plugins/latex.js +0 -193
  77. package/src/mp/components/markdown/towxml/parse/markdown/plugins/mark.js +0 -120
  78. package/src/mp/components/markdown/towxml/parse/markdown/plugins/sub.js +0 -95
  79. package/src/mp/components/markdown/towxml/parse/markdown/plugins/sup.js +0 -95
  80. package/src/mp/components/markdown/towxml/parse/markdown/plugins/todo.js +0 -220
  81. package/src/mp/components/markdown/towxml/parse/markdown/plugins/yuml.js +0 -18
  82. package/src/mp/components/markdown/towxml/parse/parse2/Parser.js +0 -263
  83. package/src/mp/components/markdown/towxml/parse/parse2/Tokenizer.js +0 -507
  84. package/src/mp/components/markdown/towxml/parse/parse2/domhandler/index.js +0 -104
  85. package/src/mp/components/markdown/towxml/parse/parse2/domhandler/node.js +0 -169
  86. package/src/mp/components/markdown/towxml/parse/parse2/entities/decode.js +0 -54
  87. package/src/mp/components/markdown/towxml/parse/parse2/entities/decode_codepoint.js +0 -19
  88. package/src/mp/components/markdown/towxml/parse/parse2/entities/encode.js +0 -54
  89. package/src/mp/components/markdown/towxml/parse/parse2/entities/index.js +0 -30
  90. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/decode.js +0 -31
  91. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/entities.js +0 -2128
  92. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/legacy.js +0 -109
  93. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/xml.js +0 -2
  94. package/src/mp/components/markdown/towxml/parse/parse2/index.js +0 -8
  95. package/src/mp/components/markdown/towxml/style/main.wxss +0 -378
  96. package/src/mp/components/markdown/towxml/style/theme/dark.wxss +0 -73
  97. package/src/mp/components/markdown/towxml/style/theme/light.wxss +0 -63
  98. package/src/mp/components/markdown/towxml/table/table.js +0 -11
  99. package/src/mp/components/markdown/towxml/table/table.json +0 -6
  100. package/src/mp/components/markdown/towxml/table/table.wxml +0 -24
  101. package/src/mp/components/markdown/towxml/table/table.wxss +0 -0
  102. package/src/mp/components/markdown/towxml/todogroup/todogroup.js +0 -19
  103. package/src/mp/components/markdown/towxml/todogroup/todogroup.json +0 -6
  104. package/src/mp/components/markdown/towxml/todogroup/todogroup.wxml +0 -13
  105. package/src/mp/components/markdown/towxml/todogroup/todogroup.wxss +0 -3
  106. package/src/mp/components/markdown/towxml/towxml.js +0 -17
  107. package/src/mp/components/markdown/towxml/towxml.json +0 -6
  108. package/src/mp/components/markdown/towxml/towxml.wxml +0 -5
  109. package/src/mp/components/markdown/towxml/towxml.wxss +0 -8
  110. package/src/mp/components/markdown/towxml/yuml/yuml.js +0 -51
  111. package/src/mp/components/markdown/towxml/yuml/yuml.json +0 -5
  112. package/src/mp/components/markdown/towxml/yuml/yuml.wxml +0 -5
  113. package/src/mp/components/markdown/towxml/yuml/yuml.wxss +0 -0
  114. package/src/web/components/markdown/index.jsx +0 -40
@@ -1,507 +0,0 @@
1
- /* ! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */
2
- 'use strict';
3
- function whitespace(t) {
4
- return ' ' === t || '\n' === t || '\t' === t || '\f' === t || '\r' === t;
5
- }
6
- function ifElseState(t, e, s) {
7
- const i = t.toLowerCase();
8
- return t === i
9
- ? function (t, a) {
10
- a === i ? (t._state = e) : ((t._state = s), t._index--);
11
- }
12
- : function (a, _) {
13
- _ === i || _ === t ? (a._state = e) : ((a._state = s), a._index--);
14
- };
15
- }
16
- function consumeSpecialNameChar(t, e) {
17
- const s = t.toLowerCase();
18
- return function (i, a) {
19
- a === s || a === t ? (i._state = e) : ((i._state = 3), i._index--);
20
- };
21
- }
22
- const __importDefault =
23
- (this && this.__importDefault) ||
24
- function (t) {
25
- return t && t.__esModule ? t : { default: t };
26
- };
27
- Object.defineProperty(exports, '__esModule', { value: !0 });
28
- const decode_codepoint_1 = __importDefault(require('./entities/decode_codepoint'));
29
- const entities_json_1 = __importDefault(require('./entities/maps/entities'));
30
- const legacy_json_1 = __importDefault(require('./entities/maps/legacy'));
31
- const xml_json_1 = __importDefault(require('./entities/maps/xml'));
32
- const stateBeforeCdata1 = ifElseState('C', 23, 16);
33
- const stateBeforeCdata2 = ifElseState('D', 24, 16);
34
- const stateBeforeCdata3 = ifElseState('A', 25, 16);
35
- const stateBeforeCdata4 = ifElseState('T', 26, 16);
36
- const stateBeforeCdata5 = ifElseState('A', 27, 16);
37
- const stateBeforeScript1 = consumeSpecialNameChar('R', 34);
38
- const stateBeforeScript2 = consumeSpecialNameChar('I', 35);
39
- const stateBeforeScript3 = consumeSpecialNameChar('P', 36);
40
- const stateBeforeScript4 = consumeSpecialNameChar('T', 37);
41
- const stateAfterScript1 = ifElseState('R', 39, 1);
42
- const stateAfterScript2 = ifElseState('I', 40, 1);
43
- const stateAfterScript3 = ifElseState('P', 41, 1);
44
- const stateAfterScript4 = ifElseState('T', 42, 1);
45
- const stateBeforeStyle1 = consumeSpecialNameChar('Y', 44);
46
- const stateBeforeStyle2 = consumeSpecialNameChar('L', 45);
47
- const stateBeforeStyle3 = consumeSpecialNameChar('E', 46);
48
- const stateAfterStyle1 = ifElseState('Y', 48, 1);
49
- const stateAfterStyle2 = ifElseState('L', 49, 1);
50
- const stateAfterStyle3 = ifElseState('E', 50, 1);
51
- const stateBeforeEntity = ifElseState('#', 52, 53);
52
- const stateBeforeNumericEntity = ifElseState('X', 55, 54);
53
- const Tokenizer = (function () {
54
- function t(t, e) {
55
- (this._state = 1),
56
- (this._buffer = ''),
57
- (this._sectionStart = 0),
58
- (this._index = 0),
59
- (this._bufferOffset = 0),
60
- (this._baseState = 1),
61
- (this._special = 1),
62
- (this._running = !0),
63
- (this._ended = !1),
64
- (this._cbs = e),
65
- (this._xmlMode = !(!t || !t.xmlMode)),
66
- (this._decodeEntities = !(!t || !t.decodeEntities));
67
- }
68
- return (
69
- (t.prototype.reset = function () {
70
- (this._state = 1),
71
- (this._buffer = ''),
72
- (this._sectionStart = 0),
73
- (this._index = 0),
74
- (this._bufferOffset = 0),
75
- (this._baseState = 1),
76
- (this._special = 1),
77
- (this._running = !0),
78
- (this._ended = !1);
79
- }),
80
- (t.prototype._stateText = function (t) {
81
- '<' === t
82
- ? (this._index > this._sectionStart && this._cbs.ontext(this._getSection()),
83
- (this._state = 2),
84
- (this._sectionStart = this._index))
85
- : this._decodeEntities &&
86
- 1 === this._special &&
87
- '&' === t &&
88
- (this._index > this._sectionStart && this._cbs.ontext(this._getSection()),
89
- (this._baseState = 1),
90
- (this._state = 51),
91
- (this._sectionStart = this._index));
92
- }),
93
- (t.prototype._stateBeforeTagName = function (t) {
94
- '/' === t
95
- ? (this._state = 5)
96
- : '<' === t
97
- ? (this._cbs.ontext(this._getSection()), (this._sectionStart = this._index))
98
- : '>' === t || 1 !== this._special || whitespace(t)
99
- ? (this._state = 1)
100
- : '!' === t
101
- ? ((this._state = 15), (this._sectionStart = this._index + 1))
102
- : '?' === t
103
- ? ((this._state = 17), (this._sectionStart = this._index + 1))
104
- : ((this._state = this._xmlMode || ('s' !== t && 'S' !== t) ? 3 : 31), (this._sectionStart = this._index));
105
- }),
106
- (t.prototype._stateInTagName = function (t) {
107
- ('/' === t || '>' === t || whitespace(t)) && (this._emitToken('onopentagname'), (this._state = 8), this._index--);
108
- }),
109
- (t.prototype._stateBeforeCloseingTagName = function (t) {
110
- whitespace(t) ||
111
- ('>' === t
112
- ? (this._state = 1)
113
- : 1 !== this._special
114
- ? 's' === t || 'S' === t
115
- ? (this._state = 32)
116
- : ((this._state = 1), this._index--)
117
- : ((this._state = 6), (this._sectionStart = this._index)));
118
- }),
119
- (t.prototype._stateInCloseingTagName = function (t) {
120
- ('>' === t || whitespace(t)) && (this._emitToken('onclosetag'), (this._state = 7), this._index--);
121
- }),
122
- (t.prototype._stateAfterCloseingTagName = function (t) {
123
- '>' === t && ((this._state = 1), (this._sectionStart = this._index + 1));
124
- }),
125
- (t.prototype._stateBeforeAttributeName = function (t) {
126
- '>' === t
127
- ? (this._cbs.onopentagend(), (this._state = 1), (this._sectionStart = this._index + 1))
128
- : '/' === t
129
- ? (this._state = 4)
130
- : whitespace(t) || ((this._state = 9), (this._sectionStart = this._index));
131
- }),
132
- (t.prototype._stateInSelfClosingTag = function (t) {
133
- '>' === t
134
- ? (this._cbs.onselfclosingtag(), (this._state = 1), (this._sectionStart = this._index + 1))
135
- : whitespace(t) || ((this._state = 8), this._index--);
136
- }),
137
- (t.prototype._stateInAttributeName = function (t) {
138
- ('=' === t || '/' === t || '>' === t || whitespace(t)) &&
139
- (this._cbs.onattribname(this._getSection()), (this._sectionStart = -1), (this._state = 10), this._index--);
140
- }),
141
- (t.prototype._stateAfterAttributeName = function (t) {
142
- '=' === t
143
- ? (this._state = 11)
144
- : '/' === t || '>' === t
145
- ? (this._cbs.onattribend(), (this._state = 8), this._index--)
146
- : whitespace(t) || (this._cbs.onattribend(), (this._state = 9), (this._sectionStart = this._index));
147
- }),
148
- (t.prototype._stateBeforeAttributeValue = function (t) {
149
- '"' === t
150
- ? ((this._state = 12), (this._sectionStart = this._index + 1))
151
- : "'" === t
152
- ? ((this._state = 13), (this._sectionStart = this._index + 1))
153
- : whitespace(t) || ((this._state = 14), (this._sectionStart = this._index), this._index--);
154
- }),
155
- (t.prototype._stateInAttributeValueDoubleQuotes = function (t) {
156
- '"' === t
157
- ? (this._emitToken('onattribdata'), this._cbs.onattribend(), (this._state = 8))
158
- : this._decodeEntities &&
159
- '&' === t &&
160
- (this._emitToken('onattribdata'),
161
- (this._baseState = this._state),
162
- (this._state = 51),
163
- (this._sectionStart = this._index));
164
- }),
165
- (t.prototype._stateInAttributeValueSingleQuotes = function (t) {
166
- "'" === t
167
- ? (this._emitToken('onattribdata'), this._cbs.onattribend(), (this._state = 8))
168
- : this._decodeEntities &&
169
- '&' === t &&
170
- (this._emitToken('onattribdata'),
171
- (this._baseState = this._state),
172
- (this._state = 51),
173
- (this._sectionStart = this._index));
174
- }),
175
- (t.prototype._stateInAttributeValueNoQuotes = function (t) {
176
- whitespace(t) || '>' === t
177
- ? (this._emitToken('onattribdata'), this._cbs.onattribend(), (this._state = 8), this._index--)
178
- : this._decodeEntities &&
179
- '&' === t &&
180
- (this._emitToken('onattribdata'),
181
- (this._baseState = this._state),
182
- (this._state = 51),
183
- (this._sectionStart = this._index));
184
- }),
185
- (t.prototype._stateBeforeDeclaration = function (t) {
186
- this._state = '[' === t ? 22 : '-' === t ? 18 : 16;
187
- }),
188
- (t.prototype._stateInDeclaration = function (t) {
189
- '>' === t &&
190
- (this._cbs.ondeclaration(this._getSection()), (this._state = 1), (this._sectionStart = this._index + 1));
191
- }),
192
- (t.prototype._stateInProcessingInstruction = function (t) {
193
- '>' === t &&
194
- (this._cbs.onprocessinginstruction(this._getSection()),
195
- (this._state = 1),
196
- (this._sectionStart = this._index + 1));
197
- }),
198
- (t.prototype._stateBeforeComment = function (t) {
199
- '-' === t ? ((this._state = 19), (this._sectionStart = this._index + 1)) : (this._state = 16);
200
- }),
201
- (t.prototype._stateInComment = function (t) {
202
- '-' === t && (this._state = 20);
203
- }),
204
- (t.prototype._stateAfterComment1 = function (t) {
205
- this._state = '-' === t ? 21 : 19;
206
- }),
207
- (t.prototype._stateAfterComment2 = function (t) {
208
- '>' === t
209
- ? (this._cbs.oncomment(this._buffer.substring(this._sectionStart, this._index - 2)),
210
- (this._state = 1),
211
- (this._sectionStart = this._index + 1))
212
- : '-' !== t && (this._state = 19);
213
- }),
214
- (t.prototype._stateBeforeCdata6 = function (t) {
215
- '[' === t ? ((this._state = 28), (this._sectionStart = this._index + 1)) : ((this._state = 16), this._index--);
216
- }),
217
- (t.prototype._stateInCdata = function (t) {
218
- ']' === t && (this._state = 29);
219
- }),
220
- (t.prototype._stateAfterCdata1 = function (t) {
221
- this._state = ']' === t ? 30 : 28;
222
- }),
223
- (t.prototype._stateAfterCdata2 = function (t) {
224
- '>' === t
225
- ? (this._cbs.oncdata(this._buffer.substring(this._sectionStart, this._index - 2)),
226
- (this._state = 1),
227
- (this._sectionStart = this._index + 1))
228
- : ']' !== t && (this._state = 28);
229
- }),
230
- (t.prototype._stateBeforeSpecial = function (t) {
231
- 'c' === t || 'C' === t
232
- ? (this._state = 33)
233
- : 't' === t || 'T' === t
234
- ? (this._state = 43)
235
- : ((this._state = 3), this._index--);
236
- }),
237
- (t.prototype._stateBeforeSpecialEnd = function (t) {
238
- 2 !== this._special || ('c' !== t && 'C' !== t)
239
- ? 3 !== this._special || ('t' !== t && 'T' !== t)
240
- ? (this._state = 1)
241
- : (this._state = 47)
242
- : (this._state = 38);
243
- }),
244
- (t.prototype._stateBeforeScript5 = function (t) {
245
- ('/' === t || '>' === t || whitespace(t)) && (this._special = 2), (this._state = 3), this._index--;
246
- }),
247
- (t.prototype._stateAfterScript5 = function (t) {
248
- '>' === t || whitespace(t)
249
- ? ((this._special = 1), (this._state = 6), (this._sectionStart = this._index - 6), this._index--)
250
- : (this._state = 1);
251
- }),
252
- (t.prototype._stateBeforeStyle4 = function (t) {
253
- ('/' === t || '>' === t || whitespace(t)) && (this._special = 3), (this._state = 3), this._index--;
254
- }),
255
- (t.prototype._stateAfterStyle4 = function (t) {
256
- '>' === t || whitespace(t)
257
- ? ((this._special = 1), (this._state = 6), (this._sectionStart = this._index - 5), this._index--)
258
- : (this._state = 1);
259
- }),
260
- (t.prototype._parseNamedEntityStrict = function () {
261
- if (this._sectionStart + 1 < this._index) {
262
- const t = this._buffer.substring(this._sectionStart + 1, this._index);
263
- const e = this._xmlMode ? xml_json_1.default : entities_json_1.default;
264
- Object.prototype.hasOwnProperty.call(e, t) && (this._emitPartial(e[t]), (this._sectionStart = this._index + 1));
265
- }
266
- }),
267
- (t.prototype._parseLegacyEntity = function () {
268
- const t = this._sectionStart + 1;
269
- let e = this._index - t;
270
- for (e > 6 && (e = 6); e >= 2; ) {
271
- const s = this._buffer.substr(t, e);
272
- if (Object.prototype.hasOwnProperty.call(legacy_json_1.default, s))
273
- return this._emitPartial(legacy_json_1.default[s]), void (this._sectionStart += e + 1);
274
- e--;
275
- }
276
- }),
277
- (t.prototype._stateInNamedEntity = function (t) {
278
- ';' === t
279
- ? (this._parseNamedEntityStrict(),
280
- this._sectionStart + 1 < this._index && !this._xmlMode && this._parseLegacyEntity(),
281
- (this._state = this._baseState))
282
- : (t < 'a' || t > 'z') &&
283
- (t < 'A' || t > 'Z') &&
284
- (t < '0' || t > '9') &&
285
- (this._xmlMode ||
286
- this._sectionStart + 1 === this._index ||
287
- (1 !== this._baseState ? '=' !== t && this._parseNamedEntityStrict() : this._parseLegacyEntity()),
288
- (this._state = this._baseState),
289
- this._index--);
290
- }),
291
- (t.prototype._decodeNumericEntity = function (t, e) {
292
- const s = this._sectionStart + t;
293
- if (s !== this._index) {
294
- const i = this._buffer.substring(s, this._index);
295
- const a = parseInt(i, e);
296
- this._emitPartial(decode_codepoint_1.default(a)), (this._sectionStart = this._index);
297
- } else this._sectionStart--;
298
- this._state = this._baseState;
299
- }),
300
- (t.prototype._stateInNumericEntity = function (t) {
301
- ';' === t
302
- ? (this._decodeNumericEntity(2, 10), this._sectionStart++)
303
- : (t < '0' || t > '9') &&
304
- (this._xmlMode ? (this._state = this._baseState) : this._decodeNumericEntity(2, 10), this._index--);
305
- }),
306
- (t.prototype._stateInHexEntity = function (t) {
307
- ';' === t
308
- ? (this._decodeNumericEntity(3, 16), this._sectionStart++)
309
- : (t < 'a' || t > 'f') &&
310
- (t < 'A' || t > 'F') &&
311
- (t < '0' || t > '9') &&
312
- (this._xmlMode ? (this._state = this._baseState) : this._decodeNumericEntity(3, 16), this._index--);
313
- }),
314
- (t.prototype._cleanup = function () {
315
- this._sectionStart < 0
316
- ? ((this._buffer = ''), (this._bufferOffset += this._index), (this._index = 0))
317
- : this._running &&
318
- (1 === this._state
319
- ? (this._sectionStart !== this._index && this._cbs.ontext(this._buffer.substr(this._sectionStart)),
320
- (this._buffer = ''),
321
- (this._bufferOffset += this._index),
322
- (this._index = 0))
323
- : this._sectionStart === this._index
324
- ? ((this._buffer = ''), (this._bufferOffset += this._index), (this._index = 0))
325
- : ((this._buffer = this._buffer.substr(this._sectionStart)),
326
- (this._index -= this._sectionStart),
327
- (this._bufferOffset += this._sectionStart)),
328
- (this._sectionStart = 0));
329
- }),
330
- (t.prototype.write = function (t) {
331
- this._ended && this._cbs.onerror(Error('.write() after done!')), (this._buffer += t), this._parse();
332
- }),
333
- (t.prototype._parse = function () {
334
- for (; this._index < this._buffer.length && this._running; ) {
335
- const t = this._buffer.charAt(this._index);
336
- 1 === this._state
337
- ? this._stateText(t)
338
- : 12 === this._state
339
- ? this._stateInAttributeValueDoubleQuotes(t)
340
- : 9 === this._state
341
- ? this._stateInAttributeName(t)
342
- : 19 === this._state
343
- ? this._stateInComment(t)
344
- : 8 === this._state
345
- ? this._stateBeforeAttributeName(t)
346
- : 3 === this._state
347
- ? this._stateInTagName(t)
348
- : 6 === this._state
349
- ? this._stateInCloseingTagName(t)
350
- : 2 === this._state
351
- ? this._stateBeforeTagName(t)
352
- : 10 === this._state
353
- ? this._stateAfterAttributeName(t)
354
- : 13 === this._state
355
- ? this._stateInAttributeValueSingleQuotes(t)
356
- : 11 === this._state
357
- ? this._stateBeforeAttributeValue(t)
358
- : 5 === this._state
359
- ? this._stateBeforeCloseingTagName(t)
360
- : 7 === this._state
361
- ? this._stateAfterCloseingTagName(t)
362
- : 31 === this._state
363
- ? this._stateBeforeSpecial(t)
364
- : 20 === this._state
365
- ? this._stateAfterComment1(t)
366
- : 14 === this._state
367
- ? this._stateInAttributeValueNoQuotes(t)
368
- : 4 === this._state
369
- ? this._stateInSelfClosingTag(t)
370
- : 16 === this._state
371
- ? this._stateInDeclaration(t)
372
- : 15 === this._state
373
- ? this._stateBeforeDeclaration(t)
374
- : 21 === this._state
375
- ? this._stateAfterComment2(t)
376
- : 18 === this._state
377
- ? this._stateBeforeComment(t)
378
- : 32 === this._state
379
- ? this._stateBeforeSpecialEnd(t)
380
- : 38 === this._state
381
- ? stateAfterScript1(this, t)
382
- : 39 === this._state
383
- ? stateAfterScript2(this, t)
384
- : 40 === this._state
385
- ? stateAfterScript3(this, t)
386
- : 33 === this._state
387
- ? stateBeforeScript1(this, t)
388
- : 34 === this._state
389
- ? stateBeforeScript2(this, t)
390
- : 35 === this._state
391
- ? stateBeforeScript3(this, t)
392
- : 36 === this._state
393
- ? stateBeforeScript4(this, t)
394
- : 37 === this._state
395
- ? this._stateBeforeScript5(t)
396
- : 41 === this._state
397
- ? stateAfterScript4(this, t)
398
- : 42 === this._state
399
- ? this._stateAfterScript5(t)
400
- : 43 === this._state
401
- ? stateBeforeStyle1(this, t)
402
- : 28 === this._state
403
- ? this._stateInCdata(t)
404
- : 44 === this._state
405
- ? stateBeforeStyle2(this, t)
406
- : 45 === this._state
407
- ? stateBeforeStyle3(this, t)
408
- : 46 === this._state
409
- ? this._stateBeforeStyle4(t)
410
- : 47 === this._state
411
- ? stateAfterStyle1(this, t)
412
- : 48 === this._state
413
- ? stateAfterStyle2(this, t)
414
- : 49 === this._state
415
- ? stateAfterStyle3(this, t)
416
- : 50 === this._state
417
- ? this._stateAfterStyle4(t)
418
- : 17 === this._state
419
- ? this._stateInProcessingInstruction(t)
420
- : 53 === this._state
421
- ? this._stateInNamedEntity(t)
422
- : 22 === this._state
423
- ? stateBeforeCdata1(this, t)
424
- : 51 === this._state
425
- ? stateBeforeEntity(this, t)
426
- : 23 === this._state
427
- ? stateBeforeCdata2(this, t)
428
- : 24 === this._state
429
- ? stateBeforeCdata3(this, t)
430
- : 29 === this._state
431
- ? this._stateAfterCdata1(t)
432
- : 30 === this._state
433
- ? this._stateAfterCdata2(t)
434
- : 25 === this._state
435
- ? stateBeforeCdata4(this, t)
436
- : 26 === this._state
437
- ? stateBeforeCdata5(this, t)
438
- : 27 === this._state
439
- ? this._stateBeforeCdata6(t)
440
- : 55 === this._state
441
- ? this._stateInHexEntity(t)
442
- : 54 === this._state
443
- ? this._stateInNumericEntity(t)
444
- : 52 === this._state
445
- ? stateBeforeNumericEntity(this, t)
446
- : this._cbs.onerror(Error('unknown _state'), this._state),
447
- this._index++;
448
- }
449
- this._cleanup();
450
- }),
451
- (t.prototype.pause = function () {
452
- this._running = !1;
453
- }),
454
- (t.prototype.resume = function () {
455
- (this._running = !0), this._index < this._buffer.length && this._parse(), this._ended && this._finish();
456
- }),
457
- (t.prototype.end = function (t) {
458
- this._ended && this._cbs.onerror(Error('.end() after done!')),
459
- t && this.write(t),
460
- (this._ended = !0),
461
- this._running && this._finish();
462
- }),
463
- (t.prototype._finish = function () {
464
- this._sectionStart < this._index && this._handleTrailingData(), this._cbs.onend();
465
- }),
466
- (t.prototype._handleTrailingData = function () {
467
- const t = this._buffer.substr(this._sectionStart);
468
- 28 === this._state || 29 === this._state || 30 === this._state
469
- ? this._cbs.oncdata(t)
470
- : 19 === this._state || 20 === this._state || 21 === this._state
471
- ? this._cbs.oncomment(t)
472
- : 53 !== this._state || this._xmlMode
473
- ? 54 !== this._state || this._xmlMode
474
- ? 55 !== this._state || this._xmlMode
475
- ? 3 !== this._state &&
476
- 8 !== this._state &&
477
- 11 !== this._state &&
478
- 10 !== this._state &&
479
- 9 !== this._state &&
480
- 13 !== this._state &&
481
- 12 !== this._state &&
482
- 14 !== this._state &&
483
- 6 !== this._state &&
484
- this._cbs.ontext(t)
485
- : (this._decodeNumericEntity(3, 16),
486
- this._sectionStart < this._index && ((this._state = this._baseState), this._handleTrailingData()))
487
- : (this._decodeNumericEntity(2, 10),
488
- this._sectionStart < this._index && ((this._state = this._baseState), this._handleTrailingData()))
489
- : (this._parseLegacyEntity(),
490
- this._sectionStart < this._index && ((this._state = this._baseState), this._handleTrailingData()));
491
- }),
492
- (t.prototype.getAbsoluteIndex = function () {
493
- return this._bufferOffset + this._index;
494
- }),
495
- (t.prototype._getSection = function () {
496
- return this._buffer.substring(this._sectionStart, this._index);
497
- }),
498
- (t.prototype._emitToken = function (t) {
499
- this._cbs[t](this._getSection()), (this._sectionStart = -1);
500
- }),
501
- (t.prototype._emitPartial = function (t) {
502
- 1 !== this._baseState ? this._cbs.onattribdata(t) : this._cbs.ontext(t);
503
- }),
504
- t
505
- );
506
- })();
507
- exports.default = Tokenizer;
@@ -1,104 +0,0 @@
1
- /* ! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */
2
- 'use strict';
3
- Object.defineProperty(exports, '__esModule', { value: !0 });
4
- const node_1 = require('./node');
5
- (exports.Node = node_1.Node),
6
- (exports.Element = node_1.Element),
7
- (exports.DataNode = node_1.DataNode),
8
- (exports.NodeWithChildren = node_1.NodeWithChildren);
9
- const reWhitespace = /\s+/g;
10
- const defaultOpts = { normalizeWhitespace: !1, withStartIndices: !1, withEndIndices: !1 };
11
- const DomHandler = (function () {
12
- function t(t, e, o) {
13
- (this.dom = []),
14
- (this._done = !1),
15
- (this._tagStack = []),
16
- (this._lastNode = null),
17
- (this._parser = null),
18
- 'function' === typeof e && ((o = e), (e = defaultOpts)),
19
- 'object' === typeof t && ((e = t), (t = undefined)),
20
- (this._callback = t || null),
21
- (this._options = e || defaultOpts),
22
- (this._elementCB = o || null);
23
- }
24
- return (
25
- (t.prototype.onparserinit = function (t) {
26
- this._parser = t;
27
- }),
28
- (t.prototype.onreset = function () {
29
- (this.dom = []),
30
- (this._done = !1),
31
- (this._tagStack = []),
32
- (this._lastNode = null),
33
- (this._parser = this._parser || null);
34
- }),
35
- (t.prototype.onend = function () {
36
- this._done || ((this._done = !0), (this._parser = null), this.handleCallback(null));
37
- }),
38
- (t.prototype.onerror = function (t) {
39
- this.handleCallback(t);
40
- }),
41
- (t.prototype.onclosetag = function () {
42
- this._lastNode = null;
43
- const t = this._tagStack.pop();
44
- t &&
45
- this._parser &&
46
- (this._options.withEndIndices && (t.endIndex = this._parser.endIndex), this._elementCB && this._elementCB(t));
47
- }),
48
- (t.prototype.onopentag = function (t, e) {
49
- const o = new node_1.Element(t, e);
50
- this.addNode(o), this._tagStack.push(o);
51
- }),
52
- (t.prototype.ontext = function (t) {
53
- const e = this._options.normalizeWhitespace;
54
- const o = this._lastNode;
55
- if (o && 'text' === o.type) e ? (o.data = (o.data + t).replace(reWhitespace, ' ')) : (o.data += t);
56
- else {
57
- e && (t = t.replace(reWhitespace, ' '));
58
- const n = new node_1.DataNode('text', t);
59
- this.addNode(n), (this._lastNode = n);
60
- }
61
- }),
62
- (t.prototype.oncomment = function (t) {
63
- if (this._lastNode && 'comment' === this._lastNode.type) return void (this._lastNode.data += t);
64
- const e = new node_1.DataNode('comment', t);
65
- this.addNode(e), (this._lastNode = e);
66
- }),
67
- (t.prototype.oncommentend = function () {
68
- this._lastNode = null;
69
- }),
70
- (t.prototype.oncdatastart = function () {
71
- const t = new node_1.DataNode('text', '');
72
- const e = new node_1.NodeWithChildren('cdata', [t]);
73
- this.addNode(e), (t.parent = e), (this._lastNode = t);
74
- }),
75
- (t.prototype.oncdataend = function () {
76
- this._lastNode = null;
77
- }),
78
- (t.prototype.onprocessinginstruction = function (t, e) {
79
- const o = new node_1.ProcessingInstruction(t, e);
80
- this.addNode(o);
81
- }),
82
- (t.prototype.handleCallback = function (t) {
83
- if ('function' === typeof this._callback) this._callback(t, this.dom);
84
- else if (t) throw t;
85
- }),
86
- (t.prototype.addNode = function (t) {
87
- const e = this._tagStack[this._tagStack.length - 1];
88
- const o = e ? e.children : this.dom;
89
- const n = o[o.length - 1];
90
- this._parser &&
91
- (this._options.withStartIndices && (t.startIndex = this._parser.startIndex),
92
- this._options.withEndIndices && (t.endIndex = this._parser.endIndex)),
93
- o.push(t),
94
- n && ((t.prev = n), (n.next = t)),
95
- e && (t.parent = e),
96
- (this._lastNode = null);
97
- }),
98
- (t.prototype.addDataNode = function (t) {
99
- this.addNode(t), (this._lastNode = t);
100
- }),
101
- t
102
- );
103
- })();
104
- (exports.DomHandler = DomHandler), (exports.default = DomHandler);