monaco-mermaid-ng 1.0.0
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/.prettierignore +7 -0
- package/.prettierrc.json +3 -0
- package/LICENSE +21 -0
- package/README.md +177 -0
- package/README.zh-CN.md +177 -0
- package/browser.js +1414 -0
- package/eslint.config.js +86 -0
- package/index.d.ts +3 -0
- package/index.js +1377 -0
- package/package.json +47 -0
- package/tsconfig.json +26 -0
package/browser.js
ADDED
|
@@ -0,0 +1,1414 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
|
17
|
+
try {
|
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
+
}
|
|
20
|
+
catch (error) { e = { error: error }; }
|
|
21
|
+
finally {
|
|
22
|
+
try {
|
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
+
}
|
|
25
|
+
finally { if (e) throw e.error; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
30
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
31
|
+
if (ar || !(i in from)) {
|
|
32
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33
|
+
ar[i] = from[i];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
|
+
};
|
|
38
|
+
exports.__esModule = true;
|
|
39
|
+
exports["default"] = (function (monacoEditor) {
|
|
40
|
+
monacoEditor.languages.register({ id: 'mermaid' });
|
|
41
|
+
var requirementDiagrams = [
|
|
42
|
+
'requirement',
|
|
43
|
+
'functionalRequirement',
|
|
44
|
+
'interfaceRequirement',
|
|
45
|
+
'performanceRequirement',
|
|
46
|
+
'physicalRequirement',
|
|
47
|
+
'designConstraint',
|
|
48
|
+
];
|
|
49
|
+
var keywords = {
|
|
50
|
+
flowchart: {
|
|
51
|
+
typeKeywords: ['flowchart', 'flowchart-v2', 'flowchart-elk', 'graph'],
|
|
52
|
+
blockKeywords: ['subgraph', 'end'],
|
|
53
|
+
keywords: [
|
|
54
|
+
'TB',
|
|
55
|
+
'TD',
|
|
56
|
+
'BT',
|
|
57
|
+
'RL',
|
|
58
|
+
'LR',
|
|
59
|
+
'click',
|
|
60
|
+
'call',
|
|
61
|
+
'href',
|
|
62
|
+
'_self',
|
|
63
|
+
'_blank',
|
|
64
|
+
'_parent',
|
|
65
|
+
'_top',
|
|
66
|
+
'linkStyle',
|
|
67
|
+
'style',
|
|
68
|
+
'classDef',
|
|
69
|
+
'class',
|
|
70
|
+
'direction',
|
|
71
|
+
'interpolate',
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
sequenceDiagram: {
|
|
75
|
+
typeKeywords: ['sequenceDiagram'],
|
|
76
|
+
blockKeywords: [
|
|
77
|
+
'alt',
|
|
78
|
+
'par',
|
|
79
|
+
'and',
|
|
80
|
+
'loop',
|
|
81
|
+
'else',
|
|
82
|
+
'end',
|
|
83
|
+
'rect',
|
|
84
|
+
'opt',
|
|
85
|
+
'alt',
|
|
86
|
+
'rect',
|
|
87
|
+
],
|
|
88
|
+
keywords: [
|
|
89
|
+
'participant',
|
|
90
|
+
'as',
|
|
91
|
+
'Note',
|
|
92
|
+
'note',
|
|
93
|
+
'right of',
|
|
94
|
+
'left of',
|
|
95
|
+
'over',
|
|
96
|
+
'activate',
|
|
97
|
+
'deactivate',
|
|
98
|
+
'autonumber',
|
|
99
|
+
'title',
|
|
100
|
+
'actor',
|
|
101
|
+
'accDescription',
|
|
102
|
+
'link',
|
|
103
|
+
'links',
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
classDiagram: {
|
|
107
|
+
typeKeywords: ['classDiagram', 'classDiagram-v2'],
|
|
108
|
+
blockKeywords: ['class'],
|
|
109
|
+
keywords: [
|
|
110
|
+
'link',
|
|
111
|
+
'click',
|
|
112
|
+
'callback',
|
|
113
|
+
'call',
|
|
114
|
+
'href',
|
|
115
|
+
'cssClass',
|
|
116
|
+
'direction',
|
|
117
|
+
'TB',
|
|
118
|
+
'BT',
|
|
119
|
+
'RL',
|
|
120
|
+
'LR',
|
|
121
|
+
'title',
|
|
122
|
+
'accDescription',
|
|
123
|
+
'order',
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
stateDiagram: {
|
|
127
|
+
typeKeywords: ['stateDiagram', 'stateDiagram-v2'],
|
|
128
|
+
blockKeywords: ['state', 'note', 'end'],
|
|
129
|
+
keywords: [
|
|
130
|
+
'state',
|
|
131
|
+
'as',
|
|
132
|
+
'hide empty description',
|
|
133
|
+
'direction',
|
|
134
|
+
'TB',
|
|
135
|
+
'BT',
|
|
136
|
+
'RL',
|
|
137
|
+
'LR',
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
erDiagram: {
|
|
141
|
+
typeKeywords: ['erDiagram'],
|
|
142
|
+
blockKeywords: [],
|
|
143
|
+
keywords: ['title', 'accDescription']
|
|
144
|
+
},
|
|
145
|
+
journey: {
|
|
146
|
+
typeKeywords: ['journey'],
|
|
147
|
+
blockKeywords: ['section'],
|
|
148
|
+
keywords: ['title']
|
|
149
|
+
},
|
|
150
|
+
info: {
|
|
151
|
+
typeKeywords: ['info'],
|
|
152
|
+
blockKeywords: [],
|
|
153
|
+
keywords: ['showInfo']
|
|
154
|
+
},
|
|
155
|
+
gantt: {
|
|
156
|
+
typeKeywords: ['gantt'],
|
|
157
|
+
blockKeywords: [],
|
|
158
|
+
keywords: [
|
|
159
|
+
'title',
|
|
160
|
+
'dateFormat',
|
|
161
|
+
'axisFormat',
|
|
162
|
+
'todayMarker',
|
|
163
|
+
'section',
|
|
164
|
+
'excludes',
|
|
165
|
+
'inclusiveEndDates',
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
requirementDiagram: {
|
|
169
|
+
typeKeywords: ['requirement', 'requirementDiagram'],
|
|
170
|
+
blockKeywords: requirementDiagrams.concat('element'),
|
|
171
|
+
keywords: []
|
|
172
|
+
},
|
|
173
|
+
gitGraph: {
|
|
174
|
+
typeKeywords: ['gitGraph'],
|
|
175
|
+
blockKeywords: [],
|
|
176
|
+
keywords: [
|
|
177
|
+
'accTitle',
|
|
178
|
+
'accDescr',
|
|
179
|
+
'commit',
|
|
180
|
+
'cherry-pick',
|
|
181
|
+
'branch',
|
|
182
|
+
'merge',
|
|
183
|
+
'reset',
|
|
184
|
+
'checkout',
|
|
185
|
+
'LR',
|
|
186
|
+
'BT',
|
|
187
|
+
'id',
|
|
188
|
+
'msg',
|
|
189
|
+
'type',
|
|
190
|
+
'tag',
|
|
191
|
+
'NORMAL',
|
|
192
|
+
'REVERSE',
|
|
193
|
+
'HIGHLIGHT',
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
pie: {
|
|
197
|
+
typeKeywords: ['pie'],
|
|
198
|
+
blockKeywords: [],
|
|
199
|
+
keywords: ['title', 'showData', 'title', 'accDescription']
|
|
200
|
+
},
|
|
201
|
+
c4Diagram: {
|
|
202
|
+
typeKeywords: [
|
|
203
|
+
'C4Context',
|
|
204
|
+
'C4Container',
|
|
205
|
+
'C4Component',
|
|
206
|
+
'C4Dynamic',
|
|
207
|
+
'C4Deployment',
|
|
208
|
+
],
|
|
209
|
+
blockKeywords: [
|
|
210
|
+
'Boundary',
|
|
211
|
+
'Enterprise_Boundary',
|
|
212
|
+
'System_Boundary',
|
|
213
|
+
'Container_Boundary',
|
|
214
|
+
'Node',
|
|
215
|
+
'Node_L',
|
|
216
|
+
'Node_R',
|
|
217
|
+
],
|
|
218
|
+
keywords: [
|
|
219
|
+
'title',
|
|
220
|
+
'accDescription',
|
|
221
|
+
'direction',
|
|
222
|
+
'TB',
|
|
223
|
+
'BT',
|
|
224
|
+
'RL',
|
|
225
|
+
'LR',
|
|
226
|
+
'Person_Ext',
|
|
227
|
+
'Person',
|
|
228
|
+
'SystemQueue_Ext',
|
|
229
|
+
'SystemDb_Ext',
|
|
230
|
+
'System_Ext',
|
|
231
|
+
'SystemQueue',
|
|
232
|
+
'SystemDb',
|
|
233
|
+
'System',
|
|
234
|
+
'ContainerQueue_Ext',
|
|
235
|
+
'ContainerDb_Ext',
|
|
236
|
+
'Container_Ext',
|
|
237
|
+
'ContainerQueue',
|
|
238
|
+
'ContainerDb',
|
|
239
|
+
'Container',
|
|
240
|
+
'ComponentQueue_Ext',
|
|
241
|
+
'ComponentDb_Ext',
|
|
242
|
+
'Component_Ext',
|
|
243
|
+
'ComponentQueue',
|
|
244
|
+
'ComponentDb',
|
|
245
|
+
'Component',
|
|
246
|
+
'Deployment_Node',
|
|
247
|
+
'Rel',
|
|
248
|
+
'BiRel',
|
|
249
|
+
'Rel_Up',
|
|
250
|
+
'Rel_U',
|
|
251
|
+
'Rel_Down',
|
|
252
|
+
'Rel_D',
|
|
253
|
+
'Rel_Left',
|
|
254
|
+
'Rel_L',
|
|
255
|
+
'Rel_Right',
|
|
256
|
+
'Rel_R',
|
|
257
|
+
'Rel_Back',
|
|
258
|
+
'RelIndex',
|
|
259
|
+
]
|
|
260
|
+
},
|
|
261
|
+
mindmap: {
|
|
262
|
+
typeKeywords: ['mindmap'],
|
|
263
|
+
blockKeywords: [],
|
|
264
|
+
keywords: ['root', 'icon', 'class']
|
|
265
|
+
},
|
|
266
|
+
timeline: {
|
|
267
|
+
typeKeywords: ['timeline'],
|
|
268
|
+
blockKeywords: ['section'],
|
|
269
|
+
keywords: ['title', 'accDescription']
|
|
270
|
+
},
|
|
271
|
+
sankey: {
|
|
272
|
+
typeKeywords: ['sankey', 'sankey-beta'],
|
|
273
|
+
blockKeywords: [],
|
|
274
|
+
keywords: []
|
|
275
|
+
},
|
|
276
|
+
quadrantChart: {
|
|
277
|
+
typeKeywords: ['quadrantChart'],
|
|
278
|
+
blockKeywords: [],
|
|
279
|
+
keywords: [
|
|
280
|
+
'title',
|
|
281
|
+
'x-axis',
|
|
282
|
+
'y-axis',
|
|
283
|
+
'quadrant-1',
|
|
284
|
+
'quadrant-2',
|
|
285
|
+
'quadrant-3',
|
|
286
|
+
'quadrant-4',
|
|
287
|
+
'classDef',
|
|
288
|
+
]
|
|
289
|
+
},
|
|
290
|
+
xychart: {
|
|
291
|
+
typeKeywords: ['xychart-beta', 'xychart'],
|
|
292
|
+
blockKeywords: [],
|
|
293
|
+
keywords: [
|
|
294
|
+
'title',
|
|
295
|
+
'x-axis',
|
|
296
|
+
'y-axis',
|
|
297
|
+
'line',
|
|
298
|
+
'bar',
|
|
299
|
+
'horizontal',
|
|
300
|
+
'vertical',
|
|
301
|
+
]
|
|
302
|
+
},
|
|
303
|
+
block: {
|
|
304
|
+
typeKeywords: ['block-beta', 'block'],
|
|
305
|
+
blockKeywords: ['block', 'end'],
|
|
306
|
+
keywords: ['columns', 'space', 'style', 'classDef', 'class']
|
|
307
|
+
},
|
|
308
|
+
packet: {
|
|
309
|
+
typeKeywords: ['packet-beta', 'packet'],
|
|
310
|
+
blockKeywords: [],
|
|
311
|
+
keywords: []
|
|
312
|
+
},
|
|
313
|
+
kanban: {
|
|
314
|
+
typeKeywords: ['kanban'],
|
|
315
|
+
blockKeywords: [],
|
|
316
|
+
keywords: ['assigned', 'ticket', 'priority']
|
|
317
|
+
},
|
|
318
|
+
architecture: {
|
|
319
|
+
typeKeywords: ['architecture-beta', 'architecture'],
|
|
320
|
+
blockKeywords: [],
|
|
321
|
+
keywords: [
|
|
322
|
+
'group',
|
|
323
|
+
'service',
|
|
324
|
+
'junction',
|
|
325
|
+
'cloud',
|
|
326
|
+
'database',
|
|
327
|
+
'disk',
|
|
328
|
+
'internet',
|
|
329
|
+
'server',
|
|
330
|
+
'in',
|
|
331
|
+
]
|
|
332
|
+
},
|
|
333
|
+
radar: {
|
|
334
|
+
typeKeywords: ['radar-beta', 'radar'],
|
|
335
|
+
blockKeywords: [],
|
|
336
|
+
keywords: [
|
|
337
|
+
'title',
|
|
338
|
+
'axis',
|
|
339
|
+
'curve',
|
|
340
|
+
'showLegend',
|
|
341
|
+
'max',
|
|
342
|
+
'min',
|
|
343
|
+
'graticule',
|
|
344
|
+
'ticks',
|
|
345
|
+
'circle',
|
|
346
|
+
'polygon',
|
|
347
|
+
]
|
|
348
|
+
},
|
|
349
|
+
treemap: {
|
|
350
|
+
typeKeywords: ['treemap-beta', 'treemap'],
|
|
351
|
+
blockKeywords: [],
|
|
352
|
+
keywords: ['classDef', 'class']
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
var configDirectiveHandler = [
|
|
356
|
+
/^\s*%%(?={)/,
|
|
357
|
+
{
|
|
358
|
+
token: 'string',
|
|
359
|
+
next: '@configDirective',
|
|
360
|
+
nextEmbedded: 'javascript'
|
|
361
|
+
},
|
|
362
|
+
];
|
|
363
|
+
// Register a tokens provider for the mermaid language
|
|
364
|
+
monacoEditor.languages.setMonarchTokensProvider('mermaid', __assign(__assign({}, Object.entries(keywords)
|
|
365
|
+
.map(function (entry) {
|
|
366
|
+
return Object.fromEntries(Object.entries(entry[1]).map(function (deepEntry) { return [
|
|
367
|
+
entry[0] + deepEntry[0][0].toUpperCase() + deepEntry[0].slice(1),
|
|
368
|
+
deepEntry[1],
|
|
369
|
+
]; }));
|
|
370
|
+
})
|
|
371
|
+
.reduce(function (overallKeywords, nextKeyword) { return (__assign(__assign({}, overallKeywords), nextKeyword)); }, {})), { tokenizer: {
|
|
372
|
+
root: [
|
|
373
|
+
[/^\s*gitGraph/m, 'typeKeyword', 'gitGraph'],
|
|
374
|
+
[/^\s*info/m, 'typeKeyword', 'info'],
|
|
375
|
+
[/^\s*pie/m, 'typeKeyword', 'pie'],
|
|
376
|
+
[
|
|
377
|
+
/^\s*(flowchart|flowchart-v2|flowchart-elk|graph)/m,
|
|
378
|
+
'typeKeyword',
|
|
379
|
+
'flowchart',
|
|
380
|
+
],
|
|
381
|
+
[/^\s*sequenceDiagram/, 'typeKeyword', 'sequenceDiagram'],
|
|
382
|
+
[/^\s*classDiagram(-v2)?/, 'typeKeyword', 'classDiagram'],
|
|
383
|
+
[/^\s*journey/, 'typeKeyword', 'journey'],
|
|
384
|
+
[/^\s*gantt/, 'typeKeyword', 'gantt'],
|
|
385
|
+
[/^\s*stateDiagram(-v2)?/, 'typeKeyword', 'stateDiagram'],
|
|
386
|
+
[/^\s*er(Diagram)?/, 'typeKeyword', 'erDiagram'],
|
|
387
|
+
[/^\s*requirement(Diagram)?/, 'typeKeyword', 'requirementDiagram'],
|
|
388
|
+
[
|
|
389
|
+
/^\s*(C4Context|C4Container|C4Component|C4Dynamic|C4Deployment)/m,
|
|
390
|
+
'typeKeyword',
|
|
391
|
+
'c4Diagram',
|
|
392
|
+
],
|
|
393
|
+
[/^\s*mindmap/m, 'typeKeyword', 'mindmap'],
|
|
394
|
+
[/^\s*timeline/m, 'typeKeyword', 'timeline'],
|
|
395
|
+
[/^\s*sankey(-beta)?/m, 'typeKeyword', 'sankey'],
|
|
396
|
+
[/^\s*quadrantChart/m, 'typeKeyword', 'quadrantChart'],
|
|
397
|
+
[/^\s*xychart(-beta)?/m, 'typeKeyword', 'xychart'],
|
|
398
|
+
[/^\s*block(-beta)?/m, 'typeKeyword', 'block'],
|
|
399
|
+
[/^\s*packet(-beta)?/m, 'typeKeyword', 'packet'],
|
|
400
|
+
[/^\s*kanban/m, 'typeKeyword', 'kanban'],
|
|
401
|
+
[/^\s*architecture(-beta)?/m, 'typeKeyword', 'architecture'],
|
|
402
|
+
[/^\s*radar(-beta)?/m, 'typeKeyword', 'radar'],
|
|
403
|
+
[/^\s*treemap(-beta)?/m, 'typeKeyword', 'treemap'],
|
|
404
|
+
[
|
|
405
|
+
/^---$/,
|
|
406
|
+
{ token: 'keyword', next: '@frontmatter', nextEmbedded: 'yaml' },
|
|
407
|
+
],
|
|
408
|
+
configDirectiveHandler,
|
|
409
|
+
[/%%[^${].*$/, 'comment'],
|
|
410
|
+
],
|
|
411
|
+
frontmatter: [
|
|
412
|
+
[/^---$/, { token: 'keyword', next: '@pop', nextEmbedded: '@pop' }],
|
|
413
|
+
],
|
|
414
|
+
configDirective: [
|
|
415
|
+
[/%%$/, { token: 'string', next: '@pop', nextEmbedded: '@pop' }],
|
|
416
|
+
],
|
|
417
|
+
gitGraph: [
|
|
418
|
+
configDirectiveHandler,
|
|
419
|
+
[/option(?=s)/, { token: 'typeKeyword', next: 'optionsGitGraph' }],
|
|
420
|
+
[
|
|
421
|
+
/(accTitle|accDescr)(\s*:)(\s*[^\r\n]+$)/,
|
|
422
|
+
['keyword', 'delimiter.bracket', 'string'],
|
|
423
|
+
],
|
|
424
|
+
[
|
|
425
|
+
/(^\s*branch)(.*?)(\s+order)(:\s*)(\d+\s*$)/,
|
|
426
|
+
['keyword', 'variable', 'keyword', 'delimiter.bracket', 'number'],
|
|
427
|
+
],
|
|
428
|
+
[/".*?"/, 'string'],
|
|
429
|
+
[
|
|
430
|
+
/(^\s*)(branch|reset|merge|checkout)(\s*\S+)/m,
|
|
431
|
+
['delimiter.bracket', 'keyword', 'variable'],
|
|
432
|
+
],
|
|
433
|
+
[
|
|
434
|
+
/[a-zA-Z][\w$]*/,
|
|
435
|
+
{
|
|
436
|
+
cases: {
|
|
437
|
+
'@gitGraphBlockKeywords': 'typeKeyword',
|
|
438
|
+
'@gitGraphKeywords': 'keyword'
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
],
|
|
442
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
443
|
+
[/\^/, 'delimiter.bracket'],
|
|
444
|
+
],
|
|
445
|
+
optionsGitGraph: [
|
|
446
|
+
[
|
|
447
|
+
/s$/,
|
|
448
|
+
{
|
|
449
|
+
token: 'typeKeyword',
|
|
450
|
+
nextEmbedded: 'json'
|
|
451
|
+
},
|
|
452
|
+
],
|
|
453
|
+
['end', { token: 'typeKeyword', next: '@pop', nextEmbedded: '@pop' }],
|
|
454
|
+
],
|
|
455
|
+
info: [
|
|
456
|
+
[
|
|
457
|
+
/[a-zA-Z][\w$]*/,
|
|
458
|
+
{
|
|
459
|
+
cases: {
|
|
460
|
+
'@infoBlockKeywords': 'typeKeyword',
|
|
461
|
+
'@infoKeywords': 'keyword'
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
],
|
|
465
|
+
],
|
|
466
|
+
pie: [
|
|
467
|
+
configDirectiveHandler,
|
|
468
|
+
[/(title|accDescription)(.*$)/, ['keyword', 'string']],
|
|
469
|
+
[
|
|
470
|
+
/[a-zA-Z][\w$]*/,
|
|
471
|
+
{
|
|
472
|
+
cases: {
|
|
473
|
+
'@pieBlockKeywords': 'typeKeyword',
|
|
474
|
+
'@pieKeywords': 'keyword'
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
],
|
|
478
|
+
[/".*?"/, 'string'],
|
|
479
|
+
[/\s*\d+/, 'number'],
|
|
480
|
+
[/:/, 'delimiter.bracket'],
|
|
481
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
482
|
+
],
|
|
483
|
+
flowchart: [
|
|
484
|
+
configDirectiveHandler,
|
|
485
|
+
[/[ox]?(--+|==+)[ox]/, 'transition'],
|
|
486
|
+
[
|
|
487
|
+
/[a-zA-Z][\w$]*/,
|
|
488
|
+
{
|
|
489
|
+
cases: {
|
|
490
|
+
'@flowchartBlockKeywords': 'typeKeyword',
|
|
491
|
+
'@flowchartKeywords': 'keyword',
|
|
492
|
+
'@default': 'variable'
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
],
|
|
496
|
+
[/\|+.+?\|+/, 'string'],
|
|
497
|
+
[/\[+(\\.+?[\\/]|\/.+?[/\\])\]+/, 'string'],
|
|
498
|
+
[/[[>]+[^\]|[]+?\]+/, 'string'],
|
|
499
|
+
[/{+.+?}+/, 'string'],
|
|
500
|
+
[/\(+.+?\)+/, 'string'],
|
|
501
|
+
[/-\.+->?/, 'transition'],
|
|
502
|
+
[
|
|
503
|
+
/(-[-.])([^->][^-]+?)(-{3,}|-{2,}>|\.-+>)/,
|
|
504
|
+
['transition', 'string', 'transition'],
|
|
505
|
+
],
|
|
506
|
+
[/(==+)([^=]+?)(={3,}|={2,}>)/, ['transition', 'string', 'transition']],
|
|
507
|
+
[/<?(--+|==+)>|===+|---+/, 'transition'],
|
|
508
|
+
[/:::/, 'transition'],
|
|
509
|
+
[/[;&]/, 'delimiter.bracket'],
|
|
510
|
+
[/".*?"/, 'string'],
|
|
511
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
512
|
+
],
|
|
513
|
+
sequenceDiagram: [
|
|
514
|
+
configDirectiveHandler,
|
|
515
|
+
[/(title:?|accDescription)([^\r\n;]*$)/, ['keyword', 'string']],
|
|
516
|
+
[/(autonumber)([^\r\n\S]+off[^\r\n\S]*$)/, ['keyword', 'keyword']],
|
|
517
|
+
[
|
|
518
|
+
/(autonumber)([^\r\n\S]+\d+[^\r\n\S]+\d+[^\r\n\S]*$)/,
|
|
519
|
+
['keyword', 'number'],
|
|
520
|
+
],
|
|
521
|
+
[/(autonumber)([^\r\n\S]+\d+[^\r\n\S]*$)/, ['keyword', 'number']],
|
|
522
|
+
[
|
|
523
|
+
/(link\s+)(.*?)(:)(\s*.*?)(\s*@)(\s*[^\r\n;]+)/,
|
|
524
|
+
[
|
|
525
|
+
'keyword',
|
|
526
|
+
'variable',
|
|
527
|
+
'delimiter.bracket',
|
|
528
|
+
'string',
|
|
529
|
+
'delimiter.bracket',
|
|
530
|
+
'string',
|
|
531
|
+
],
|
|
532
|
+
],
|
|
533
|
+
[
|
|
534
|
+
/((?:links|properties)\s+)([^\r\n:]*?)(:\s+)/,
|
|
535
|
+
[
|
|
536
|
+
{ token: 'keyword' },
|
|
537
|
+
{ token: 'variable' },
|
|
538
|
+
{
|
|
539
|
+
token: 'delimiter.bracket',
|
|
540
|
+
nextEmbedded: 'javascript',
|
|
541
|
+
next: '@sequenceDiagramLinksProps'
|
|
542
|
+
},
|
|
543
|
+
],
|
|
544
|
+
],
|
|
545
|
+
[
|
|
546
|
+
/[a-zA-Z][\w$]*/,
|
|
547
|
+
{
|
|
548
|
+
cases: {
|
|
549
|
+
'@sequenceDiagramBlockKeywords': 'typeKeyword',
|
|
550
|
+
'@sequenceDiagramKeywords': 'keyword',
|
|
551
|
+
'@default': 'variable'
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
],
|
|
555
|
+
[/(--?>?>|--?[)x])[+-]?/, 'transition'],
|
|
556
|
+
[/(:)([^:\n]*?$)/, ['delimiter.bracket', 'string']],
|
|
557
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
558
|
+
],
|
|
559
|
+
sequenceDiagramLinksProps: [
|
|
560
|
+
// [/^:/, { token: 'delimiter.bracket', nextEmbedded: 'json' }],
|
|
561
|
+
[
|
|
562
|
+
/$|;/,
|
|
563
|
+
{ nextEmbedded: '@pop', next: '@pop', token: 'delimiter.bracket' },
|
|
564
|
+
],
|
|
565
|
+
],
|
|
566
|
+
classDiagram: [
|
|
567
|
+
configDirectiveHandler,
|
|
568
|
+
[/(^\s*(?:title|accDescription))(\s+.*$)/, ['keyword', 'string']],
|
|
569
|
+
[
|
|
570
|
+
/(\*|<\|?|o|)(--|\.\.)(\*|\|?>|o|)([ \t]*[a-zA-Z]+[ \t]*)(:)(.*?$)/,
|
|
571
|
+
[
|
|
572
|
+
'transition',
|
|
573
|
+
'transition',
|
|
574
|
+
'transition',
|
|
575
|
+
'variable',
|
|
576
|
+
'delimiter.bracket',
|
|
577
|
+
'string',
|
|
578
|
+
],
|
|
579
|
+
],
|
|
580
|
+
[/(?!class\s)([a-zA-Z]+)(\s+[a-zA-Z]+)/, ['type', 'variable']],
|
|
581
|
+
[/(\*|<\|?|o)?(--|\.\.)(\*|\|?>|o)?/, 'transition'],
|
|
582
|
+
[/^\s*class\s(?!.*\{)/, 'keyword'],
|
|
583
|
+
[
|
|
584
|
+
/[a-zA-Z][\w$]*/,
|
|
585
|
+
{
|
|
586
|
+
cases: {
|
|
587
|
+
'@classDiagramBlockKeywords': 'typeKeyword',
|
|
588
|
+
'@classDiagramKeywords': 'keyword',
|
|
589
|
+
'@default': 'variable'
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
],
|
|
593
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
594
|
+
[
|
|
595
|
+
/(<<)(.+?)(>>)/,
|
|
596
|
+
['delimiter.bracket', 'annotation', 'delimiter.bracket'],
|
|
597
|
+
],
|
|
598
|
+
[/".*?"/, 'string'],
|
|
599
|
+
[/:::/, 'transition'],
|
|
600
|
+
[/:|\+|-|#|~|\*\s*$|\$\s*$|\(|\)|{|}/, 'delimiter.bracket'],
|
|
601
|
+
],
|
|
602
|
+
journey: [
|
|
603
|
+
configDirectiveHandler,
|
|
604
|
+
[/(title)(.*)/, ['keyword', 'string']],
|
|
605
|
+
[/(section)(.*)/, ['typeKeyword', 'string']],
|
|
606
|
+
[
|
|
607
|
+
/[a-zA-Z][\w$]*/,
|
|
608
|
+
{
|
|
609
|
+
cases: {
|
|
610
|
+
'@journeyBlockKeywords': 'typeKeyword',
|
|
611
|
+
'@journeyKeywords': 'keyword',
|
|
612
|
+
'@default': 'variable'
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
],
|
|
616
|
+
[
|
|
617
|
+
/(^\s*.+?)(:)(.*?)(:)(.*?)([,$])/,
|
|
618
|
+
[
|
|
619
|
+
'string',
|
|
620
|
+
'delimiter.bracket',
|
|
621
|
+
'number',
|
|
622
|
+
'delimiter.bracket',
|
|
623
|
+
'variable',
|
|
624
|
+
'delimiter.bracket',
|
|
625
|
+
],
|
|
626
|
+
],
|
|
627
|
+
[/,/, 'delimiter.bracket'],
|
|
628
|
+
[/(^\s*.+?)(:)([^:]*?)$/, ['string', 'delimiter.bracket', 'variable']],
|
|
629
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
630
|
+
],
|
|
631
|
+
gantt: [
|
|
632
|
+
configDirectiveHandler,
|
|
633
|
+
[/(title)(.*)/, ['keyword', 'string']],
|
|
634
|
+
[/(section)(.*)/, ['typeKeyword', 'string']],
|
|
635
|
+
[/^\s*([^:\n]*?)(:)/, ['string', 'delimiter.bracket']],
|
|
636
|
+
[
|
|
637
|
+
/[a-zA-Z][\w$]*/,
|
|
638
|
+
{
|
|
639
|
+
cases: {
|
|
640
|
+
'@ganttBlockKeywords': 'typeKeyword',
|
|
641
|
+
'@ganttKeywords': 'keyword'
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
],
|
|
645
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
646
|
+
[/:/, 'delimiter.bracket'],
|
|
647
|
+
],
|
|
648
|
+
stateDiagram: [
|
|
649
|
+
configDirectiveHandler,
|
|
650
|
+
[/note[^:]*$/, { token: 'typeKeyword', next: 'stateDiagramNote' }],
|
|
651
|
+
['hide empty description', 'keyword'],
|
|
652
|
+
[/^\s*state\s(?!.*\{)/, 'keyword'],
|
|
653
|
+
[/(<<)(fork|join|choice)(>>)/, 'annotation'],
|
|
654
|
+
[
|
|
655
|
+
/(\[\[)(fork|join|choice)(]])/,
|
|
656
|
+
['delimiter.bracket', 'annotation', 'delimiter.bracket'],
|
|
657
|
+
],
|
|
658
|
+
[
|
|
659
|
+
/[a-zA-Z][\w$]*/,
|
|
660
|
+
{
|
|
661
|
+
cases: {
|
|
662
|
+
'@stateDiagramBlockKeywords': 'typeKeyword',
|
|
663
|
+
'@stateDiagramKeywords': 'keyword',
|
|
664
|
+
'@default': 'variable'
|
|
665
|
+
}
|
|
666
|
+
},
|
|
667
|
+
],
|
|
668
|
+
[/".*?"/, 'string'],
|
|
669
|
+
[/(:)([^:\n]*?$)/, ['delimiter.bracket', 'string']],
|
|
670
|
+
[/{|}/, 'delimiter.bracket'],
|
|
671
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
672
|
+
[/-->/, 'transition'],
|
|
673
|
+
[/\[.*?]/, 'string'],
|
|
674
|
+
],
|
|
675
|
+
stateDiagramNote: [
|
|
676
|
+
[/^\s*end note$/, { token: 'typeKeyword', next: '@pop' }],
|
|
677
|
+
[/.*/, 'string'],
|
|
678
|
+
],
|
|
679
|
+
erDiagram: [
|
|
680
|
+
configDirectiveHandler,
|
|
681
|
+
[/(title|accDescription)(.*$)/, ['keyword', 'string']],
|
|
682
|
+
[/[}|][o|](--|\.\.)[o|][{|]/, 'transition'],
|
|
683
|
+
[/".*?"/, 'string'],
|
|
684
|
+
[/(:)(.*?$)/, ['delimiter.bracket', 'string']],
|
|
685
|
+
[/:|{|}/, 'delimiter.bracket'],
|
|
686
|
+
[/([a-zA-Z]+)(\s+[a-zA-Z]+)/, ['type', 'variable']],
|
|
687
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
688
|
+
[/[a-zA-Z_-][\w$]*/, 'variable'],
|
|
689
|
+
],
|
|
690
|
+
requirementDiagram: [
|
|
691
|
+
configDirectiveHandler,
|
|
692
|
+
[/->|<-|-/, 'transition'],
|
|
693
|
+
[/(\d+\.)*\d+/, 'number'],
|
|
694
|
+
[
|
|
695
|
+
/[a-zA-Z_-][\w$]*/,
|
|
696
|
+
{
|
|
697
|
+
cases: {
|
|
698
|
+
'@requirementDiagramBlockKeywords': 'typeKeyword',
|
|
699
|
+
'@default': 'variable'
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
],
|
|
703
|
+
[/:|{|}|\//, 'delimiter.bracket'],
|
|
704
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
705
|
+
[/".*?"/, 'string'],
|
|
706
|
+
],
|
|
707
|
+
c4Diagram: [
|
|
708
|
+
configDirectiveHandler,
|
|
709
|
+
[/(title|accDescription)(.*$)/, ['keyword', 'string']],
|
|
710
|
+
[/\(/, { token: 'delimiter.bracket', next: 'c4DiagramParenthesis' }],
|
|
711
|
+
[
|
|
712
|
+
/[a-zA-Z_-][\w$]*/,
|
|
713
|
+
{
|
|
714
|
+
cases: {
|
|
715
|
+
'@c4DiagramBlockKeywords': 'typeKeyword',
|
|
716
|
+
'@c4DiagramKeywords': 'keyword',
|
|
717
|
+
'@default': 'variable'
|
|
718
|
+
}
|
|
719
|
+
},
|
|
720
|
+
],
|
|
721
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
722
|
+
],
|
|
723
|
+
c4DiagramParenthesis: [
|
|
724
|
+
[/,/, 'delimiter.bracket'],
|
|
725
|
+
[/\)/, { next: '@pop', token: 'delimiter.bracket' }],
|
|
726
|
+
[/[^,)]/, 'string'],
|
|
727
|
+
],
|
|
728
|
+
mindmap: [
|
|
729
|
+
configDirectiveHandler,
|
|
730
|
+
[/::icon\(.*?\)/, 'annotation'],
|
|
731
|
+
[/:::[\w]+/, 'annotation'],
|
|
732
|
+
[/\(\(.*?\)\)/, 'string'],
|
|
733
|
+
[/\(.*?\)/, 'string'],
|
|
734
|
+
[/\[.*?\]/, 'string'],
|
|
735
|
+
[/\{\{.*?\}\}/, 'string'],
|
|
736
|
+
[/\)\).*?\(\(/, 'string'],
|
|
737
|
+
[
|
|
738
|
+
/[a-zA-Z][\w$]*/,
|
|
739
|
+
{
|
|
740
|
+
cases: {
|
|
741
|
+
'@mindmapKeywords': 'keyword',
|
|
742
|
+
'@default': 'variable'
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
],
|
|
746
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
747
|
+
],
|
|
748
|
+
timeline: [
|
|
749
|
+
configDirectiveHandler,
|
|
750
|
+
[/(title)(.*)/, ['keyword', 'string']],
|
|
751
|
+
[/(section)(.*)/, ['typeKeyword', 'string']],
|
|
752
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
753
|
+
[/:/, 'delimiter.bracket'],
|
|
754
|
+
[
|
|
755
|
+
/[a-zA-Z][\w$]*/,
|
|
756
|
+
{
|
|
757
|
+
cases: {
|
|
758
|
+
'@timelineBlockKeywords': 'typeKeyword',
|
|
759
|
+
'@timelineKeywords': 'keyword',
|
|
760
|
+
'@default': 'variable'
|
|
761
|
+
}
|
|
762
|
+
},
|
|
763
|
+
],
|
|
764
|
+
],
|
|
765
|
+
sankey: [
|
|
766
|
+
configDirectiveHandler,
|
|
767
|
+
[/"[^"]*"/, 'string'],
|
|
768
|
+
[/'[^']*'/, 'string'],
|
|
769
|
+
[/,/, 'delimiter.bracket'],
|
|
770
|
+
[/[\d.]+/, 'number'],
|
|
771
|
+
[/[a-zA-Z][\w\s]*(?=,)/, 'variable'],
|
|
772
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
773
|
+
],
|
|
774
|
+
quadrantChart: [
|
|
775
|
+
configDirectiveHandler,
|
|
776
|
+
[/(title)(.*)/, ['keyword', 'string']],
|
|
777
|
+
[
|
|
778
|
+
/(x-axis|y-axis)(\s+)(.+?)(-->)(.+)/,
|
|
779
|
+
['keyword', '', 'string', 'transition', 'string'],
|
|
780
|
+
],
|
|
781
|
+
[/(x-axis|y-axis)(\s+)(.*)/, ['keyword', '', 'string']],
|
|
782
|
+
[/(quadrant-[1-4])(\s+)(.*)/, ['keyword', '', 'string']],
|
|
783
|
+
[/(classDef)(\s+)(\w+)(.*)/, ['keyword', '', 'type', 'string']],
|
|
784
|
+
[
|
|
785
|
+
/(\w+)(:::)(\w+)(:)(\s*\[)([^\]]+)(\])/,
|
|
786
|
+
[
|
|
787
|
+
'variable',
|
|
788
|
+
'transition',
|
|
789
|
+
'type',
|
|
790
|
+
'delimiter.bracket',
|
|
791
|
+
'delimiter.bracket',
|
|
792
|
+
'number',
|
|
793
|
+
'delimiter.bracket',
|
|
794
|
+
],
|
|
795
|
+
],
|
|
796
|
+
[
|
|
797
|
+
/(\w[\w\s]*?)(:)(\s*\[)([^\]]+)(\])/,
|
|
798
|
+
[
|
|
799
|
+
'variable',
|
|
800
|
+
'delimiter.bracket',
|
|
801
|
+
'delimiter.bracket',
|
|
802
|
+
'number',
|
|
803
|
+
'delimiter.bracket',
|
|
804
|
+
],
|
|
805
|
+
],
|
|
806
|
+
[/[\d.]+/, 'number'],
|
|
807
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
808
|
+
],
|
|
809
|
+
xychart: [
|
|
810
|
+
configDirectiveHandler,
|
|
811
|
+
[/(title)(\s+)(".*?"|[^\n]+)/, ['keyword', '', 'string']],
|
|
812
|
+
[
|
|
813
|
+
/(x-axis)(\s+)(".*?"|[\w]+)(\s+)(\d+)(\s*)(-->)(\s*)(\d+)/,
|
|
814
|
+
[
|
|
815
|
+
'keyword',
|
|
816
|
+
'',
|
|
817
|
+
'string',
|
|
818
|
+
'',
|
|
819
|
+
'number',
|
|
820
|
+
'',
|
|
821
|
+
'transition',
|
|
822
|
+
'',
|
|
823
|
+
'number',
|
|
824
|
+
],
|
|
825
|
+
],
|
|
826
|
+
[
|
|
827
|
+
/(x-axis|y-axis)(\s+)(".*?"|[\w]+)(\s*)(\[)([^\]]+)(\])/,
|
|
828
|
+
[
|
|
829
|
+
'keyword',
|
|
830
|
+
'',
|
|
831
|
+
'string',
|
|
832
|
+
'',
|
|
833
|
+
'delimiter.bracket',
|
|
834
|
+
'string',
|
|
835
|
+
'delimiter.bracket',
|
|
836
|
+
],
|
|
837
|
+
],
|
|
838
|
+
[/(x-axis|y-axis)(\s+)(".*?"|.*)/, ['keyword', '', 'string']],
|
|
839
|
+
[
|
|
840
|
+
/(line|bar)(\s*)(\[)([^\]]+)(\])/,
|
|
841
|
+
['keyword', '', 'delimiter.bracket', 'number', 'delimiter.bracket'],
|
|
842
|
+
],
|
|
843
|
+
[/".*?"/, 'string'],
|
|
844
|
+
[/\[.*?\]/, 'string'],
|
|
845
|
+
[/[\d.+-]+/, 'number'],
|
|
846
|
+
[
|
|
847
|
+
/[a-zA-Z][\w$]*/,
|
|
848
|
+
{
|
|
849
|
+
cases: {
|
|
850
|
+
'@xychartKeywords': 'keyword',
|
|
851
|
+
'@default': 'variable'
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
],
|
|
855
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
856
|
+
],
|
|
857
|
+
block: [
|
|
858
|
+
configDirectiveHandler,
|
|
859
|
+
[/(columns)(\s+)(\d+)/, ['keyword', '', 'number']],
|
|
860
|
+
[/(space)(:\d+)?/, ['keyword', 'number']],
|
|
861
|
+
[/(style|classDef)(\s+)(\w+)(.*)/, ['keyword', '', 'type', 'string']],
|
|
862
|
+
[
|
|
863
|
+
/(class)(\s+)(\w+)(\s+)(\w+)/,
|
|
864
|
+
['keyword', '', 'variable', '', 'type'],
|
|
865
|
+
],
|
|
866
|
+
[
|
|
867
|
+
/(\w+)(\s*)(\[)(".*?")(\])/,
|
|
868
|
+
['variable', '', 'delimiter.bracket', 'string', 'delimiter.bracket'],
|
|
869
|
+
],
|
|
870
|
+
[
|
|
871
|
+
/(\w+)(\s*)(\(\()(".*?")(\)\))/,
|
|
872
|
+
['variable', '', 'delimiter.bracket', 'string', 'delimiter.bracket'],
|
|
873
|
+
],
|
|
874
|
+
[
|
|
875
|
+
/(\w+)(\s*)(\(\[)(".*?")(\]\))/,
|
|
876
|
+
['variable', '', 'delimiter.bracket', 'string', 'delimiter.bracket'],
|
|
877
|
+
],
|
|
878
|
+
[
|
|
879
|
+
/(\w+)(\s*)(\[\[)(".*?")(\]\])/,
|
|
880
|
+
['variable', '', 'delimiter.bracket', 'string', 'delimiter.bracket'],
|
|
881
|
+
],
|
|
882
|
+
[/--+>|<--+|--+/, 'transition'],
|
|
883
|
+
[/".*?"/, 'string'],
|
|
884
|
+
[/:\d+/, 'number'],
|
|
885
|
+
[
|
|
886
|
+
/[a-zA-Z][\w$]*/,
|
|
887
|
+
{
|
|
888
|
+
cases: {
|
|
889
|
+
'@blockBlockKeywords': 'typeKeyword',
|
|
890
|
+
'@blockKeywords': 'keyword',
|
|
891
|
+
'@default': 'variable'
|
|
892
|
+
}
|
|
893
|
+
},
|
|
894
|
+
],
|
|
895
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
896
|
+
],
|
|
897
|
+
packet: [
|
|
898
|
+
configDirectiveHandler,
|
|
899
|
+
[
|
|
900
|
+
/(\d+)(-\d+)?(:)(\s*)(".*?")/,
|
|
901
|
+
['number', 'number', 'delimiter.bracket', '', 'string'],
|
|
902
|
+
],
|
|
903
|
+
[
|
|
904
|
+
/(\+\d+)(:)(\s*)(".*?")/,
|
|
905
|
+
['number', 'delimiter.bracket', '', 'string'],
|
|
906
|
+
],
|
|
907
|
+
[/".*?"/, 'string'],
|
|
908
|
+
[/\d+/, 'number'],
|
|
909
|
+
[/:/, 'delimiter.bracket'],
|
|
910
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
911
|
+
],
|
|
912
|
+
kanban: [
|
|
913
|
+
configDirectiveHandler,
|
|
914
|
+
[/(@\{)/, { token: 'delimiter.bracket', next: '@kanbanMetadata' }],
|
|
915
|
+
[
|
|
916
|
+
/(\w+)(\s*)(\[)([^\]]+)(\])/,
|
|
917
|
+
['variable', '', 'delimiter.bracket', 'string', 'delimiter.bracket'],
|
|
918
|
+
],
|
|
919
|
+
[/\[.*?\]/, 'string'],
|
|
920
|
+
[
|
|
921
|
+
/[a-zA-Z][\w$]*/,
|
|
922
|
+
{
|
|
923
|
+
cases: {
|
|
924
|
+
'@kanbanKeywords': 'keyword',
|
|
925
|
+
'@default': 'variable'
|
|
926
|
+
}
|
|
927
|
+
},
|
|
928
|
+
],
|
|
929
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
930
|
+
],
|
|
931
|
+
kanbanMetadata: [
|
|
932
|
+
[/\}/, { token: 'delimiter.bracket', next: '@pop' }],
|
|
933
|
+
[/(assigned|ticket|priority)(:)/, ['keyword', 'delimiter.bracket']],
|
|
934
|
+
[/'[^']*'|"[^"]*"/, 'string'],
|
|
935
|
+
[/,/, 'delimiter.bracket'],
|
|
936
|
+
[/[^,}'":]+/, 'string'],
|
|
937
|
+
],
|
|
938
|
+
architecture: [
|
|
939
|
+
configDirectiveHandler,
|
|
940
|
+
[/(group|service|junction)(\s+)(\w+)/, ['keyword', '', 'variable']],
|
|
941
|
+
[
|
|
942
|
+
/(\()(\w+)(:\w+)?(\))/,
|
|
943
|
+
[
|
|
944
|
+
'delimiter.bracket',
|
|
945
|
+
'annotation',
|
|
946
|
+
'annotation',
|
|
947
|
+
'delimiter.bracket',
|
|
948
|
+
],
|
|
949
|
+
],
|
|
950
|
+
[
|
|
951
|
+
/(\[)([^\]]+)(\])/,
|
|
952
|
+
['delimiter.bracket', 'string', 'delimiter.bracket'],
|
|
953
|
+
],
|
|
954
|
+
[/(in)(\s+)(\w+)/, ['keyword', '', 'variable']],
|
|
955
|
+
[/:{[TBLR]}/, 'annotation'],
|
|
956
|
+
[/:[TBLR]/, 'annotation'],
|
|
957
|
+
[/<?(--+)>?/, 'transition'],
|
|
958
|
+
[/\{group\}/, 'annotation'],
|
|
959
|
+
[
|
|
960
|
+
/[a-zA-Z][\w$]*/,
|
|
961
|
+
{
|
|
962
|
+
cases: {
|
|
963
|
+
'@architectureKeywords': 'keyword',
|
|
964
|
+
'@default': 'variable'
|
|
965
|
+
}
|
|
966
|
+
},
|
|
967
|
+
],
|
|
968
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
969
|
+
],
|
|
970
|
+
radar: [
|
|
971
|
+
configDirectiveHandler,
|
|
972
|
+
[/(title)(.*)/, ['keyword', 'string']],
|
|
973
|
+
[/(axis)(\s+)(.*)/, ['keyword', '', 'variable']],
|
|
974
|
+
[
|
|
975
|
+
/(curve)(\s+)(\w+)(\s*)(\[)?"?([^\]"{}]+)"?(\])?/,
|
|
976
|
+
[
|
|
977
|
+
'keyword',
|
|
978
|
+
'',
|
|
979
|
+
'variable',
|
|
980
|
+
'',
|
|
981
|
+
'delimiter.bracket',
|
|
982
|
+
'string',
|
|
983
|
+
'delimiter.bracket',
|
|
984
|
+
],
|
|
985
|
+
],
|
|
986
|
+
[
|
|
987
|
+
/(curve)(\s+)(\w+)(\s*)(\{)([^}]+)(\})/,
|
|
988
|
+
[
|
|
989
|
+
'keyword',
|
|
990
|
+
'',
|
|
991
|
+
'variable',
|
|
992
|
+
'',
|
|
993
|
+
'delimiter.bracket',
|
|
994
|
+
'number',
|
|
995
|
+
'delimiter.bracket',
|
|
996
|
+
],
|
|
997
|
+
],
|
|
998
|
+
[/(showLegend)(\s+)(true|false)/, ['keyword', '', 'keyword']],
|
|
999
|
+
[/(max|min|ticks)(\s+)(\d+)/, ['keyword', '', 'number']],
|
|
1000
|
+
[/(graticule)(\s+)(circle|polygon)/, ['keyword', '', 'keyword']],
|
|
1001
|
+
[/\{[^}]+\}/, 'number'],
|
|
1002
|
+
[/\[[^\]]+\]/, 'string'],
|
|
1003
|
+
[/"[^"]*"/, 'string'],
|
|
1004
|
+
[/[\d.]+/, 'number'],
|
|
1005
|
+
[
|
|
1006
|
+
/[a-zA-Z][\w$]*/,
|
|
1007
|
+
{
|
|
1008
|
+
cases: {
|
|
1009
|
+
'@radarKeywords': 'keyword',
|
|
1010
|
+
'@default': 'variable'
|
|
1011
|
+
}
|
|
1012
|
+
},
|
|
1013
|
+
],
|
|
1014
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
1015
|
+
],
|
|
1016
|
+
treemap: [
|
|
1017
|
+
configDirectiveHandler,
|
|
1018
|
+
[/(classDef)(\s+)(\w+)(.*)/, ['keyword', '', 'type', 'string']],
|
|
1019
|
+
[/(:::)(\w+)/, ['transition', 'type']],
|
|
1020
|
+
[
|
|
1021
|
+
/"([^"]+)"(\s*)(:)(\s*)(\d+)/,
|
|
1022
|
+
['string', '', 'delimiter.bracket', '', 'number'],
|
|
1023
|
+
],
|
|
1024
|
+
[/"[^"]*"/, 'string'],
|
|
1025
|
+
[/:\s*\d+/, 'number'],
|
|
1026
|
+
[/\d+/, 'number'],
|
|
1027
|
+
[/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'],
|
|
1028
|
+
]
|
|
1029
|
+
} }));
|
|
1030
|
+
monacoEditor.editor.defineTheme('mermaid-dark', {
|
|
1031
|
+
base: 'vs-dark',
|
|
1032
|
+
inherit: true,
|
|
1033
|
+
colors: {},
|
|
1034
|
+
rules: [
|
|
1035
|
+
{ token: 'typeKeyword', foreground: '9650c8', fontStyle: 'bold' },
|
|
1036
|
+
{ token: 'transition', foreground: '008800', fontStyle: 'bold' },
|
|
1037
|
+
{ token: 'identifier', foreground: '9cdcfe' },
|
|
1038
|
+
]
|
|
1039
|
+
});
|
|
1040
|
+
monacoEditor.editor.defineTheme('mermaid', {
|
|
1041
|
+
base: 'vs',
|
|
1042
|
+
inherit: true,
|
|
1043
|
+
colors: {},
|
|
1044
|
+
rules: [
|
|
1045
|
+
{ token: 'typeKeyword', foreground: '9650c8', fontStyle: 'bold' },
|
|
1046
|
+
{ token: 'keyword', foreground: '649696' },
|
|
1047
|
+
{ token: 'custom-error', foreground: 'ff0000', fontStyle: 'bold' },
|
|
1048
|
+
{ token: 'string', foreground: 'AA8500' },
|
|
1049
|
+
{ token: 'transition', foreground: '008800', fontStyle: 'bold' },
|
|
1050
|
+
{ token: 'delimiter.bracket', foreground: '000000', fontStyle: 'bold' },
|
|
1051
|
+
{ token: 'annotation', foreground: '4b4b96' },
|
|
1052
|
+
{ token: 'number', foreground: '4b4b96' },
|
|
1053
|
+
{ token: 'comment', foreground: '888c89' },
|
|
1054
|
+
{ token: 'variable', foreground: 'A22889' },
|
|
1055
|
+
{ token: 'type', foreground: '2BDEA8' },
|
|
1056
|
+
{ token: 'identifier', foreground: '9cdcfe' },
|
|
1057
|
+
]
|
|
1058
|
+
});
|
|
1059
|
+
// Register a completion item provider for the mermaid language
|
|
1060
|
+
monacoEditor.languages.registerCompletionItemProvider('mermaid', {
|
|
1061
|
+
provideCompletionItems: function (model, position) {
|
|
1062
|
+
var word = model.getWordUntilPosition(position);
|
|
1063
|
+
var range = {
|
|
1064
|
+
startLineNumber: position.lineNumber,
|
|
1065
|
+
endLineNumber: position.lineNumber,
|
|
1066
|
+
startColumn: word.startColumn,
|
|
1067
|
+
endColumn: word.endColumn
|
|
1068
|
+
};
|
|
1069
|
+
var suggestions = __spreadArray(__spreadArray(__spreadArray([
|
|
1070
|
+
{
|
|
1071
|
+
label: 'loop',
|
|
1072
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1073
|
+
insertText: ['loop ${1:Loop text}', '\t$0', 'end'].join('\n'),
|
|
1074
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1075
|
+
documentation: 'Sequence Diagram Loops'
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
label: 'alt',
|
|
1079
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1080
|
+
insertText: [
|
|
1081
|
+
'alt ${1:Describing text}',
|
|
1082
|
+
'\t$0',
|
|
1083
|
+
'else',
|
|
1084
|
+
'\t',
|
|
1085
|
+
'end',
|
|
1086
|
+
].join('\n'),
|
|
1087
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1088
|
+
documentation: 'Alternative Path'
|
|
1089
|
+
},
|
|
1090
|
+
{
|
|
1091
|
+
label: 'opt',
|
|
1092
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1093
|
+
insertText: ['opt ${1:Describing text}', '\t$0', 'end'].join('\n'),
|
|
1094
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1095
|
+
documentation: 'Optional Path'
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
label: 'par',
|
|
1099
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1100
|
+
insertText: [
|
|
1101
|
+
'par ${1:[Action 1]}',
|
|
1102
|
+
'\t$0',
|
|
1103
|
+
'and ${2:[Action 2]}',
|
|
1104
|
+
'\t',
|
|
1105
|
+
'and ${3:[Action 3]}',
|
|
1106
|
+
'\t',
|
|
1107
|
+
'end',
|
|
1108
|
+
].join('\n'),
|
|
1109
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1110
|
+
documentation: 'Parallel Actions'
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
label: 'rect',
|
|
1114
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1115
|
+
insertText: ['rect ${1:rgb(0, 255, 0)}', '\t$0', 'end'].join('\n'),
|
|
1116
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1117
|
+
documentation: 'Background Color'
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
label: 'subgraph',
|
|
1121
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1122
|
+
insertText: ['subgraph ${1:title}', '\t$0', 'end'].join('\n'),
|
|
1123
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1124
|
+
documentation: 'Subgraph'
|
|
1125
|
+
},
|
|
1126
|
+
{
|
|
1127
|
+
label: 'class',
|
|
1128
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1129
|
+
insertText: ['class ${1:className} {', '\t$0', '}'].join('\n'),
|
|
1130
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1131
|
+
documentation: 'Class'
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
label: 'state',
|
|
1135
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1136
|
+
insertText: ['state ${1:stateName} {', '\t$0', '}'].join('\n'),
|
|
1137
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1138
|
+
documentation: 'State'
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
label: 'note',
|
|
1142
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1143
|
+
insertText: ['note ${1:right of State1}', '\t$0', 'end note'].join('\n'),
|
|
1144
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1145
|
+
documentation: 'State'
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
label: 'section',
|
|
1149
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1150
|
+
insertText: ['section ${1:Go to work}', '\t$0'].join('\n'),
|
|
1151
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1152
|
+
documentation: 'User-journey Section'
|
|
1153
|
+
},
|
|
1154
|
+
{
|
|
1155
|
+
label: 'element',
|
|
1156
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1157
|
+
insertText: ['element ${1:test_entity} {', '\t$0', '}'].join('\n'),
|
|
1158
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1159
|
+
documentation: 'Requirement Diagram Element'
|
|
1160
|
+
},
|
|
1161
|
+
{
|
|
1162
|
+
label: 'options',
|
|
1163
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1164
|
+
insertText: ['options', '{', ' $0', '}', 'end'].join('\n'),
|
|
1165
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1166
|
+
documentation: 'Git Graph Options'
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
label: 'mindmap',
|
|
1170
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1171
|
+
insertText: [
|
|
1172
|
+
'mindmap',
|
|
1173
|
+
' root((${1:Central Topic}))',
|
|
1174
|
+
' ${2:Topic 1}',
|
|
1175
|
+
' ${3:Subtopic 1}',
|
|
1176
|
+
' ${4:Subtopic 2}',
|
|
1177
|
+
' ${5:Topic 2}',
|
|
1178
|
+
' $0',
|
|
1179
|
+
].join('\n'),
|
|
1180
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1181
|
+
documentation: 'Mindmap Diagram'
|
|
1182
|
+
},
|
|
1183
|
+
{
|
|
1184
|
+
label: 'timeline',
|
|
1185
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1186
|
+
insertText: [
|
|
1187
|
+
'timeline',
|
|
1188
|
+
' title ${1:History of Events}',
|
|
1189
|
+
' ${2:2023} : ${3:Event 1}',
|
|
1190
|
+
' : ${4:Event 2}',
|
|
1191
|
+
' ${5:2024} : ${6:Event 3}',
|
|
1192
|
+
' $0',
|
|
1193
|
+
].join('\n'),
|
|
1194
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1195
|
+
documentation: 'Timeline Diagram'
|
|
1196
|
+
},
|
|
1197
|
+
{
|
|
1198
|
+
label: 'sankey',
|
|
1199
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1200
|
+
insertText: [
|
|
1201
|
+
'sankey-beta',
|
|
1202
|
+
'',
|
|
1203
|
+
'${1:Source1},${2:Target1},${3:100}',
|
|
1204
|
+
'${4:Source2},${5:Target2},${6:50}',
|
|
1205
|
+
'$0',
|
|
1206
|
+
].join('\n'),
|
|
1207
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1208
|
+
documentation: 'Sankey Diagram'
|
|
1209
|
+
},
|
|
1210
|
+
{
|
|
1211
|
+
label: 'quadrantChart',
|
|
1212
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1213
|
+
insertText: [
|
|
1214
|
+
'quadrantChart',
|
|
1215
|
+
' title ${1:Reach and engagement}',
|
|
1216
|
+
' x-axis ${2:Low Reach} --> ${3:High Reach}',
|
|
1217
|
+
' y-axis ${4:Low Engagement} --> ${5:High Engagement}',
|
|
1218
|
+
' quadrant-1 ${6:We should expand}',
|
|
1219
|
+
' quadrant-2 ${7:Need to promote}',
|
|
1220
|
+
' quadrant-3 ${8:Re-evaluate}',
|
|
1221
|
+
' quadrant-4 ${9:May be improved}',
|
|
1222
|
+
' ${10:Campaign A}: [${11:0.3}, ${12:0.6}]',
|
|
1223
|
+
' ${13:Campaign B}: [${14:0.45}, ${15:0.23}]',
|
|
1224
|
+
' $0',
|
|
1225
|
+
].join('\n'),
|
|
1226
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1227
|
+
documentation: 'Quadrant Chart'
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
label: 'xychart',
|
|
1231
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1232
|
+
insertText: [
|
|
1233
|
+
'xychart-beta',
|
|
1234
|
+
' title "${1:Sales Revenue}"',
|
|
1235
|
+
' x-axis [${2:jan, feb, mar, apr, may}]',
|
|
1236
|
+
' y-axis "${3:Revenue (in $)}" ${4:0} --> ${5:10000}',
|
|
1237
|
+
' bar [${6:5000, 6000, 7500, 8200, 9500}]',
|
|
1238
|
+
' line [${7:5000, 6000, 7500, 8200, 9500}]',
|
|
1239
|
+
' $0',
|
|
1240
|
+
].join('\n'),
|
|
1241
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1242
|
+
documentation: 'XY Chart (Bar/Line)'
|
|
1243
|
+
},
|
|
1244
|
+
{
|
|
1245
|
+
label: 'block',
|
|
1246
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1247
|
+
insertText: [
|
|
1248
|
+
'block-beta',
|
|
1249
|
+
' columns ${1:3}',
|
|
1250
|
+
' ${2:a}["${3:Block A}"]:${4:2}',
|
|
1251
|
+
' ${5:b}["${6:Block B}"]',
|
|
1252
|
+
' ${7:c}["${8:Block C}"]',
|
|
1253
|
+
' $0',
|
|
1254
|
+
].join('\n'),
|
|
1255
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1256
|
+
documentation: 'Block Diagram'
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
label: 'packet',
|
|
1260
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1261
|
+
insertText: [
|
|
1262
|
+
'packet-beta',
|
|
1263
|
+
' 0-15: "${1:Source Port}"',
|
|
1264
|
+
' 16-31: "${2:Destination Port}"',
|
|
1265
|
+
' 32-63: "${3:Sequence Number}"',
|
|
1266
|
+
' $0',
|
|
1267
|
+
].join('\n'),
|
|
1268
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1269
|
+
documentation: 'Packet Diagram'
|
|
1270
|
+
},
|
|
1271
|
+
{
|
|
1272
|
+
label: 'kanban',
|
|
1273
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1274
|
+
insertText: [
|
|
1275
|
+
'kanban',
|
|
1276
|
+
' ${1:todo}[${2:Todo}]',
|
|
1277
|
+
' ${3:task1}[${4:Task 1}]',
|
|
1278
|
+
' ${5:task2}[${6:Task 2}]',
|
|
1279
|
+
' ${7:inProgress}[${8:In Progress}]',
|
|
1280
|
+
' ${9:task3}[${10:Task 3}]',
|
|
1281
|
+
' ${11:done}[${12:Done}]',
|
|
1282
|
+
' $0',
|
|
1283
|
+
].join('\n'),
|
|
1284
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1285
|
+
documentation: 'Kanban Board'
|
|
1286
|
+
},
|
|
1287
|
+
{
|
|
1288
|
+
label: 'architecture',
|
|
1289
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1290
|
+
insertText: [
|
|
1291
|
+
'architecture-beta',
|
|
1292
|
+
' group ${1:api}(cloud)[${2:API}]',
|
|
1293
|
+
'',
|
|
1294
|
+
' service ${3:db}(database)[${4:Database}] in ${1:api}',
|
|
1295
|
+
' service ${5:server}(server)[${6:Server}] in ${1:api}',
|
|
1296
|
+
'',
|
|
1297
|
+
' ${3:db}:R -- L:${5:server}',
|
|
1298
|
+
' $0',
|
|
1299
|
+
].join('\n'),
|
|
1300
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1301
|
+
documentation: 'Architecture Diagram'
|
|
1302
|
+
},
|
|
1303
|
+
{
|
|
1304
|
+
label: 'radar',
|
|
1305
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1306
|
+
insertText: [
|
|
1307
|
+
'radar-beta',
|
|
1308
|
+
' title "${1:Performance Metrics}"',
|
|
1309
|
+
' axis ${2:Speed}, ${3:Quality}, ${4:Cost}, ${5:Reliability}, ${6:Flexibility}',
|
|
1310
|
+
' curve ${7:Product A}{${8:80}, ${9:90}, ${10:70}, ${11:85}, ${12:75}}',
|
|
1311
|
+
' curve ${13:Product B}{${14:70}, ${15:80}, ${16:90}, ${17:75}, ${18:85}}',
|
|
1312
|
+
' $0',
|
|
1313
|
+
].join('\n'),
|
|
1314
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1315
|
+
documentation: 'Radar Chart (Spider/Polar Chart)'
|
|
1316
|
+
},
|
|
1317
|
+
{
|
|
1318
|
+
label: 'treemap',
|
|
1319
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1320
|
+
insertText: [
|
|
1321
|
+
'treemap-beta',
|
|
1322
|
+
' "${1:Root}"',
|
|
1323
|
+
' "${2:Category A}"',
|
|
1324
|
+
' "${3:Item 1}": ${4:100}',
|
|
1325
|
+
' "${5:Item 2}": ${6:80}',
|
|
1326
|
+
' "${7:Category B}"',
|
|
1327
|
+
' "${8:Item 3}": ${9:120}',
|
|
1328
|
+
' "${10:Item 4}": ${11:60}',
|
|
1329
|
+
' $0',
|
|
1330
|
+
].join('\n'),
|
|
1331
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1332
|
+
documentation: 'Treemap Diagram'
|
|
1333
|
+
},
|
|
1334
|
+
{
|
|
1335
|
+
label: 'frontmatter',
|
|
1336
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1337
|
+
insertText: [
|
|
1338
|
+
'---',
|
|
1339
|
+
'config:',
|
|
1340
|
+
' theme: ${1|default,dark,forest,neutral,base|}',
|
|
1341
|
+
' look: ${2|classic,handDrawn|}',
|
|
1342
|
+
'---',
|
|
1343
|
+
'$0',
|
|
1344
|
+
].join('\n'),
|
|
1345
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1346
|
+
documentation: 'YAML Frontmatter Configuration'
|
|
1347
|
+
}
|
|
1348
|
+
], __read(keywords.c4Diagram.blockKeywords.map(function (containerType) { return ({
|
|
1349
|
+
label: containerType,
|
|
1350
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1351
|
+
insertText: [
|
|
1352
|
+
containerType + ' (${1:boundary_id}, "New Boundary") {',
|
|
1353
|
+
' $0',
|
|
1354
|
+
'}',
|
|
1355
|
+
].join('\n'),
|
|
1356
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1357
|
+
documentation: 'C4 Diagram ' + containerType + ' Boundary'
|
|
1358
|
+
}); })), false), __read(requirementDiagrams.map(function (requirementDiagramType) { return ({
|
|
1359
|
+
label: requirementDiagramType,
|
|
1360
|
+
kind: monacoEditor.languages.CompletionItemKind.Snippet,
|
|
1361
|
+
insertText: [
|
|
1362
|
+
requirementDiagramType + ' ${1:test_req} {',
|
|
1363
|
+
'\tid: 1',
|
|
1364
|
+
'\ttext: the test text.',
|
|
1365
|
+
'\trisk: high',
|
|
1366
|
+
'\tverifyMethod: test',
|
|
1367
|
+
'}',
|
|
1368
|
+
].join('\n'),
|
|
1369
|
+
insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
1370
|
+
documentation: requirementDiagramType
|
|
1371
|
+
.split(/(?=[A-Z])/)
|
|
1372
|
+
.map(function (part) { return part[0].toUpperCase() + part.slice(1); })
|
|
1373
|
+
.join(' ')
|
|
1374
|
+
}); })), false), __read(__spreadArray([], __read(new Set(Object.values(keywords)
|
|
1375
|
+
.map(function (diagramKeywords) {
|
|
1376
|
+
return Object.entries(diagramKeywords)
|
|
1377
|
+
.filter(function (keywordType) { return keywordType[0] !== 'annotations'; })
|
|
1378
|
+
.map(function (entry) { return entry[1]; });
|
|
1379
|
+
})
|
|
1380
|
+
.flat(2))), false).map(function (keyword) { return ({
|
|
1381
|
+
label: keyword,
|
|
1382
|
+
kind: monacoEditor.languages.CompletionItemKind.Keyword,
|
|
1383
|
+
insertText: keyword
|
|
1384
|
+
}); })), false);
|
|
1385
|
+
return {
|
|
1386
|
+
suggestions: suggestions.map(function (suggestion) { return (__assign(__assign({}, suggestion), { range: range })); })
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
monacoEditor.languages.setLanguageConfiguration('mermaid', {
|
|
1391
|
+
autoClosingPairs: [
|
|
1392
|
+
{
|
|
1393
|
+
open: '(',
|
|
1394
|
+
close: ')'
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
open: '{',
|
|
1398
|
+
close: '}'
|
|
1399
|
+
},
|
|
1400
|
+
{
|
|
1401
|
+
open: '[',
|
|
1402
|
+
close: ']'
|
|
1403
|
+
},
|
|
1404
|
+
],
|
|
1405
|
+
brackets: [
|
|
1406
|
+
['(', ')'],
|
|
1407
|
+
['{', '}'],
|
|
1408
|
+
['[', ']'],
|
|
1409
|
+
],
|
|
1410
|
+
comments: {
|
|
1411
|
+
lineComment: '%%'
|
|
1412
|
+
}
|
|
1413
|
+
});
|
|
1414
|
+
});
|