@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,79 +0,0 @@
1
- /*
2
- Language: HTMLBars
3
- Requires: xml.js
4
- Author: Michael Johnston <lastobelus@gmail.com>
5
- Description: Matcher for HTMLBars
6
- Website: https://github.com/tildeio/htmlbars
7
- Category: template
8
- */
9
-
10
- export default function (hljs) {
11
- const BUILT_INS =
12
- 'action collection component concat debugger each each-in else get hash if input link-to loc log mut outlet partial query-params render textarea unbound unless with yield view';
13
-
14
- const ATTR_ASSIGNMENT = {
15
- illegal: /\}\}/,
16
- begin: /[a-zA-Z0-9_]+=/,
17
- returnBegin: true,
18
- relevance: 0,
19
- contains: [
20
- {
21
- className: 'attr',
22
- begin: /[a-zA-Z0-9_]+/,
23
- },
24
- ],
25
- };
26
-
27
- const SUB_EXPR = {
28
- illegal: /\}\}/,
29
- begin: /\)/,
30
- end: /\)/,
31
- contains: [
32
- {
33
- begin: /[a-zA-Z\.\-]+/,
34
- keywords: { built_in: BUILT_INS },
35
- starts: {
36
- endsWithParent: true,
37
- relevance: 0,
38
- contains: [hljs.QUOTE_STRING_MODE],
39
- },
40
- },
41
- ],
42
- };
43
-
44
- const TAG_INNARDS = {
45
- endsWithParent: true,
46
- relevance: 0,
47
- keywords: { keyword: 'as', built_in: BUILT_INS },
48
- contains: [hljs.QUOTE_STRING_MODE, ATTR_ASSIGNMENT, hljs.NUMBER_MODE],
49
- };
50
-
51
- return {
52
- name: 'HTMLBars',
53
- case_insensitive: true,
54
- subLanguage: 'xml',
55
- contains: [
56
- hljs.COMMENT('{{!(--)?', '(--)?}}'),
57
- {
58
- className: 'template-tag',
59
- begin: /\{\{[#\/]/,
60
- end: /\}\}/,
61
- contains: [
62
- {
63
- className: 'name',
64
- begin: /[a-zA-Z\.\-]+/,
65
- keywords: { 'builtin-name': BUILT_INS },
66
- starts: TAG_INNARDS,
67
- },
68
- ],
69
- },
70
- {
71
- className: 'template-variable',
72
- begin: /\{\{[a-zA-Z][a-zA-Z\-]+/,
73
- end: /\}\}/,
74
- keywords: { keyword: 'as', built_in: BUILT_INS },
75
- contains: [hljs.QUOTE_STRING_MODE],
76
- },
77
- ],
78
- };
79
- }
@@ -1,126 +0,0 @@
1
- /*
2
- Language: Java
3
- Author: Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
4
- Category: common, enterprise
5
- Website: https://www.java.com/
6
- */
7
-
8
- export default function (hljs) {
9
- const JAVA_IDENT_RE = '[\u00C0-\u02B8a-zA-Z_$][\u00C0-\u02B8a-zA-Z_$0-9]*';
10
- const GENERIC_IDENT_RE = `${JAVA_IDENT_RE}(<${JAVA_IDENT_RE}(\\s*,\\s*${JAVA_IDENT_RE})*>)?`;
11
- const KEYWORDS =
12
- 'false synchronized int abstract float private char boolean var static null if const ' +
13
- 'for true while long strictfp finally protected import native final void ' +
14
- 'enum else break transient catch instanceof byte super volatile case assert short ' +
15
- 'package default double public try this switch continue throws protected public private ' +
16
- 'module requires exports do';
17
-
18
- const ANNOTATION = {
19
- className: 'meta',
20
- begin: `@${JAVA_IDENT_RE}`,
21
- contains: [
22
- {
23
- begin: /\(/,
24
- end: /\)/,
25
- contains: ['self'], // allow nested () inside our annotation
26
- },
27
- ],
28
- };
29
- // https://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html
30
- const JAVA_NUMBER_RE =
31
- '\\b' +
32
- '(' +
33
- '0[bB]([01]+[01_]+[01]+|[01]+)' + // 0b...
34
- '|' +
35
- '0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)' + // 0x...
36
- '|' +
37
- '(' +
38
- '([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?' +
39
- '|' +
40
- '\\.([\\d]+[\\d_]+[\\d]+|[\\d]+)' +
41
- ')' +
42
- '([eE][-+]?\\d+)?' + // octal, decimal, float
43
- ')' +
44
- '[lLfF]?';
45
- const JAVA_NUMBER_MODE = {
46
- className: 'number',
47
- begin: JAVA_NUMBER_RE,
48
- relevance: 0,
49
- };
50
-
51
- return {
52
- name: 'Java',
53
- aliases: ['jsp'],
54
- keywords: KEYWORDS,
55
- illegal: /<\/|#/,
56
- contains: [
57
- hljs.COMMENT('/\\*\\*', '\\*/', {
58
- relevance: 0,
59
- contains: [
60
- {
61
- // eat up @'s in emails to prevent them to be recognized as doctags
62
- begin: /\w+@/,
63
- relevance: 0,
64
- },
65
- {
66
- className: 'doctag',
67
- begin: '@[A-Za-z]+',
68
- },
69
- ],
70
- }),
71
- hljs.C_LINE_COMMENT_MODE,
72
- hljs.C_BLOCK_COMMENT_MODE,
73
- hljs.APOS_STRING_MODE,
74
- hljs.QUOTE_STRING_MODE,
75
- {
76
- className: 'class',
77
- beginKeywords: 'class interface',
78
- end: /[{;=]/,
79
- excludeEnd: true,
80
- keywords: 'class interface',
81
- illegal: /[:"\[\]]/,
82
- contains: [{ beginKeywords: 'extends implements' }, hljs.UNDERSCORE_TITLE_MODE],
83
- },
84
- {
85
- // Expression keywords prevent 'keyword Name(...)' from being
86
- // recognized as a function definition
87
- beginKeywords: 'new throw return else',
88
- relevance: 0,
89
- },
90
- {
91
- className: 'function',
92
- begin: `(${GENERIC_IDENT_RE}\\s+)+${hljs.UNDERSCORE_IDENT_RE}\\s*\\(`,
93
- returnBegin: true,
94
- end: /[{;=]/,
95
- excludeEnd: true,
96
- keywords: KEYWORDS,
97
- contains: [
98
- {
99
- begin: `${hljs.UNDERSCORE_IDENT_RE}\\s*\\(`,
100
- returnBegin: true,
101
- relevance: 0,
102
- contains: [hljs.UNDERSCORE_TITLE_MODE],
103
- },
104
- {
105
- className: 'params',
106
- begin: /\(/,
107
- end: /\)/,
108
- keywords: KEYWORDS,
109
- relevance: 0,
110
- contains: [
111
- ANNOTATION,
112
- hljs.APOS_STRING_MODE,
113
- hljs.QUOTE_STRING_MODE,
114
- hljs.C_NUMBER_MODE,
115
- hljs.C_BLOCK_COMMENT_MODE,
116
- ],
117
- },
118
- hljs.C_LINE_COMMENT_MODE,
119
- hljs.C_BLOCK_COMMENT_MODE,
120
- ],
121
- },
122
- JAVA_NUMBER_MODE,
123
- ANNOTATION,
124
- ],
125
- };
126
- }
@@ -1,263 +0,0 @@
1
- /*
2
- Language: JavaScript
3
- Description: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.
4
- Category: common, scripting
5
- Website: https://developer.mozilla.org/en-US/docs/Web/JavaScript
6
- */
7
-
8
- export default function (hljs) {
9
- const FRAGMENT = {
10
- begin: '<>',
11
- end: '</>',
12
- };
13
- const XML_TAG = {
14
- begin: /<[A-Za-z0-9\\._:-]+/,
15
- end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
16
- };
17
- const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
18
- const KEYWORDS = {
19
- keyword:
20
- 'in of if for while finally var new function do return void else break catch ' +
21
- 'instanceof with throw case default try this switch continue typeof delete ' +
22
- 'let yield const export super debugger as async await static ' +
23
- // ECMAScript 6 modules import
24
- 'import from as',
25
- literal: 'true false null undefined NaN Infinity',
26
- built_in:
27
- 'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' +
28
- 'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' +
29
- 'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' +
30
- 'TypeError URIError Number Math Date String RegExp Array Float32Array ' +
31
- 'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
32
- 'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
33
- 'module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect ' +
34
- 'Promise',
35
- };
36
- const NUMBER = {
37
- className: 'number',
38
- variants: [{ begin: '\\b(0[bB][01]+)n?' }, { begin: '\\b(0[oO][0-7]+)n?' }, { begin: `${hljs.C_NUMBER_RE}n?` }],
39
- relevance: 0,
40
- };
41
- const SUBST = {
42
- className: 'subst',
43
- begin: '\\$\\{',
44
- end: '\\}',
45
- keywords: KEYWORDS,
46
- contains: [], // defined later
47
- };
48
- const HTML_TEMPLATE = {
49
- begin: 'html`',
50
- end: '',
51
- starts: {
52
- end: '`',
53
- returnEnd: false,
54
- contains: [hljs.BACKSLASH_ESCAPE, SUBST],
55
- subLanguage: 'xml',
56
- },
57
- };
58
- const CSS_TEMPLATE = {
59
- begin: 'css`',
60
- end: '',
61
- starts: {
62
- end: '`',
63
- returnEnd: false,
64
- contains: [hljs.BACKSLASH_ESCAPE, SUBST],
65
- subLanguage: 'css',
66
- },
67
- };
68
- const TEMPLATE_STRING = {
69
- className: 'string',
70
- begin: '`',
71
- end: '`',
72
- contains: [hljs.BACKSLASH_ESCAPE, SUBST],
73
- };
74
- SUBST.contains = [
75
- hljs.APOS_STRING_MODE,
76
- hljs.QUOTE_STRING_MODE,
77
- HTML_TEMPLATE,
78
- CSS_TEMPLATE,
79
- TEMPLATE_STRING,
80
- NUMBER,
81
- hljs.REGEXP_MODE,
82
- ];
83
- const PARAMS_CONTAINS = SUBST.contains.concat([hljs.C_BLOCK_COMMENT_MODE, hljs.C_LINE_COMMENT_MODE]);
84
- const PARAMS = {
85
- className: 'params',
86
- begin: /\(/,
87
- end: /\)/,
88
- excludeBegin: true,
89
- excludeEnd: true,
90
- contains: PARAMS_CONTAINS,
91
- };
92
-
93
- return {
94
- name: 'JavaScript',
95
- aliases: ['js', 'jsx', 'mjs', 'cjs'],
96
- keywords: KEYWORDS,
97
- contains: [
98
- {
99
- className: 'meta',
100
- relevance: 10,
101
- begin: /^\s*['"]use (strict|asm)['"]/,
102
- },
103
- {
104
- className: 'meta',
105
- begin: /^#!/,
106
- end: /$/,
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.COMMENT('/\\*\\*', '\\*/', {
115
- relevance: 0,
116
- contains: [
117
- {
118
- className: 'doctag',
119
- begin: '@[A-Za-z]+',
120
- contains: [
121
- {
122
- className: 'type',
123
- begin: '\\{',
124
- end: '\\}',
125
- relevance: 0,
126
- },
127
- {
128
- className: 'variable',
129
- begin: `${IDENT_RE}(?=\\s*(-)|$)`,
130
- endsParent: true,
131
- relevance: 0,
132
- },
133
- // eat spaces (not newlines) so we can find
134
- // types or variables
135
- {
136
- begin: /(?=[^\n])\s/,
137
- relevance: 0,
138
- },
139
- ],
140
- },
141
- ],
142
- }),
143
- hljs.C_BLOCK_COMMENT_MODE,
144
- NUMBER,
145
- {
146
- // object attr container
147
- begin: /[{,\n]\s*/,
148
- relevance: 0,
149
- contains: [
150
- {
151
- begin: `${IDENT_RE}\\s*:`,
152
- returnBegin: true,
153
- relevance: 0,
154
- contains: [{ className: 'attr', begin: IDENT_RE, relevance: 0 }],
155
- },
156
- ],
157
- },
158
- {
159
- // "value" container
160
- begin: `(${hljs.RE_STARTERS_RE}|\\b(case|return|throw)\\b)\\s*`,
161
- keywords: 'return throw case',
162
- contains: [
163
- hljs.C_LINE_COMMENT_MODE,
164
- hljs.C_BLOCK_COMMENT_MODE,
165
- hljs.REGEXP_MODE,
166
- {
167
- className: 'function',
168
- begin: `(\\(.*?\\)|${IDENT_RE})\\s*=>`,
169
- returnBegin: true,
170
- end: '\\s*=>',
171
- contains: [
172
- {
173
- className: 'params',
174
- variants: [
175
- {
176
- begin: IDENT_RE,
177
- },
178
- {
179
- begin: /\(\s*\)/,
180
- },
181
- {
182
- begin: /\(/,
183
- end: /\)/,
184
- excludeBegin: true,
185
- excludeEnd: true,
186
- keywords: KEYWORDS,
187
- contains: PARAMS_CONTAINS,
188
- },
189
- ],
190
- },
191
- ],
192
- },
193
- {
194
- // could be a comma delimited list of params to a function call
195
- begin: /,/,
196
- relevance: 0,
197
- },
198
- {
199
- className: '',
200
- begin: /\s/,
201
- end: /\s*/,
202
- skip: true,
203
- },
204
- {
205
- // JSX
206
- variants: [
207
- { begin: FRAGMENT.begin, end: FRAGMENT.end },
208
- { begin: XML_TAG.begin, end: XML_TAG.end },
209
- ],
210
- subLanguage: 'xml',
211
- contains: [
212
- {
213
- begin: XML_TAG.begin,
214
- end: XML_TAG.end,
215
- skip: true,
216
- contains: ['self'],
217
- },
218
- ],
219
- },
220
- ],
221
- relevance: 0,
222
- },
223
- {
224
- className: 'function',
225
- beginKeywords: 'function',
226
- end: /\{/,
227
- excludeEnd: true,
228
- contains: [hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE }), PARAMS],
229
- illegal: /\[|%/,
230
- },
231
- {
232
- begin: /\$[(.]/, // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
233
- },
234
-
235
- hljs.METHOD_GUARD,
236
- {
237
- // ES6 class
238
- className: 'class',
239
- beginKeywords: 'class',
240
- end: /[{;=]/,
241
- excludeEnd: true,
242
- illegal: /[:"\[\]]/,
243
- contains: [{ beginKeywords: 'extends' }, hljs.UNDERSCORE_TITLE_MODE],
244
- },
245
- {
246
- beginKeywords: 'constructor',
247
- end: /\{/,
248
- excludeEnd: true,
249
- },
250
- {
251
- begin: `(get|set)\\s*(?=${IDENT_RE}\\()`,
252
- end: /{/,
253
- keywords: 'get set',
254
- contains: [
255
- hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE }),
256
- { begin: /\(\)/ }, // eat to avoid empty params
257
- PARAMS,
258
- ],
259
- },
260
- ],
261
- illegal: /#(?!!)/,
262
- };
263
- }
@@ -1,51 +0,0 @@
1
- /*
2
- Language: JSON
3
- Description: JSON (JavaScript Object Notation) is a lightweight data-interchange format.
4
- Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
5
- Website: http://www.json.org
6
- Category: common, protocols
7
- */
8
-
9
- export default function (hljs) {
10
- const LITERALS = { literal: 'true false null' };
11
- const ALLOWED_COMMENTS = [hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE];
12
- const TYPES = [hljs.QUOTE_STRING_MODE, hljs.C_NUMBER_MODE];
13
- const VALUE_CONTAINER = {
14
- end: ',',
15
- endsWithParent: true,
16
- excludeEnd: true,
17
- contains: TYPES,
18
- keywords: LITERALS,
19
- };
20
- const OBJECT = {
21
- begin: '{',
22
- end: '}',
23
- contains: [
24
- {
25
- className: 'attr',
26
- begin: /"/,
27
- end: /"/,
28
- contains: [hljs.BACKSLASH_ESCAPE],
29
- illegal: '\\n',
30
- },
31
- hljs.inherit(VALUE_CONTAINER, { begin: /:/ }),
32
- ].concat(ALLOWED_COMMENTS),
33
- illegal: '\\S',
34
- };
35
- const ARRAY = {
36
- begin: '\\[',
37
- end: '\\]',
38
- contains: [hljs.inherit(VALUE_CONTAINER)], // inherit is a workaround for a bug that makes shared modes with endsWithParent compile only the ending of one of the parents
39
- illegal: '\\S',
40
- };
41
- TYPES.push(OBJECT, ARRAY);
42
- ALLOWED_COMMENTS.forEach((rule) => {
43
- TYPES.push(rule);
44
- });
45
- return {
46
- name: 'JSON',
47
- contains: TYPES,
48
- keywords: LITERALS,
49
- illegal: '\\S',
50
- };
51
- }
@@ -1,177 +0,0 @@
1
- /*
2
- Language: Less
3
- Description: It's CSS, with just a little more.
4
- Author: Max Mikhailov <seven.phases.max@gmail.com>
5
- Website: http://lesscss.org
6
- Category: common, css
7
- */
8
-
9
- export default function (hljs) {
10
- const IDENT_RE = '[\\w-]+'; // yes, Less identifiers may begin with a digit
11
- const INTERP_IDENT_RE = `(${IDENT_RE}|@{${IDENT_RE}})`;
12
-
13
- /* Generic Modes */
14
-
15
- const RULES = [];
16
- const VALUE = []; // forward def. for recursive modes
17
-
18
- const STRING_MODE = function (c) {
19
- return {
20
- // Less strings are not multiline (also include '~' for more consistent coloring of "escaped" strings)
21
- className: 'string',
22
- begin: `~?${c}.*?${c}`,
23
- };
24
- };
25
-
26
- const IDENT_MODE = function (name, begin, relevance) {
27
- return {
28
- className: name,
29
- begin,
30
- relevance,
31
- };
32
- };
33
-
34
- const PARENS_MODE = {
35
- // used only to properly balance nested parens inside mixin call, def. arg list
36
- begin: '\\(',
37
- end: '\\)',
38
- contains: VALUE,
39
- relevance: 0,
40
- };
41
-
42
- // generic Less highlighter (used almost everywhere except selectors):
43
- VALUE.push(
44
- hljs.C_LINE_COMMENT_MODE,
45
- hljs.C_BLOCK_COMMENT_MODE,
46
- STRING_MODE("'"),
47
- STRING_MODE('"'),
48
- hljs.CSS_NUMBER_MODE, // fixme: it does not include dot for numbers like .5em :(
49
- {
50
- begin: '(url|data-uri)\\(',
51
- starts: { className: 'string', end: '[\\)\\n]', excludeEnd: true },
52
- },
53
- IDENT_MODE('number', '#[0-9A-Fa-f]+\\b'),
54
- PARENS_MODE,
55
- IDENT_MODE('variable', `@@?${IDENT_RE}`, 10),
56
- IDENT_MODE('variable', `@{${IDENT_RE}}`),
57
- IDENT_MODE('built_in', '~?`[^`]*?`'), // inline javascript (or whatever host language) *multiline* string
58
- {
59
- // @media features (it’s here to not duplicate things in AT_RULE_MODE with extra PARENS_MODE overriding):
60
- className: 'attribute',
61
- begin: `${IDENT_RE}\\s*:`,
62
- end: ':',
63
- returnBegin: true,
64
- excludeEnd: true,
65
- },
66
- {
67
- className: 'meta',
68
- begin: '!important',
69
- },
70
- );
71
-
72
- const VALUE_WITH_RULESETS = VALUE.concat({
73
- begin: '{',
74
- end: '}',
75
- contains: RULES,
76
- });
77
-
78
- const MIXIN_GUARD_MODE = {
79
- beginKeywords: 'when',
80
- endsWithParent: true,
81
- contains: [{ beginKeywords: 'and not' }].concat(VALUE), // using this form to override VALUE’s 'function' match
82
- };
83
-
84
- /* Rule-Level Modes */
85
-
86
- const RULE_MODE = {
87
- begin: `${INTERP_IDENT_RE}\\s*:`,
88
- returnBegin: true,
89
- end: '[;}]',
90
- relevance: 0,
91
- contains: [
92
- {
93
- className: 'attribute',
94
- begin: INTERP_IDENT_RE,
95
- end: ':',
96
- excludeEnd: true,
97
- starts: {
98
- endsWithParent: true,
99
- illegal: '[<=$]',
100
- relevance: 0,
101
- contains: VALUE,
102
- },
103
- },
104
- ],
105
- };
106
-
107
- const AT_RULE_MODE = {
108
- className: 'keyword',
109
- begin: '@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b',
110
- starts: { end: '[;{}]', returnEnd: true, contains: VALUE, relevance: 0 },
111
- };
112
-
113
- // variable definitions and calls
114
- const VAR_RULE_MODE = {
115
- className: 'variable',
116
- variants: [
117
- // using more strict pattern for higher relevance to increase chances of Less detection.
118
- // this is *the only* Less specific statement used in most of the sources, so...
119
- // (we’ll still often loose to the css-parser unless there's '//' comment,
120
- // simply because 1 variable just can't beat 99 properties :)
121
- { begin: `@${IDENT_RE}\\s*:`, relevance: 15 },
122
- { begin: `@${IDENT_RE}` },
123
- ],
124
- starts: { end: '[;}]', returnEnd: true, contains: VALUE_WITH_RULESETS },
125
- };
126
-
127
- const SELECTOR_MODE = {
128
- // first parse unambiguous selectors (i.e. those not starting with tag)
129
- // then fall into the scary lookahead-discriminator variant.
130
- // this mode also handles mixin definitions and calls
131
- variants: [
132
- {
133
- begin: '[\\.#:&\\[>]',
134
- end: '[;{}]', // mixin calls end with ';'
135
- },
136
- {
137
- begin: INTERP_IDENT_RE,
138
- end: '{',
139
- },
140
- ],
141
- returnBegin: true,
142
- returnEnd: true,
143
- illegal: '[<=\'$"]',
144
- relevance: 0,
145
- contains: [
146
- hljs.C_LINE_COMMENT_MODE,
147
- hljs.C_BLOCK_COMMENT_MODE,
148
- MIXIN_GUARD_MODE,
149
- IDENT_MODE('keyword', 'all\\b'),
150
- IDENT_MODE('variable', `@{${IDENT_RE}}`), // otherwise it’s identified as tag
151
- IDENT_MODE('selector-tag', `${INTERP_IDENT_RE}%?`, 0), // '%' for more consistent coloring of @keyframes "tags"
152
- IDENT_MODE('selector-id', `#${INTERP_IDENT_RE}`),
153
- IDENT_MODE('selector-class', `\\.${INTERP_IDENT_RE}`, 0),
154
- IDENT_MODE('selector-tag', '&', 0),
155
- { className: 'selector-attr', begin: '\\[', end: '\\]' },
156
- { className: 'selector-pseudo', begin: /:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/ },
157
- { begin: '\\(', end: '\\)', contains: VALUE_WITH_RULESETS }, // argument list of parametric mixins
158
- { begin: '!important' }, // eat !important after mixin call or it will be colored as tag
159
- ],
160
- };
161
-
162
- RULES.push(
163
- hljs.C_LINE_COMMENT_MODE,
164
- hljs.C_BLOCK_COMMENT_MODE,
165
- AT_RULE_MODE,
166
- VAR_RULE_MODE,
167
- RULE_MODE,
168
- SELECTOR_MODE,
169
- );
170
-
171
- return {
172
- name: 'Less',
173
- case_insensitive: true,
174
- illegal: '[=>\'/<($"]',
175
- contains: RULES,
176
- };
177
- }