@cloudbase/weda-ui 0.2.6 → 0.2.10

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 (158) hide show
  1. package/package.json +3 -4
  2. package/src/configs/components/container.json +2 -1
  3. package/src/configs/components/form/input.json +6 -0
  4. package/src/configs/components/form/richText.json +2 -1
  5. package/src/configs/components/form/uploader.json +4 -5
  6. package/src/configs/components/image.json +2 -1
  7. package/src/configs/components/link.json +2 -1
  8. package/src/configs/components/richtextview.json +2 -1
  9. package/src/configs/components/scrollVeiw.json +2 -1
  10. package/src/configs/components/swiper.json +2 -1
  11. package/src/configs/components/tabs.json +31 -86
  12. package/src/configs/components/text.json +2 -1
  13. package/src/configs/index.js +4 -7
  14. package/src/mp/components/form/input/index.js +5 -1
  15. package/src/mp/components/form/input/index.wxml +2 -1
  16. package/src/mp/components/form/select/index.js +2 -2
  17. package/src/mp/components/form/textarea/index.wxml +1 -0
  18. package/src/mp/components/form/uploader/index.js +48 -14
  19. package/src/mp/components/form/uploader/index.wxml +9 -2
  20. package/src/mp/components/image/index.js +57 -8
  21. package/src/mp/components/image/index.json +4 -1
  22. package/src/mp/components/image/index.wxml +4 -2
  23. package/src/mp/components/image/index.wxss +14 -0
  24. package/src/mp/components/richText/index.wxml +1 -1
  25. package/src/mp/components/tabs/index.js +14 -1
  26. package/src/mp/utils/deepEqual.js +42 -0
  27. package/src/web/components/form/enumSelect/MultipleSelect.jsx +94 -0
  28. package/src/web/components/form/enumSelect/NormalSelect.jsx +105 -0
  29. package/src/web/components/form/enumSelect/SelectContainer.jsx +43 -0
  30. package/src/web/components/form/enumSelect/hooks/index.js +49 -0
  31. package/src/web/components/form/enumSelect/index.jsx +9 -0
  32. package/src/web/components/form/enumSelect/props/defaultProps.js +39 -0
  33. package/src/web/components/form/enumSelect/props/propsTypes.js +50 -0
  34. package/src/web/components/form/input/index.jsx +14 -10
  35. package/src/web/components/form/radio/index.jsx +1 -1
  36. package/src/web/components/form/select/h5.jsx +1 -1
  37. package/src/web/components/form/select/region/{cities.json → cities.js} +2 -2
  38. package/src/web/components/form/select/region/index.js +3 -3
  39. package/src/web/components/form/select/region/{provinces.json → provinces.js} +2 -2
  40. package/src/web/components/form/select/region/{regions.json → regions.js} +2 -2
  41. package/src/web/components/form/switch/index.jsx +1 -0
  42. package/src/web/components/form/uploader/index.css +15 -0
  43. package/src/web/components/form/uploader/index.jsx +2 -2
  44. package/src/web/components/form/uploader/uploader.h5.jsx +237 -0
  45. package/src/web/components/form/uploader/{uploaderPc.jsx → uploader.pc.jsx} +69 -59
  46. package/src/web/components/image/image.jsx +79 -5
  47. package/src/web/components/image/index.css +17 -0
  48. package/src/web/components/image/index.jsx +1 -0
  49. package/src/web/components/index.js +1 -1
  50. package/src/web/components/link/test/__snapshots__/storybook.test.js.snap +754 -0
  51. package/src/web/components/modal/index.jsx +3 -2
  52. package/src/web/components/richTextView/index.css +0 -10
  53. package/src/web/components/richTextView/index.jsx +1 -12
  54. package/src/web/components/tabs/index.jsx +3 -3
  55. package/src/web/components/tabs/{tabsH5.jsx → tabs.h5.jsx} +9 -47
  56. package/src/web/components/tabs/{tabsPc.jsx → tabs.pc.jsx} +13 -47
  57. package/src/web/components/uploaderView/index.jsx +1 -1
  58. package/src/web/utils/tcb.js +8 -0
  59. package/CHANGELOG.md +0 -240
  60. package/src/.DS_Store +0 -0
  61. package/src/configs/components/markdown.json +0 -17
  62. package/src/mp/.gitignore +0 -10
  63. package/src/mp/components/markdown/index.js +0 -27
  64. package/src/mp/components/markdown/index.json +0 -6
  65. package/src/mp/components/markdown/index.wxml +0 -1
  66. package/src/mp/components/markdown/towxml/audio-player/Audio.js +0 -99
  67. package/src/mp/components/markdown/towxml/audio-player/audio-player.js +0 -102
  68. package/src/mp/components/markdown/towxml/audio-player/audio-player.json +0 -5
  69. package/src/mp/components/markdown/towxml/audio-player/audio-player.wxml +0 -14
  70. package/src/mp/components/markdown/towxml/audio-player/audio-player.wxss +0 -175
  71. package/src/mp/components/markdown/towxml/audio-player/loading.svg +0 -1
  72. package/src/mp/components/markdown/towxml/config.js +0 -285
  73. package/src/mp/components/markdown/towxml/decode.js +0 -26
  74. package/src/mp/components/markdown/towxml/decode.json +0 -12
  75. package/src/mp/components/markdown/towxml/decode.wxml +0 -1
  76. package/src/mp/components/markdown/towxml/decode.wxss +0 -0
  77. package/src/mp/components/markdown/towxml/img/img.js +0 -98
  78. package/src/mp/components/markdown/towxml/img/img.json +0 -3
  79. package/src/mp/components/markdown/towxml/img/img.wxml +0 -1
  80. package/src/mp/components/markdown/towxml/img/img.wxss +0 -0
  81. package/src/mp/components/markdown/towxml/index.js +0 -19
  82. package/src/mp/components/markdown/towxml/latex/latex.js +0 -53
  83. package/src/mp/components/markdown/towxml/latex/latex.json +0 -5
  84. package/src/mp/components/markdown/towxml/latex/latex.wxml +0 -1
  85. package/src/mp/components/markdown/towxml/latex/latex.wxss +0 -0
  86. package/src/mp/components/markdown/towxml/parse/highlight/highlight.js +0 -729
  87. package/src/mp/components/markdown/towxml/parse/highlight/index.js +0 -7
  88. package/src/mp/components/markdown/towxml/parse/highlight/languages/bash.js +0 -91
  89. package/src/mp/components/markdown/towxml/parse/highlight/languages/c-like.js +0 -244
  90. package/src/mp/components/markdown/towxml/parse/highlight/languages/c.js +0 -20
  91. package/src/mp/components/markdown/towxml/parse/highlight/languages/css.js +0 -138
  92. package/src/mp/components/markdown/towxml/parse/highlight/languages/dart.js +0 -135
  93. package/src/mp/components/markdown/towxml/parse/highlight/languages/go.js +0 -57
  94. package/src/mp/components/markdown/towxml/parse/highlight/languages/htmlbars.js +0 -79
  95. package/src/mp/components/markdown/towxml/parse/highlight/languages/java.js +0 -126
  96. package/src/mp/components/markdown/towxml/parse/highlight/languages/javascript.js +0 -263
  97. package/src/mp/components/markdown/towxml/parse/highlight/languages/json.js +0 -51
  98. package/src/mp/components/markdown/towxml/parse/highlight/languages/less.js +0 -177
  99. package/src/mp/components/markdown/towxml/parse/highlight/languages/nginx.js +0 -103
  100. package/src/mp/components/markdown/towxml/parse/highlight/languages/php.js +0 -152
  101. package/src/mp/components/markdown/towxml/parse/highlight/languages/python-repl.js +0 -27
  102. package/src/mp/components/markdown/towxml/parse/highlight/languages/python.js +0 -146
  103. package/src/mp/components/markdown/towxml/parse/highlight/languages/scss.js +0 -137
  104. package/src/mp/components/markdown/towxml/parse/highlight/languages/shell.js +0 -23
  105. package/src/mp/components/markdown/towxml/parse/highlight/languages/typescript.js +0 -198
  106. package/src/mp/components/markdown/towxml/parse/highlight/languages/xml.js +0 -143
  107. package/src/mp/components/markdown/towxml/parse/highlight/style/github.wxss +0 -99
  108. package/src/mp/components/markdown/towxml/parse/highlight/style/monokai.wxss +0 -70
  109. package/src/mp/components/markdown/towxml/parse/index.js +0 -106
  110. package/src/mp/components/markdown/towxml/parse/markdown/index.js +0 -53
  111. package/src/mp/components/markdown/towxml/parse/markdown/markdown.js +0 -5834
  112. package/src/mp/components/markdown/towxml/parse/markdown/plugins/emoji.js +0 -1773
  113. package/src/mp/components/markdown/towxml/parse/markdown/plugins/ins.js +0 -120
  114. package/src/mp/components/markdown/towxml/parse/markdown/plugins/latex.js +0 -193
  115. package/src/mp/components/markdown/towxml/parse/markdown/plugins/mark.js +0 -120
  116. package/src/mp/components/markdown/towxml/parse/markdown/plugins/sub.js +0 -95
  117. package/src/mp/components/markdown/towxml/parse/markdown/plugins/sup.js +0 -95
  118. package/src/mp/components/markdown/towxml/parse/markdown/plugins/todo.js +0 -220
  119. package/src/mp/components/markdown/towxml/parse/markdown/plugins/yuml.js +0 -18
  120. package/src/mp/components/markdown/towxml/parse/parse2/Parser.js +0 -263
  121. package/src/mp/components/markdown/towxml/parse/parse2/Tokenizer.js +0 -507
  122. package/src/mp/components/markdown/towxml/parse/parse2/domhandler/index.js +0 -104
  123. package/src/mp/components/markdown/towxml/parse/parse2/domhandler/node.js +0 -169
  124. package/src/mp/components/markdown/towxml/parse/parse2/entities/decode.js +0 -54
  125. package/src/mp/components/markdown/towxml/parse/parse2/entities/decode_codepoint.js +0 -19
  126. package/src/mp/components/markdown/towxml/parse/parse2/entities/encode.js +0 -54
  127. package/src/mp/components/markdown/towxml/parse/parse2/entities/index.js +0 -30
  128. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/decode.js +0 -31
  129. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/entities.js +0 -2128
  130. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/legacy.js +0 -109
  131. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/xml.js +0 -2
  132. package/src/mp/components/markdown/towxml/parse/parse2/index.js +0 -8
  133. package/src/mp/components/markdown/towxml/style/main.wxss +0 -378
  134. package/src/mp/components/markdown/towxml/style/theme/dark.wxss +0 -73
  135. package/src/mp/components/markdown/towxml/style/theme/light.wxss +0 -63
  136. package/src/mp/components/markdown/towxml/table/table.js +0 -11
  137. package/src/mp/components/markdown/towxml/table/table.json +0 -6
  138. package/src/mp/components/markdown/towxml/table/table.wxml +0 -24
  139. package/src/mp/components/markdown/towxml/table/table.wxss +0 -0
  140. package/src/mp/components/markdown/towxml/todogroup/todogroup.js +0 -19
  141. package/src/mp/components/markdown/towxml/todogroup/todogroup.json +0 -6
  142. package/src/mp/components/markdown/towxml/todogroup/todogroup.wxml +0 -13
  143. package/src/mp/components/markdown/towxml/todogroup/todogroup.wxss +0 -3
  144. package/src/mp/components/markdown/towxml/towxml.js +0 -17
  145. package/src/mp/components/markdown/towxml/towxml.json +0 -6
  146. package/src/mp/components/markdown/towxml/towxml.wxml +0 -5
  147. package/src/mp/components/markdown/towxml/towxml.wxss +0 -8
  148. package/src/mp/components/markdown/towxml/yuml/yuml.js +0 -51
  149. package/src/mp/components/markdown/towxml/yuml/yuml.json +0 -5
  150. package/src/mp/components/markdown/towxml/yuml/yuml.wxml +0 -5
  151. package/src/mp/components/markdown/towxml/yuml/yuml.wxss +0 -0
  152. package/src/web/.DS_Store +0 -0
  153. package/src/web/components/form/uploader/uploaderH5.jsx +0 -208
  154. package/src/web/components/markdown/index.jsx +0 -40
  155. package/src/web/wedatheme/.git +0 -1
  156. package/src/web/wedatheme/.gitignore +0 -5
  157. package/src/web/wedatheme/.npmrc +0 -1
  158. package/src/web/wedatheme/package-lock.json +0 -14335
@@ -1,729 +0,0 @@
1
- 'use strict';
2
- function deepFreeze(e) {
3
- Object.freeze(e);
4
- const n = 'function' === typeof e;
5
- return (
6
- Object.getOwnPropertyNames(e).forEach((t) => {
7
- !e.hasOwnProperty(t) ||
8
- null === e[t] ||
9
- ('object' !== typeof e[t] && 'function' !== typeof e[t]) ||
10
- (n && ('caller' === t || 'callee' === t || 'arguments' === t)) ||
11
- Object.isFrozen(e[t]) ||
12
- deepFreeze(e[t]);
13
- }),
14
- e
15
- );
16
- }
17
- function escapeHTML(e) {
18
- return e.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
19
- }
20
- function inherit(e) {
21
- let n;
22
- const t = {};
23
- const r = Array.prototype.slice.call(arguments, 1);
24
- for (n in e) t[n] = e[n];
25
- return (
26
- r.forEach((e) => {
27
- for (n in e) t[n] = e[n];
28
- }),
29
- t
30
- );
31
- }
32
- function tag(e) {
33
- return e.nodeName.toLowerCase();
34
- }
35
- function nodeStream(e) {
36
- const n = [];
37
- return (
38
- (function e(t, r) {
39
- for (let a = t.firstChild; a; a = a.nextSibling)
40
- 3 === a.nodeType
41
- ? (r += a.nodeValue.length)
42
- : 1 === a.nodeType &&
43
- (n.push({ event: 'start', offset: r, node: a }),
44
- (r = e(a, r)),
45
- tag(a).match(/br|hr|img|input/) || n.push({ event: 'stop', offset: r, node: a }));
46
- return r;
47
- })(e, 0),
48
- n
49
- );
50
- }
51
- function mergeStreams(e, n, t) {
52
- let r = 0;
53
- let a = '';
54
- const i = [];
55
- function s() {
56
- return e.length && n.length
57
- ? e[0].offset !== n[0].offset
58
- ? e[0].offset < n[0].offset
59
- ? e
60
- : n
61
- : 'start' === n[0].event
62
- ? e
63
- : n
64
- : e.length
65
- ? e
66
- : n;
67
- }
68
- function o(e) {
69
- a += `<${tag(e)}${[].map
70
- .call(e.attributes, (e) => ` ${e.nodeName}="${escapeHTML(e.value).replace(/"/g, '&quot;')}"`)
71
- .join('')}>`;
72
- }
73
- function l(e) {
74
- a += `</${tag(e)}>`;
75
- }
76
- function c(e) {
77
- ('start' === e.event ? o : l)(e.node);
78
- }
79
- for (; e.length || n.length; ) {
80
- let u = s();
81
- if (((a += escapeHTML(t.substring(r, u[0].offset))), (r = u[0].offset), u === e)) {
82
- i.reverse().forEach(l);
83
- do {
84
- c(u.splice(0, 1)[0]), (u = s());
85
- } while (u === e && u.length && u[0].offset === r);
86
- i.reverse().forEach(o);
87
- } else 'start' === u[0].event ? i.push(u[0].node) : i.pop(), c(u.splice(0, 1)[0]);
88
- }
89
- return a + escapeHTML(t.substr(r));
90
- }
91
- const utils = Object.freeze({
92
- __proto__: null,
93
- escapeHTML,
94
- inherit,
95
- nodeStream,
96
- mergeStreams,
97
- });
98
- const SPAN_CLOSE = '</span>';
99
- const emitsWrappingTags = (e) => !!e.kind;
100
- class HTMLRenderer {
101
- constructor(e, n) {
102
- (this.buffer = ''), (this.classPrefix = n.classPrefix), e.walk(this);
103
- }
104
- addText(e) {
105
- this.buffer += escapeHTML(e);
106
- }
107
- openNode(e) {
108
- if (!emitsWrappingTags(e)) return;
109
- let n = e.kind;
110
- e.sublanguage || (n = `${this.classPrefix}${n}`), this.span(n);
111
- }
112
- closeNode(e) {
113
- emitsWrappingTags(e) && (this.buffer += SPAN_CLOSE);
114
- }
115
- span(e) {
116
- this.buffer += `<span class="${e}">`;
117
- }
118
- value() {
119
- return this.buffer;
120
- }
121
- }
122
- class TokenTree {
123
- constructor() {
124
- (this.rootNode = { children: [] }), (this.stack = [this.rootNode]);
125
- }
126
- get top() {
127
- return this.stack[this.stack.length - 1];
128
- }
129
- get root() {
130
- return this.rootNode;
131
- }
132
- add(e) {
133
- this.top.children.push(e);
134
- }
135
- openNode(e) {
136
- const n = { kind: e, children: [] };
137
- this.add(n), this.stack.push(n);
138
- }
139
- closeNode() {
140
- if (this.stack.length > 1) return this.stack.pop();
141
- }
142
- closeAllNodes() {
143
- for (; this.closeNode(); );
144
- }
145
- toJSON() {
146
- return JSON.stringify(this.rootNode, null, 4);
147
- }
148
- walk(e) {
149
- return this.constructor._walk(e, this.rootNode);
150
- }
151
- static _walk(e, n) {
152
- return (
153
- 'string' === typeof n
154
- ? e.addText(n)
155
- : n.children && (e.openNode(n), n.children.forEach((n) => this._walk(e, n)), e.closeNode(n)),
156
- e
157
- );
158
- }
159
- static _collapse(e) {
160
- e.children &&
161
- (e.children.every((e) => 'string' === typeof e)
162
- ? ((e.text = e.children.join('')), delete e.children)
163
- : e.children.forEach((e) => {
164
- 'string' !== typeof e && TokenTree._collapse(e);
165
- }));
166
- }
167
- }
168
- class TokenTreeEmitter extends TokenTree {
169
- constructor(e) {
170
- super(), (this.options = e);
171
- }
172
- addKeyword(e, n) {
173
- '' !== e && (this.openNode(n), this.addText(e), this.closeNode());
174
- }
175
- addText(e) {
176
- '' !== e && this.add(e);
177
- }
178
- addSublanguage(e, n) {
179
- const t = e.root;
180
- (t.kind = n), (t.sublanguage = !0), this.add(t);
181
- }
182
- toHTML() {
183
- return new HTMLRenderer(this, this.options).value();
184
- }
185
- finalize() {}
186
- }
187
- function escape(e) {
188
- return new RegExp(e.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'm');
189
- }
190
- function source(e) {
191
- return (e && e.source) || e;
192
- }
193
- function countMatchGroups(e) {
194
- return new RegExp(`${e.toString()}|`).exec('').length - 1;
195
- }
196
- function startsWith(e, n) {
197
- const t = e && e.exec(n);
198
- return t && 0 === t.index;
199
- }
200
- function join(e, n) {
201
- for (var t = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./, r = 0, a = '', i = 0; i < e.length; i++) {
202
- const s = (r += 1);
203
- let o = source(e[i]);
204
- for (i > 0 && (a += n), a += '('; o.length > 0; ) {
205
- const l = t.exec(o);
206
- if (null == l) {
207
- a += o;
208
- break;
209
- }
210
- (a += o.substring(0, l.index)),
211
- (o = o.substring(l.index + l[0].length)),
212
- '\\' == l[0][0] && l[1] ? (a += `\\${String(Number(l[1]) + s)}`) : ((a += l[0]), '(' == l[0] && r++);
213
- }
214
- a += ')';
215
- }
216
- return a;
217
- }
218
- const IDENT_RE = '[a-zA-Z]\\w*';
219
- const UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\w*';
220
- const NUMBER_RE = '\\b\\d+(\\.\\d+)?';
221
- const C_NUMBER_RE = '(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)';
222
- const BINARY_NUMBER_RE = '\\b(0b[01]+)';
223
- const RE_STARTERS_RE =
224
- '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~';
225
- const BACKSLASH_ESCAPE = { begin: '\\\\[\\s\\S]', relevance: 0 };
226
- const APOS_STRING_MODE = { className: 'string', begin: "'", end: "'", illegal: '\\n', contains: [BACKSLASH_ESCAPE] };
227
- const QUOTE_STRING_MODE = { className: 'string', begin: '"', end: '"', illegal: '\\n', contains: [BACKSLASH_ESCAPE] };
228
- const PHRASAL_WORDS_MODE = {
229
- begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/,
230
- };
231
- const COMMENT = function (e, n, t) {
232
- const r = inherit({ className: 'comment', begin: e, end: n, contains: [] }, t || {});
233
- return (
234
- r.contains.push(PHRASAL_WORDS_MODE),
235
- r.contains.push({ className: 'doctag', begin: '(?:TODO|FIXME|NOTE|BUG|XXX):', relevance: 0 }),
236
- r
237
- );
238
- };
239
- const C_LINE_COMMENT_MODE = COMMENT('//', '$');
240
- const C_BLOCK_COMMENT_MODE = COMMENT('/\\*', '\\*/');
241
- const HASH_COMMENT_MODE = COMMENT('#', '$');
242
- const NUMBER_MODE = { className: 'number', begin: NUMBER_RE, relevance: 0 };
243
- const C_NUMBER_MODE = { className: 'number', begin: C_NUMBER_RE, relevance: 0 };
244
- const BINARY_NUMBER_MODE = { className: 'number', begin: '\\b(0b[01]+)', relevance: 0 };
245
- const CSS_NUMBER_MODE = {
246
- className: 'number',
247
- begin: `${NUMBER_RE}(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,
248
- relevance: 0,
249
- };
250
- const REGEXP_MODE = {
251
- begin: /(?=\/[^\/\n]*\/)/,
252
- contains: [
253
- {
254
- className: 'regexp',
255
- begin: /\//,
256
- end: /\/[gimuy]*/,
257
- illegal: /\n/,
258
- contains: [BACKSLASH_ESCAPE, { begin: /\[/, end: /\]/, relevance: 0, contains: [BACKSLASH_ESCAPE] }],
259
- },
260
- ],
261
- };
262
- const TITLE_MODE = { className: 'title', begin: IDENT_RE, relevance: 0 };
263
- const UNDERSCORE_TITLE_MODE = { className: 'title', begin: '[a-zA-Z_]\\w*', relevance: 0 };
264
- const METHOD_GUARD = { begin: '\\.\\s*[a-zA-Z_]\\w*', relevance: 0 };
265
- const MODES = Object.freeze({
266
- __proto__: null,
267
- IDENT_RE,
268
- UNDERSCORE_IDENT_RE: '[a-zA-Z_]\\w*',
269
- NUMBER_RE,
270
- C_NUMBER_RE,
271
- BINARY_NUMBER_RE: '\\b(0b[01]+)',
272
- RE_STARTERS_RE,
273
- BACKSLASH_ESCAPE,
274
- APOS_STRING_MODE,
275
- QUOTE_STRING_MODE,
276
- PHRASAL_WORDS_MODE,
277
- COMMENT,
278
- C_LINE_COMMENT_MODE,
279
- C_BLOCK_COMMENT_MODE,
280
- HASH_COMMENT_MODE,
281
- NUMBER_MODE,
282
- C_NUMBER_MODE,
283
- BINARY_NUMBER_MODE,
284
- CSS_NUMBER_MODE,
285
- REGEXP_MODE,
286
- TITLE_MODE,
287
- UNDERSCORE_TITLE_MODE,
288
- METHOD_GUARD,
289
- });
290
- const COMMON_KEYWORDS = 'of and for in not or if then'.split(' ');
291
- function compileLanguage(e) {
292
- function n(n, t) {
293
- return new RegExp(source(n), `m${e.case_insensitive ? 'i' : ''}${t ? 'g' : ''}`);
294
- }
295
- class t {
296
- constructor() {
297
- (this.matchIndexes = {}), (this.regexes = []), (this.matchAt = 1), (this.position = 0);
298
- }
299
- addRule(e, n) {
300
- (n.position = this.position++),
301
- (this.matchIndexes[this.matchAt] = n),
302
- this.regexes.push([n, e]),
303
- (this.matchAt += countMatchGroups(e) + 1);
304
- }
305
- compile() {
306
- 0 === this.regexes.length && (this.exec = () => null);
307
- const e = this.regexes.map((e) => e[1]);
308
- (this.matcherRe = n(join(e, '|'), !0)), (this.lastIndex = 0);
309
- }
310
- exec(e) {
311
- this.matcherRe.lastIndex = this.lastIndex;
312
- const n = this.matcherRe.exec(e);
313
- if (!n) return null;
314
- const t = n.findIndex((e, n) => n > 0 && void 0 != e);
315
- const r = this.matchIndexes[t];
316
- return Object.assign(n, r);
317
- }
318
- }
319
- class r {
320
- constructor() {
321
- (this.rules = []), (this.multiRegexes = []), (this.count = 0), (this.lastIndex = 0), (this.regexIndex = 0);
322
- }
323
- getMatcher(e) {
324
- if (this.multiRegexes[e]) return this.multiRegexes[e];
325
- const n = new t();
326
- return this.rules.slice(e).forEach(([e, t]) => n.addRule(e, t)), n.compile(), (this.multiRegexes[e] = n), n;
327
- }
328
- considerAll() {
329
- this.regexIndex = 0;
330
- }
331
- addRule(e, n) {
332
- this.rules.push([e, n]), 'begin' === n.type && this.count++;
333
- }
334
- exec(e) {
335
- const n = this.getMatcher(this.regexIndex);
336
- n.lastIndex = this.lastIndex;
337
- const t = n.exec(e);
338
- return t && ((this.regexIndex += t.position + 1), this.regexIndex === this.count && (this.regexIndex = 0)), t;
339
- }
340
- }
341
- function a(e) {
342
- const n = e.input[e.index - 1];
343
- const t = e.input[e.index + e[0].length];
344
- if ('.' === n || '.' === t) return { ignoreMatch: !0 };
345
- }
346
- if (e.contains && e.contains.includes('self'))
347
- throw new Error('ERR: contains `self` is not supported at the top-level of a language. See documentation.');
348
- !(function t(i, s) {
349
- i.compiled ||
350
- ((i.compiled = !0),
351
- (i.__onBegin = null),
352
- (i.keywords = i.keywords || i.beginKeywords),
353
- i.keywords && (i.keywords = compileKeywords(i.keywords, e.case_insensitive)),
354
- (i.lexemesRe = n(i.lexemes || /\w+/, !0)),
355
- s &&
356
- (i.beginKeywords && ((i.begin = `\\b(${i.beginKeywords.split(' ').join('|')})(?=\\b|\\s)`), (i.__onBegin = a)),
357
- i.begin || (i.begin = /\B|\b/),
358
- (i.beginRe = n(i.begin)),
359
- i.endSameAsBegin && (i.end = i.begin),
360
- i.end || i.endsWithParent || (i.end = /\B|\b/),
361
- i.end && (i.endRe = n(i.end)),
362
- (i.terminator_end = source(i.end) || ''),
363
- i.endsWithParent && s.terminator_end && (i.terminator_end += (i.end ? '|' : '') + s.terminator_end)),
364
- i.illegal && (i.illegalRe = n(i.illegal)),
365
- null == i.relevance && (i.relevance = 1),
366
- i.contains || (i.contains = []),
367
- (i.contains = [].concat(...i.contains.map((e) => expand_or_clone_mode('self' === e ? i : e)))),
368
- i.contains.forEach((e) => {
369
- t(e, i);
370
- }),
371
- i.starts && t(i.starts, s),
372
- (i.matcher = (function (e) {
373
- const n = new r();
374
- return (
375
- e.contains.forEach((e) => n.addRule(e.begin, { rule: e, type: 'begin' })),
376
- e.terminator_end && n.addRule(e.terminator_end, { type: 'end' }),
377
- e.illegal && n.addRule(e.illegal, { type: 'illegal' }),
378
- n
379
- );
380
- })(i)));
381
- })(e);
382
- }
383
- function dependencyOnParent(e) {
384
- return !!e && (e.endsWithParent || dependencyOnParent(e.starts));
385
- }
386
- function expand_or_clone_mode(e) {
387
- return (
388
- e.variants && !e.cached_variants && (e.cached_variants = e.variants.map((n) => inherit(e, { variants: null }, n))),
389
- e.cached_variants
390
- ? e.cached_variants
391
- : dependencyOnParent(e)
392
- ? inherit(e, { starts: e.starts ? inherit(e.starts) : null })
393
- : Object.isFrozen(e)
394
- ? inherit(e)
395
- : e
396
- );
397
- }
398
- function compileKeywords(e, n) {
399
- const t = {};
400
- return (
401
- 'string' === typeof e
402
- ? r('keyword', e)
403
- : Object.keys(e).forEach((n) => {
404
- r(n, e[n]);
405
- }),
406
- t
407
- );
408
- function r(e, r) {
409
- n && (r = r.toLowerCase()),
410
- r.split(' ').forEach((n) => {
411
- const r = n.split('|');
412
- t[r[0]] = [e, scoreForKeyword(r[0], r[1])];
413
- });
414
- }
415
- }
416
- function scoreForKeyword(e, n) {
417
- return n ? Number(n) : commonKeyword(e) ? 0 : 1;
418
- }
419
- function commonKeyword(e) {
420
- return COMMON_KEYWORDS.includes(e.toLowerCase());
421
- }
422
- const version = '10.0.0-beta.0';
423
- const escape$1 = escapeHTML;
424
- const inherit$1 = inherit;
425
- const { nodeStream: nodeStream$1, mergeStreams: mergeStreams$1 } = utils;
426
- const HLJS = function (e) {
427
- const n = [];
428
- const t = {};
429
- const r = {};
430
- const a = [];
431
- let i = !0;
432
- const s = /((^(<[^>]+>|\t|)+|(?:\n)))/gm;
433
- const o = "Could not find the language '{}', did you forget to load/include a language module?";
434
- let l = {
435
- noHighlightRe: /^(no-?highlight)$/i,
436
- languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
437
- classPrefix: 'hljs-',
438
- tabReplace: null,
439
- useBR: !1,
440
- languages: void 0,
441
- __emitter: TokenTreeEmitter,
442
- };
443
- function c(e) {
444
- return l.noHighlightRe.test(e);
445
- }
446
- function u(e, n, t, r) {
447
- const a = { code: n, language: e };
448
- R('before:highlight', a);
449
- const i = a.result ? a.result : d(a.language, a.code, t, r);
450
- return (i.code = a.code), R('after:highlight', i), i;
451
- }
452
- function d(e, n, r, a) {
453
- const s = n;
454
- function c(e, n) {
455
- const t = R.case_insensitive ? n[0].toLowerCase() : n[0];
456
- return e.keywords.hasOwnProperty(t) && e.keywords[t];
457
- }
458
- function u() {
459
- null != b.subLanguage
460
- ? (function () {
461
- if ('' !== S) {
462
- const e = 'string' === typeof b.subLanguage;
463
- if (!e || t[b.subLanguage]) {
464
- const n = e
465
- ? d(b.subLanguage, S, !0, v[b.subLanguage])
466
- : g(S, b.subLanguage.length ? b.subLanguage : void 0);
467
- b.relevance > 0 && (T += n.relevance),
468
- e && (v[b.subLanguage] = n.top),
469
- N.addSublanguage(n.emitter, n.language);
470
- } else N.addText(S);
471
- }
472
- })()
473
- : (function () {
474
- let e;
475
- let n;
476
- let t;
477
- let r;
478
- if (b.keywords) {
479
- for (n = 0, b.lexemesRe.lastIndex = 0, t = b.lexemesRe.exec(S), r = ''; t; ) {
480
- r += S.substring(n, t.index);
481
- let a = null;
482
- (e = c(b, t)) ? (N.addText(r), (r = ''), (T += e[1]), (a = e[0]), N.addKeyword(t[0], a)) : (r += t[0]),
483
- (n = b.lexemesRe.lastIndex),
484
- (t = b.lexemesRe.exec(S));
485
- }
486
- (r += S.substr(n)), N.addText(r);
487
- } else N.addText(S);
488
- })(),
489
- (S = '');
490
- }
491
- function h(e) {
492
- e.className && N.openNode(e.className), (b = Object.create(e, { parent: { value: b } }));
493
- }
494
- function f(e) {
495
- const n = e[0];
496
- const t = e.rule;
497
- if (t.__onBegin) {
498
- if ((t.__onBegin(e) || {}).ignoreMatch)
499
- return (function (e) {
500
- return 0 === b.matcher.regexIndex ? ((S += e[0]), 1) : ((w = !0), 0);
501
- })(n);
502
- }
503
- return (
504
- t && t.endSameAsBegin && (t.endRe = escape(n)),
505
- t.skip ? (S += n) : (t.excludeBegin && (S += n), u(), t.returnBegin || t.excludeBegin || (S = n)),
506
- h(t),
507
- t.returnBegin ? 0 : n.length
508
- );
509
- }
510
- function E(e) {
511
- const n = e[0];
512
- const t = s.substr(e.index);
513
- const r = (function e(n, t) {
514
- if (startsWith(n.endRe, t)) {
515
- for (; n.endsParent && n.parent; ) n = n.parent;
516
- return n;
517
- }
518
- if (n.endsWithParent) return e(n.parent, t);
519
- })(b, t);
520
- if (r) {
521
- const a = b;
522
- a.skip ? (S += n) : (a.returnEnd || a.excludeEnd || (S += n), u(), a.excludeEnd && (S = n));
523
- do {
524
- b.className && N.closeNode(), b.skip || b.subLanguage || (T += b.relevance), (b = b.parent);
525
- } while (b !== r.parent);
526
- return r.starts && (r.endSameAsBegin && (r.starts.endRe = r.endRe), h(r.starts)), a.returnEnd ? 0 : n.length;
527
- }
528
- }
529
- let _ = {};
530
- function m(n, t) {
531
- let a;
532
- const o = t && t[0];
533
- if (((S += n), null == o)) return u(), 0;
534
- if ('begin' == _.type && 'end' == t.type && _.index == t.index && '' === o) {
535
- if (((S += s.slice(t.index, t.index + 1)), !i))
536
- throw (((a = new Error('0 width match regex')).languageName = e), (a.badRule = _.rule), a);
537
- return 1;
538
- }
539
- if (((_ = t), 'begin' === t.type)) return f(t);
540
- if ('illegal' === t.type && !r)
541
- throw (((a = new Error(`Illegal lexeme "${o}" for mode "${b.className || '<unnamed>'}"`)).mode = b), a);
542
- if ('end' === t.type) {
543
- const l = E(t);
544
- if (void 0 != l) return l;
545
- }
546
- return (S += o), o.length;
547
- }
548
- var R = p(e);
549
- if (!R) throw (console.error(o.replace('{}', e)), new Error(`Unknown language: "${e}"`));
550
- compileLanguage(R);
551
- let M;
552
- var b = a || R;
553
- var v = {};
554
- var N = new l.__emitter(l);
555
- !(function () {
556
- for (var e = [], n = b; n !== R; n = n.parent) n.className && e.unshift(n.className);
557
- e.forEach((e) => N.openNode(e));
558
- })();
559
- let O;
560
- let x;
561
- var S = '';
562
- var T = 0;
563
- let D = 0;
564
- try {
565
- var w = !1;
566
- for (
567
- b.matcher.considerAll();
568
- w ? (w = !1) : ((b.matcher.lastIndex = D), b.matcher.considerAll()), (O = b.matcher.exec(s));
569
-
570
- ) {
571
- (x = m(s.substring(D, O.index), O)), (D = O.index + x);
572
- }
573
- return (
574
- m(s.substr(D)),
575
- N.closeAllNodes(),
576
- N.finalize(),
577
- (M = N.toHTML()),
578
- { relevance: T, value: M, language: e, illegal: !1, emitter: N, top: b }
579
- );
580
- } catch (n) {
581
- if (n.message && n.message.includes('Illegal'))
582
- return {
583
- illegal: !0,
584
- illegalBy: { msg: n.message, context: s.slice(D - 100, D + 100), mode: n.mode },
585
- sofar: M,
586
- relevance: 0,
587
- value: escape$1(s),
588
- emitter: N,
589
- };
590
- if (i) return { relevance: 0, value: escape$1(s), emitter: N, language: e, top: b, errorRaised: n };
591
- throw n;
592
- }
593
- }
594
- function g(e, n) {
595
- n = n || l.languages || Object.keys(t);
596
- let r = { relevance: 0, emitter: new l.__emitter(l), value: escape$1(e) };
597
- let a = r;
598
- return (
599
- n
600
- .filter(p)
601
- .filter(m)
602
- .forEach((n) => {
603
- const t = d(n, e, !1);
604
- (t.language = n), t.relevance > a.relevance && (a = t), t.relevance > r.relevance && ((a = r), (r = t));
605
- }),
606
- a.language && (r.second_best = a),
607
- r
608
- );
609
- }
610
- function h(e) {
611
- return l.tabReplace || l.useBR
612
- ? e.replace(s, (e, n) => (l.useBR && '\n' === e ? '<br>' : l.tabReplace ? n.replace(/\t/g, l.tabReplace) : ''))
613
- : e;
614
- }
615
- function f(e) {
616
- let n;
617
- let t;
618
- let a;
619
- let i;
620
- let s;
621
- const d = (function (e) {
622
- let n;
623
- let t = `${e.className} `;
624
- if (((t += e.parentNode ? e.parentNode.className : ''), (n = l.languageDetectRe.exec(t)))) {
625
- const r = p(n[1]);
626
- return (
627
- r ||
628
- (console.warn(o.replace('{}', n[1])), console.warn('Falling back to no-highlight mode for this block.', e)),
629
- r ? n[1] : 'no-highlight'
630
- );
631
- }
632
- return t.split(/\s+/).find((e) => c(e) || p(e));
633
- })(e);
634
- c(d) ||
635
- (R('before:highlightBlock', { block: e, language: d }),
636
- l.useBR
637
- ? ((n = document.createElement('div')).innerHTML = e.innerHTML.replace(/\n/g, '').replace(/<br[ \/]*>/g, '\n'))
638
- : (n = e),
639
- (s = n.textContent),
640
- (a = d ? u(d, s, !0) : g(s)),
641
- (t = nodeStream$1(n)).length &&
642
- (((i = document.createElement('div')).innerHTML = a.value), (a.value = mergeStreams$1(t, nodeStream$1(i), s))),
643
- (a.value = h(a.value)),
644
- R('after:highlightBlock', { block: e, result: a }),
645
- (e.innerHTML = a.value),
646
- (e.className = (function (e, n, t) {
647
- const a = n ? r[n] : t;
648
- const i = [e.trim()];
649
- return e.match(/\bhljs\b/) || i.push('hljs'), e.includes(a) || i.push(a), i.join(' ').trim();
650
- })(e.className, d, a.language)),
651
- (e.result = { language: a.language, re: a.relevance }),
652
- a.second_best && (e.second_best = { language: a.second_best.language, re: a.second_best.relevance }));
653
- }
654
- function E() {
655
- if (!E.called) {
656
- E.called = !0;
657
- const e = document.querySelectorAll('pre code');
658
- n.forEach.call(e, f);
659
- }
660
- }
661
- const _ = { disableAutodetect: !0 };
662
- function p(e) {
663
- return (e = (e || '').toLowerCase()), t[e] || t[r[e]];
664
- }
665
- function m(e) {
666
- const n = p(e);
667
- return n && !n.disableAutodetect;
668
- }
669
- function R(e, n) {
670
- const t = e;
671
- a.forEach((e) => {
672
- e[t] && e[t](n);
673
- });
674
- }
675
- Object.assign(e, {
676
- highlight: u,
677
- highlightAuto: g,
678
- fixMarkup: h,
679
- highlightBlock: f,
680
- configure(e) {
681
- l = inherit$1(l, e);
682
- },
683
- initHighlighting: E,
684
- initHighlightingOnLoad() {
685
- window.addEventListener('DOMContentLoaded', E, !1);
686
- },
687
- registerLanguage(n, a) {
688
- let s;
689
- try {
690
- s = a(e);
691
- } catch (e) {
692
- if ((console.error("Language definition for '{}' could not be registered.".replace('{}', n)), !i)) throw e;
693
- console.error(e), (s = _);
694
- }
695
- s.name || (s.name = n),
696
- (t[n] = s),
697
- (s.rawDefinition = a.bind(null, e)),
698
- s.aliases &&
699
- s.aliases.forEach((e) => {
700
- r[e] = n;
701
- });
702
- },
703
- listLanguages() {
704
- return Object.keys(t);
705
- },
706
- getLanguage: p,
707
- requireLanguage(e) {
708
- const n = p(e);
709
- if (n) return n;
710
- throw new Error("The '{}' language is required, but not loaded.".replace('{}', e));
711
- },
712
- autoDetection: m,
713
- inherit: inherit$1,
714
- addPlugin(e, n) {
715
- a.push(e);
716
- },
717
- }),
718
- (e.debugMode = function () {
719
- i = !1;
720
- }),
721
- (e.safeMode = function () {
722
- i = !0;
723
- }),
724
- (e.versionString = version);
725
- for (const e in MODES) 'object' === typeof MODES[e] && deepFreeze(MODES[e]);
726
- return Object.assign(e, MODES), e;
727
- };
728
- const highlight = HLJS({});
729
- module.exports = highlight;