@cloudbase/weda-ui 0.2.7 → 0.2.11

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 (130) hide show
  1. package/package.json +2 -4
  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 +4 -7
  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/enumSelect/MultipleSelect.jsx +89 -0
  16. package/src/web/components/form/enumSelect/NormalSelect.jsx +101 -0
  17. package/src/web/components/form/enumSelect/SelectContainer.jsx +43 -0
  18. package/src/web/components/form/enumSelect/index.jsx +9 -0
  19. package/src/web/components/form/enumSelect/props/defaultProps.js +39 -0
  20. package/src/web/components/form/enumSelect/props/propsTypes.js +50 -0
  21. package/src/web/components/form/select/region/{cities.json → cities.js} +2 -2
  22. package/src/web/components/form/select/region/index.js +3 -3
  23. package/src/web/components/form/select/region/{provinces.json → provinces.js} +2 -2
  24. package/src/web/components/form/select/region/{regions.json → regions.js} +2 -2
  25. package/src/web/components/form/switch/index.jsx +1 -0
  26. package/src/web/components/form/uploader/uploader.h5.jsx +42 -16
  27. package/src/web/components/form/uploader/uploader.pc.jsx +1 -1
  28. package/src/web/components/image/image.jsx +0 -1
  29. package/src/web/components/index.js +1 -1
  30. package/src/web/components/link/test/__snapshots__/storybook.test.js.snap +754 -0
  31. package/src/web/components/modal/index.jsx +3 -2
  32. package/CHANGELOG.md +0 -240
  33. package/src/.DS_Store +0 -0
  34. package/src/configs/components/markdown.json +0 -17
  35. package/src/mp/.gitignore +0 -10
  36. package/src/mp/components/markdown/index.js +0 -27
  37. package/src/mp/components/markdown/index.json +0 -6
  38. package/src/mp/components/markdown/index.wxml +0 -1
  39. package/src/mp/components/markdown/towxml/audio-player/Audio.js +0 -99
  40. package/src/mp/components/markdown/towxml/audio-player/audio-player.js +0 -102
  41. package/src/mp/components/markdown/towxml/audio-player/audio-player.json +0 -5
  42. package/src/mp/components/markdown/towxml/audio-player/audio-player.wxml +0 -14
  43. package/src/mp/components/markdown/towxml/audio-player/audio-player.wxss +0 -175
  44. package/src/mp/components/markdown/towxml/audio-player/loading.svg +0 -1
  45. package/src/mp/components/markdown/towxml/config.js +0 -285
  46. package/src/mp/components/markdown/towxml/decode.js +0 -26
  47. package/src/mp/components/markdown/towxml/decode.json +0 -12
  48. package/src/mp/components/markdown/towxml/decode.wxml +0 -1
  49. package/src/mp/components/markdown/towxml/decode.wxss +0 -0
  50. package/src/mp/components/markdown/towxml/img/img.js +0 -98
  51. package/src/mp/components/markdown/towxml/img/img.json +0 -3
  52. package/src/mp/components/markdown/towxml/img/img.wxml +0 -1
  53. package/src/mp/components/markdown/towxml/img/img.wxss +0 -0
  54. package/src/mp/components/markdown/towxml/index.js +0 -19
  55. package/src/mp/components/markdown/towxml/latex/latex.js +0 -53
  56. package/src/mp/components/markdown/towxml/latex/latex.json +0 -5
  57. package/src/mp/components/markdown/towxml/latex/latex.wxml +0 -1
  58. package/src/mp/components/markdown/towxml/latex/latex.wxss +0 -0
  59. package/src/mp/components/markdown/towxml/parse/highlight/highlight.js +0 -729
  60. package/src/mp/components/markdown/towxml/parse/highlight/index.js +0 -7
  61. package/src/mp/components/markdown/towxml/parse/highlight/languages/bash.js +0 -91
  62. package/src/mp/components/markdown/towxml/parse/highlight/languages/c-like.js +0 -244
  63. package/src/mp/components/markdown/towxml/parse/highlight/languages/c.js +0 -20
  64. package/src/mp/components/markdown/towxml/parse/highlight/languages/css.js +0 -138
  65. package/src/mp/components/markdown/towxml/parse/highlight/languages/dart.js +0 -135
  66. package/src/mp/components/markdown/towxml/parse/highlight/languages/go.js +0 -57
  67. package/src/mp/components/markdown/towxml/parse/highlight/languages/htmlbars.js +0 -79
  68. package/src/mp/components/markdown/towxml/parse/highlight/languages/java.js +0 -126
  69. package/src/mp/components/markdown/towxml/parse/highlight/languages/javascript.js +0 -263
  70. package/src/mp/components/markdown/towxml/parse/highlight/languages/json.js +0 -51
  71. package/src/mp/components/markdown/towxml/parse/highlight/languages/less.js +0 -177
  72. package/src/mp/components/markdown/towxml/parse/highlight/languages/nginx.js +0 -103
  73. package/src/mp/components/markdown/towxml/parse/highlight/languages/php.js +0 -152
  74. package/src/mp/components/markdown/towxml/parse/highlight/languages/python-repl.js +0 -27
  75. package/src/mp/components/markdown/towxml/parse/highlight/languages/python.js +0 -146
  76. package/src/mp/components/markdown/towxml/parse/highlight/languages/scss.js +0 -137
  77. package/src/mp/components/markdown/towxml/parse/highlight/languages/shell.js +0 -23
  78. package/src/mp/components/markdown/towxml/parse/highlight/languages/typescript.js +0 -198
  79. package/src/mp/components/markdown/towxml/parse/highlight/languages/xml.js +0 -143
  80. package/src/mp/components/markdown/towxml/parse/highlight/style/github.wxss +0 -99
  81. package/src/mp/components/markdown/towxml/parse/highlight/style/monokai.wxss +0 -70
  82. package/src/mp/components/markdown/towxml/parse/index.js +0 -106
  83. package/src/mp/components/markdown/towxml/parse/markdown/index.js +0 -53
  84. package/src/mp/components/markdown/towxml/parse/markdown/markdown.js +0 -5834
  85. package/src/mp/components/markdown/towxml/parse/markdown/plugins/emoji.js +0 -1773
  86. package/src/mp/components/markdown/towxml/parse/markdown/plugins/ins.js +0 -120
  87. package/src/mp/components/markdown/towxml/parse/markdown/plugins/latex.js +0 -193
  88. package/src/mp/components/markdown/towxml/parse/markdown/plugins/mark.js +0 -120
  89. package/src/mp/components/markdown/towxml/parse/markdown/plugins/sub.js +0 -95
  90. package/src/mp/components/markdown/towxml/parse/markdown/plugins/sup.js +0 -95
  91. package/src/mp/components/markdown/towxml/parse/markdown/plugins/todo.js +0 -220
  92. package/src/mp/components/markdown/towxml/parse/markdown/plugins/yuml.js +0 -18
  93. package/src/mp/components/markdown/towxml/parse/parse2/Parser.js +0 -263
  94. package/src/mp/components/markdown/towxml/parse/parse2/Tokenizer.js +0 -507
  95. package/src/mp/components/markdown/towxml/parse/parse2/domhandler/index.js +0 -104
  96. package/src/mp/components/markdown/towxml/parse/parse2/domhandler/node.js +0 -169
  97. package/src/mp/components/markdown/towxml/parse/parse2/entities/decode.js +0 -54
  98. package/src/mp/components/markdown/towxml/parse/parse2/entities/decode_codepoint.js +0 -19
  99. package/src/mp/components/markdown/towxml/parse/parse2/entities/encode.js +0 -54
  100. package/src/mp/components/markdown/towxml/parse/parse2/entities/index.js +0 -30
  101. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/decode.js +0 -31
  102. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/entities.js +0 -2128
  103. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/legacy.js +0 -109
  104. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/xml.js +0 -2
  105. package/src/mp/components/markdown/towxml/parse/parse2/index.js +0 -8
  106. package/src/mp/components/markdown/towxml/style/main.wxss +0 -378
  107. package/src/mp/components/markdown/towxml/style/theme/dark.wxss +0 -73
  108. package/src/mp/components/markdown/towxml/style/theme/light.wxss +0 -63
  109. package/src/mp/components/markdown/towxml/table/table.js +0 -11
  110. package/src/mp/components/markdown/towxml/table/table.json +0 -6
  111. package/src/mp/components/markdown/towxml/table/table.wxml +0 -24
  112. package/src/mp/components/markdown/towxml/table/table.wxss +0 -0
  113. package/src/mp/components/markdown/towxml/todogroup/todogroup.js +0 -19
  114. package/src/mp/components/markdown/towxml/todogroup/todogroup.json +0 -6
  115. package/src/mp/components/markdown/towxml/todogroup/todogroup.wxml +0 -13
  116. package/src/mp/components/markdown/towxml/todogroup/todogroup.wxss +0 -3
  117. package/src/mp/components/markdown/towxml/towxml.js +0 -17
  118. package/src/mp/components/markdown/towxml/towxml.json +0 -6
  119. package/src/mp/components/markdown/towxml/towxml.wxml +0 -5
  120. package/src/mp/components/markdown/towxml/towxml.wxss +0 -8
  121. package/src/mp/components/markdown/towxml/yuml/yuml.js +0 -51
  122. package/src/mp/components/markdown/towxml/yuml/yuml.json +0 -5
  123. package/src/mp/components/markdown/towxml/yuml/yuml.wxml +0 -5
  124. package/src/mp/components/markdown/towxml/yuml/yuml.wxss +0 -0
  125. package/src/web/.DS_Store +0 -0
  126. package/src/web/components/markdown/index.jsx +0 -40
  127. package/src/web/wedatheme/.git +0 -1
  128. package/src/web/wedatheme/.gitignore +0 -5
  129. package/src/web/wedatheme/.npmrc +0 -1
  130. package/src/web/wedatheme/package-lock.json +0 -14335
@@ -1,220 +0,0 @@
1
- (function (f) {
2
- if (typeof exports === 'object' && typeof module !== 'undefined') {
3
- module.exports = f();
4
- } else if (typeof define === 'function' && define.amd) {
5
- define([], f);
6
- } else {
7
- let g;
8
- if (typeof window !== 'undefined') {
9
- g = window;
10
- } else if (typeof global !== 'undefined') {
11
- g = global;
12
- } else if (typeof self !== 'undefined') {
13
- g = self;
14
- } else {
15
- g = this;
16
- }
17
- g.markdownitTaskLists = f();
18
- }
19
- })(() => {
20
- let define;
21
- let module;
22
- let exports;
23
- return (function () {
24
- function e(t, n, r) {
25
- function s(o, u) {
26
- if (!n[o]) {
27
- if (!t[o]) {
28
- const a = typeof require === 'function' && require;
29
- if (!u && a) return a(o, !0);
30
- if (i) return i(o, !0);
31
- const f = new Error(`Cannot find module '${o}'`);
32
- throw ((f.code = 'MODULE_NOT_FOUND'), f);
33
- }
34
- const l = (n[o] = { exports: {} });
35
- t[o][0].call(
36
- l.exports,
37
- (e) => {
38
- const n = t[o][1][e];
39
- return s(n ? n : e);
40
- },
41
- l,
42
- l.exports,
43
- e,
44
- t,
45
- n,
46
- r,
47
- );
48
- }
49
- return n[o].exports;
50
- }
51
- var i = typeof require === 'function' && require;
52
- for (let o = 0; o < r.length; o++) s(r[o]);
53
- return s;
54
- }
55
- return e;
56
- })()(
57
- {
58
- 1: [
59
- function (require, module, exports) {
60
- // Markdown-it plugin to render GitHub-style task lists; see
61
- //
62
- // https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments
63
- // https://github.com/blog/1825-task-lists-in-all-markdown-documents
64
-
65
- let disableCheckboxes = true;
66
- let useLabelWrapper = false;
67
- let useLabelAfter = false;
68
-
69
- module.exports = function (md, options) {
70
- if (options) {
71
- disableCheckboxes = !options.enabled;
72
- useLabelWrapper = !!options.label;
73
- useLabelAfter = !!options.labelAfter;
74
- }
75
-
76
- md.core.ruler.after('inline', 'github-task-lists', (state) => {
77
- const { tokens } = state;
78
-
79
- // 用于寻找关闭标签的数组
80
- const tagPaired = (index) => {
81
- let targetItem;
82
- const item = tokens[index];
83
- const { tag } = item;
84
- const { level } = item;
85
- const targetType = item.type === 'list_item_open' ? 'list_item_close' : 'bullet_list_close';
86
- for (let i = index, len = tokens.length; i < len; i++) {
87
- const _item = tokens[i];
88
-
89
- if (_item.tag === tag && level === _item.level && _item.type === targetType) {
90
- targetItem = _item;
91
- break;
92
- }
93
- }
94
- return targetItem;
95
- };
96
-
97
- for (let i = 2; i < tokens.length; i++) {
98
- if (isTodoItem(tokens, i)) {
99
- todoify(tokens[i], state.Token);
100
- attrSet(tokens[i - 2], 'class', `task-list-item${!disableCheckboxes ? ' enabled' : ''}`);
101
- attrSet(tokens[parentToken(tokens, i - 2)], 'class', 'contains-task-list');
102
-
103
- tagPaired(parentToken(tokens, i - 2)).tag = 'todogroup';
104
- tokens[parentToken(tokens, i - 2)].tag = 'todogroup';
105
-
106
- tagPaired(i - 2).tag = 'todolist';
107
- tokens[i - 2].tag = 'todolist';
108
- }
109
- }
110
- });
111
- };
112
-
113
- function attrSet(token, name, value) {
114
- const index = token.attrIndex(name);
115
- const attr = [name, value];
116
- if (index < 0) {
117
- token.attrPush(attr);
118
- } else {
119
- token.attrs[index] = attr;
120
- }
121
- }
122
-
123
- function parentToken(tokens, index) {
124
- const targetLevel = tokens[index].level - 1;
125
- for (let i = index - 1; i >= 0; i--) {
126
- if (tokens[i].level === targetLevel) {
127
- return i;
128
- }
129
- }
130
- return -1;
131
- }
132
-
133
- function isTodoItem(tokens, index) {
134
- return (
135
- isInline(tokens[index]) &&
136
- isParagraph(tokens[index - 1]) &&
137
- isListItem(tokens[index - 2]) &&
138
- startsWithTodoMarkdown(tokens[index])
139
- );
140
- }
141
-
142
- function todoify(token, TokenConstructor) {
143
- token.children.unshift(makeCheckbox(token, TokenConstructor));
144
- token.children[1].content = token.children[1].content.slice(3);
145
- token.content = token.content.slice(3);
146
-
147
- if (useLabelWrapper) {
148
- if (useLabelAfter) {
149
- token.children.pop();
150
-
151
- // Use large random number as id property of the checkbox.
152
- const id = `task-item-${Math.ceil(Math.random() * (10000 * 1000) - 1000)}`;
153
- token.children[0].content = `${token.children[0].content.slice(0, -1)} id="${id}">`;
154
- token.children.push(afterLabel(token.content, id, TokenConstructor));
155
- } else {
156
- token.children.unshift(beginLabel(TokenConstructor));
157
- token.children.push(endLabel(TokenConstructor));
158
- }
159
- }
160
- }
161
-
162
- function makeCheckbox(token, TokenConstructor) {
163
- const checkbox = new TokenConstructor('html_inline', '', 0);
164
- const disabledAttr = disableCheckboxes ? ' disabled="" ' : '';
165
- const value = ` value="${token.content}" `;
166
- if (token.content.indexOf('[ ] ') === 0) {
167
- checkbox.content = `<checkbox class="h2w__todoCheckbox task-list-item-checkbox"${disabledAttr}${value}/>`;
168
- } else if (token.content.indexOf('[x] ') === 0 || token.content.indexOf('[X] ') === 0) {
169
- checkbox.content = `<checkbox class="h2w__todoCheckbox task-list-item-checkbox" checked="true"${disabledAttr}${value}/>`;
170
- }
171
- return checkbox;
172
- }
173
-
174
- // these next two functions are kind of hacky; probably should really be a
175
- // true block-level token with .tag=='label'
176
- function beginLabel(TokenConstructor) {
177
- const token = new TokenConstructor('html_inline', '', 0);
178
- token.content = '<label>';
179
- return token;
180
- }
181
-
182
- function endLabel(TokenConstructor) {
183
- const token = new TokenConstructor('html_inline', '', 0);
184
- token.content = '</label>';
185
- return token;
186
- }
187
-
188
- function afterLabel(content, id, TokenConstructor) {
189
- const token = new TokenConstructor('html_inline', '', 0);
190
- token.content = `<label class="task-list-item-label" for="${id}">${content}</label>`;
191
- token.attrs = [{ for: id }];
192
- return token;
193
- }
194
-
195
- function isInline(token) {
196
- return token.type === 'inline';
197
- }
198
- function isParagraph(token) {
199
- return token.type === 'paragraph_open';
200
- }
201
- function isListItem(token) {
202
- return token.type === 'list_item_open';
203
- }
204
-
205
- function startsWithTodoMarkdown(token) {
206
- // leading whitespace in a list item is already trimmed off by markdown-it
207
- return (
208
- token.content.indexOf('[ ] ') === 0 ||
209
- token.content.indexOf('[x] ') === 0 ||
210
- token.content.indexOf('[X] ') === 0
211
- );
212
- }
213
- },
214
- {},
215
- ],
216
- },
217
- {},
218
- [1],
219
- )(1);
220
- });
@@ -1,18 +0,0 @@
1
- const config = require('../../../config');
2
- const mermaidChart = (code) => `<yuml value="${encodeURIComponent(code)}"></yuml>`;
3
-
4
- module.exports = (md) => {
5
- const temp = md.renderer.rules.fence.bind(md.renderer.rules);
6
- md.renderer.rules.fence = (tokens, idx, options, env, slf) => {
7
- const token = tokens[idx];
8
- const code = token.content.trim();
9
- if (token.info === 'yuml') {
10
- return mermaidChart(code);
11
- }
12
- // const firstLine = code.split(/\n/)[0].trim()
13
- // if (firstLine === 'gantt' || firstLine === 'sequenceDiagram' || firstLine.match(/^graph (?:TB|BT|RL|LR|TD);?$/)) {
14
- // return mermaidChart(code)
15
- // }
16
- return temp(tokens, idx, options, env, slf);
17
- };
18
- };
@@ -1,263 +0,0 @@
1
- /* ! Project:无, Create:FWS 2020.01.08 21:48, Update:FWS 2020.01.08 21:48 */
2
- 'use strict';
3
- function Parser(t, e) {
4
- const s = this;
5
- return (
6
- (s._tagname = ''),
7
- (s._attribname = ''),
8
- (s._attribvalue = ''),
9
- (s._attribs = null),
10
- (s._stack = []),
11
- (s._foreignContext = []),
12
- (s.startIndex = 0),
13
- (s.endIndex = null),
14
- (s.parseChunk = Parser.prototype.write),
15
- (s.done = Parser.prototype.end),
16
- (s._options = e || {}),
17
- (s._cbs = t || {}),
18
- (s._tagname = ''),
19
- (s._attribname = ''),
20
- (s._attribvalue = ''),
21
- (s._attribs = null),
22
- (s._stack = []),
23
- (s._foreignContext = []),
24
- (s.startIndex = 0),
25
- (s.endIndex = null),
26
- (s._lowerCaseTagNames = 'lowerCaseTags' in s._options ? !!s._options.lowerCaseTags : !s._options.xmlMode),
27
- (s._lowerCaseAttributeNames =
28
- 'lowerCaseAttributeNames' in s._options ? !!s._options.lowerCaseAttributeNames : !s._options.xmlMode),
29
- (s._tokenizer = new (s._options.Tokenizer || Tokenizer_1.default)(s._options, s)),
30
- s._cbs.onparserinit && s._cbs.onparserinit(s),
31
- s
32
- );
33
- }
34
- const __importDefault =
35
- (this && this.__importDefault) ||
36
- function (t) {
37
- return t && t.__esModule ? t : { default: t };
38
- };
39
- Object.defineProperty(exports, '__esModule', { value: !0 });
40
- var Tokenizer_1 = __importDefault(require('./Tokenizer'));
41
- const formTags = new Set(['input', 'option', 'optgroup', 'select', 'button', 'datalist', 'textarea']);
42
- const pTag = new Set(['p']);
43
- const openImpliesClose = {
44
- tr: new Set(['tr', 'th', 'td']),
45
- th: new Set(['th']),
46
- td: new Set(['thead', 'th', 'td']),
47
- body: new Set(['head', 'link', 'script']),
48
- li: new Set(['li']),
49
- p: pTag,
50
- h1: pTag,
51
- h2: pTag,
52
- h3: pTag,
53
- h4: pTag,
54
- h5: pTag,
55
- h6: pTag,
56
- select: formTags,
57
- input: formTags,
58
- output: formTags,
59
- button: formTags,
60
- datalist: formTags,
61
- textarea: formTags,
62
- option: new Set(['option']),
63
- optgroup: new Set(['optgroup', 'option']),
64
- dd: new Set(['dt', 'dd']),
65
- dt: new Set(['dt', 'dd']),
66
- address: pTag,
67
- article: pTag,
68
- aside: pTag,
69
- blockquote: pTag,
70
- details: pTag,
71
- div: pTag,
72
- dl: pTag,
73
- fieldset: pTag,
74
- figcaption: pTag,
75
- figure: pTag,
76
- footer: pTag,
77
- form: pTag,
78
- header: pTag,
79
- hr: pTag,
80
- main: pTag,
81
- nav: pTag,
82
- ol: pTag,
83
- pre: pTag,
84
- section: pTag,
85
- table: pTag,
86
- ul: pTag,
87
- rt: new Set(['rt', 'rp']),
88
- rp: new Set(['rt', 'rp']),
89
- tbody: new Set(['thead', 'tbody']),
90
- tfoot: new Set(['thead', 'tbody']),
91
- };
92
- const voidElements = new Set([
93
- 'area',
94
- 'base',
95
- 'basefont',
96
- 'br',
97
- 'col',
98
- 'command',
99
- 'embed',
100
- 'frame',
101
- 'hr',
102
- 'img',
103
- 'input',
104
- 'isindex',
105
- 'keygen',
106
- 'link',
107
- 'meta',
108
- 'param',
109
- 'source',
110
- 'track',
111
- 'wbr',
112
- ]);
113
- const foreignContextElements = new Set(['math', 'svg']);
114
- const htmlIntegrationElements = new Set([
115
- 'mi',
116
- 'mo',
117
- 'mn',
118
- 'ms',
119
- 'mtext',
120
- 'annotation-xml',
121
- 'foreignObject',
122
- 'desc',
123
- 'title',
124
- ]);
125
- const reNameEnd = /\s|\//;
126
- (Parser.prototype._updatePosition = function (t) {
127
- null === this.endIndex
128
- ? this._tokenizer._sectionStart <= t
129
- ? (this.startIndex = 0)
130
- : (this.startIndex = this._tokenizer._sectionStart - t)
131
- : (this.startIndex = this.endIndex + 1),
132
- (this.endIndex = this._tokenizer.getAbsoluteIndex());
133
- }),
134
- (Parser.prototype.ontext = function (t) {
135
- this._updatePosition(1), this.endIndex--, this._cbs.ontext && this._cbs.ontext(t);
136
- }),
137
- (Parser.prototype.onopentagname = function (t) {
138
- if (
139
- (this._lowerCaseTagNames && (t = t.toLowerCase()),
140
- (this._tagname = t),
141
- !this._options.xmlMode && t in openImpliesClose)
142
- )
143
- for (let e = void 0; openImpliesClose[t].has((e = this._stack[this._stack.length - 1])); this.onclosetag(e));
144
- (!this._options.xmlMode && voidElements.has(t)) ||
145
- (this._stack.push(t),
146
- foreignContextElements.has(t)
147
- ? this._foreignContext.push(!0)
148
- : htmlIntegrationElements.has(t) && this._foreignContext.push(!1)),
149
- this._cbs.onopentagname && this._cbs.onopentagname(t),
150
- this._cbs.onopentag && (this._attribs = {});
151
- }),
152
- (Parser.prototype.onopentagend = function () {
153
- this._updatePosition(1),
154
- this._attribs &&
155
- (this._cbs.onopentag && this._cbs.onopentag(this._tagname, this._attribs), (this._attribs = null)),
156
- !this._options.xmlMode &&
157
- this._cbs.onclosetag &&
158
- voidElements.has(this._tagname) &&
159
- this._cbs.onclosetag(this._tagname),
160
- (this._tagname = '');
161
- }),
162
- (Parser.prototype.onclosetag = function (t) {
163
- if (
164
- (this._updatePosition(1),
165
- this._lowerCaseTagNames && (t = t.toLowerCase()),
166
- (foreignContextElements.has(t) || htmlIntegrationElements.has(t)) && this._foreignContext.pop(),
167
- !this._stack.length || (!this._options.xmlMode && voidElements.has(t)))
168
- )
169
- this._options.xmlMode || ('br' !== t && 'p' !== t) || (this.onopentagname(t), this._closeCurrentTag());
170
- else {
171
- let e = this._stack.lastIndexOf(t);
172
- if (-1 !== e)
173
- if (this._cbs.onclosetag) for (e = this._stack.length - e; e--; ) this._cbs.onclosetag(this._stack.pop());
174
- else this._stack.length = e;
175
- else 'p' !== t || this._options.xmlMode || (this.onopentagname(t), this._closeCurrentTag());
176
- }
177
- }),
178
- (Parser.prototype.onselfclosingtag = function () {
179
- this._options.xmlMode || this._options.recognizeSelfClosing || this._foreignContext[this._foreignContext.length - 1]
180
- ? this._closeCurrentTag()
181
- : this.onopentagend();
182
- }),
183
- (Parser.prototype._closeCurrentTag = function () {
184
- const t = this._tagname;
185
- this.onopentagend(),
186
- this._stack[this._stack.length - 1] === t && (this._cbs.onclosetag && this._cbs.onclosetag(t), this._stack.pop());
187
- }),
188
- (Parser.prototype.onattribname = function (t) {
189
- this._lowerCaseAttributeNames && (t = t.toLowerCase()), (this._attribname = t);
190
- }),
191
- (Parser.prototype.onattribdata = function (t) {
192
- this._attribvalue += t;
193
- }),
194
- (Parser.prototype.onattribend = function () {
195
- this._cbs.onattribute && this._cbs.onattribute(this._attribname, this._attribvalue),
196
- this._attribs &&
197
- !Object.prototype.hasOwnProperty.call(this._attribs, this._attribname) &&
198
- (this._attribs[this._attribname] = this._attribvalue),
199
- (this._attribname = ''),
200
- (this._attribvalue = '');
201
- }),
202
- (Parser.prototype._getInstructionName = function (t) {
203
- const e = t.search(reNameEnd);
204
- let s = e < 0 ? t : t.substr(0, e);
205
- return this._lowerCaseTagNames && (s = s.toLowerCase()), s;
206
- }),
207
- (Parser.prototype.ondeclaration = function (t) {
208
- if (this._cbs.onprocessinginstruction) {
209
- const e = this._getInstructionName(t);
210
- this._cbs.onprocessinginstruction(`!${e}`, `!${t}`);
211
- }
212
- }),
213
- (Parser.prototype.onprocessinginstruction = function (t) {
214
- if (this._cbs.onprocessinginstruction) {
215
- const e = this._getInstructionName(t);
216
- this._cbs.onprocessinginstruction(`?${e}`, `?${t}`);
217
- }
218
- }),
219
- (Parser.prototype.oncomment = function (t) {
220
- this._updatePosition(4),
221
- this._cbs.oncomment && this._cbs.oncomment(t),
222
- this._cbs.oncommentend && this._cbs.oncommentend();
223
- }),
224
- (Parser.prototype.oncdata = function (t) {
225
- this._updatePosition(1),
226
- this._options.xmlMode || this._options.recognizeCDATA
227
- ? (this._cbs.oncdatastart && this._cbs.oncdatastart(),
228
- this._cbs.ontext && this._cbs.ontext(t),
229
- this._cbs.oncdataend && this._cbs.oncdataend())
230
- : this.oncomment(`[CDATA[${t}]]`);
231
- }),
232
- (Parser.prototype.onerror = function (t) {
233
- this._cbs.onerror && this._cbs.onerror(t);
234
- }),
235
- (Parser.prototype.onend = function () {
236
- if (this._cbs.onclosetag) for (let t = this._stack.length; t > 0; this._cbs.onclosetag(this._stack[--t]));
237
- this._cbs.onend && this._cbs.onend();
238
- }),
239
- (Parser.prototype.reset = function () {
240
- this._cbs.onreset && this._cbs.onreset(),
241
- this._tokenizer.reset(),
242
- (this._tagname = ''),
243
- (this._attribname = ''),
244
- (this._attribs = null),
245
- (this._stack = []),
246
- this._cbs.onparserinit && this._cbs.onparserinit(this);
247
- }),
248
- (Parser.prototype.parseComplete = function (t) {
249
- this.reset(), this.end(t);
250
- }),
251
- (Parser.prototype.write = function (t) {
252
- this._tokenizer.write(t);
253
- }),
254
- (Parser.prototype.end = function (t) {
255
- this._tokenizer.end(t);
256
- }),
257
- (Parser.prototype.pause = function () {
258
- this._tokenizer.pause();
259
- }),
260
- (Parser.prototype.resume = function () {
261
- this._tokenizer.resume();
262
- }),
263
- (exports.Parser = Parser);