xmlui 0.9.2 → 0.9.3
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.
- package/dist/{apiInterceptorWorker-DJ_oGB-F.mjs → apiInterceptorWorker-Y5MxQ95G.mjs} +1 -1
- package/dist/{core-XLM8cuFP.mjs → core-DowI-7YH.mjs} +2 -52
- package/dist/{index-2qtmUAFJ.mjs → index-DHAz4bv_.mjs} +14895 -1503
- package/dist/index.css +297 -219
- package/dist/scripts/src/components/HtmlTags/HtmlTags.js +11 -1
- package/dist/scripts/src/components/Markdown/Markdown.js +17 -13
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +38 -19
- package/dist/scripts/src/components/Slider/Slider.js +25 -6
- package/dist/scripts/src/components/Slider/SliderNative.js +78 -18
- package/dist/scripts/src/components/Theme/ThemeNative.js +1 -1
- package/dist/scripts/src/components-core/InspectorContext.js +1 -1
- package/dist/scripts/src/components-core/RestApiProxy.js +19 -9
- package/dist/scripts/src/components-core/{DevTools.js → devtools/DevTools.js} +71 -10
- package/dist/scripts/src/syntax/monaco/grammar.monacoLanguage.js +286 -0
- package/dist/scripts/src/syntax/monaco/xmlui-dark.js +27 -0
- package/dist/scripts/src/syntax/monaco/xmlui-light.js +26 -0
- package/dist/scripts/src/syntax/monaco/xmluiscript.monacoLanguage.js +310 -0
- package/dist/style.css +210 -138
- package/dist/xmlui-metadata.mjs +306 -477
- package/dist/xmlui-metadata.umd.js +308 -476
- package/dist/xmlui-standalone.umd.js +34026 -29168
- package/dist/xmlui.mjs +10 -10
- package/package.json +3 -4
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.XmluiGrammar = void 0;
|
|
4
|
+
exports.XmluiGrammar = {
|
|
5
|
+
id: "xmlui",
|
|
6
|
+
config: {
|
|
7
|
+
comments: {
|
|
8
|
+
blockComment: ["<!--", "-->"],
|
|
9
|
+
},
|
|
10
|
+
brackets: [["<", ">"]],
|
|
11
|
+
autoClosingPairs: [
|
|
12
|
+
{ open: "<", close: ">" },
|
|
13
|
+
{ open: "'", close: "'" },
|
|
14
|
+
{ open: '"', close: '"' },
|
|
15
|
+
{ open: "`", close: "`" },
|
|
16
|
+
],
|
|
17
|
+
surroundingPairs: [
|
|
18
|
+
{ open: "<", close: ">" },
|
|
19
|
+
{ open: "'", close: "'" },
|
|
20
|
+
{ open: '"', close: '"' },
|
|
21
|
+
{ open: "`", close: "`" },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
language: {
|
|
25
|
+
defaultToken: "",
|
|
26
|
+
tokenPostfix: ".xmlui",
|
|
27
|
+
ignoreCase: false,
|
|
28
|
+
identifier: /[a-zA-Z$_][-\w.$]*/,
|
|
29
|
+
tokenizer: {
|
|
30
|
+
root: [
|
|
31
|
+
{ include: "@commentStart" },
|
|
32
|
+
{ include: "@helperTag" },
|
|
33
|
+
{ include: "@componentTagStart" },
|
|
34
|
+
{ include: "@escapeCharacter" },
|
|
35
|
+
{ include: "@textWithBindingExpr" },
|
|
36
|
+
{ include: "@entity" },
|
|
37
|
+
{ include: "@cdataStart" },
|
|
38
|
+
],
|
|
39
|
+
helperTag: [
|
|
40
|
+
{ include: "@scriptTagStart" },
|
|
41
|
+
{ include: "@eventTagStart" },
|
|
42
|
+
{ include: "@apiTagStart" },
|
|
43
|
+
{ include: "@methodTagStart" },
|
|
44
|
+
{ include: "@propOrVarTagStart" },
|
|
45
|
+
],
|
|
46
|
+
eventTagStart: [
|
|
47
|
+
[
|
|
48
|
+
/(<)((?:[a-zA-Z_][\w\.\-]*?:)?)(event)/,
|
|
49
|
+
["delimiter.angle", "namespace", { token: "tag-event", next: "@eventTag" }],
|
|
50
|
+
],
|
|
51
|
+
],
|
|
52
|
+
eventTag: [
|
|
53
|
+
{ include: "@commentStart" },
|
|
54
|
+
{ include: "@valueAttributeScriptInsideStart" },
|
|
55
|
+
{ include: "@attributeStart" },
|
|
56
|
+
[/\/>/, "delimiter.angle", "@pop"],
|
|
57
|
+
[
|
|
58
|
+
/(<\/)(event)(\s*>)/,
|
|
59
|
+
["delimiter.angle", "tag-event", { token: "delimiter.angle", next: "@pop" }],
|
|
60
|
+
],
|
|
61
|
+
[/>/, { token: "delimiter.angle", next: "@eventTagContent" }],
|
|
62
|
+
],
|
|
63
|
+
eventTagContent: [
|
|
64
|
+
{ include: "commentStart" },
|
|
65
|
+
{ include: "componentTagStart" },
|
|
66
|
+
[
|
|
67
|
+
/[^<]/,
|
|
68
|
+
{ token: "@rematch", next: "@eventTagScriptContent", nextEmbedded: "xmluiscript" },
|
|
69
|
+
],
|
|
70
|
+
[/<\/event\s*>/, { token: "@rematch", next: "@pop" }],
|
|
71
|
+
],
|
|
72
|
+
eventTagScriptContent: [
|
|
73
|
+
[/<\/event\s*>/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }],
|
|
74
|
+
[/[^<]/, ""],
|
|
75
|
+
],
|
|
76
|
+
methodTagStart: [
|
|
77
|
+
[
|
|
78
|
+
/(<)((?:[a-zA-Z_][\w\.\-]*?:)?)(method)/,
|
|
79
|
+
["delimiter.angle", "namespace", { token: "tag-helper", next: "@methodTag" }],
|
|
80
|
+
],
|
|
81
|
+
],
|
|
82
|
+
methodTag: [
|
|
83
|
+
{ include: "@commentStart" },
|
|
84
|
+
{ include: "@valueAttributeScriptInsideStart" },
|
|
85
|
+
{ include: "@attributeStart" },
|
|
86
|
+
[/\/>/, "delimiter.angle", "@pop"],
|
|
87
|
+
[
|
|
88
|
+
/>/,
|
|
89
|
+
{
|
|
90
|
+
token: "delimiter.angle",
|
|
91
|
+
next: "@methodTagScriptContent",
|
|
92
|
+
nextEmbedded: "xmluiscript",
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
/(<\/)(method)(\s*>)/,
|
|
97
|
+
["delimiter.angle", "tag-helper", { token: "delimiter.angle", next: "@pop" }],
|
|
98
|
+
],
|
|
99
|
+
],
|
|
100
|
+
methodTagScriptContent: [
|
|
101
|
+
[/<\/method\s*>/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }],
|
|
102
|
+
[/[^</]/, ""],
|
|
103
|
+
],
|
|
104
|
+
apiTagStart: [
|
|
105
|
+
[
|
|
106
|
+
/(<)((?:[a-zA-Z_][\w\.\-]*?:)?)(api)/,
|
|
107
|
+
["delimiter.angle", "namespace", { token: "tag-helper", next: "@apiTag" }],
|
|
108
|
+
],
|
|
109
|
+
],
|
|
110
|
+
apiTag: [
|
|
111
|
+
{ include: "@commentStart" },
|
|
112
|
+
{ include: "@valueAttributeScriptInsideStart" },
|
|
113
|
+
{ include: "@attributeStart" },
|
|
114
|
+
[/\/>/, "delimiter.angle", "@pop"],
|
|
115
|
+
[
|
|
116
|
+
/>/,
|
|
117
|
+
{ token: "delimiter.angle", next: "@apiTagScriptContent", nextEmbedded: "xmluiscript" },
|
|
118
|
+
],
|
|
119
|
+
[
|
|
120
|
+
/(<\/)(api)(\s*>)/,
|
|
121
|
+
["delimiter.angle", "tag-helper", { token: "delimiter.angle", next: "@pop" }],
|
|
122
|
+
],
|
|
123
|
+
],
|
|
124
|
+
apiTagScriptContent: [
|
|
125
|
+
[/<\/api\s*>/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }],
|
|
126
|
+
[/[^</]/, ""],
|
|
127
|
+
],
|
|
128
|
+
valueAttributeScriptInsideStart: [
|
|
129
|
+
[
|
|
130
|
+
/(^|\s+)(value)(\s*=)(['\"`])/,
|
|
131
|
+
[
|
|
132
|
+
"",
|
|
133
|
+
"attribute",
|
|
134
|
+
"operators",
|
|
135
|
+
{
|
|
136
|
+
cases: {
|
|
137
|
+
"'": { token: "string", next: "@singleQuotedScript", nextEmbedded: "xmluiscript" },
|
|
138
|
+
'"': { token: "string", next: "@doubleQuotedScript", nextEmbedded: "xmluiscript" },
|
|
139
|
+
"`": {
|
|
140
|
+
token: "string",
|
|
141
|
+
next: "@backtickQuotedScript",
|
|
142
|
+
nextEmbedded: "xmluiscript",
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
],
|
|
148
|
+
],
|
|
149
|
+
scriptTagStart: [
|
|
150
|
+
[
|
|
151
|
+
/(<)(script\s*)(>)/,
|
|
152
|
+
[
|
|
153
|
+
"delimiter.angle",
|
|
154
|
+
"tag-script",
|
|
155
|
+
{ token: "delimiter.angle", nextEmbedded: "xmluiscript", next: "@scriptTag" },
|
|
156
|
+
],
|
|
157
|
+
],
|
|
158
|
+
[/(<\/)(script\s*)(>)/, ["delimiter.angle", "tag-script", "delimiter.angle"]],
|
|
159
|
+
],
|
|
160
|
+
scriptTag: [
|
|
161
|
+
[/<\/script>/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }],
|
|
162
|
+
[/[^<]+/, ""],
|
|
163
|
+
],
|
|
164
|
+
propOrVarTagStart: [
|
|
165
|
+
[
|
|
166
|
+
/(<\/?)((?:[a-zA-Z_][\w\.\-]*?:)?)((?:property)|(?:prop)|(?:var))/,
|
|
167
|
+
["delimiter.angle", "namespace", { token: "tag-helper", next: "@propOrVarTag" }],
|
|
168
|
+
],
|
|
169
|
+
],
|
|
170
|
+
propOrVarTag: [
|
|
171
|
+
[/\/?>/, { token: "delimiter.angle", next: "@pop" }],
|
|
172
|
+
{ include: "@commentStart" },
|
|
173
|
+
{ include: "@attributeStart" },
|
|
174
|
+
],
|
|
175
|
+
componentTagStart: [
|
|
176
|
+
[
|
|
177
|
+
/(\s*<\/?)((?:[a-zA-Z_][\w\.\-]*?:)?)([A-Z][\w\.\-]*)/,
|
|
178
|
+
["delimiter.angle", "namespace", { token: "tag-component", next: "@componentTag" }],
|
|
179
|
+
],
|
|
180
|
+
],
|
|
181
|
+
componentTag: [
|
|
182
|
+
[/\/?>/, { token: "delimiter.angle", next: "@pop" }],
|
|
183
|
+
{ include: "@commentStart" },
|
|
184
|
+
{ include: "@eventHandler" },
|
|
185
|
+
{ include: "@attributeStart" },
|
|
186
|
+
],
|
|
187
|
+
eventHandler: [
|
|
188
|
+
[
|
|
189
|
+
/(^|\s+)(on[A-Z][-\w.]*)(\s*=)(['\"`])/,
|
|
190
|
+
[
|
|
191
|
+
"",
|
|
192
|
+
"attribute",
|
|
193
|
+
"operators",
|
|
194
|
+
{
|
|
195
|
+
cases: {
|
|
196
|
+
"'": { token: "string", next: "@singleQuotedScript", nextEmbedded: "xmluiscript" },
|
|
197
|
+
'"': { token: "string", next: "@doubleQuotedScript", nextEmbedded: "xmluiscript" },
|
|
198
|
+
"`": {
|
|
199
|
+
token: "string",
|
|
200
|
+
next: "@backtickQuotedScript",
|
|
201
|
+
nextEmbedded: "xmluiscript",
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
],
|
|
207
|
+
],
|
|
208
|
+
doubleQuotedScript: [
|
|
209
|
+
[/"/, { token: "string", next: "@pop", nextEmbedded: "@pop" }],
|
|
210
|
+
[/[^"]/, ""],
|
|
211
|
+
],
|
|
212
|
+
singleQuotedScript: [
|
|
213
|
+
[/'/, { token: "string", next: "@pop", nextEmbedded: "@pop" }],
|
|
214
|
+
[/[^']/, ""],
|
|
215
|
+
],
|
|
216
|
+
backtickQuotedScript: [
|
|
217
|
+
[/`/, { token: "string", next: "@pop", nextEmbedded: "@pop" }],
|
|
218
|
+
[/[^`]/, ""],
|
|
219
|
+
],
|
|
220
|
+
attributeStart: [
|
|
221
|
+
[
|
|
222
|
+
/(^|\s+)(@identifier(?::@identifier)?)(\s*=\s*)(['\"`])/,
|
|
223
|
+
[
|
|
224
|
+
"",
|
|
225
|
+
"attribute",
|
|
226
|
+
"operators",
|
|
227
|
+
{
|
|
228
|
+
cases: {
|
|
229
|
+
"'": { token: "string", next: "@singleQuotedString" },
|
|
230
|
+
'"': { token: "string", next: "@doubleQuotedString" },
|
|
231
|
+
"`": { token: "string", next: "@backtickQuotedString" },
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
],
|
|
236
|
+
[
|
|
237
|
+
/(^|\s+)(@identifier(?::@identifier)?)(\s*=\s*)(@identifier)/,
|
|
238
|
+
["", "attribute", "operators", "string"],
|
|
239
|
+
],
|
|
240
|
+
[/(^|\s+)(@identifier(?::@identifier)?)/, ["", "attribute"]],
|
|
241
|
+
],
|
|
242
|
+
singleQuotedString: [
|
|
243
|
+
[/'/, "string", "@pop"],
|
|
244
|
+
{ include: "@textWithBindingExpr" },
|
|
245
|
+
[/[^']/, "string"],
|
|
246
|
+
],
|
|
247
|
+
doubleQuotedString: [
|
|
248
|
+
[/"/, "string", "@pop"],
|
|
249
|
+
{ include: "@textWithBindingExpr" },
|
|
250
|
+
[/[^"]/, "string"],
|
|
251
|
+
],
|
|
252
|
+
backtickQuotedString: [
|
|
253
|
+
[/`/, "string", "@pop"],
|
|
254
|
+
{ include: "@textWithBindingExpr" },
|
|
255
|
+
[/[^`]/, "string"],
|
|
256
|
+
],
|
|
257
|
+
textWithBindingExpr: [
|
|
258
|
+
{ include: "@escapeCharacter" },
|
|
259
|
+
{ include: "@entity" },
|
|
260
|
+
[/{/, { token: "delimiter.curly", next: "@bindingExpr", nextEmbedded: "xmluiscript" }],
|
|
261
|
+
],
|
|
262
|
+
bindingExpr: [
|
|
263
|
+
[/}/, { token: "delimiter.curly", next: "@pop", nextEmbedded: "@pop" }],
|
|
264
|
+
[/[^}]+/, ""],
|
|
265
|
+
],
|
|
266
|
+
cdataStart: [
|
|
267
|
+
[
|
|
268
|
+
/(<!\[)(CDATA)(\[)/,
|
|
269
|
+
["delimiter.angle", "tag-cdata", { token: "delimiter.angle", next: "@cdata" }],
|
|
270
|
+
],
|
|
271
|
+
],
|
|
272
|
+
cdata: [
|
|
273
|
+
[/]]>/, "delimiter.angle", "@pop"],
|
|
274
|
+
[/./, "string"],
|
|
275
|
+
],
|
|
276
|
+
commentStart: [[/<!--/, "comment", "@comment"]],
|
|
277
|
+
comment: [
|
|
278
|
+
[/[^<\-]+/, "comment.content"],
|
|
279
|
+
[/-->/, { token: "comment", next: "@pop" }],
|
|
280
|
+
[/[<\-]/, "comment.content"],
|
|
281
|
+
],
|
|
282
|
+
escapeCharacter: [[/\\S/, "string.escape"]],
|
|
283
|
+
entity: [[/&(amp|lt|gt|quot|apos|nbsp);/, "string.escape"]],
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const darkTheme = {
|
|
4
|
+
base: "vs-dark",
|
|
5
|
+
inherit: true,
|
|
6
|
+
rules: [
|
|
7
|
+
{ token: "comment", foreground: "#4E4E4E" },
|
|
8
|
+
{ token: "comment.content", foreground: "#4E4E4E" },
|
|
9
|
+
{ token: "tag-component", foreground: "#F07100" },
|
|
10
|
+
{ token: "tag-event", foreground: "#3572F6" },
|
|
11
|
+
{ token: "tag-helper", foreground: "#3572F6" },
|
|
12
|
+
{ token: "attribute", foreground: "#C79B00" },
|
|
13
|
+
{ token: "operators", foreground: "#7235C7" },
|
|
14
|
+
{ token: "delimiter.angle", foreground: "#66748E" },
|
|
15
|
+
{ token: "delimiter.curly", foreground: "#000000" },
|
|
16
|
+
{ token: "string", foreground: "#497A48" },
|
|
17
|
+
{ token: "tag-cdata", foreground: "#1BADFF" },
|
|
18
|
+
{ token: "tag-script", foreground: "#0CA6A6" },
|
|
19
|
+
{ token: "string.escape", foreground: "#1BB95A" },
|
|
20
|
+
{ token: "constant", foreground: "#FF00E8" },
|
|
21
|
+
],
|
|
22
|
+
colors: {
|
|
23
|
+
"editor.background": "#17232b",
|
|
24
|
+
"editor.foreground": "#497A48",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
exports.default = darkTheme;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const lightTheme = {
|
|
4
|
+
base: "vs",
|
|
5
|
+
inherit: true,
|
|
6
|
+
rules: [
|
|
7
|
+
{ token: "comment", foreground: "#4E4E4E" },
|
|
8
|
+
{ token: "comment.content", foreground: "#4E4E4E" },
|
|
9
|
+
{ token: "tag-component", foreground: "#F07100" },
|
|
10
|
+
{ token: "tag-event", foreground: "#3572F6" },
|
|
11
|
+
{ token: "tag-helper", foreground: "#3572F6" },
|
|
12
|
+
{ token: "attribute", foreground: "#C79B00" },
|
|
13
|
+
{ token: "operators", foreground: "#7235C7" },
|
|
14
|
+
{ token: "delimiter.angle", foreground: "#66748E" },
|
|
15
|
+
{ token: "delimiter.curly", foreground: "#000000" },
|
|
16
|
+
{ token: "string", foreground: "#497A48" },
|
|
17
|
+
{ token: "tag-cdata", foreground: "#1BADFF" },
|
|
18
|
+
{ token: "tag-script", foreground: "#0CA6A6" },
|
|
19
|
+
{ token: "string.escape", foreground: "#1BB95A" },
|
|
20
|
+
{ token: "constant", foreground: "#FF00E8" },
|
|
21
|
+
],
|
|
22
|
+
colors: {
|
|
23
|
+
"editor.foreground": "#497A48",
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
exports.default = lightTheme;
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Based on https://github.com/microsoft/monaco-editor/blob/main/src/basic-languages/javascript/javascript.ts */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.XmluiScripGrammar = void 0;
|
|
5
|
+
exports.XmluiScripGrammar = {
|
|
6
|
+
id: "xmluiscript",
|
|
7
|
+
config: {
|
|
8
|
+
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
|
9
|
+
comments: {
|
|
10
|
+
lineComment: "//",
|
|
11
|
+
blockComment: ["/*", "*/"],
|
|
12
|
+
},
|
|
13
|
+
brackets: [
|
|
14
|
+
["{", "}"],
|
|
15
|
+
["[", "]"],
|
|
16
|
+
["(", ")"],
|
|
17
|
+
],
|
|
18
|
+
onEnterRules: [
|
|
19
|
+
{
|
|
20
|
+
// e.g. /** | */
|
|
21
|
+
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
|
|
22
|
+
afterText: /^\s*\*\/$/,
|
|
23
|
+
action: {
|
|
24
|
+
// numeric repr of indentAction: languages.IndentAction.IndentOutdent, but without the "monaco-core" package
|
|
25
|
+
indentAction: 2,
|
|
26
|
+
appendText: " * ",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
// e.g. /** ...|
|
|
31
|
+
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
|
|
32
|
+
action: {
|
|
33
|
+
// numeric repr of indentAction: languages.IndentAction.None, but without the "monaco-core" package
|
|
34
|
+
indentAction: 0,
|
|
35
|
+
appendText: " * ",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
// e.g. * ...|
|
|
40
|
+
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
|
|
41
|
+
action: {
|
|
42
|
+
// numeric repr of indentAction: languages.IndentAction.None, but without the "monaco-core" package
|
|
43
|
+
indentAction: 0,
|
|
44
|
+
appendText: "* ",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
// e.g. */|
|
|
49
|
+
beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
|
|
50
|
+
action: {
|
|
51
|
+
// numeric repr of indentAction: languages.IndentAction.None, but without the "monaco-core" package
|
|
52
|
+
indentAction: 0,
|
|
53
|
+
removeText: 1,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
autoClosingPairs: [
|
|
58
|
+
{ open: "{", close: "}" },
|
|
59
|
+
{ open: "[", close: "]" },
|
|
60
|
+
{ open: "(", close: ")" },
|
|
61
|
+
{ open: '"', close: '"', notIn: ["string"] },
|
|
62
|
+
{ open: "'", close: "'", notIn: ["string", "comment"] },
|
|
63
|
+
{ open: "`", close: "`", notIn: ["string", "comment"] },
|
|
64
|
+
{ open: "/**", close: " */", notIn: ["string"] },
|
|
65
|
+
],
|
|
66
|
+
folding: {
|
|
67
|
+
markers: {
|
|
68
|
+
start: new RegExp("^\\s*//\\s*#?region\\b"),
|
|
69
|
+
end: new RegExp("^\\s*//\\s*#?endregion\\b"),
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
language: {
|
|
74
|
+
// Set defaultToken to invalid to see what you do not tokenize yet
|
|
75
|
+
defaultToken: "invalid",
|
|
76
|
+
tokenPostfix: ".xs",
|
|
77
|
+
typeKeywords: [],
|
|
78
|
+
keywords: [
|
|
79
|
+
"break",
|
|
80
|
+
"case",
|
|
81
|
+
"catch",
|
|
82
|
+
"class",
|
|
83
|
+
"continue",
|
|
84
|
+
"const",
|
|
85
|
+
"constructor",
|
|
86
|
+
"debugger",
|
|
87
|
+
"default",
|
|
88
|
+
"delete",
|
|
89
|
+
"do",
|
|
90
|
+
"else",
|
|
91
|
+
"export",
|
|
92
|
+
"extends",
|
|
93
|
+
"false",
|
|
94
|
+
"finally",
|
|
95
|
+
"for",
|
|
96
|
+
"from",
|
|
97
|
+
"function",
|
|
98
|
+
"get",
|
|
99
|
+
"if",
|
|
100
|
+
"import",
|
|
101
|
+
"in",
|
|
102
|
+
"instanceof",
|
|
103
|
+
"let",
|
|
104
|
+
"new",
|
|
105
|
+
"null",
|
|
106
|
+
"return",
|
|
107
|
+
"set",
|
|
108
|
+
"static",
|
|
109
|
+
"super",
|
|
110
|
+
"switch",
|
|
111
|
+
"symbol",
|
|
112
|
+
"this",
|
|
113
|
+
"throw",
|
|
114
|
+
"true",
|
|
115
|
+
"try",
|
|
116
|
+
"typeof",
|
|
117
|
+
"undefined",
|
|
118
|
+
"var",
|
|
119
|
+
"void",
|
|
120
|
+
"while",
|
|
121
|
+
"with",
|
|
122
|
+
"yield",
|
|
123
|
+
"async",
|
|
124
|
+
"await",
|
|
125
|
+
"of",
|
|
126
|
+
],
|
|
127
|
+
operators: [
|
|
128
|
+
"<=",
|
|
129
|
+
">=",
|
|
130
|
+
"==",
|
|
131
|
+
"!=",
|
|
132
|
+
"===",
|
|
133
|
+
"!==",
|
|
134
|
+
"=>",
|
|
135
|
+
"+",
|
|
136
|
+
"-",
|
|
137
|
+
"**",
|
|
138
|
+
"*",
|
|
139
|
+
"/",
|
|
140
|
+
"%",
|
|
141
|
+
"++",
|
|
142
|
+
"--",
|
|
143
|
+
"<<",
|
|
144
|
+
"</",
|
|
145
|
+
">>",
|
|
146
|
+
">>>",
|
|
147
|
+
"&",
|
|
148
|
+
"|",
|
|
149
|
+
"^",
|
|
150
|
+
"!",
|
|
151
|
+
"~",
|
|
152
|
+
"&&",
|
|
153
|
+
"||",
|
|
154
|
+
"??",
|
|
155
|
+
"?",
|
|
156
|
+
":",
|
|
157
|
+
"=",
|
|
158
|
+
"+=",
|
|
159
|
+
"-=",
|
|
160
|
+
"*=",
|
|
161
|
+
"**=",
|
|
162
|
+
"/=",
|
|
163
|
+
"%=",
|
|
164
|
+
"<<=",
|
|
165
|
+
">>=",
|
|
166
|
+
">>>=",
|
|
167
|
+
"&=",
|
|
168
|
+
"|=",
|
|
169
|
+
"^=",
|
|
170
|
+
"@",
|
|
171
|
+
],
|
|
172
|
+
// we include these common regular expressions
|
|
173
|
+
symbols: /[=><!~?:&|+\-*\/\^%]+/,
|
|
174
|
+
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
|
|
175
|
+
digits: /\d+(_+\d+)*/,
|
|
176
|
+
octaldigits: /[0-7]+(_+[0-7]+)*/,
|
|
177
|
+
binarydigits: /[0-1]+(_+[0-1]+)*/,
|
|
178
|
+
hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,
|
|
179
|
+
regexpctl: /[(){}\[\]\$\^|\-*+?\.]/,
|
|
180
|
+
regexpesc: /\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,
|
|
181
|
+
// The main tokenizer for our languages
|
|
182
|
+
tokenizer: {
|
|
183
|
+
root: [[/[{}]/, "delimiter.bracket"], { include: "common" }],
|
|
184
|
+
common: [
|
|
185
|
+
// identifiers and keywords
|
|
186
|
+
[
|
|
187
|
+
/#?[a-z_$][\w$]*/,
|
|
188
|
+
{
|
|
189
|
+
cases: {
|
|
190
|
+
"@keywords": "keyword",
|
|
191
|
+
"@default": "identifier",
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
[/[A-Z][\w\$]*/, "type.identifier"], // to show class names nicely
|
|
196
|
+
// [/[A-Z][\w\$]*/, 'identifier'],
|
|
197
|
+
// whitespace
|
|
198
|
+
{ include: "@whitespace" },
|
|
199
|
+
// regular expression: ensure it is terminated before beginning (otherwise it is an opeator)
|
|
200
|
+
[
|
|
201
|
+
/\/(?=([^\\\/]|\\.)+\/([dgimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/,
|
|
202
|
+
{ token: "regexp", bracket: "@open", next: "@regexp" },
|
|
203
|
+
],
|
|
204
|
+
// delimiters and operators
|
|
205
|
+
[/[()\[\]]/, "@brackets"],
|
|
206
|
+
[/[<>](?!@symbols)/, "@brackets"],
|
|
207
|
+
[/!(?=([^=]|$))/, "delimiter"],
|
|
208
|
+
[
|
|
209
|
+
/@symbols/,
|
|
210
|
+
{
|
|
211
|
+
cases: {
|
|
212
|
+
"@operators": "delimiter",
|
|
213
|
+
"@default": "",
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
// numbers
|
|
218
|
+
[/(@digits)[eE]([\-+]?(@digits))?/, "number.float"],
|
|
219
|
+
[/(@digits)\.(@digits)([eE][\-+]?(@digits))?/, "number.float"],
|
|
220
|
+
[/0[xX](@hexdigits)n?/, "number.hex"],
|
|
221
|
+
[/0[oO]?(@octaldigits)n?/, "number.octal"],
|
|
222
|
+
[/0[bB](@binarydigits)n?/, "number.binary"],
|
|
223
|
+
[/(@digits)n?/, "number"],
|
|
224
|
+
// delimiter: after number because of .\d floats
|
|
225
|
+
[/[;,.]/, "delimiter"],
|
|
226
|
+
// strings
|
|
227
|
+
[/"([^"\\]|\\.)*$/, "string.invalid"], // non-teminated string
|
|
228
|
+
[/'([^'\\]|\\.)*$/, "string.invalid"], // non-teminated string
|
|
229
|
+
[/"/, "string", "@string_double"],
|
|
230
|
+
[/'/, "string", "@string_single"],
|
|
231
|
+
[/`/, "string", "@string_backtick"],
|
|
232
|
+
],
|
|
233
|
+
whitespace: [
|
|
234
|
+
[/[ \t\r\n]+/, ""],
|
|
235
|
+
[/\/\*\*(?!\/)/, "comment.doc", "@jsdoc"],
|
|
236
|
+
[/\/\*/, "comment", "@comment"],
|
|
237
|
+
[/\/\/.*$/, "comment"],
|
|
238
|
+
],
|
|
239
|
+
comment: [
|
|
240
|
+
[/[^\/*]+/, "comment"],
|
|
241
|
+
[/\*\//, "comment", "@pop"],
|
|
242
|
+
[/[\/*]/, "comment"],
|
|
243
|
+
],
|
|
244
|
+
jsdoc: [
|
|
245
|
+
[/[^\/*]+/, "comment.doc"],
|
|
246
|
+
[/\*\//, "comment.doc", "@pop"],
|
|
247
|
+
[/[\/*]/, "comment.doc"],
|
|
248
|
+
],
|
|
249
|
+
// We match regular expression quite precisely
|
|
250
|
+
regexp: [
|
|
251
|
+
[
|
|
252
|
+
/(\{)(\d+(?:,\d*)?)(\})/,
|
|
253
|
+
["regexp.escape.control", "regexp.escape.control", "regexp.escape.control"],
|
|
254
|
+
],
|
|
255
|
+
[
|
|
256
|
+
/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,
|
|
257
|
+
["regexp.escape.control", { token: "regexp.escape.control", next: "@regexrange" }],
|
|
258
|
+
],
|
|
259
|
+
[/(\()(\?:|\?=|\?!)/, ["regexp.escape.control", "regexp.escape.control"]],
|
|
260
|
+
[/[()]/, "regexp.escape.control"],
|
|
261
|
+
[/@regexpctl/, "regexp.escape.control"],
|
|
262
|
+
[/[^\\\/]/, "regexp"],
|
|
263
|
+
[/@regexpesc/, "regexp.escape"],
|
|
264
|
+
[/\\\./, "regexp.invalid"],
|
|
265
|
+
[
|
|
266
|
+
/(\/)([dgimsuy]*)/,
|
|
267
|
+
[{ token: "regexp", bracket: "@close", next: "@pop" }, "keyword.other"],
|
|
268
|
+
],
|
|
269
|
+
],
|
|
270
|
+
regexrange: [
|
|
271
|
+
[/-/, "regexp.escape.control"],
|
|
272
|
+
[/\^/, "regexp.invalid"],
|
|
273
|
+
[/@regexpesc/, "regexp.escape"],
|
|
274
|
+
[/[^\]]/, "regexp"],
|
|
275
|
+
[
|
|
276
|
+
/\]/,
|
|
277
|
+
{
|
|
278
|
+
token: "regexp.escape.control",
|
|
279
|
+
next: "@pop",
|
|
280
|
+
bracket: "@close",
|
|
281
|
+
},
|
|
282
|
+
],
|
|
283
|
+
],
|
|
284
|
+
string_double: [
|
|
285
|
+
[/[^\\"]+/, "string"],
|
|
286
|
+
[/@escapes/, "string.escape"],
|
|
287
|
+
[/\\./, "string.escape.invalid"],
|
|
288
|
+
[/"/, "string", "@pop"],
|
|
289
|
+
],
|
|
290
|
+
string_single: [
|
|
291
|
+
[/[^\\']+/, "string"],
|
|
292
|
+
[/@escapes/, "string.escape"],
|
|
293
|
+
[/\\./, "string.escape.invalid"],
|
|
294
|
+
[/'/, "string", "@pop"],
|
|
295
|
+
],
|
|
296
|
+
string_backtick: [
|
|
297
|
+
[/\$\{/, { token: "delimiter.bracket", next: "@bracketCounting" }],
|
|
298
|
+
[/[^\\`$]+/, "string"],
|
|
299
|
+
[/@escapes/, "string.escape"],
|
|
300
|
+
[/\\./, "string.escape.invalid"],
|
|
301
|
+
[/`/, "string", "@pop"],
|
|
302
|
+
],
|
|
303
|
+
bracketCounting: [
|
|
304
|
+
[/\{/, "delimiter.bracket", "@bracketCounting"],
|
|
305
|
+
[/\}/, "delimiter.bracket", "@pop"],
|
|
306
|
+
{ include: "common" },
|
|
307
|
+
],
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
};
|