@diagrammo/dgmo 0.25.4 → 0.26.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/dist/advanced.cjs +62564 -0
- package/dist/advanced.d.cts +5702 -0
- package/dist/advanced.d.ts +5702 -0
- package/dist/advanced.js +62315 -0
- package/dist/auto.cjs +59851 -0
- package/dist/auto.css +214 -0
- package/dist/auto.d.cts +39 -0
- package/dist/auto.d.ts +39 -0
- package/dist/auto.js +437 -0
- package/dist/auto.mjs +59861 -0
- package/dist/cli.cjs +465 -0
- package/dist/editor.cjs +432 -0
- package/dist/editor.d.cts +26 -0
- package/dist/editor.d.ts +26 -0
- package/dist/editor.js +401 -0
- package/dist/highlight.cjs +720 -0
- package/dist/highlight.d.cts +32 -0
- package/dist/highlight.d.ts +32 -0
- package/dist/highlight.js +690 -0
- package/dist/index.cjs +59037 -0
- package/dist/index.d.cts +375 -0
- package/dist/index.d.ts +375 -0
- package/dist/index.js +59041 -0
- package/dist/internal.cjs +62566 -0
- package/dist/internal.d.cts +5702 -0
- package/dist/internal.d.ts +5702 -0
- package/dist/internal.js +62315 -0
- package/dist/map-data/PROVENANCE.json +1 -0
- package/dist/map-data/gazetteer.json +1 -0
- package/dist/map-data/lakes.json +1 -0
- package/dist/map-data/mountain-ranges.json +1 -0
- package/dist/map-data/na-lakes.json +1 -0
- package/dist/map-data/na-land.json +1 -0
- package/dist/map-data/region-names.json +1 -0
- package/dist/map-data/rivers.json +1 -0
- package/dist/map-data/us-states.json +1 -0
- package/dist/map-data/water-bodies.json +1 -0
- package/dist/map-data/world-coarse.json +1 -0
- package/dist/map-data/world-detail.json +1 -0
- package/dist/pert.cjs +325 -0
- package/dist/pert.d.cts +554 -0
- package/dist/pert.d.ts +554 -0
- package/dist/pert.js +294 -0
- package/package.json +1 -1
- package/src/advanced.ts +2 -0
- package/src/class/parser.ts +0 -1
- package/src/completion-types.ts +0 -1
- package/src/completion.ts +80 -39
- package/src/editor/dgmo.grammar.js +18 -0
- package/src/editor/dgmo.grammar.terms.js +35 -0
- package/src/er/parser.ts +0 -1
- package/src/graph/flowchart-parser.ts +1 -1
- package/src/graph/flowchart-renderer.ts +19 -5
- package/src/graph/state-renderer.ts +19 -5
- package/src/infra/parser.ts +1 -1
- package/src/pert/parser.ts +0 -14
- package/src/raci/renderer.ts +8 -2
package/dist/pert.js
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
// src/pert/internal.ts
|
|
2
|
+
var UNIT_TO_DAYS_LOCAL = {
|
|
3
|
+
min: 1 / (60 * 24),
|
|
4
|
+
h: 1 / 24,
|
|
5
|
+
d: 1,
|
|
6
|
+
bd: 1,
|
|
7
|
+
// PERT has no calendar; bd ≈ d for analytical purposes
|
|
8
|
+
w: 7,
|
|
9
|
+
m: 30,
|
|
10
|
+
q: 90,
|
|
11
|
+
y: 365,
|
|
12
|
+
s: 14
|
|
13
|
+
// sprint (14 calendar days) — not seconds
|
|
14
|
+
};
|
|
15
|
+
function unitToDays(unit) {
|
|
16
|
+
return UNIT_TO_DAYS_LOCAL[unit];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// src/pert/monte-carlo.ts
|
|
20
|
+
function lagDays(lag) {
|
|
21
|
+
return lag === null ? 0 : lag.amount * unitToDays(lag.unit);
|
|
22
|
+
}
|
|
23
|
+
function mulberry32(seed) {
|
|
24
|
+
let s = seed >>> 0;
|
|
25
|
+
return () => {
|
|
26
|
+
s = s + 1831565813 >>> 0;
|
|
27
|
+
let t = s;
|
|
28
|
+
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
29
|
+
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
30
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function standardNormal(rng) {
|
|
34
|
+
let u = 0;
|
|
35
|
+
let v = 0;
|
|
36
|
+
while (u === 0) u = rng();
|
|
37
|
+
while (v === 0) v = rng();
|
|
38
|
+
return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v);
|
|
39
|
+
}
|
|
40
|
+
function gamma(shape, rng) {
|
|
41
|
+
if (shape < 1) {
|
|
42
|
+
const u = rng();
|
|
43
|
+
return gamma(shape + 1, rng) * Math.pow(u, 1 / shape);
|
|
44
|
+
}
|
|
45
|
+
const d = shape - 1 / 3;
|
|
46
|
+
const c = 1 / Math.sqrt(9 * d);
|
|
47
|
+
while (true) {
|
|
48
|
+
let x;
|
|
49
|
+
let v;
|
|
50
|
+
do {
|
|
51
|
+
x = standardNormal(rng);
|
|
52
|
+
v = 1 + c * x;
|
|
53
|
+
} while (v <= 0);
|
|
54
|
+
v = v * v * v;
|
|
55
|
+
const u = rng();
|
|
56
|
+
if (u < 1 - 0.0331 * x * x * x * x) return d * v;
|
|
57
|
+
if (Math.log(u) < x * x / 2 + d * (1 - v + Math.log(v))) return d * v;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function sampleBeta(alpha, beta, rng) {
|
|
61
|
+
const x = gamma(alpha, rng);
|
|
62
|
+
const y = gamma(beta, rng);
|
|
63
|
+
return x / (x + y);
|
|
64
|
+
}
|
|
65
|
+
function sampleBetaPert(o, m, p, rng) {
|
|
66
|
+
if (o === p) return m;
|
|
67
|
+
const range = p - o;
|
|
68
|
+
const alpha = 1 + 4 * (m - o) / range;
|
|
69
|
+
const beta = 1 + 4 * (p - m) / range;
|
|
70
|
+
return o + sampleBeta(alpha, beta, rng) * range;
|
|
71
|
+
}
|
|
72
|
+
function simulate(resolved, expanded, _predecessors, _successors, topo, terminals, poisoned, opts) {
|
|
73
|
+
const rng = mulberry32(opts.seed);
|
|
74
|
+
const expById = /* @__PURE__ */ new Map();
|
|
75
|
+
for (const e of expanded) expById.set(e.id, e);
|
|
76
|
+
const completionTimes = new Array(opts.trials);
|
|
77
|
+
const criticalityCount = /* @__PURE__ */ new Map();
|
|
78
|
+
for (const id of topo) criticalityCount.set(id, 0);
|
|
79
|
+
const pathCount = /* @__PURE__ */ new Map();
|
|
80
|
+
const pathById = /* @__PURE__ */ new Map();
|
|
81
|
+
const incomingEdges = /* @__PURE__ */ new Map();
|
|
82
|
+
for (const id of topo) incomingEdges.set(id, []);
|
|
83
|
+
for (const e of resolved.edges) incomingEdges.get(e.target)?.push(e);
|
|
84
|
+
const es = /* @__PURE__ */ new Map();
|
|
85
|
+
const ef = /* @__PURE__ */ new Map();
|
|
86
|
+
const predOnLongestPath = /* @__PURE__ */ new Map();
|
|
87
|
+
for (let trial = 0; trial < opts.trials; trial++) {
|
|
88
|
+
for (const id of topo) {
|
|
89
|
+
const exp = expById.get(id);
|
|
90
|
+
let duration;
|
|
91
|
+
if (!exp || poisoned.has(id)) {
|
|
92
|
+
duration = 0;
|
|
93
|
+
} else if (exp.o === exp.p) {
|
|
94
|
+
duration = exp.m;
|
|
95
|
+
} else {
|
|
96
|
+
duration = sampleBetaPert(exp.o, exp.m, exp.p, rng);
|
|
97
|
+
}
|
|
98
|
+
let esLower = 0;
|
|
99
|
+
let efLower = -Infinity;
|
|
100
|
+
let bestPred = null;
|
|
101
|
+
let bestPredVal = -Infinity;
|
|
102
|
+
for (const edge of incomingEdges.get(id) ?? []) {
|
|
103
|
+
const aEs = es.get(edge.source) ?? 0;
|
|
104
|
+
const aEf = ef.get(edge.source) ?? 0;
|
|
105
|
+
const lag = lagDays(edge.lag);
|
|
106
|
+
let candES = -Infinity;
|
|
107
|
+
let candEF = -Infinity;
|
|
108
|
+
switch (edge.type) {
|
|
109
|
+
case "FS":
|
|
110
|
+
candES = aEf + lag;
|
|
111
|
+
break;
|
|
112
|
+
case "SS":
|
|
113
|
+
candES = aEs + lag;
|
|
114
|
+
break;
|
|
115
|
+
case "FF":
|
|
116
|
+
candEF = aEf + lag;
|
|
117
|
+
break;
|
|
118
|
+
case "SF":
|
|
119
|
+
candEF = aEs + lag;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
if (candES > esLower) esLower = candES;
|
|
123
|
+
if (candEF > efLower) efLower = candEF;
|
|
124
|
+
const contribution = Math.max(candES, candEF - duration);
|
|
125
|
+
if (contribution > bestPredVal) {
|
|
126
|
+
bestPredVal = contribution;
|
|
127
|
+
bestPred = edge.source;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
let esVal = esLower;
|
|
131
|
+
let efVal = esVal + duration;
|
|
132
|
+
if (efLower > efVal) {
|
|
133
|
+
efVal = efLower;
|
|
134
|
+
esVal = efVal - duration;
|
|
135
|
+
}
|
|
136
|
+
es.set(id, esVal);
|
|
137
|
+
ef.set(id, efVal);
|
|
138
|
+
predOnLongestPath.set(id, bestPred);
|
|
139
|
+
}
|
|
140
|
+
let endEf = 0;
|
|
141
|
+
let endId = terminals[0] ?? null;
|
|
142
|
+
for (const id of topo) {
|
|
143
|
+
const e = ef.get(id) ?? 0;
|
|
144
|
+
if (e > endEf) {
|
|
145
|
+
endEf = e;
|
|
146
|
+
endId = id;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
completionTimes[trial] = endEf;
|
|
150
|
+
if (endId !== null) {
|
|
151
|
+
const path = [];
|
|
152
|
+
let cur = endId;
|
|
153
|
+
while (cur !== null) {
|
|
154
|
+
path.unshift(cur);
|
|
155
|
+
criticalityCount.set(cur, (criticalityCount.get(cur) ?? 0) + 1);
|
|
156
|
+
cur = predOnLongestPath.get(cur) ?? null;
|
|
157
|
+
}
|
|
158
|
+
const key = path.join("\0");
|
|
159
|
+
pathCount.set(key, (pathCount.get(key) ?? 0) + 1);
|
|
160
|
+
if (!pathById.has(key)) pathById.set(key, path);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
completionTimes.sort((a, b) => a - b);
|
|
164
|
+
const pct = (frac) => {
|
|
165
|
+
const idx = Math.min(
|
|
166
|
+
completionTimes.length - 1,
|
|
167
|
+
Math.max(0, Math.floor(frac * completionTimes.length))
|
|
168
|
+
);
|
|
169
|
+
return completionTimes[idx] ?? 0;
|
|
170
|
+
};
|
|
171
|
+
const minDurationDays = completionTimes[0] ?? 0;
|
|
172
|
+
const maxDurationDays = completionTimes[completionTimes.length - 1] ?? 0;
|
|
173
|
+
let modalKey = "";
|
|
174
|
+
let modalCount = -1;
|
|
175
|
+
for (const [key, count] of pathCount) {
|
|
176
|
+
if (count > modalCount) {
|
|
177
|
+
modalCount = count;
|
|
178
|
+
modalKey = key;
|
|
179
|
+
} else if (count === modalCount) {
|
|
180
|
+
const a = pathById.get(modalKey) ?? [];
|
|
181
|
+
const b = pathById.get(key) ?? [];
|
|
182
|
+
const va = pathVariance(a, expById);
|
|
183
|
+
const vb = pathVariance(b, expById);
|
|
184
|
+
if (vb > va) {
|
|
185
|
+
modalKey = key;
|
|
186
|
+
} else if (vb === va && key.localeCompare(modalKey) < 0) {
|
|
187
|
+
modalKey = key;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const criticalityByActivity = {};
|
|
192
|
+
for (const id of topo) {
|
|
193
|
+
criticalityByActivity[id] = (criticalityCount.get(id) ?? 0) / opts.trials;
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
trials: opts.trials,
|
|
197
|
+
seed: opts.seed,
|
|
198
|
+
p50: pct(0.5),
|
|
199
|
+
p80: pct(0.8),
|
|
200
|
+
p95: pct(0.95),
|
|
201
|
+
p16: pct(0.16),
|
|
202
|
+
p84: pct(0.84),
|
|
203
|
+
criticalityByActivity,
|
|
204
|
+
modalCriticalPath: pathById.get(modalKey) ?? [],
|
|
205
|
+
// Analyzer populates this after MC returns by running the
|
|
206
|
+
// deterministic per-activity tornado pass. Empty here so the
|
|
207
|
+
// type contract is satisfied even in scrubber/fast paths that
|
|
208
|
+
// never compute swings.
|
|
209
|
+
tornadoSwings: [],
|
|
210
|
+
minDurationDays,
|
|
211
|
+
maxDurationDays
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function pathVariance(path, expById) {
|
|
215
|
+
let sum = 0;
|
|
216
|
+
for (const id of path) {
|
|
217
|
+
const e = expById.get(id);
|
|
218
|
+
if (!e) continue;
|
|
219
|
+
const sigma = (e.p - e.o) / 6;
|
|
220
|
+
sum += sigma * sigma;
|
|
221
|
+
}
|
|
222
|
+
return sum;
|
|
223
|
+
}
|
|
224
|
+
function buildSimulationContext(resolved) {
|
|
225
|
+
const predecessors = /* @__PURE__ */ new Map();
|
|
226
|
+
const successors = /* @__PURE__ */ new Map();
|
|
227
|
+
for (const r of resolved.activities) {
|
|
228
|
+
predecessors.set(r.activity.id, []);
|
|
229
|
+
successors.set(r.activity.id, []);
|
|
230
|
+
}
|
|
231
|
+
for (const e of resolved.edges) {
|
|
232
|
+
successors.get(e.source)?.push(e.target);
|
|
233
|
+
predecessors.get(e.target)?.push(e.source);
|
|
234
|
+
}
|
|
235
|
+
const inDegree = /* @__PURE__ */ new Map();
|
|
236
|
+
for (const r of resolved.activities) {
|
|
237
|
+
inDegree.set(r.activity.id, predecessors.get(r.activity.id).length);
|
|
238
|
+
}
|
|
239
|
+
const queue = [];
|
|
240
|
+
for (const [id, deg] of inDegree) if (deg === 0) queue.push(id);
|
|
241
|
+
const topo = [];
|
|
242
|
+
while (queue.length > 0) {
|
|
243
|
+
const id = queue.shift();
|
|
244
|
+
topo.push(id);
|
|
245
|
+
for (const next of successors.get(id) ?? []) {
|
|
246
|
+
const deg = (inDegree.get(next) ?? 0) - 1;
|
|
247
|
+
inDegree.set(next, deg);
|
|
248
|
+
if (deg === 0) queue.push(next);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
const terminals = [];
|
|
252
|
+
for (const r of resolved.activities) {
|
|
253
|
+
if ((successors.get(r.activity.id) ?? []).length === 0) {
|
|
254
|
+
terminals.push(r.activity.id);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
const poisoned = /* @__PURE__ */ new Set();
|
|
258
|
+
for (const r of resolved.activities) {
|
|
259
|
+
if (r.activity.duration === null) {
|
|
260
|
+
const stack = [r.activity.id];
|
|
261
|
+
while (stack.length > 0) {
|
|
262
|
+
const id = stack.pop();
|
|
263
|
+
if (poisoned.has(id)) continue;
|
|
264
|
+
poisoned.add(id);
|
|
265
|
+
for (const next of successors.get(id) ?? []) stack.push(next);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return { predecessors, successors, topo, terminals, poisoned };
|
|
270
|
+
}
|
|
271
|
+
function simulateCanonical(resolved, expanded, opts) {
|
|
272
|
+
const ctx = buildSimulationContext(resolved);
|
|
273
|
+
return simulate(
|
|
274
|
+
resolved,
|
|
275
|
+
expanded,
|
|
276
|
+
ctx.predecessors,
|
|
277
|
+
ctx.successors,
|
|
278
|
+
ctx.topo,
|
|
279
|
+
ctx.terminals,
|
|
280
|
+
ctx.poisoned,
|
|
281
|
+
{ trials: opts.trials, seed: opts.seed }
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
function simulateFast(resolved, expanded, opts) {
|
|
285
|
+
return simulateCanonical(resolved, expanded, opts);
|
|
286
|
+
}
|
|
287
|
+
export {
|
|
288
|
+
buildSimulationContext,
|
|
289
|
+
mulberry32,
|
|
290
|
+
sampleBetaPert,
|
|
291
|
+
simulateCanonical,
|
|
292
|
+
simulateFast
|
|
293
|
+
};
|
|
294
|
+
//# sourceMappingURL=pert.js.map
|
package/package.json
CHANGED
package/src/advanced.ts
CHANGED
package/src/class/parser.ts
CHANGED
package/src/completion-types.ts
CHANGED
|
@@ -15,7 +15,6 @@ export type ChartType = string;
|
|
|
15
15
|
export interface DiagramSymbols {
|
|
16
16
|
kind: ChartType;
|
|
17
17
|
entities: string[]; // table names, node IDs, class names, etc.
|
|
18
|
-
keywords: string[]; // diagram-specific reserved words
|
|
19
18
|
/**
|
|
20
19
|
* Map of alias-literal → canonical entity name, collected from
|
|
21
20
|
* `Name as <alias>` declarations in the document. Editor surfaces
|
package/src/completion.ts
CHANGED
|
@@ -648,6 +648,69 @@ export const ENTITY_TYPES = new Map<string, string[]>([
|
|
|
648
648
|
],
|
|
649
649
|
]);
|
|
650
650
|
|
|
651
|
+
// ============================================================
|
|
652
|
+
// Structural keywords for line-leading completion
|
|
653
|
+
// ============================================================
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Chart-type-specific structural keywords offered on an empty/start-of-line in
|
|
657
|
+
* the data zone (block openers like `loop`, section headers like `containers`,
|
|
658
|
+
* the `tag` block declaration, etc.). This is the single source of truth for
|
|
659
|
+
* the editor's structural-keyword popup — every entry MUST be a token the
|
|
660
|
+
* corresponding parser actually recognizes (validated by the
|
|
661
|
+
* completion-conformance suite). Do NOT add removed/diagnostic-only tokens
|
|
662
|
+
* (e.g. cycle's `no-descriptions`) or tokens the parser ignores.
|
|
663
|
+
*
|
|
664
|
+
* Chart types not listed here have no structural keywords (most data charts).
|
|
665
|
+
*/
|
|
666
|
+
export const STRUCTURAL_KEYWORDS = new Map<string, string[]>([
|
|
667
|
+
['sequence', ['if', 'else', 'loop', 'parallel', 'note', 'tag']],
|
|
668
|
+
['gantt', ['era', 'marker', 'holiday', 'workweek', 'parallel', 'tag']],
|
|
669
|
+
['c4', ['containers', 'components', 'deployment', 'tag']],
|
|
670
|
+
['timeline', ['era', 'marker', 'tag']],
|
|
671
|
+
['org', ['tag']],
|
|
672
|
+
['kanban', ['tag']],
|
|
673
|
+
['sitemap', ['tag']],
|
|
674
|
+
['infra', ['tag']],
|
|
675
|
+
['pert', ['tag']],
|
|
676
|
+
['mindmap', ['tag']],
|
|
677
|
+
['boxes-and-lines', ['tag']],
|
|
678
|
+
['er', ['tag']],
|
|
679
|
+
['cycle', ['direction-counterclockwise', 'circle-nodes']],
|
|
680
|
+
['journey-map', ['persona', 'tag']],
|
|
681
|
+
['raci', ['roles']],
|
|
682
|
+
['tech-radar', ['rings']],
|
|
683
|
+
[
|
|
684
|
+
'wireframe',
|
|
685
|
+
[
|
|
686
|
+
'nav',
|
|
687
|
+
'tabs',
|
|
688
|
+
'table',
|
|
689
|
+
'image',
|
|
690
|
+
'modal',
|
|
691
|
+
'skeleton',
|
|
692
|
+
'alert',
|
|
693
|
+
'progress',
|
|
694
|
+
'chart',
|
|
695
|
+
'mobile',
|
|
696
|
+
'tag',
|
|
697
|
+
],
|
|
698
|
+
],
|
|
699
|
+
['class', ['abstract', 'interface', 'enum', 'extends', 'implements']],
|
|
700
|
+
]);
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Chart types that support `tag` block declarations (and thus the
|
|
704
|
+
* `alias`/`default` sub-keywords inside a tag block). Derived from
|
|
705
|
+
* STRUCTURAL_KEYWORDS so the two can never drift — a chart supports tag blocks
|
|
706
|
+
* iff it offers the `tag` keyword.
|
|
707
|
+
*/
|
|
708
|
+
export const TAG_SUPPORTING_TYPES: ReadonlySet<string> = new Set(
|
|
709
|
+
[...STRUCTURAL_KEYWORDS]
|
|
710
|
+
.filter(([, kws]) => kws.includes('tag'))
|
|
711
|
+
.map(([type]) => type)
|
|
712
|
+
);
|
|
713
|
+
|
|
651
714
|
// ============================================================
|
|
652
715
|
// Pipe metadata for inline `| key value` on data lines
|
|
653
716
|
// ============================================================
|
|
@@ -992,7 +1055,6 @@ function extractSequenceSymbols(docText: string): DiagramSymbols {
|
|
|
992
1055
|
return {
|
|
993
1056
|
kind: 'sequence',
|
|
994
1057
|
entities,
|
|
995
|
-
keywords: ['if', 'else', 'loop', 'parallel', 'note'],
|
|
996
1058
|
};
|
|
997
1059
|
}
|
|
998
1060
|
|
|
@@ -1031,7 +1093,7 @@ function extractStateSymbols(docText: string): DiagramSymbols {
|
|
|
1031
1093
|
}
|
|
1032
1094
|
}
|
|
1033
1095
|
|
|
1034
|
-
return { kind: 'state', entities
|
|
1096
|
+
return { kind: 'state', entities };
|
|
1035
1097
|
}
|
|
1036
1098
|
|
|
1037
1099
|
// ============================================================
|
|
@@ -1247,7 +1309,7 @@ function extractSitemapSymbols(docText: string): DiagramSymbols {
|
|
|
1247
1309
|
}
|
|
1248
1310
|
}
|
|
1249
1311
|
|
|
1250
|
-
return { kind: 'sitemap', entities
|
|
1312
|
+
return { kind: 'sitemap', entities };
|
|
1251
1313
|
}
|
|
1252
1314
|
|
|
1253
1315
|
// ============================================================
|
|
@@ -1326,7 +1388,6 @@ function extractC4Symbols(docText: string): DiagramSymbols {
|
|
|
1326
1388
|
return {
|
|
1327
1389
|
kind: 'c4',
|
|
1328
1390
|
entities,
|
|
1329
|
-
keywords: ['containers', 'components', 'deployment'],
|
|
1330
1391
|
};
|
|
1331
1392
|
}
|
|
1332
1393
|
|
|
@@ -1429,7 +1490,7 @@ function extractGanttSymbols(docText: string): DiagramSymbols {
|
|
|
1429
1490
|
}
|
|
1430
1491
|
}
|
|
1431
1492
|
|
|
1432
|
-
return { kind: 'gantt', entities
|
|
1493
|
+
return { kind: 'gantt', entities };
|
|
1433
1494
|
}
|
|
1434
1495
|
|
|
1435
1496
|
// ============================================================
|
|
@@ -1487,7 +1548,7 @@ function extractBoxesAndLinesSymbols(docText: string): DiagramSymbols {
|
|
|
1487
1548
|
if (label && !entities.includes(label)) entities.push(label);
|
|
1488
1549
|
}
|
|
1489
1550
|
|
|
1490
|
-
return { kind: 'boxes-and-lines', entities
|
|
1551
|
+
return { kind: 'boxes-and-lines', entities };
|
|
1491
1552
|
}
|
|
1492
1553
|
|
|
1493
1554
|
// ============================================================
|
|
@@ -1540,7 +1601,7 @@ function extractOrgSymbols(docText: string): DiagramSymbols {
|
|
|
1540
1601
|
if (label && !entities.includes(label)) entities.push(label);
|
|
1541
1602
|
}
|
|
1542
1603
|
|
|
1543
|
-
return { kind: 'org', entities
|
|
1604
|
+
return { kind: 'org', entities };
|
|
1544
1605
|
}
|
|
1545
1606
|
|
|
1546
1607
|
// ============================================================
|
|
@@ -1592,7 +1653,7 @@ function extractKanbanSymbols(docText: string): DiagramSymbols {
|
|
|
1592
1653
|
}
|
|
1593
1654
|
}
|
|
1594
1655
|
|
|
1595
|
-
return { kind: 'kanban', entities
|
|
1656
|
+
return { kind: 'kanban', entities };
|
|
1596
1657
|
}
|
|
1597
1658
|
|
|
1598
1659
|
// ============================================================
|
|
@@ -1635,7 +1696,7 @@ function extractMindmapSymbols(docText: string): DiagramSymbols {
|
|
|
1635
1696
|
if (label && !entities.includes(label)) entities.push(label);
|
|
1636
1697
|
}
|
|
1637
1698
|
|
|
1638
|
-
return { kind: 'mindmap', entities
|
|
1699
|
+
return { kind: 'mindmap', entities };
|
|
1639
1700
|
}
|
|
1640
1701
|
|
|
1641
1702
|
// ============================================================
|
|
@@ -1668,7 +1729,7 @@ function extractPyramidSymbols(docText: string): DiagramSymbols {
|
|
|
1668
1729
|
if (label && !entities.includes(label)) entities.push(label);
|
|
1669
1730
|
}
|
|
1670
1731
|
|
|
1671
|
-
return { kind: 'pyramid', entities
|
|
1732
|
+
return { kind: 'pyramid', entities };
|
|
1672
1733
|
}
|
|
1673
1734
|
|
|
1674
1735
|
// ============================================================
|
|
@@ -1701,7 +1762,7 @@ function extractRingSymbols(docText: string): DiagramSymbols {
|
|
|
1701
1762
|
if (label && !entities.includes(label)) entities.push(label);
|
|
1702
1763
|
}
|
|
1703
1764
|
|
|
1704
|
-
return { kind: 'ring', entities
|
|
1765
|
+
return { kind: 'ring', entities };
|
|
1705
1766
|
}
|
|
1706
1767
|
|
|
1707
1768
|
// ============================================================
|
|
@@ -1736,7 +1797,7 @@ function extractArcSymbols(docText: string): DiagramSymbols {
|
|
|
1736
1797
|
}
|
|
1737
1798
|
}
|
|
1738
1799
|
|
|
1739
|
-
return { kind: 'arc', entities
|
|
1800
|
+
return { kind: 'arc', entities };
|
|
1740
1801
|
}
|
|
1741
1802
|
|
|
1742
1803
|
// ============================================================
|
|
@@ -1775,7 +1836,7 @@ function extractSankeySymbols(docText: string): DiagramSymbols {
|
|
|
1775
1836
|
}
|
|
1776
1837
|
}
|
|
1777
1838
|
|
|
1778
|
-
return { kind: 'sankey', entities
|
|
1839
|
+
return { kind: 'sankey', entities };
|
|
1779
1840
|
}
|
|
1780
1841
|
|
|
1781
1842
|
// ============================================================
|
|
@@ -1835,7 +1896,7 @@ function extractTimelineSymbols(docText: string): DiagramSymbols {
|
|
|
1835
1896
|
if (label && !entities.includes(label)) entities.push(label);
|
|
1836
1897
|
}
|
|
1837
1898
|
|
|
1838
|
-
return { kind: 'timeline', entities
|
|
1899
|
+
return { kind: 'timeline', entities };
|
|
1839
1900
|
}
|
|
1840
1901
|
|
|
1841
1902
|
// ============================================================
|
|
@@ -1867,7 +1928,7 @@ function extractVennSymbols(docText: string): DiagramSymbols {
|
|
|
1867
1928
|
if (label && !entities.includes(label)) entities.push(label);
|
|
1868
1929
|
}
|
|
1869
1930
|
|
|
1870
|
-
return { kind: 'venn', entities
|
|
1931
|
+
return { kind: 'venn', entities };
|
|
1871
1932
|
}
|
|
1872
1933
|
|
|
1873
1934
|
// ============================================================
|
|
@@ -1901,7 +1962,7 @@ function extractQuadrantSymbols(docText: string): DiagramSymbols {
|
|
|
1901
1962
|
if (label && !entities.includes(label)) entities.push(label);
|
|
1902
1963
|
}
|
|
1903
1964
|
|
|
1904
|
-
return { kind: 'quadrant', entities
|
|
1965
|
+
return { kind: 'quadrant', entities };
|
|
1905
1966
|
}
|
|
1906
1967
|
|
|
1907
1968
|
// ============================================================
|
|
@@ -1936,7 +1997,7 @@ function extractSlopeSymbols(docText: string): DiagramSymbols {
|
|
|
1936
1997
|
if (label && !entities.includes(label)) entities.push(label);
|
|
1937
1998
|
}
|
|
1938
1999
|
|
|
1939
|
-
return { kind: 'slope', entities
|
|
2000
|
+
return { kind: 'slope', entities };
|
|
1940
2001
|
}
|
|
1941
2002
|
|
|
1942
2003
|
// ============================================================
|
|
@@ -1983,7 +2044,7 @@ function extractDataChartSymbols(docText: string): DiagramSymbols {
|
|
|
1983
2044
|
}
|
|
1984
2045
|
}
|
|
1985
2046
|
|
|
1986
|
-
return { kind: chartType, entities
|
|
2047
|
+
return { kind: chartType, entities };
|
|
1987
2048
|
}
|
|
1988
2049
|
|
|
1989
2050
|
// ============================================================
|
|
@@ -2034,23 +2095,6 @@ registerExtractor('chord', extractDataChartSymbols);
|
|
|
2034
2095
|
|
|
2035
2096
|
function extractTechRadarSymbols(docText: string): DiagramSymbols {
|
|
2036
2097
|
const entities: string[] = [];
|
|
2037
|
-
const keywords: string[] = [
|
|
2038
|
-
'rings',
|
|
2039
|
-
'quadrant',
|
|
2040
|
-
'ring',
|
|
2041
|
-
'trend',
|
|
2042
|
-
'new',
|
|
2043
|
-
'up',
|
|
2044
|
-
'down',
|
|
2045
|
-
'stable',
|
|
2046
|
-
'top-left',
|
|
2047
|
-
'top-right',
|
|
2048
|
-
'bottom-left',
|
|
2049
|
-
'bottom-right',
|
|
2050
|
-
'alias',
|
|
2051
|
-
'aka',
|
|
2052
|
-
'color',
|
|
2053
|
-
];
|
|
2054
2098
|
|
|
2055
2099
|
// Extract ring names and aliases from the rings block
|
|
2056
2100
|
const lines = docText.split('\n');
|
|
@@ -2078,7 +2122,7 @@ function extractTechRadarSymbols(docText: string): DiagramSymbols {
|
|
|
2078
2122
|
}
|
|
2079
2123
|
}
|
|
2080
2124
|
|
|
2081
|
-
return { kind: 'tech-radar', entities
|
|
2125
|
+
return { kind: 'tech-radar', entities };
|
|
2082
2126
|
}
|
|
2083
2127
|
|
|
2084
2128
|
// ============================================================
|
|
@@ -2121,7 +2165,6 @@ function extractCycleSymbols(docText: string): DiagramSymbols {
|
|
|
2121
2165
|
return {
|
|
2122
2166
|
kind: 'cycle',
|
|
2123
2167
|
entities,
|
|
2124
|
-
keywords: ['direction-counterclockwise', 'circle-nodes'],
|
|
2125
2168
|
};
|
|
2126
2169
|
}
|
|
2127
2170
|
|
|
@@ -2218,7 +2261,6 @@ function extractRaciSymbols(docText: string): DiagramSymbols {
|
|
|
2218
2261
|
return {
|
|
2219
2262
|
kind: chartType,
|
|
2220
2263
|
entities,
|
|
2221
|
-
keywords: ['variant', 'roles'],
|
|
2222
2264
|
};
|
|
2223
2265
|
}
|
|
2224
2266
|
|
|
@@ -2271,6 +2313,5 @@ function extractJourneyMapSymbols(docText: string): DiagramSymbols {
|
|
|
2271
2313
|
return {
|
|
2272
2314
|
kind: 'journey-map',
|
|
2273
2315
|
entities,
|
|
2274
|
-
keywords: ['persona', 'pain', 'opportunity', 'thought', 'description'],
|
|
2275
2316
|
};
|
|
2276
2317
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
+
import {LRParser} from "@lezer/lr"
|
|
3
|
+
import {specializeKeyword} from "./tokens"
|
|
4
|
+
export const parser = LRParser.deserialize({
|
|
5
|
+
version: 14,
|
|
6
|
+
states: "!WQVQPOOOOQO'#DU'#DUOOQO'#DP'#DPO%]QPO'#CdOOQO'#DO'#DOQVQPOOOOQO-E6}-E6}OOQO,59O,59OOOQO-E6|-E6|",
|
|
7
|
+
stateData: "&Q~OvOS~OPPOQPORPOSPOTPOVSOXPOYPOZPO[PO]PO^PO_PO`POaPObPOcPOdPOePOfPOgPOhPOiPOjPOkPOlPOmPOnPOoPOpPOqPOwSO~OPPOQPORPOSPOTPOXPOYPOZPO[PO]PO^PO_PO`POaPObPOcPOdPOePOfPOgPOhPOiPOjPOkPOlPOmPOnPOoPOpPOqPO~OwVO~P#]OVXYZ[]^_`ghijklmnabcdefopqk~",
|
|
8
|
+
goto: "!byPPPPPPPPzPPPPPPPPPPPPPPPPPPPPPPPPP!O!UPPPP!]TSOTQTORWTSROTRURVQORT",
|
|
9
|
+
nodeNames: "⚠ ChartType TagKeyword DirectiveKeyword ControlKeyword ModifierKeyword Document Comment ContentLine SyncArrow AsyncArrow Duration DateLiteral Percentage Number SectionMarker Url OpenBracket CloseBracket OpenParen CloseParen OpenAngle CloseAngle Pipe Colon Comma Plus Dash Tilde Star Question QuotedString Identifier Punct",
|
|
10
|
+
maxTerm: 40,
|
|
11
|
+
skippedNodes: [0],
|
|
12
|
+
repeatNodeCount: 2,
|
|
13
|
+
tokenData: "<v~RzOX#uXY#zYZ$VZp#upq#zqr#urs$[st#uux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!Q1|!Q![1|![!]9X!_!`1|!a!b1|!b!c1|!c!}1|#R#S1|#T#o1|~<aOg~q~~<hPl~q~!`!a<k~<pOY~~<sP;=`<%l#u",
|
|
14
|
+
tokenizers: [0],
|
|
15
|
+
topRules: {"Document":[0,6]},
|
|
16
|
+
specialized: [{term: 32, get: (value, stack) => (specializeKeyword(value, stack) << 1), external: specializeKeyword}],
|
|
17
|
+
tokenPrec: 204
|
|
18
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
+
export const
|
|
3
|
+
ChartType = 1,
|
|
4
|
+
TagKeyword = 2,
|
|
5
|
+
DirectiveKeyword = 3,
|
|
6
|
+
ControlKeyword = 4,
|
|
7
|
+
ModifierKeyword = 5,
|
|
8
|
+
Document = 6,
|
|
9
|
+
Comment = 7,
|
|
10
|
+
ContentLine = 8,
|
|
11
|
+
SyncArrow = 9,
|
|
12
|
+
AsyncArrow = 10,
|
|
13
|
+
Duration = 11,
|
|
14
|
+
DateLiteral = 12,
|
|
15
|
+
Percentage = 13,
|
|
16
|
+
Number = 14,
|
|
17
|
+
SectionMarker = 15,
|
|
18
|
+
Url = 16,
|
|
19
|
+
OpenBracket = 17,
|
|
20
|
+
CloseBracket = 18,
|
|
21
|
+
OpenParen = 19,
|
|
22
|
+
CloseParen = 20,
|
|
23
|
+
OpenAngle = 21,
|
|
24
|
+
CloseAngle = 22,
|
|
25
|
+
Pipe = 23,
|
|
26
|
+
Colon = 24,
|
|
27
|
+
Comma = 25,
|
|
28
|
+
Plus = 26,
|
|
29
|
+
Dash = 27,
|
|
30
|
+
Tilde = 28,
|
|
31
|
+
Star = 29,
|
|
32
|
+
Question = 30,
|
|
33
|
+
QuotedString = 31,
|
|
34
|
+
Identifier = 32,
|
|
35
|
+
Punct = 33
|
package/src/er/parser.ts
CHANGED
|
@@ -647,5 +647,5 @@ export function extractSymbols(docText: string): DiagramSymbols {
|
|
|
647
647
|
const m = NODE_ID_RE.exec(line);
|
|
648
648
|
if (m && !entities.includes(m[1]!)) entities.push(m[1]!);
|
|
649
649
|
}
|
|
650
|
-
return { kind: 'flowchart', entities
|
|
650
|
+
return { kind: 'flowchart', entities };
|
|
651
651
|
}
|