@diagrammo/dgmo 0.2.28 → 0.3.1
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/.claude/skills/dgmo-chart/SKILL.md +6 -0
- package/README.md +5 -0
- package/dist/cli.cjs +361 -921
- package/dist/index.cjs +184 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +184 -107
- package/dist/index.js.map +1 -1
- package/docs/language-reference.md +51 -14
- package/package.json +6 -6
- package/src/chart.ts +12 -6
- package/src/class/layout.ts +17 -12
- package/src/class/parser.ts +20 -42
- package/src/class/renderer.ts +44 -46
- package/src/d3.ts +23 -6
- package/src/echarts.ts +25 -7
- package/src/sequence/parser.ts +16 -3
- package/src/sequence/renderer.ts +22 -0
- package/src/utils/parsing.ts +31 -0
package/dist/index.cjs
CHANGED
|
@@ -1275,6 +1275,67 @@ var init_palettes = __esm({
|
|
|
1275
1275
|
}
|
|
1276
1276
|
});
|
|
1277
1277
|
|
|
1278
|
+
// src/utils/parsing.ts
|
|
1279
|
+
function measureIndent(line7) {
|
|
1280
|
+
let indent = 0;
|
|
1281
|
+
for (const ch of line7) {
|
|
1282
|
+
if (ch === " ") indent++;
|
|
1283
|
+
else if (ch === " ") indent += 4;
|
|
1284
|
+
else break;
|
|
1285
|
+
}
|
|
1286
|
+
return indent;
|
|
1287
|
+
}
|
|
1288
|
+
function extractColor(label, palette) {
|
|
1289
|
+
const m = label.match(COLOR_SUFFIX_RE);
|
|
1290
|
+
if (!m) return { label };
|
|
1291
|
+
const colorName = m[1].trim();
|
|
1292
|
+
return {
|
|
1293
|
+
label: label.substring(0, m.index).trim(),
|
|
1294
|
+
color: resolveColor(colorName, palette)
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
function collectIndentedValues(lines, startIndex) {
|
|
1298
|
+
const values = [];
|
|
1299
|
+
let j = startIndex + 1;
|
|
1300
|
+
for (; j < lines.length; j++) {
|
|
1301
|
+
const raw = lines[j];
|
|
1302
|
+
const trimmed = raw.trim();
|
|
1303
|
+
if (!trimmed) continue;
|
|
1304
|
+
if (trimmed.startsWith("//")) continue;
|
|
1305
|
+
if (raw[0] !== " " && raw[0] !== " ") break;
|
|
1306
|
+
values.push(trimmed.replace(/,\s*$/, ""));
|
|
1307
|
+
}
|
|
1308
|
+
return { values, newIndex: j - 1 };
|
|
1309
|
+
}
|
|
1310
|
+
function parsePipeMetadata(segments, aliasMap = /* @__PURE__ */ new Map()) {
|
|
1311
|
+
const metadata = {};
|
|
1312
|
+
for (let j = 1; j < segments.length; j++) {
|
|
1313
|
+
for (const part of segments[j].split(",")) {
|
|
1314
|
+
const trimmedPart = part.trim();
|
|
1315
|
+
if (!trimmedPart) continue;
|
|
1316
|
+
const colonIdx = trimmedPart.indexOf(":");
|
|
1317
|
+
if (colonIdx > 0) {
|
|
1318
|
+
const rawKey = trimmedPart.substring(0, colonIdx).trim().toLowerCase();
|
|
1319
|
+
const key = aliasMap.get(rawKey) ?? rawKey;
|
|
1320
|
+
const value = trimmedPart.substring(colonIdx + 1).trim();
|
|
1321
|
+
metadata[key] = value;
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
return metadata;
|
|
1326
|
+
}
|
|
1327
|
+
var COLOR_SUFFIX_RE, CHART_TYPE_RE, TITLE_RE, OPTION_RE;
|
|
1328
|
+
var init_parsing = __esm({
|
|
1329
|
+
"src/utils/parsing.ts"() {
|
|
1330
|
+
"use strict";
|
|
1331
|
+
init_colors();
|
|
1332
|
+
COLOR_SUFFIX_RE = /\(([^)]+)\)\s*$/;
|
|
1333
|
+
CHART_TYPE_RE = /^chart\s*:\s*(.+)/i;
|
|
1334
|
+
TITLE_RE = /^title\s*:\s*(.+)/i;
|
|
1335
|
+
OPTION_RE = /^([a-z][a-z0-9-]*)\s*:\s*(.+)$/i;
|
|
1336
|
+
}
|
|
1337
|
+
});
|
|
1338
|
+
|
|
1278
1339
|
// src/sequence/participant-inference.ts
|
|
1279
1340
|
function inferParticipantType(name) {
|
|
1280
1341
|
for (const rule of PARTICIPANT_RULES) {
|
|
@@ -1591,54 +1652,6 @@ var init_arrows = __esm({
|
|
|
1591
1652
|
}
|
|
1592
1653
|
});
|
|
1593
1654
|
|
|
1594
|
-
// src/utils/parsing.ts
|
|
1595
|
-
function measureIndent(line7) {
|
|
1596
|
-
let indent = 0;
|
|
1597
|
-
for (const ch of line7) {
|
|
1598
|
-
if (ch === " ") indent++;
|
|
1599
|
-
else if (ch === " ") indent += 4;
|
|
1600
|
-
else break;
|
|
1601
|
-
}
|
|
1602
|
-
return indent;
|
|
1603
|
-
}
|
|
1604
|
-
function extractColor(label, palette) {
|
|
1605
|
-
const m = label.match(COLOR_SUFFIX_RE);
|
|
1606
|
-
if (!m) return { label };
|
|
1607
|
-
const colorName = m[1].trim();
|
|
1608
|
-
return {
|
|
1609
|
-
label: label.substring(0, m.index).trim(),
|
|
1610
|
-
color: resolveColor(colorName, palette)
|
|
1611
|
-
};
|
|
1612
|
-
}
|
|
1613
|
-
function parsePipeMetadata(segments, aliasMap = /* @__PURE__ */ new Map()) {
|
|
1614
|
-
const metadata = {};
|
|
1615
|
-
for (let j = 1; j < segments.length; j++) {
|
|
1616
|
-
for (const part of segments[j].split(",")) {
|
|
1617
|
-
const trimmedPart = part.trim();
|
|
1618
|
-
if (!trimmedPart) continue;
|
|
1619
|
-
const colonIdx = trimmedPart.indexOf(":");
|
|
1620
|
-
if (colonIdx > 0) {
|
|
1621
|
-
const rawKey = trimmedPart.substring(0, colonIdx).trim().toLowerCase();
|
|
1622
|
-
const key = aliasMap.get(rawKey) ?? rawKey;
|
|
1623
|
-
const value = trimmedPart.substring(colonIdx + 1).trim();
|
|
1624
|
-
metadata[key] = value;
|
|
1625
|
-
}
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
1628
|
-
return metadata;
|
|
1629
|
-
}
|
|
1630
|
-
var COLOR_SUFFIX_RE, CHART_TYPE_RE, TITLE_RE, OPTION_RE;
|
|
1631
|
-
var init_parsing = __esm({
|
|
1632
|
-
"src/utils/parsing.ts"() {
|
|
1633
|
-
"use strict";
|
|
1634
|
-
init_colors();
|
|
1635
|
-
COLOR_SUFFIX_RE = /\(([^)]+)\)\s*$/;
|
|
1636
|
-
CHART_TYPE_RE = /^chart\s*:\s*(.+)/i;
|
|
1637
|
-
TITLE_RE = /^title\s*:\s*(.+)/i;
|
|
1638
|
-
OPTION_RE = /^([a-z][a-z0-9-]*)\s*:\s*(.+)$/i;
|
|
1639
|
-
}
|
|
1640
|
-
});
|
|
1641
|
-
|
|
1642
1655
|
// src/sequence/parser.ts
|
|
1643
1656
|
var parser_exports = {};
|
|
1644
1657
|
__export(parser_exports, {
|
|
@@ -1659,6 +1672,13 @@ function isSequenceNote(el) {
|
|
|
1659
1672
|
}
|
|
1660
1673
|
function parseReturnLabel(rawLabel) {
|
|
1661
1674
|
if (!rawLabel) return { label: "" };
|
|
1675
|
+
const standaloneMatch = rawLabel.match(/^<-\s*(.*)$/);
|
|
1676
|
+
if (standaloneMatch) {
|
|
1677
|
+
return {
|
|
1678
|
+
label: standaloneMatch[1].trim(),
|
|
1679
|
+
standaloneReturn: true
|
|
1680
|
+
};
|
|
1681
|
+
}
|
|
1662
1682
|
const arrowReturn = rawLabel.match(ARROW_RETURN_PATTERN);
|
|
1663
1683
|
if (arrowReturn) {
|
|
1664
1684
|
return { label: arrowReturn[1].trim(), returnLabel: arrowReturn[2].trim() };
|
|
@@ -1996,14 +2016,15 @@ function parseSequenceDgmo(content) {
|
|
|
1996
2016
|
const to = arrowMatch[2];
|
|
1997
2017
|
lastMsgFrom = from;
|
|
1998
2018
|
const rawLabel = arrowMatch[3]?.trim() || "";
|
|
1999
|
-
const { label, returnLabel } = isAsync ? { label: rawLabel, returnLabel: void 0 } : parseReturnLabel(rawLabel);
|
|
2019
|
+
const { label, returnLabel, standaloneReturn } = isAsync ? { label: rawLabel, returnLabel: void 0, standaloneReturn: void 0 } : parseReturnLabel(rawLabel);
|
|
2000
2020
|
const msg = {
|
|
2001
2021
|
from,
|
|
2002
2022
|
to,
|
|
2003
2023
|
label,
|
|
2004
2024
|
returnLabel,
|
|
2005
2025
|
lineNumber,
|
|
2006
|
-
...isAsync ? { async: true } : {}
|
|
2026
|
+
...isAsync ? { async: true } : {},
|
|
2027
|
+
...standaloneReturn ? { standaloneReturn: true } : {}
|
|
2007
2028
|
};
|
|
2008
2029
|
result.messages.push(msg);
|
|
2009
2030
|
currentContainer().push(msg);
|
|
@@ -2710,23 +2731,6 @@ function parseClassDiagram(content, palette) {
|
|
|
2710
2731
|
}
|
|
2711
2732
|
currentClass = null;
|
|
2712
2733
|
contentStarted = true;
|
|
2713
|
-
const relKeyword = trimmed.match(REL_KEYWORD_RE);
|
|
2714
|
-
if (relKeyword) {
|
|
2715
|
-
const sourceName = relKeyword[1];
|
|
2716
|
-
const keyword = relKeyword[2].toLowerCase();
|
|
2717
|
-
const targetName = relKeyword[3];
|
|
2718
|
-
const label = relKeyword[4]?.trim();
|
|
2719
|
-
getOrCreateClass(sourceName, lineNumber);
|
|
2720
|
-
getOrCreateClass(targetName, lineNumber);
|
|
2721
|
-
result.relationships.push({
|
|
2722
|
-
source: classId(sourceName),
|
|
2723
|
-
target: classId(targetName),
|
|
2724
|
-
type: KEYWORD_TO_TYPE[keyword],
|
|
2725
|
-
...label && { label },
|
|
2726
|
-
lineNumber
|
|
2727
|
-
});
|
|
2728
|
-
continue;
|
|
2729
|
-
}
|
|
2730
2734
|
const relArrow = trimmed.match(REL_ARROW_RE);
|
|
2731
2735
|
if (relArrow) {
|
|
2732
2736
|
const sourceName = relArrow[1];
|
|
@@ -2747,13 +2751,24 @@ function parseClassDiagram(content, palette) {
|
|
|
2747
2751
|
const classDecl = trimmed.match(CLASS_DECL_RE);
|
|
2748
2752
|
if (classDecl) {
|
|
2749
2753
|
const name = classDecl[1];
|
|
2750
|
-
const
|
|
2751
|
-
const
|
|
2754
|
+
const relKeyword = classDecl[2];
|
|
2755
|
+
const parentName = classDecl[3];
|
|
2756
|
+
const modifier = classDecl[4];
|
|
2757
|
+
const colorName = classDecl[5]?.trim();
|
|
2752
2758
|
const color = colorName ? resolveColor(colorName, palette) : void 0;
|
|
2753
2759
|
const node = getOrCreateClass(name, lineNumber);
|
|
2754
2760
|
if (modifier) node.modifier = modifier;
|
|
2755
2761
|
if (color) node.color = color;
|
|
2756
2762
|
node.lineNumber = lineNumber;
|
|
2763
|
+
if (relKeyword && parentName) {
|
|
2764
|
+
getOrCreateClass(parentName, lineNumber);
|
|
2765
|
+
result.relationships.push({
|
|
2766
|
+
source: classId(name),
|
|
2767
|
+
target: classId(parentName),
|
|
2768
|
+
type: relKeyword,
|
|
2769
|
+
lineNumber
|
|
2770
|
+
});
|
|
2771
|
+
}
|
|
2757
2772
|
currentClass = node;
|
|
2758
2773
|
continue;
|
|
2759
2774
|
}
|
|
@@ -2793,8 +2808,9 @@ function looksLikeClassDiagram(content) {
|
|
|
2793
2808
|
hasModifier = true;
|
|
2794
2809
|
hasClassDecl = true;
|
|
2795
2810
|
}
|
|
2796
|
-
if (
|
|
2811
|
+
if (/^[A-Z][A-Za-z0-9_]*\s+(extends|implements)\s+[A-Z]/.test(trimmed)) {
|
|
2797
2812
|
hasRelationship = true;
|
|
2813
|
+
hasClassDecl = true;
|
|
2798
2814
|
}
|
|
2799
2815
|
if (REL_ARROW_RE.test(trimmed)) {
|
|
2800
2816
|
hasRelationship = true;
|
|
@@ -2812,27 +2828,19 @@ function looksLikeClassDiagram(content) {
|
|
|
2812
2828
|
if (hasRelationship && hasClassDecl && hasIndentedMember) return true;
|
|
2813
2829
|
return false;
|
|
2814
2830
|
}
|
|
2815
|
-
var CLASS_DECL_RE,
|
|
2831
|
+
var CLASS_DECL_RE, REL_ARROW_RE, VISIBILITY_RE, STATIC_SUFFIX_RE, METHOD_RE, FIELD_RE, ARROW_TO_TYPE;
|
|
2816
2832
|
var init_parser2 = __esm({
|
|
2817
2833
|
"src/class/parser.ts"() {
|
|
2818
2834
|
"use strict";
|
|
2819
2835
|
init_colors();
|
|
2820
2836
|
init_diagnostics();
|
|
2821
2837
|
init_parsing();
|
|
2822
|
-
CLASS_DECL_RE = /^([A-Z][A-Za-z0-9_]*)(?:\s+\[(abstract|interface|enum)\])?(?:\s+\(([^)]+)\))?\s*$/;
|
|
2823
|
-
REL_KEYWORD_RE = /^([A-Z][A-Za-z0-9_]*)\s+(extends|implements|contains|has|uses)\s+([A-Z][A-Za-z0-9_]*)(?:\s*:\s*(.+))?$/;
|
|
2838
|
+
CLASS_DECL_RE = /^([A-Z][A-Za-z0-9_]*)(?:\s+(extends|implements)\s+([A-Z][A-Za-z0-9_]*))?(?:\s+\[(abstract|interface|enum)\])?(?:\s+\(([^)]+)\))?\s*$/;
|
|
2824
2839
|
REL_ARROW_RE = /^([A-Z][A-Za-z0-9_]*)\s+(--\|>|\.\.\|>|\*--|o--|\.\.\>|->)\s+([A-Z][A-Za-z0-9_]*)(?:\s*:\s*(.+))?$/;
|
|
2825
2840
|
VISIBILITY_RE = /^([+\-#])\s*/;
|
|
2826
2841
|
STATIC_SUFFIX_RE = /\{static\}\s*$/;
|
|
2827
2842
|
METHOD_RE = /^(.+?)\(([^)]*)\)(?:\s*:\s*(.+))?$/;
|
|
2828
2843
|
FIELD_RE = /^(.+?)\s*:\s*(.+)$/;
|
|
2829
|
-
KEYWORD_TO_TYPE = {
|
|
2830
|
-
extends: "extends",
|
|
2831
|
-
implements: "implements",
|
|
2832
|
-
contains: "composes",
|
|
2833
|
-
has: "aggregates",
|
|
2834
|
-
uses: "depends"
|
|
2835
|
-
};
|
|
2836
2844
|
ARROW_TO_TYPE = {
|
|
2837
2845
|
"--|>": "extends",
|
|
2838
2846
|
"..|>": "implements",
|
|
@@ -2872,7 +2880,7 @@ function parseRelationship(trimmed, lineNumber, pushError) {
|
|
|
2872
2880
|
};
|
|
2873
2881
|
}
|
|
2874
2882
|
}
|
|
2875
|
-
const kw = trimmed.match(
|
|
2883
|
+
const kw = trimmed.match(REL_KEYWORD_RE);
|
|
2876
2884
|
if (kw) {
|
|
2877
2885
|
const fromSym = KEYWORD_TO_SYMBOL[kw[2].toLowerCase()] ?? kw[2];
|
|
2878
2886
|
const toSym = KEYWORD_TO_SYMBOL[kw[3].toLowerCase()] ?? kw[3];
|
|
@@ -3055,7 +3063,7 @@ function looksLikeERDiagram(content) {
|
|
|
3055
3063
|
if (hasRelationship && hasTableDecl && hasConstraint) return true;
|
|
3056
3064
|
return false;
|
|
3057
3065
|
}
|
|
3058
|
-
var TABLE_DECL_RE, COLUMN_RE, CONSTRAINT_MAP, REL_SYMBOLIC_RE,
|
|
3066
|
+
var TABLE_DECL_RE, COLUMN_RE, CONSTRAINT_MAP, REL_SYMBOLIC_RE, REL_KEYWORD_RE, KEYWORD_TO_SYMBOL;
|
|
3059
3067
|
var init_parser3 = __esm({
|
|
3060
3068
|
"src/er/parser.ts"() {
|
|
3061
3069
|
"use strict";
|
|
@@ -3071,7 +3079,7 @@ var init_parser3 = __esm({
|
|
|
3071
3079
|
nullable: "nullable"
|
|
3072
3080
|
};
|
|
3073
3081
|
REL_SYMBOLIC_RE = /^([a-zA-Z_]\w*)\s+([1*?])\s*-{1,2}\s*([1*?])\s+([a-zA-Z_]\w*)(?:\s*:\s*(.+))?$/;
|
|
3074
|
-
|
|
3082
|
+
REL_KEYWORD_RE = /^([a-zA-Z_]\w*)\s+(one|many|zero)[- ]to[- ](one|many|zero)\s+([a-zA-Z_]\w*)(?:\s*:\s*(.+))?$/i;
|
|
3075
3083
|
KEYWORD_TO_SYMBOL = {
|
|
3076
3084
|
one: "1",
|
|
3077
3085
|
many: "*",
|
|
@@ -3156,8 +3164,16 @@ function parseChart(content, palette) {
|
|
|
3156
3164
|
continue;
|
|
3157
3165
|
}
|
|
3158
3166
|
if (key === "series") {
|
|
3159
|
-
|
|
3160
|
-
|
|
3167
|
+
let rawNames;
|
|
3168
|
+
if (value) {
|
|
3169
|
+
result.series = value;
|
|
3170
|
+
rawNames = value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
3171
|
+
} else {
|
|
3172
|
+
const collected = collectIndentedValues(lines, i);
|
|
3173
|
+
i = collected.newIndex;
|
|
3174
|
+
rawNames = collected.values;
|
|
3175
|
+
result.series = rawNames.join(", ");
|
|
3176
|
+
}
|
|
3161
3177
|
const names = [];
|
|
3162
3178
|
const nameColors = [];
|
|
3163
3179
|
for (const raw of rawNames) {
|
|
@@ -3236,6 +3252,7 @@ var init_chart = __esm({
|
|
|
3236
3252
|
"use strict";
|
|
3237
3253
|
init_colors();
|
|
3238
3254
|
init_diagnostics();
|
|
3255
|
+
init_parsing();
|
|
3239
3256
|
VALID_TYPES = /* @__PURE__ */ new Set([
|
|
3240
3257
|
"bar",
|
|
3241
3258
|
"line",
|
|
@@ -3311,8 +3328,16 @@ function parseEChart(content, palette) {
|
|
|
3311
3328
|
continue;
|
|
3312
3329
|
}
|
|
3313
3330
|
if (key === "series") {
|
|
3314
|
-
|
|
3315
|
-
|
|
3331
|
+
let rawNames;
|
|
3332
|
+
if (value) {
|
|
3333
|
+
result.series = value;
|
|
3334
|
+
rawNames = value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
3335
|
+
} else {
|
|
3336
|
+
const collected = collectIndentedValues(lines, i);
|
|
3337
|
+
i = collected.newIndex;
|
|
3338
|
+
rawNames = collected.values;
|
|
3339
|
+
result.series = rawNames.join(", ");
|
|
3340
|
+
}
|
|
3316
3341
|
const names = [];
|
|
3317
3342
|
const nameColors = [];
|
|
3318
3343
|
for (const raw of rawNames) {
|
|
@@ -3348,11 +3373,23 @@ function parseEChart(content, palette) {
|
|
|
3348
3373
|
continue;
|
|
3349
3374
|
}
|
|
3350
3375
|
if (key === "columns") {
|
|
3351
|
-
|
|
3376
|
+
if (value) {
|
|
3377
|
+
result.columns = value.split(",").map((s) => s.trim());
|
|
3378
|
+
} else {
|
|
3379
|
+
const collected = collectIndentedValues(lines, i);
|
|
3380
|
+
i = collected.newIndex;
|
|
3381
|
+
result.columns = collected.values;
|
|
3382
|
+
}
|
|
3352
3383
|
continue;
|
|
3353
3384
|
}
|
|
3354
3385
|
if (key === "rows") {
|
|
3355
|
-
|
|
3386
|
+
if (value) {
|
|
3387
|
+
result.rows = value.split(",").map((s) => s.trim());
|
|
3388
|
+
} else {
|
|
3389
|
+
const collected = collectIndentedValues(lines, i);
|
|
3390
|
+
i = collected.newIndex;
|
|
3391
|
+
result.rows = collected.values;
|
|
3392
|
+
}
|
|
3356
3393
|
continue;
|
|
3357
3394
|
}
|
|
3358
3395
|
if (key === "x") {
|
|
@@ -4668,6 +4705,7 @@ var init_echarts = __esm({
|
|
|
4668
4705
|
init_palettes();
|
|
4669
4706
|
init_chart();
|
|
4670
4707
|
init_diagnostics();
|
|
4708
|
+
init_parsing();
|
|
4671
4709
|
ECHART_EXPORT_WIDTH = 1200;
|
|
4672
4710
|
ECHART_EXPORT_HEIGHT = 800;
|
|
4673
4711
|
STANDARD_CHART_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -7753,22 +7791,30 @@ function computeNodeDimensions(node) {
|
|
|
7753
7791
|
}
|
|
7754
7792
|
const width = Math.max(MIN_WIDTH, maxTextLen * CHAR_WIDTH2 + PADDING_X);
|
|
7755
7793
|
const headerHeight = HEADER_BASE + (node.modifier ? MODIFIER_BADGE : 0);
|
|
7756
|
-
let fieldsHeight
|
|
7794
|
+
let fieldsHeight;
|
|
7757
7795
|
if (isEnum) {
|
|
7758
7796
|
const enumValues = node.members;
|
|
7759
7797
|
if (enumValues.length > 0) {
|
|
7760
7798
|
fieldsHeight = COMPARTMENT_PADDING_Y * 2 + enumValues.length * MEMBER_LINE_HEIGHT + SEPARATOR_HEIGHT;
|
|
7799
|
+
} else {
|
|
7800
|
+
fieldsHeight = SEPARATOR_HEIGHT + COMPARTMENT_PADDING_Y;
|
|
7761
7801
|
}
|
|
7762
7802
|
} else {
|
|
7763
7803
|
if (fields.length > 0) {
|
|
7764
7804
|
fieldsHeight = COMPARTMENT_PADDING_Y * 2 + fields.length * MEMBER_LINE_HEIGHT + SEPARATOR_HEIGHT;
|
|
7805
|
+
} else {
|
|
7806
|
+
fieldsHeight = SEPARATOR_HEIGHT + COMPARTMENT_PADDING_Y;
|
|
7765
7807
|
}
|
|
7766
7808
|
}
|
|
7767
7809
|
let methodsHeight = 0;
|
|
7768
|
-
if (!isEnum
|
|
7769
|
-
|
|
7810
|
+
if (!isEnum) {
|
|
7811
|
+
if (methods.length > 0) {
|
|
7812
|
+
methodsHeight = COMPARTMENT_PADDING_Y * 2 + methods.length * MEMBER_LINE_HEIGHT + SEPARATOR_HEIGHT;
|
|
7813
|
+
} else {
|
|
7814
|
+
methodsHeight = SEPARATOR_HEIGHT + COMPARTMENT_PADDING_Y;
|
|
7815
|
+
}
|
|
7770
7816
|
}
|
|
7771
|
-
const height = headerHeight + fieldsHeight + methodsHeight
|
|
7817
|
+
const height = headerHeight + fieldsHeight + methodsHeight;
|
|
7772
7818
|
return { width, height, headerHeight, fieldsHeight, methodsHeight };
|
|
7773
7819
|
}
|
|
7774
7820
|
function layoutClassDiagram(parsed) {
|
|
@@ -8021,17 +8067,15 @@ function renderClassDiagram(container, parsed, layout, palette, isDark, onClickI
|
|
|
8021
8067
|
const fields = node.members.filter((m) => !m.isMethod);
|
|
8022
8068
|
const methods = node.members.filter((m) => m.isMethod);
|
|
8023
8069
|
if (isEnum) {
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
memberY += MEMBER_LINE_HEIGHT2;
|
|
8030
|
-
}
|
|
8070
|
+
nodeG.append("line").attr("x1", -w / 2).attr("y1", yPos).attr("x2", w / 2).attr("y2", yPos).attr("stroke", stroke2).attr("stroke-width", 0.5).attr("stroke-opacity", 0.5);
|
|
8071
|
+
let memberY = yPos + COMPARTMENT_PADDING_Y2;
|
|
8072
|
+
for (const member of node.members) {
|
|
8073
|
+
nodeG.append("text").attr("x", -w / 2 + MEMBER_PADDING_X).attr("y", memberY + MEMBER_LINE_HEIGHT2 / 2).attr("dominant-baseline", "central").attr("fill", palette.text).attr("font-size", MEMBER_FONT_SIZE).text(member.name);
|
|
8074
|
+
memberY += MEMBER_LINE_HEIGHT2;
|
|
8031
8075
|
}
|
|
8032
8076
|
} else {
|
|
8077
|
+
nodeG.append("line").attr("x1", -w / 2).attr("y1", yPos).attr("x2", w / 2).attr("y2", yPos).attr("stroke", stroke2).attr("stroke-width", 0.5).attr("stroke-opacity", 0.5);
|
|
8033
8078
|
if (fields.length > 0) {
|
|
8034
|
-
nodeG.append("line").attr("x1", -w / 2).attr("y1", yPos).attr("x2", w / 2).attr("y2", yPos).attr("stroke", stroke2).attr("stroke-width", 0.5).attr("stroke-opacity", 0.5);
|
|
8035
8079
|
let memberY = yPos + COMPARTMENT_PADDING_Y2;
|
|
8036
8080
|
for (const field of fields) {
|
|
8037
8081
|
const vis = visibilitySymbol(field.visibility);
|
|
@@ -8044,10 +8088,10 @@ function renderClassDiagram(container, parsed, layout, palette, isDark, onClickI
|
|
|
8044
8088
|
textEl.text(text);
|
|
8045
8089
|
memberY += MEMBER_LINE_HEIGHT2;
|
|
8046
8090
|
}
|
|
8047
|
-
yPos += node.fieldsHeight;
|
|
8048
8091
|
}
|
|
8092
|
+
yPos += node.fieldsHeight;
|
|
8093
|
+
nodeG.append("line").attr("x1", -w / 2).attr("y1", yPos).attr("x2", w / 2).attr("y2", yPos).attr("stroke", stroke2).attr("stroke-width", 0.5).attr("stroke-opacity", 0.5);
|
|
8049
8094
|
if (methods.length > 0) {
|
|
8050
|
-
nodeG.append("line").attr("x1", -w / 2).attr("y1", yPos).attr("x2", w / 2).attr("y2", yPos).attr("stroke", stroke2).attr("stroke-width", 0.5).attr("stroke-opacity", 0.5);
|
|
8051
8095
|
let memberY = yPos + COMPARTMENT_PADDING_Y2;
|
|
8052
8096
|
for (const method of methods) {
|
|
8053
8097
|
const vis = visibilitySymbol(method.visibility);
|
|
@@ -12147,6 +12191,22 @@ function buildRenderSequence(messages) {
|
|
|
12147
12191
|
messageIndex: top.messageIndex
|
|
12148
12192
|
});
|
|
12149
12193
|
}
|
|
12194
|
+
if (msg.standaloneReturn) {
|
|
12195
|
+
for (let si = stack.length - 1; si >= 0; si--) {
|
|
12196
|
+
if (stack[si].from === msg.to && stack[si].to === msg.from) {
|
|
12197
|
+
stack.splice(si, 1);
|
|
12198
|
+
break;
|
|
12199
|
+
}
|
|
12200
|
+
}
|
|
12201
|
+
steps.push({
|
|
12202
|
+
type: "return",
|
|
12203
|
+
from: msg.from,
|
|
12204
|
+
to: msg.to,
|
|
12205
|
+
label: msg.label,
|
|
12206
|
+
messageIndex: mi
|
|
12207
|
+
});
|
|
12208
|
+
continue;
|
|
12209
|
+
}
|
|
12150
12210
|
steps.push({
|
|
12151
12211
|
type: "call",
|
|
12152
12212
|
from: msg.from,
|
|
@@ -13428,18 +13488,34 @@ function parseD3(content, palette) {
|
|
|
13428
13488
|
}
|
|
13429
13489
|
}
|
|
13430
13490
|
if (result.type === "quadrant") {
|
|
13431
|
-
const xAxisMatch = line7.match(/^x-axis\s*:\s*(
|
|
13491
|
+
const xAxisMatch = line7.match(/^x-axis\s*:\s*(.*)/i);
|
|
13432
13492
|
if (xAxisMatch) {
|
|
13433
|
-
const
|
|
13493
|
+
const val = xAxisMatch[1].trim();
|
|
13494
|
+
let parts;
|
|
13495
|
+
if (val) {
|
|
13496
|
+
parts = val.split(",").map((s) => s.trim());
|
|
13497
|
+
} else {
|
|
13498
|
+
const collected = collectIndentedValues(lines, i);
|
|
13499
|
+
i = collected.newIndex;
|
|
13500
|
+
parts = collected.values;
|
|
13501
|
+
}
|
|
13434
13502
|
if (parts.length >= 2) {
|
|
13435
13503
|
result.quadrantXAxis = [parts[0], parts[1]];
|
|
13436
13504
|
result.quadrantXAxisLineNumber = lineNumber;
|
|
13437
13505
|
}
|
|
13438
13506
|
continue;
|
|
13439
13507
|
}
|
|
13440
|
-
const yAxisMatch = line7.match(/^y-axis\s*:\s*(
|
|
13508
|
+
const yAxisMatch = line7.match(/^y-axis\s*:\s*(.*)/i);
|
|
13441
13509
|
if (yAxisMatch) {
|
|
13442
|
-
const
|
|
13510
|
+
const val = yAxisMatch[1].trim();
|
|
13511
|
+
let parts;
|
|
13512
|
+
if (val) {
|
|
13513
|
+
parts = val.split(",").map((s) => s.trim());
|
|
13514
|
+
} else {
|
|
13515
|
+
const collected = collectIndentedValues(lines, i);
|
|
13516
|
+
i = collected.newIndex;
|
|
13517
|
+
parts = collected.values;
|
|
13518
|
+
}
|
|
13443
13519
|
if (parts.length >= 2) {
|
|
13444
13520
|
result.quadrantYAxis = [parts[0], parts[1]];
|
|
13445
13521
|
result.quadrantYAxisLineNumber = lineNumber;
|
|
@@ -16255,6 +16331,7 @@ var init_d3 = __esm({
|
|
|
16255
16331
|
init_colors();
|
|
16256
16332
|
init_palettes();
|
|
16257
16333
|
init_diagnostics();
|
|
16334
|
+
init_parsing();
|
|
16258
16335
|
DEFAULT_CLOUD_OPTIONS = {
|
|
16259
16336
|
rotate: "none",
|
|
16260
16337
|
max: 0,
|