@cloudbase/weda-ui 0.2.5 → 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 (150) hide show
  1. package/package.json +4 -4
  2. package/src/.DS_Store +0 -0
  3. package/src/configs/components/container.json +2 -1
  4. package/src/configs/components/form/input.json +6 -0
  5. package/src/configs/components/form/richText.json +2 -1
  6. package/src/configs/components/form/uploader.json +10 -5
  7. package/src/configs/components/image.json +2 -1
  8. package/src/configs/components/link.json +2 -1
  9. package/src/configs/components/richtextview.json +2 -1
  10. package/src/configs/components/scrollVeiw.json +2 -1
  11. package/src/configs/components/swiper.json +2 -1
  12. package/src/configs/components/tabs.json +31 -86
  13. package/src/configs/components/text.json +2 -1
  14. package/src/configs/index.js +3 -5
  15. package/src/index.js +2 -3
  16. package/src/mp/components/form/input/index.js +5 -1
  17. package/src/mp/components/form/input/index.wxml +2 -1
  18. package/src/mp/components/form/select/index.js +2 -2
  19. package/src/mp/components/form/textarea/index.wxml +1 -0
  20. package/src/mp/components/form/uploader/index.js +50 -13
  21. package/src/mp/components/form/uploader/index.wxml +11 -1
  22. package/src/mp/components/image/index.js +57 -8
  23. package/src/mp/components/image/index.json +4 -1
  24. package/src/mp/components/image/index.wxml +4 -2
  25. package/src/mp/components/image/index.wxss +15 -0
  26. package/src/mp/components/richText/index.wxml +3 -1
  27. package/src/mp/components/tabs/index.js +22 -6
  28. package/src/mp/utils/deepEqual.js +42 -0
  29. package/src/web/actions/index.js +2 -4
  30. package/src/web/components/form/checkbox/index.jsx +8 -10
  31. package/src/web/components/form/formcell/index.jsx +1 -1
  32. package/src/web/components/form/input/index.jsx +16 -18
  33. package/src/web/components/form/radio/index.jsx +7 -7
  34. package/src/web/components/form/select/h5.jsx +1 -1
  35. package/src/web/components/form/select/region/{cities.json → cities.js} +2 -2
  36. package/src/web/components/form/select/region/index.js +3 -3
  37. package/src/web/components/form/select/region/{provinces.json → provinces.js} +2 -2
  38. package/src/web/components/form/select/region/{regions.json → regions.js} +2 -2
  39. package/src/web/components/form/switch/index.jsx +4 -9
  40. package/src/web/components/form/textarea/index.jsx +4 -12
  41. package/src/web/components/form/uploader/index.css +15 -0
  42. package/src/web/components/form/uploader/index.jsx +2 -2
  43. package/src/web/components/form/uploader/uploader.h5.jsx +237 -0
  44. package/src/web/components/form/uploader/{uploaderPc.jsx → uploader.pc.jsx} +76 -58
  45. package/src/web/components/image/image.jsx +79 -5
  46. package/src/web/components/image/index.css +18 -0
  47. package/src/web/components/image/index.jsx +1 -0
  48. package/src/web/components/index.js +26 -58
  49. package/src/web/components/richTextView/index.css +0 -10
  50. package/src/web/components/richTextView/index.jsx +1 -12
  51. package/src/web/components/tabs/{index.js → index.jsx} +3 -3
  52. package/src/web/components/tabs/{tabsH5.js → tabs.h5.jsx} +9 -47
  53. package/src/web/components/tabs/{tabsPc.js → tabs.pc.jsx} +13 -47
  54. package/src/web/components/uploaderView/index.jsx +1 -1
  55. package/src/web/index.js +2 -3
  56. package/src/web/utils/isObjectEqual.js +10 -1
  57. package/src/web/utils/useSyncValue.js +14 -0
  58. package/src/web/weda-ui.css +8 -0
  59. package/src/configs/components/markdown.json +0 -17
  60. package/src/mp/components/markdown/index.js +0 -27
  61. package/src/mp/components/markdown/index.json +0 -6
  62. package/src/mp/components/markdown/index.wxml +0 -1
  63. package/src/mp/components/markdown/towxml/audio-player/Audio.js +0 -99
  64. package/src/mp/components/markdown/towxml/audio-player/audio-player.js +0 -102
  65. package/src/mp/components/markdown/towxml/audio-player/audio-player.json +0 -5
  66. package/src/mp/components/markdown/towxml/audio-player/audio-player.wxml +0 -14
  67. package/src/mp/components/markdown/towxml/audio-player/audio-player.wxss +0 -175
  68. package/src/mp/components/markdown/towxml/audio-player/loading.svg +0 -1
  69. package/src/mp/components/markdown/towxml/config.js +0 -285
  70. package/src/mp/components/markdown/towxml/decode.js +0 -26
  71. package/src/mp/components/markdown/towxml/decode.json +0 -12
  72. package/src/mp/components/markdown/towxml/decode.wxml +0 -1
  73. package/src/mp/components/markdown/towxml/decode.wxss +0 -0
  74. package/src/mp/components/markdown/towxml/img/img.js +0 -98
  75. package/src/mp/components/markdown/towxml/img/img.json +0 -3
  76. package/src/mp/components/markdown/towxml/img/img.wxml +0 -1
  77. package/src/mp/components/markdown/towxml/img/img.wxss +0 -0
  78. package/src/mp/components/markdown/towxml/index.js +0 -19
  79. package/src/mp/components/markdown/towxml/latex/latex.js +0 -53
  80. package/src/mp/components/markdown/towxml/latex/latex.json +0 -5
  81. package/src/mp/components/markdown/towxml/latex/latex.wxml +0 -1
  82. package/src/mp/components/markdown/towxml/latex/latex.wxss +0 -0
  83. package/src/mp/components/markdown/towxml/parse/highlight/highlight.js +0 -729
  84. package/src/mp/components/markdown/towxml/parse/highlight/index.js +0 -7
  85. package/src/mp/components/markdown/towxml/parse/highlight/languages/bash.js +0 -91
  86. package/src/mp/components/markdown/towxml/parse/highlight/languages/c-like.js +0 -244
  87. package/src/mp/components/markdown/towxml/parse/highlight/languages/c.js +0 -20
  88. package/src/mp/components/markdown/towxml/parse/highlight/languages/css.js +0 -138
  89. package/src/mp/components/markdown/towxml/parse/highlight/languages/dart.js +0 -135
  90. package/src/mp/components/markdown/towxml/parse/highlight/languages/go.js +0 -57
  91. package/src/mp/components/markdown/towxml/parse/highlight/languages/htmlbars.js +0 -79
  92. package/src/mp/components/markdown/towxml/parse/highlight/languages/java.js +0 -126
  93. package/src/mp/components/markdown/towxml/parse/highlight/languages/javascript.js +0 -263
  94. package/src/mp/components/markdown/towxml/parse/highlight/languages/json.js +0 -51
  95. package/src/mp/components/markdown/towxml/parse/highlight/languages/less.js +0 -177
  96. package/src/mp/components/markdown/towxml/parse/highlight/languages/nginx.js +0 -103
  97. package/src/mp/components/markdown/towxml/parse/highlight/languages/php.js +0 -152
  98. package/src/mp/components/markdown/towxml/parse/highlight/languages/python-repl.js +0 -27
  99. package/src/mp/components/markdown/towxml/parse/highlight/languages/python.js +0 -146
  100. package/src/mp/components/markdown/towxml/parse/highlight/languages/scss.js +0 -137
  101. package/src/mp/components/markdown/towxml/parse/highlight/languages/shell.js +0 -23
  102. package/src/mp/components/markdown/towxml/parse/highlight/languages/typescript.js +0 -198
  103. package/src/mp/components/markdown/towxml/parse/highlight/languages/xml.js +0 -143
  104. package/src/mp/components/markdown/towxml/parse/highlight/style/github.wxss +0 -99
  105. package/src/mp/components/markdown/towxml/parse/highlight/style/monokai.wxss +0 -70
  106. package/src/mp/components/markdown/towxml/parse/index.js +0 -106
  107. package/src/mp/components/markdown/towxml/parse/markdown/index.js +0 -53
  108. package/src/mp/components/markdown/towxml/parse/markdown/markdown.js +0 -5834
  109. package/src/mp/components/markdown/towxml/parse/markdown/plugins/emoji.js +0 -1773
  110. package/src/mp/components/markdown/towxml/parse/markdown/plugins/ins.js +0 -120
  111. package/src/mp/components/markdown/towxml/parse/markdown/plugins/latex.js +0 -193
  112. package/src/mp/components/markdown/towxml/parse/markdown/plugins/mark.js +0 -120
  113. package/src/mp/components/markdown/towxml/parse/markdown/plugins/sub.js +0 -95
  114. package/src/mp/components/markdown/towxml/parse/markdown/plugins/sup.js +0 -95
  115. package/src/mp/components/markdown/towxml/parse/markdown/plugins/todo.js +0 -220
  116. package/src/mp/components/markdown/towxml/parse/markdown/plugins/yuml.js +0 -18
  117. package/src/mp/components/markdown/towxml/parse/parse2/Parser.js +0 -263
  118. package/src/mp/components/markdown/towxml/parse/parse2/Tokenizer.js +0 -507
  119. package/src/mp/components/markdown/towxml/parse/parse2/domhandler/index.js +0 -104
  120. package/src/mp/components/markdown/towxml/parse/parse2/domhandler/node.js +0 -169
  121. package/src/mp/components/markdown/towxml/parse/parse2/entities/decode.js +0 -54
  122. package/src/mp/components/markdown/towxml/parse/parse2/entities/decode_codepoint.js +0 -19
  123. package/src/mp/components/markdown/towxml/parse/parse2/entities/encode.js +0 -54
  124. package/src/mp/components/markdown/towxml/parse/parse2/entities/index.js +0 -30
  125. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/decode.js +0 -31
  126. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/entities.js +0 -2128
  127. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/legacy.js +0 -109
  128. package/src/mp/components/markdown/towxml/parse/parse2/entities/maps/xml.js +0 -2
  129. package/src/mp/components/markdown/towxml/parse/parse2/index.js +0 -8
  130. package/src/mp/components/markdown/towxml/style/main.wxss +0 -378
  131. package/src/mp/components/markdown/towxml/style/theme/dark.wxss +0 -73
  132. package/src/mp/components/markdown/towxml/style/theme/light.wxss +0 -63
  133. package/src/mp/components/markdown/towxml/table/table.js +0 -11
  134. package/src/mp/components/markdown/towxml/table/table.json +0 -6
  135. package/src/mp/components/markdown/towxml/table/table.wxml +0 -24
  136. package/src/mp/components/markdown/towxml/table/table.wxss +0 -0
  137. package/src/mp/components/markdown/towxml/todogroup/todogroup.js +0 -19
  138. package/src/mp/components/markdown/towxml/todogroup/todogroup.json +0 -6
  139. package/src/mp/components/markdown/towxml/todogroup/todogroup.wxml +0 -13
  140. package/src/mp/components/markdown/towxml/todogroup/todogroup.wxss +0 -3
  141. package/src/mp/components/markdown/towxml/towxml.js +0 -17
  142. package/src/mp/components/markdown/towxml/towxml.json +0 -6
  143. package/src/mp/components/markdown/towxml/towxml.wxml +0 -5
  144. package/src/mp/components/markdown/towxml/towxml.wxss +0 -8
  145. package/src/mp/components/markdown/towxml/yuml/yuml.js +0 -51
  146. package/src/mp/components/markdown/towxml/yuml/yuml.json +0 -5
  147. package/src/mp/components/markdown/towxml/yuml/yuml.wxml +0 -5
  148. package/src/mp/components/markdown/towxml/yuml/yuml.wxss +0 -0
  149. package/src/web/components/form/uploader/uploaderH5.jsx +0 -192
  150. package/src/web/components/markdown/index.jsx +0 -40
@@ -1,198 +0,0 @@
1
- /*
2
- Language: TypeScript
3
- Author: Panu Horsmalahti <panu.horsmalahti@iki.fi>
4
- Contributors: Ike Ku <dempfi@yahoo.com>
5
- Description: TypeScript is a strict superset of JavaScript
6
- Website: https://www.typescriptlang.org
7
- Category: common, scripting
8
- */
9
-
10
- export default function (hljs) {
11
- const JS_IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
12
- const KEYWORDS = {
13
- keyword:
14
- 'in if for while finally var new function do return void else break catch ' +
15
- 'instanceof with throw case default try this switch continue typeof delete ' +
16
- 'let yield const class public private protected get set super ' +
17
- 'static implements enum export import declare type namespace abstract ' +
18
- 'as from extends async await',
19
- literal: 'true false null undefined NaN Infinity',
20
- built_in:
21
- 'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' +
22
- 'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' +
23
- 'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' +
24
- 'TypeError URIError Number Math Date String RegExp Array Float32Array ' +
25
- 'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
26
- 'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
27
- 'module console window document any number boolean string void Promise',
28
- };
29
-
30
- const DECORATOR = {
31
- className: 'meta',
32
- begin: `@${JS_IDENT_RE}`,
33
- };
34
-
35
- const ARGS = {
36
- begin: '\\(',
37
- end: /\)/,
38
- keywords: KEYWORDS,
39
- contains: ['self', hljs.QUOTE_STRING_MODE, hljs.APOS_STRING_MODE, hljs.NUMBER_MODE],
40
- };
41
-
42
- const PARAMS = {
43
- className: 'params',
44
- begin: /\(/,
45
- end: /\)/,
46
- excludeBegin: true,
47
- excludeEnd: true,
48
- keywords: KEYWORDS,
49
- contains: [hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE, DECORATOR, ARGS],
50
- };
51
- const NUMBER = {
52
- className: 'number',
53
- variants: [{ begin: '\\b(0[bB][01]+)n?' }, { begin: '\\b(0[oO][0-7]+)n?' }, { begin: `${hljs.C_NUMBER_RE}n?` }],
54
- relevance: 0,
55
- };
56
- const SUBST = {
57
- className: 'subst',
58
- begin: '\\$\\{',
59
- end: '\\}',
60
- keywords: KEYWORDS,
61
- contains: [], // defined later
62
- };
63
- const HTML_TEMPLATE = {
64
- begin: 'html`',
65
- end: '',
66
- starts: {
67
- end: '`',
68
- returnEnd: false,
69
- contains: [hljs.BACKSLASH_ESCAPE, SUBST],
70
- subLanguage: 'xml',
71
- },
72
- };
73
- const CSS_TEMPLATE = {
74
- begin: 'css`',
75
- end: '',
76
- starts: {
77
- end: '`',
78
- returnEnd: false,
79
- contains: [hljs.BACKSLASH_ESCAPE, SUBST],
80
- subLanguage: 'css',
81
- },
82
- };
83
- const TEMPLATE_STRING = {
84
- className: 'string',
85
- begin: '`',
86
- end: '`',
87
- contains: [hljs.BACKSLASH_ESCAPE, SUBST],
88
- };
89
- SUBST.contains = [
90
- hljs.APOS_STRING_MODE,
91
- hljs.QUOTE_STRING_MODE,
92
- HTML_TEMPLATE,
93
- CSS_TEMPLATE,
94
- TEMPLATE_STRING,
95
- NUMBER,
96
- hljs.REGEXP_MODE,
97
- ];
98
-
99
- return {
100
- name: 'TypeScript',
101
- aliases: ['ts'],
102
- keywords: KEYWORDS,
103
- contains: [
104
- {
105
- className: 'meta',
106
- begin: /^\s*['"]use strict['"]/,
107
- },
108
- hljs.APOS_STRING_MODE,
109
- hljs.QUOTE_STRING_MODE,
110
- HTML_TEMPLATE,
111
- CSS_TEMPLATE,
112
- TEMPLATE_STRING,
113
- hljs.C_LINE_COMMENT_MODE,
114
- hljs.C_BLOCK_COMMENT_MODE,
115
- NUMBER,
116
- {
117
- // "value" container
118
- begin: `(${hljs.RE_STARTERS_RE}|\\b(case|return|throw)\\b)\\s*`,
119
- keywords: 'return throw case',
120
- contains: [
121
- hljs.C_LINE_COMMENT_MODE,
122
- hljs.C_BLOCK_COMMENT_MODE,
123
- hljs.REGEXP_MODE,
124
- {
125
- className: 'function',
126
- begin: `(\\(.*?\\)|${hljs.IDENT_RE})\\s*=>`,
127
- returnBegin: true,
128
- end: '\\s*=>',
129
- contains: [
130
- {
131
- className: 'params',
132
- variants: [
133
- {
134
- begin: hljs.IDENT_RE,
135
- },
136
- {
137
- begin: /\(\s*\)/,
138
- },
139
- {
140
- begin: /\(/,
141
- end: /\)/,
142
- excludeBegin: true,
143
- excludeEnd: true,
144
- keywords: KEYWORDS,
145
- contains: ['self', hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE],
146
- },
147
- ],
148
- },
149
- ],
150
- },
151
- ],
152
- relevance: 0,
153
- },
154
- {
155
- className: 'function',
156
- beginKeywords: 'function',
157
- end: /[\{;]/,
158
- excludeEnd: true,
159
- keywords: KEYWORDS,
160
- contains: ['self', hljs.inherit(hljs.TITLE_MODE, { begin: JS_IDENT_RE }), PARAMS],
161
- illegal: /%/,
162
- relevance: 0, // () => {} is more typical in TypeScript
163
- },
164
- {
165
- beginKeywords: 'constructor',
166
- end: /[\{;]/,
167
- excludeEnd: true,
168
- contains: ['self', PARAMS],
169
- },
170
- {
171
- // prevent references like module.id from being higlighted as module definitions
172
- begin: /module\./,
173
- keywords: { built_in: 'module' },
174
- relevance: 0,
175
- },
176
- {
177
- beginKeywords: 'module',
178
- end: /\{/,
179
- excludeEnd: true,
180
- },
181
- {
182
- beginKeywords: 'interface',
183
- end: /\{/,
184
- excludeEnd: true,
185
- keywords: 'interface extends',
186
- },
187
- {
188
- begin: /\$[(.]/, // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
189
- },
190
- {
191
- begin: `\\.${hljs.IDENT_RE}`,
192
- relevance: 0, // hack: prevents detection of keywords after dots
193
- },
194
- DECORATOR,
195
- ARGS,
196
- ],
197
- };
198
- }
@@ -1,143 +0,0 @@
1
- /*
2
- Language: HTML, XML
3
- Website: https://www.w3.org/XML/
4
- Category: common
5
- */
6
-
7
- export default function (hljs) {
8
- const XML_IDENT_RE = '[A-Za-z0-9\\._:-]+';
9
- const XML_ENTITIES = {
10
- className: 'symbol',
11
- begin: '&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;',
12
- };
13
- const XML_META_KEYWORDS = {
14
- begin: '\\s',
15
- contains: [
16
- {
17
- className: 'meta-keyword',
18
- begin: '#?[a-z_][a-z1-9_-]+',
19
- illegal: '\\n',
20
- },
21
- ],
22
- };
23
- const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, { begin: '\\(', end: '\\)' });
24
- const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, { className: 'meta-string' });
25
- const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, { className: 'meta-string' });
26
- const TAG_INTERNALS = {
27
- endsWithParent: true,
28
- illegal: /</,
29
- relevance: 0,
30
- contains: [
31
- {
32
- className: 'attr',
33
- begin: XML_IDENT_RE,
34
- relevance: 0,
35
- },
36
- {
37
- begin: /=\s*/,
38
- relevance: 0,
39
- contains: [
40
- {
41
- className: 'string',
42
- endsParent: true,
43
- variants: [
44
- { begin: /"/, end: /"/, contains: [XML_ENTITIES] },
45
- { begin: /'/, end: /'/, contains: [XML_ENTITIES] },
46
- { begin: /[^\s"'=<>`]+/ },
47
- ],
48
- },
49
- ],
50
- },
51
- ],
52
- };
53
- return {
54
- name: 'HTML, XML',
55
- aliases: ['html', 'xhtml', 'rss', 'atom', 'xjb', 'xsd', 'xsl', 'plist', 'wsf', 'svg'],
56
- case_insensitive: true,
57
- contains: [
58
- {
59
- className: 'meta',
60
- begin: '<![a-z]',
61
- end: '>',
62
- relevance: 10,
63
- contains: [
64
- XML_META_KEYWORDS,
65
- QUOTE_META_STRING_MODE,
66
- APOS_META_STRING_MODE,
67
- XML_META_PAR_KEYWORDS,
68
- {
69
- begin: '\\[',
70
- end: '\\]',
71
- contains: [
72
- {
73
- className: 'meta',
74
- begin: '<![a-z]',
75
- end: '>',
76
- contains: [XML_META_KEYWORDS, XML_META_PAR_KEYWORDS, QUOTE_META_STRING_MODE, APOS_META_STRING_MODE],
77
- },
78
- ],
79
- },
80
- ],
81
- },
82
- hljs.COMMENT('<!--', '-->', {
83
- relevance: 10,
84
- }),
85
- {
86
- begin: '<\\!\\[CDATA\\[',
87
- end: '\\]\\]>',
88
- relevance: 10,
89
- },
90
- XML_ENTITIES,
91
- {
92
- className: 'meta',
93
- begin: /<\?xml/,
94
- end: /\?>/,
95
- relevance: 10,
96
- },
97
- {
98
- className: 'tag',
99
- /*
100
- The lookahead pattern (?=...) ensures that 'begin' only matches
101
- '<style' as a single word, followed by a whitespace or an
102
- ending braket. The '$' is needed for the lexeme to be recognized
103
- by hljs.subMode() that tests lexemes outside the stream.
104
- */
105
- begin: '<style(?=\\s|>)',
106
- end: '>',
107
- keywords: { name: 'style' },
108
- contains: [TAG_INTERNALS],
109
- starts: {
110
- end: '</style>',
111
- returnEnd: true,
112
- subLanguage: ['css', 'xml'],
113
- },
114
- },
115
- {
116
- className: 'tag',
117
- // See the comment in the <style tag about the lookahead pattern
118
- begin: '<script(?=\\s|>)',
119
- end: '>',
120
- keywords: { name: 'script' },
121
- contains: [TAG_INTERNALS],
122
- starts: {
123
- end: '</script>',
124
- returnEnd: true,
125
- subLanguage: ['javascript', 'handlebars', 'xml'],
126
- },
127
- },
128
- {
129
- className: 'tag',
130
- begin: '</?',
131
- end: '/?>',
132
- contains: [
133
- {
134
- className: 'name',
135
- begin: /[^\/><\s]+/,
136
- relevance: 0,
137
- },
138
- TAG_INTERNALS,
139
- ],
140
- },
141
- ],
142
- };
143
- }
@@ -1,99 +0,0 @@
1
- /*
2
-
3
- github.com style (c) Vasily Polovnyov <vast@whiteants.net>
4
-
5
- */
6
-
7
- .h2w-light .hljs {
8
- display: block;
9
- overflow-x: auto;
10
- padding: 0.5em;
11
- color: #333;
12
- background: #f8f8f8;
13
- }
14
-
15
- .h2w-light .hljs-comment,
16
- .h2w-light .hljs-quote {
17
- color: #998;
18
- font-style: italic;
19
- }
20
-
21
- .h2w-light .hljs-keyword,
22
- .h2w-light .hljs-selector-tag,
23
- .h2w-light .hljs-subst {
24
- color: #333;
25
- font-weight: bold;
26
- }
27
-
28
- .h2w-light .hljs-number,
29
- .h2w-light .hljs-literal,
30
- .h2w-light .hljs-variable,
31
- .h2w-light .hljs-template-variable,
32
- .h2w-light .hljs-tag .hljs-attr {
33
- color: #008080;
34
- }
35
-
36
- .h2w-light .hljs-string,
37
- .h2w-light .hljs-doctag {
38
- color: #d14;
39
- }
40
-
41
- .h2w-light .hljs-title,
42
- .h2w-light .hljs-section,
43
- .h2w-light .hljs-selector-id {
44
- color: #900;
45
- font-weight: bold;
46
- }
47
-
48
- .h2w-light .hljs-subst {
49
- font-weight: normal;
50
- }
51
-
52
- .h2w-light .hljs-type,
53
- .h2w-light .hljs-class .hljs-title {
54
- color: #458;
55
- font-weight: bold;
56
- }
57
-
58
- .h2w-light .hljs-tag,
59
- .h2w-light .hljs-name,
60
- .h2w-light .hljs-attribute {
61
- color: #000080;
62
- font-weight: normal;
63
- }
64
-
65
- .h2w-light .hljs-regexp,
66
- .h2w-light .hljs-link {
67
- color: #009926;
68
- }
69
-
70
- .h2w-light .hljs-symbol,
71
- .h2w-light .hljs-bullet {
72
- color: #990073;
73
- }
74
-
75
- .h2w-light .hljs-built_in,
76
- .h2w-light .hljs-builtin-name {
77
- color: #0086b3;
78
- }
79
-
80
- .h2w-light .hljs-meta {
81
- color: #999;
82
- font-weight: bold;
83
- }
84
-
85
- .h2w-light .hljs-deletion {
86
- background: #fdd;
87
- }
88
-
89
- .h2w-light .hljs-addition {
90
- background: #dfd;
91
- }
92
-
93
- .h2w-light .hljs-emphasis {
94
- font-style: italic;
95
- }
96
-
97
- .h2w-light .hljs-strong {
98
- font-weight: bold;
99
- }
@@ -1,70 +0,0 @@
1
- /*
2
- Monokai style - ported by Luigi Maselli - http://grigio.org
3
- */
4
-
5
- .h2w-dark .hljs {
6
- display: block;
7
- overflow-x: auto;
8
- padding: 0.5em;
9
- background: #272822; color: #ddd;
10
- }
11
-
12
- .h2w-dark .hljs-tag,
13
- .h2w-dark .hljs-keyword,
14
- .h2w-dark .hljs-selector-tag,
15
- .h2w-dark .hljs-literal,
16
- .h2w-dark .hljs-strong,
17
- .h2w-dark .hljs-name {
18
- color: #f92672;
19
- }
20
-
21
- .h2w-dark .hljs-code {
22
- color: #66d9ef;
23
- }
24
-
25
- .h2w-dark .hljs-class .hljs-title {
26
- color: white;
27
- }
28
-
29
- .h2w-dark .hljs-attribute,
30
- .h2w-dark .hljs-symbol,
31
- .h2w-dark .hljs-regexp,
32
- .h2w-dark .hljs-link {
33
- color: #bf79db;
34
- }
35
-
36
- .h2w-dark .hljs-string,
37
- .h2w-dark .hljs-bullet,
38
- .h2w-dark .hljs-subst,
39
- .h2w-dark .hljs-title,
40
- .h2w-dark .hljs-section,
41
- .h2w-dark .hljs-emphasis,
42
- .h2w-dark .hljs-type,
43
- .h2w-dark .hljs-built_in,
44
- .h2w-dark .hljs-builtin-name,
45
- .h2w-dark .hljs-selector-attr,
46
- .h2w-dark .hljs-selector-pseudo,
47
- .h2w-dark .hljs-addition,
48
- .h2w-dark .hljs-variable,
49
- .h2w-dark .hljs-template-tag,
50
- .h2w-dark .hljs-template-variable {
51
- color: #a6e22e;
52
- }
53
-
54
- .h2w-dark .hljs-comment,
55
- .h2w-dark .hljs-quote,
56
- .h2w-dark .hljs-deletion,
57
- .h2w-dark .hljs-meta {
58
- color: #75715e;
59
- }
60
-
61
- .h2w-dark .hljs-keyword,
62
- .h2w-dark .hljs-selector-tag,
63
- .h2w-dark .hljs-literal,
64
- .h2w-dark .hljs-doctag,
65
- .h2w-dark .hljs-title,
66
- .h2w-dark .hljs-section,
67
- .h2w-dark .hljs-type,
68
- .h2w-dark .hljs-selector-id {
69
- font-weight: bold;
70
- }
@@ -1,106 +0,0 @@
1
- const parse2 = require('./parse2/index');
2
- // parse5 = require('./parse5/index').parse,
3
- const config = require('../config');
4
-
5
- // html与wxml转换关系
6
- const correspondTag = (() => {
7
- const result = {
8
- a: 'navigator',
9
- todogroup: 'checkbox-group',
10
- audio: 'audio-player',
11
- };
12
-
13
- // 该系列的标签都转换为text
14
- // ['span','b','strong','i','em','code','sub','sup','g-emoji','mark','ins','u'].forEach(item => {
15
- // result[item] = 'text';
16
- // });
17
-
18
- // 该系列小程序原生tag,不需转换
19
- [...config.wxml, ...config.components].forEach((item) => {
20
- result[item] = item;
21
- });
22
- return result;
23
- })();
24
-
25
- // 元素与html对应的wxml标签名
26
- const getWxmlTag = (tagStr) => (!tagStr ? undefined : correspondTag[tagStr] || 'view');
27
-
28
- // 精简数据,并初始化相关事件等
29
- const initObj = (obj, option) => {
30
- const result = {
31
- theme: option.theme || 'light',
32
- _e: {},
33
- };
34
- const events = (global._events = {});
35
- const { base } = option;
36
-
37
- // 主题保存到全局
38
- global._theme = result.theme;
39
-
40
- // 事件添加到全局中,各个组件在触发事件时会从全局调用
41
- if (option.events) {
42
- for (const key in option.events) {
43
- events[key] = option.events[key];
44
- }
45
- }
46
-
47
- // 遍历原始数据,处理成能解析的数据
48
- let eachFn;
49
- (eachFn = (arr, obj, _e) => {
50
- obj.child = obj.child || [];
51
- _e.child = _e.child || [];
52
-
53
- arr.forEach((item) => {
54
- if (item.type === 'comment') {
55
- return;
56
- }
57
- const o = {};
58
- const e = {};
59
- o.type = e.type = item.type;
60
- o._e = e;
61
- if (item.type === 'text') {
62
- o.text = e.text = item.data;
63
- } else {
64
- o.tag = getWxmlTag(item.name); // 转换之后的标签
65
- // o.tag = o.tag === 'text' ? 'view' : o.tag;
66
- e.tag = item.name; // 原始
67
- o.attr = item.attribs;
68
- e.attr = JSON.parse(JSON.stringify(item.attribs));
69
-
70
- o.attr.class = o.attr.class ? `h2w__${item.name} ${o.attr.class}` : `h2w__${item.name}`;
71
-
72
- // 处理资源相对路径
73
- if (base && o.attr.src) {
74
- const { src } = o.attr;
75
- switch (src.indexOf('//')) {
76
- case 0:
77
- o.attr.src = `https:${src}`;
78
- break;
79
- case -1:
80
- o.attr.src = `${base}${src}`;
81
- break;
82
- }
83
- }
84
-
85
- if (item.children) {
86
- eachFn(item.children, o, e);
87
- }
88
- }
89
- _e.child.push(e);
90
- obj.child.push(o);
91
- });
92
- })(obj, result, result._e);
93
- return result;
94
- };
95
-
96
- module.exports = (str, option) => {
97
- str = (() => {
98
- const re = /<body[^>]*>([\s\S]*)<\/body>/i;
99
- if (re.test(str)) {
100
- const result = re.exec(str);
101
- return result[1] || str;
102
- }
103
- return str;
104
- })();
105
- return initObj(parse2(str, { decodeEntities: true }), option);
106
- };
@@ -1,53 +0,0 @@
1
- let hljs;
2
- hljs = require('../highlight/index');
3
-
4
- const config = require('../../config');
5
- const mdOption = (() => {
6
- const result = {
7
- html: true,
8
- xhtmlOut: true,
9
- typographer: true,
10
- breaks: true,
11
- };
12
-
13
- if (config.highlight.length && hljs) {
14
- result.highlight = (code, lang, callback) => {
15
- const lineLen = code.split(/\r|\n/gi).length;
16
- let result = hljs.highlightAuto(code).value;
17
-
18
- result = result.replace(/\r|\n/g, '<br/>').replace(/ /g, '&nbsp;').replace(/\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;');
19
-
20
- if (config.showLineNumber) {
21
- const lineStr = (() => {
22
- let str = `<ul class="h2w__lineNum">`;
23
- for (let i = 0; i < lineLen - 1; i++) {
24
- str += `<li class="h2w__lineNumLine">${i + 1}</li>`;
25
- }
26
-
27
- str += `</ul>`;
28
- return str;
29
- })();
30
- return lineStr + result;
31
- }
32
- return result;
33
- };
34
- }
35
- return result;
36
- })();
37
- const md = require('./markdown')(mdOption);
38
-
39
- // 应用Markdown解析扩展,包括自定义组件(['sub','sup','ins','mark','emoji','todo','latex','yuml','echarts'])
40
- [...config.markdown, ...config.components].forEach((item) => {
41
- if (!/^audio-player|table|todogroup|img$/.test(item)) {
42
- md.use(require(`./plugins/${item}`));
43
- }
44
- });
45
-
46
- // 定义emoji渲染规则
47
- md.renderer.rules.emoji = (token, index) => {
48
- const item = token[index];
49
- return `<g-emoji class="h2w__emoji h2w__emoji--${item.markup}">${item.content}</g-emoji>`;
50
- };
51
-
52
- // 导出模块
53
- module.exports = (str) => md.render(str);