@diagrammo/dgmo 0.3.2 → 0.4.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/README.md +11 -14
- package/dist/cli.cjs +150 -150
- package/dist/index.cjs +341 -852
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.js +340 -852
- package/dist/index.js.map +1 -1
- package/docs/language-reference.md +18 -19
- package/package.json +1 -1
- package/src/chart.ts +8 -39
- package/src/cli.ts +6 -6
- package/src/d3.ts +198 -674
- package/src/dgmo-router.ts +21 -42
- package/src/echarts.ts +80 -220
- package/src/index.ts +1 -0
- package/src/sequence/parser.ts +55 -106
- package/src/sequence/renderer.ts +4 -60
- package/src/utils/arrows.ts +43 -18
- package/src/utils/parsing.ts +43 -0
package/dist/index.cjs
CHANGED
|
@@ -1307,6 +1307,31 @@ function collectIndentedValues(lines, startIndex) {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
return { values, newIndex: j - 1 };
|
|
1309
1309
|
}
|
|
1310
|
+
function parseSeriesNames(value, lines, lineIndex, palette) {
|
|
1311
|
+
let rawNames;
|
|
1312
|
+
let series;
|
|
1313
|
+
let newIndex = lineIndex;
|
|
1314
|
+
if (value) {
|
|
1315
|
+
series = value;
|
|
1316
|
+
rawNames = value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
1317
|
+
} else {
|
|
1318
|
+
const collected = collectIndentedValues(lines, lineIndex);
|
|
1319
|
+
newIndex = collected.newIndex;
|
|
1320
|
+
rawNames = collected.values;
|
|
1321
|
+
series = rawNames.join(", ");
|
|
1322
|
+
}
|
|
1323
|
+
const names = [];
|
|
1324
|
+
const nameColors = [];
|
|
1325
|
+
for (const raw of rawNames) {
|
|
1326
|
+
const extracted = extractColor(raw, palette);
|
|
1327
|
+
nameColors.push(extracted.color);
|
|
1328
|
+
names.push(extracted.label);
|
|
1329
|
+
}
|
|
1330
|
+
if (names.length === 1) {
|
|
1331
|
+
series = names[0];
|
|
1332
|
+
}
|
|
1333
|
+
return { series, names, nameColors, newIndex };
|
|
1334
|
+
}
|
|
1310
1335
|
function parsePipeMetadata(segments, aliasMap = /* @__PURE__ */ new Map()) {
|
|
1311
1336
|
const metadata = {};
|
|
1312
1337
|
for (let j = 1; j < segments.length; j++) {
|
|
@@ -1612,13 +1637,18 @@ var init_participant_inference = __esm({
|
|
|
1612
1637
|
|
|
1613
1638
|
// src/utils/arrows.ts
|
|
1614
1639
|
function parseArrow(line7) {
|
|
1640
|
+
if (BIDI_SYNC_RE.test(line7) || BIDI_ASYNC_RE.test(line7)) {
|
|
1641
|
+
return {
|
|
1642
|
+
error: "Bidirectional arrows are no longer supported. Use two separate lines: 'A -msg-> B' and 'B -msg-> A'"
|
|
1643
|
+
};
|
|
1644
|
+
}
|
|
1615
1645
|
const patterns = [
|
|
1616
|
-
{ re:
|
|
1617
|
-
{ re:
|
|
1618
|
-
{ re: SYNC_LABELED_RE, async: false,
|
|
1619
|
-
{ re: ASYNC_LABELED_RE, async: true,
|
|
1646
|
+
{ re: RETURN_SYNC_LABELED_RE, async: false, isReturn: true },
|
|
1647
|
+
{ re: RETURN_ASYNC_LABELED_RE, async: true, isReturn: true },
|
|
1648
|
+
{ re: SYNC_LABELED_RE, async: false, isReturn: false },
|
|
1649
|
+
{ re: ASYNC_LABELED_RE, async: true, isReturn: false }
|
|
1620
1650
|
];
|
|
1621
|
-
for (const { re, async: isAsync,
|
|
1651
|
+
for (const { re, async: isAsync, isReturn } of patterns) {
|
|
1622
1652
|
const m = line7.match(re);
|
|
1623
1653
|
if (!m) continue;
|
|
1624
1654
|
const label = m[2].trim();
|
|
@@ -1626,29 +1656,40 @@ function parseArrow(line7) {
|
|
|
1626
1656
|
for (const arrow of ARROW_CHARS) {
|
|
1627
1657
|
if (label.includes(arrow)) {
|
|
1628
1658
|
return {
|
|
1629
|
-
error: "Arrow characters (->,
|
|
1659
|
+
error: "Arrow characters (->, ~>, <-, <~) are not allowed inside labels"
|
|
1630
1660
|
};
|
|
1631
1661
|
}
|
|
1632
1662
|
}
|
|
1663
|
+
if (isReturn) {
|
|
1664
|
+
return {
|
|
1665
|
+
from: m[3],
|
|
1666
|
+
to: m[1],
|
|
1667
|
+
label,
|
|
1668
|
+
async: isAsync,
|
|
1669
|
+
isReturn: true
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1633
1672
|
return {
|
|
1634
1673
|
from: m[1],
|
|
1635
1674
|
to: m[3],
|
|
1636
1675
|
label,
|
|
1637
1676
|
async: isAsync,
|
|
1638
|
-
|
|
1677
|
+
isReturn: false
|
|
1639
1678
|
};
|
|
1640
1679
|
}
|
|
1641
1680
|
return null;
|
|
1642
1681
|
}
|
|
1643
|
-
var
|
|
1682
|
+
var SYNC_LABELED_RE, ASYNC_LABELED_RE, RETURN_SYNC_LABELED_RE, RETURN_ASYNC_LABELED_RE, BIDI_SYNC_RE, BIDI_ASYNC_RE, ARROW_CHARS;
|
|
1644
1683
|
var init_arrows = __esm({
|
|
1645
1684
|
"src/utils/arrows.ts"() {
|
|
1646
1685
|
"use strict";
|
|
1647
|
-
BIDI_SYNC_LABELED_RE = /^(\S+)\s+<-(.+)->\s+(\S+)$/;
|
|
1648
|
-
BIDI_ASYNC_LABELED_RE = /^(\S+)\s+<~(.+)~>\s+(\S+)$/;
|
|
1649
1686
|
SYNC_LABELED_RE = /^(\S+)\s+-(.+)->\s+(\S+)$/;
|
|
1650
1687
|
ASYNC_LABELED_RE = /^(\S+)\s+~(.+)~>\s+(\S+)$/;
|
|
1651
|
-
|
|
1688
|
+
RETURN_SYNC_LABELED_RE = /^(\S+)\s+<-(.+)-\s+(\S+)$/;
|
|
1689
|
+
RETURN_ASYNC_LABELED_RE = /^(\S+)\s+<~(.+)~\s+(\S+)$/;
|
|
1690
|
+
BIDI_SYNC_RE = /^(\S+)\s+<-(.+)->\s+(\S+)$/;
|
|
1691
|
+
BIDI_ASYNC_RE = /^(\S+)\s+<~(.+)~>\s+(\S+)$/;
|
|
1692
|
+
ARROW_CHARS = ["->", "~>", "<-", "<~"];
|
|
1652
1693
|
}
|
|
1653
1694
|
});
|
|
1654
1695
|
|
|
@@ -1670,36 +1711,6 @@ function isSequenceSection(el) {
|
|
|
1670
1711
|
function isSequenceNote(el) {
|
|
1671
1712
|
return "kind" in el && el.kind === "note";
|
|
1672
1713
|
}
|
|
1673
|
-
function parseReturnLabel(rawLabel) {
|
|
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
|
-
}
|
|
1682
|
-
const arrowReturn = rawLabel.match(ARROW_RETURN_PATTERN);
|
|
1683
|
-
if (arrowReturn) {
|
|
1684
|
-
return { label: arrowReturn[1].trim(), returnLabel: arrowReturn[2].trim() };
|
|
1685
|
-
}
|
|
1686
|
-
const umlReturn = rawLabel.match(UML_RETURN_PATTERN);
|
|
1687
|
-
if (umlReturn) {
|
|
1688
|
-
return { label: umlReturn[1].trim(), returnLabel: umlReturn[2].trim() };
|
|
1689
|
-
}
|
|
1690
|
-
const lastColon = rawLabel.lastIndexOf(":");
|
|
1691
|
-
if (lastColon > 0 && lastColon < rawLabel.length - 1) {
|
|
1692
|
-
const afterColon = rawLabel.substring(lastColon + 1);
|
|
1693
|
-
if (!afterColon.startsWith("//")) {
|
|
1694
|
-
const reqPart = rawLabel.substring(0, lastColon).trim();
|
|
1695
|
-
const resPart = afterColon.trim();
|
|
1696
|
-
if (reqPart && resPart) {
|
|
1697
|
-
return { label: reqPart, returnLabel: resPart };
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
return { label: rawLabel };
|
|
1702
|
-
}
|
|
1703
1714
|
function parseSequenceDgmo(content) {
|
|
1704
1715
|
const result = {
|
|
1705
1716
|
title: null,
|
|
@@ -1799,7 +1810,7 @@ function parseSequenceDgmo(content) {
|
|
|
1799
1810
|
continue;
|
|
1800
1811
|
}
|
|
1801
1812
|
const colonIndex = trimmed.indexOf(":");
|
|
1802
|
-
if (colonIndex > 0 && !trimmed.includes("->") && !trimmed.includes("~>")) {
|
|
1813
|
+
if (colonIndex > 0 && !trimmed.includes("->") && !trimmed.includes("~>") && !trimmed.includes("<-") && !trimmed.includes("<~")) {
|
|
1803
1814
|
const key = trimmed.substring(0, colonIndex).trim().toLowerCase();
|
|
1804
1815
|
if (key === "note" || key.startsWith("note ")) {
|
|
1805
1816
|
} else {
|
|
@@ -1928,16 +1939,15 @@ function parseSequenceDgmo(content) {
|
|
|
1928
1939
|
}
|
|
1929
1940
|
if (labeledArrow) {
|
|
1930
1941
|
contentStarted = true;
|
|
1931
|
-
const { from, to, label, async:
|
|
1942
|
+
const { from, to, label, async: isAsync, isReturn } = labeledArrow;
|
|
1932
1943
|
lastMsgFrom = from;
|
|
1933
1944
|
const msg = {
|
|
1934
1945
|
from,
|
|
1935
1946
|
to,
|
|
1936
1947
|
label,
|
|
1937
|
-
returnLabel: void 0,
|
|
1938
1948
|
lineNumber,
|
|
1939
|
-
...
|
|
1940
|
-
...
|
|
1949
|
+
...isAsync ? { async: true } : {},
|
|
1950
|
+
...isReturn ? { standaloneReturn: true } : {}
|
|
1941
1951
|
};
|
|
1942
1952
|
result.messages.push(msg);
|
|
1943
1953
|
currentContainer().push(msg);
|
|
@@ -1959,27 +1969,50 @@ function parseSequenceDgmo(content) {
|
|
|
1959
1969
|
}
|
|
1960
1970
|
continue;
|
|
1961
1971
|
}
|
|
1962
|
-
const
|
|
1963
|
-
/^(\S+)\s
|
|
1972
|
+
const colonPostfixSync = trimmed.match(
|
|
1973
|
+
/^(\S+)\s*->\s*([^\s:]+)\s*:\s*(.+)$/
|
|
1974
|
+
);
|
|
1975
|
+
const colonPostfixAsync = trimmed.match(
|
|
1976
|
+
/^(\S+)\s*~>\s*([^\s:]+)\s*:\s*(.+)$/
|
|
1964
1977
|
);
|
|
1965
|
-
const
|
|
1966
|
-
|
|
1978
|
+
const colonPostfix = colonPostfixSync || colonPostfixAsync;
|
|
1979
|
+
if (colonPostfix) {
|
|
1980
|
+
const a = colonPostfix[1];
|
|
1981
|
+
const b = colonPostfix[2];
|
|
1982
|
+
const msg = colonPostfix[3].trim();
|
|
1983
|
+
const arrowChar = colonPostfixAsync ? "~" : "-";
|
|
1984
|
+
const arrowEnd = colonPostfixAsync ? "~>" : "->";
|
|
1985
|
+
pushError(
|
|
1986
|
+
lineNumber,
|
|
1987
|
+
`Colon syntax is no longer supported. Use '${a} ${arrowChar}${msg}${arrowEnd} ${b}' instead`
|
|
1988
|
+
);
|
|
1989
|
+
continue;
|
|
1990
|
+
}
|
|
1991
|
+
const bidiPlainMatch = trimmed.match(
|
|
1992
|
+
/^(\S+)\s*(?:<->|<~>)\s*(\S+)/
|
|
1967
1993
|
);
|
|
1968
|
-
|
|
1969
|
-
|
|
1994
|
+
if (bidiPlainMatch) {
|
|
1995
|
+
pushError(
|
|
1996
|
+
lineNumber,
|
|
1997
|
+
"Bidirectional arrows are no longer supported. Use two separate lines: 'A -msg-> B' and 'B -msg-> A'"
|
|
1998
|
+
);
|
|
1999
|
+
continue;
|
|
2000
|
+
}
|
|
2001
|
+
const bareReturnSync = trimmed.match(/^(\S+)\s+<-\s+(\S+)$/);
|
|
2002
|
+
const bareReturnAsync = trimmed.match(/^(\S+)\s+<~\s+(\S+)$/);
|
|
2003
|
+
const bareReturn = bareReturnSync || bareReturnAsync;
|
|
2004
|
+
if (bareReturn) {
|
|
1970
2005
|
contentStarted = true;
|
|
1971
|
-
const
|
|
1972
|
-
const
|
|
2006
|
+
const to = bareReturn[1];
|
|
2007
|
+
const from = bareReturn[2];
|
|
1973
2008
|
lastMsgFrom = from;
|
|
1974
|
-
const rawLabel = bidiMatch[3]?.trim() || "";
|
|
1975
|
-
const isBidiAsync = !!bidiAsyncMatch;
|
|
1976
2009
|
const msg = {
|
|
1977
2010
|
from,
|
|
1978
2011
|
to,
|
|
1979
|
-
label:
|
|
2012
|
+
label: "",
|
|
1980
2013
|
lineNumber,
|
|
1981
|
-
|
|
1982
|
-
...
|
|
2014
|
+
standaloneReturn: true,
|
|
2015
|
+
...bareReturnAsync ? { async: true } : {}
|
|
1983
2016
|
};
|
|
1984
2017
|
result.messages.push(msg);
|
|
1985
2018
|
currentContainer().push(msg);
|
|
@@ -2001,30 +2034,20 @@ function parseSequenceDgmo(content) {
|
|
|
2001
2034
|
}
|
|
2002
2035
|
continue;
|
|
2003
2036
|
}
|
|
2004
|
-
|
|
2005
|
-
const
|
|
2006
|
-
|
|
2007
|
-
)
|
|
2008
|
-
const syncArrowMatch = trimmed.match(
|
|
2009
|
-
/^(\S+)\s*->\s*([^\s:]+)\s*(?::\s*(.+))?$/
|
|
2010
|
-
);
|
|
2011
|
-
const arrowMatch = asyncArrowMatch || syncArrowMatch;
|
|
2012
|
-
if (asyncArrowMatch) isAsync = true;
|
|
2013
|
-
if (arrowMatch) {
|
|
2037
|
+
const bareCallSync = trimmed.match(/^(\S+)\s*->\s*(\S+)$/);
|
|
2038
|
+
const bareCallAsync = trimmed.match(/^(\S+)\s*~>\s*(\S+)$/);
|
|
2039
|
+
const bareCall = bareCallSync || bareCallAsync;
|
|
2040
|
+
if (bareCall) {
|
|
2014
2041
|
contentStarted = true;
|
|
2015
|
-
const from =
|
|
2016
|
-
const to =
|
|
2042
|
+
const from = bareCall[1];
|
|
2043
|
+
const to = bareCall[2];
|
|
2017
2044
|
lastMsgFrom = from;
|
|
2018
|
-
const rawLabel = arrowMatch[3]?.trim() || "";
|
|
2019
|
-
const { label, returnLabel, standaloneReturn } = isAsync ? { label: rawLabel, returnLabel: void 0, standaloneReturn: void 0 } : parseReturnLabel(rawLabel);
|
|
2020
2045
|
const msg = {
|
|
2021
2046
|
from,
|
|
2022
2047
|
to,
|
|
2023
|
-
label,
|
|
2024
|
-
returnLabel,
|
|
2048
|
+
label: "",
|
|
2025
2049
|
lineNumber,
|
|
2026
|
-
...
|
|
2027
|
-
...standaloneReturn ? { standaloneReturn: true } : {}
|
|
2050
|
+
...bareCallAsync ? { async: true } : {}
|
|
2028
2051
|
};
|
|
2029
2052
|
result.messages.push(msg);
|
|
2030
2053
|
currentContainer().push(msg);
|
|
@@ -2233,7 +2256,7 @@ function looksLikeSequence(content) {
|
|
|
2233
2256
|
return ARROW_PATTERN.test(trimmed);
|
|
2234
2257
|
});
|
|
2235
2258
|
}
|
|
2236
|
-
var VALID_PARTICIPANT_TYPES, IS_A_PATTERN, POSITION_ONLY_PATTERN, GROUP_HEADING_PATTERN, SECTION_PATTERN, ARROW_PATTERN,
|
|
2259
|
+
var VALID_PARTICIPANT_TYPES, IS_A_PATTERN, POSITION_ONLY_PATTERN, GROUP_HEADING_PATTERN, SECTION_PATTERN, ARROW_PATTERN, NOTE_SINGLE, NOTE_MULTI;
|
|
2237
2260
|
var init_parser = __esm({
|
|
2238
2261
|
"src/sequence/parser.ts"() {
|
|
2239
2262
|
"use strict";
|
|
@@ -2256,9 +2279,7 @@ var init_parser = __esm({
|
|
|
2256
2279
|
POSITION_ONLY_PATTERN = /^(\S+)\s+position\s+(-?\d+)$/i;
|
|
2257
2280
|
GROUP_HEADING_PATTERN = /^##\s+(.+?)(?:\(([^)]+)\))?\s*$/;
|
|
2258
2281
|
SECTION_PATTERN = /^==\s+(.+?)(?:\s*==)?\s*$/;
|
|
2259
|
-
ARROW_PATTERN = /\S+\s*(
|
|
2260
|
-
ARROW_RETURN_PATTERN = /^(.+?)\s*<-\s*(.+)$/;
|
|
2261
|
-
UML_RETURN_PATTERN = /^(\w+\([^)]*\))\s*:\s*(.+)$/;
|
|
2282
|
+
ARROW_PATTERN = /\S+\s*(?:<-\S+-|<~\S+~|-\S+->|~\S+~>|->|~>|<-|<~)\s*\S+/;
|
|
2262
2283
|
NOTE_SINGLE = /^note(?:\s+(right|left)\s+of\s+(\S+))?\s*:\s*(.+)$/i;
|
|
2263
2284
|
NOTE_MULTI = /^note(?:\s+(right|left)\s+of\s+([^\s:]+))?\s*:?\s*$/i;
|
|
2264
2285
|
}
|
|
@@ -3164,49 +3185,19 @@ function parseChart(content, palette) {
|
|
|
3164
3185
|
continue;
|
|
3165
3186
|
}
|
|
3166
3187
|
if (key === "series") {
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
const collected = collectIndentedValues(lines, i);
|
|
3173
|
-
i = collected.newIndex;
|
|
3174
|
-
rawNames = collected.values;
|
|
3175
|
-
result.series = rawNames.join(", ");
|
|
3176
|
-
}
|
|
3177
|
-
const names = [];
|
|
3178
|
-
const nameColors = [];
|
|
3179
|
-
for (const raw of rawNames) {
|
|
3180
|
-
const colorMatch = raw.match(/\(([^)]+)\)\s*$/);
|
|
3181
|
-
if (colorMatch) {
|
|
3182
|
-
const resolved = resolveColor(colorMatch[1].trim(), palette);
|
|
3183
|
-
nameColors.push(resolved);
|
|
3184
|
-
names.push(raw.substring(0, colorMatch.index).trim());
|
|
3185
|
-
} else {
|
|
3186
|
-
nameColors.push(void 0);
|
|
3187
|
-
names.push(raw);
|
|
3188
|
-
}
|
|
3189
|
-
}
|
|
3190
|
-
if (names.length === 1) {
|
|
3191
|
-
result.series = names[0];
|
|
3192
|
-
}
|
|
3193
|
-
if (names.length > 1) {
|
|
3194
|
-
result.seriesNames = names;
|
|
3188
|
+
const parsed = parseSeriesNames(value, lines, i, palette);
|
|
3189
|
+
i = parsed.newIndex;
|
|
3190
|
+
result.series = parsed.series;
|
|
3191
|
+
if (parsed.names.length > 1) {
|
|
3192
|
+
result.seriesNames = parsed.names;
|
|
3195
3193
|
}
|
|
3196
|
-
if (nameColors.some(Boolean)) result.seriesNameColors = nameColors;
|
|
3194
|
+
if (parsed.nameColors.some(Boolean)) result.seriesNameColors = parsed.nameColors;
|
|
3197
3195
|
continue;
|
|
3198
3196
|
}
|
|
3199
3197
|
const parts = value.split(",").map((s) => s.trim());
|
|
3200
3198
|
const numValue = parseFloat(parts[0]);
|
|
3201
3199
|
if (!isNaN(numValue)) {
|
|
3202
|
-
|
|
3203
|
-
let pointColor;
|
|
3204
|
-
const colorMatch = rawLabel.match(/\(([^)]+)\)\s*$/);
|
|
3205
|
-
if (colorMatch) {
|
|
3206
|
-
const resolved = resolveColor(colorMatch[1].trim(), palette);
|
|
3207
|
-
pointColor = resolved;
|
|
3208
|
-
rawLabel = rawLabel.substring(0, colorMatch.index).trim();
|
|
3209
|
-
}
|
|
3200
|
+
const { label: rawLabel, color: pointColor } = extractColor(trimmed.substring(0, colonIndex).trim(), palette);
|
|
3210
3201
|
const extra = parts.slice(1).map((s) => parseFloat(s)).filter((n) => !isNaN(n));
|
|
3211
3202
|
result.data.push({
|
|
3212
3203
|
label: rawLabel,
|
|
@@ -3285,13 +3276,10 @@ function parseEChart(content, palette) {
|
|
|
3285
3276
|
if (!trimmed) continue;
|
|
3286
3277
|
const mdCategoryMatch = trimmed.match(/^#{2,}\s+(.+)$/);
|
|
3287
3278
|
if (mdCategoryMatch) {
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
if (catColorMatch) {
|
|
3291
|
-
const resolved = resolveColor(catColorMatch[1].trim(), palette);
|
|
3279
|
+
const { label: catName, color: catColor } = extractColor(mdCategoryMatch[1].trim(), palette);
|
|
3280
|
+
if (catColor) {
|
|
3292
3281
|
if (!result.categoryColors) result.categoryColors = {};
|
|
3293
|
-
catName =
|
|
3294
|
-
result.categoryColors[catName] = resolved;
|
|
3282
|
+
result.categoryColors[catName] = catColor;
|
|
3295
3283
|
}
|
|
3296
3284
|
currentCategory = catName;
|
|
3297
3285
|
continue;
|
|
@@ -3328,32 +3316,13 @@ function parseEChart(content, palette) {
|
|
|
3328
3316
|
continue;
|
|
3329
3317
|
}
|
|
3330
3318
|
if (key === "series") {
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
const collected = collectIndentedValues(lines, i);
|
|
3337
|
-
i = collected.newIndex;
|
|
3338
|
-
rawNames = collected.values;
|
|
3339
|
-
result.series = rawNames.join(", ");
|
|
3319
|
+
const parsed = parseSeriesNames(value, lines, i, palette);
|
|
3320
|
+
i = parsed.newIndex;
|
|
3321
|
+
result.series = parsed.series;
|
|
3322
|
+
if (parsed.names.length > 1) {
|
|
3323
|
+
result.seriesNames = parsed.names;
|
|
3340
3324
|
}
|
|
3341
|
-
|
|
3342
|
-
const nameColors = [];
|
|
3343
|
-
for (const raw of rawNames) {
|
|
3344
|
-
const colorMatch = raw.match(/\(([^)]+)\)\s*$/);
|
|
3345
|
-
if (colorMatch) {
|
|
3346
|
-
nameColors.push(resolveColor(colorMatch[1].trim(), palette));
|
|
3347
|
-
names.push(raw.substring(0, colorMatch.index).trim());
|
|
3348
|
-
} else {
|
|
3349
|
-
nameColors.push(void 0);
|
|
3350
|
-
names.push(raw);
|
|
3351
|
-
}
|
|
3352
|
-
}
|
|
3353
|
-
if (names.length === 1) {
|
|
3354
|
-
result.series = names[0];
|
|
3355
|
-
}
|
|
3356
|
-
if (nameColors.some(Boolean)) result.seriesNameColors = nameColors;
|
|
3325
|
+
if (parsed.nameColors.some(Boolean)) result.seriesNameColors = parsed.nameColors;
|
|
3357
3326
|
continue;
|
|
3358
3327
|
}
|
|
3359
3328
|
if (key === "xlabel") {
|
|
@@ -3415,13 +3384,7 @@ function parseEChart(content, palette) {
|
|
|
3415
3384
|
continue;
|
|
3416
3385
|
}
|
|
3417
3386
|
if (result.type === "function") {
|
|
3418
|
-
|
|
3419
|
-
let fnColor;
|
|
3420
|
-
const colorMatch = fnName.match(/\(([^)]+)\)\s*$/);
|
|
3421
|
-
if (colorMatch) {
|
|
3422
|
-
fnColor = resolveColor(colorMatch[1].trim(), palette);
|
|
3423
|
-
fnName = fnName.substring(0, colorMatch.index).trim();
|
|
3424
|
-
}
|
|
3387
|
+
const { label: fnName, color: fnColor } = extractColor(trimmed.substring(0, colonIndex).trim(), palette);
|
|
3425
3388
|
if (!result.functions) result.functions = [];
|
|
3426
3389
|
result.functions.push({
|
|
3427
3390
|
name: fnName,
|
|
@@ -3436,13 +3399,7 @@ function parseEChart(content, palette) {
|
|
|
3436
3399
|
/^(-?[\d.]+)\s*,\s*(-?[\d.]+)(?:\s*,\s*(-?[\d.]+))?$/
|
|
3437
3400
|
);
|
|
3438
3401
|
if (scatterMatch) {
|
|
3439
|
-
|
|
3440
|
-
let scatterColor;
|
|
3441
|
-
const colorMatch = scatterName.match(/\(([^)]+)\)\s*$/);
|
|
3442
|
-
if (colorMatch) {
|
|
3443
|
-
scatterColor = resolveColor(colorMatch[1].trim(), palette);
|
|
3444
|
-
scatterName = scatterName.substring(0, colorMatch.index).trim();
|
|
3445
|
-
}
|
|
3402
|
+
const { label: scatterName, color: scatterColor } = extractColor(trimmed.substring(0, colonIndex).trim(), palette);
|
|
3446
3403
|
if (!result.scatterPoints) result.scatterPoints = [];
|
|
3447
3404
|
result.scatterPoints.push({
|
|
3448
3405
|
name: scatterName,
|
|
@@ -3467,13 +3424,7 @@ function parseEChart(content, palette) {
|
|
|
3467
3424
|
}
|
|
3468
3425
|
const numValue = parseFloat(value);
|
|
3469
3426
|
if (!isNaN(numValue)) {
|
|
3470
|
-
|
|
3471
|
-
let pointColor;
|
|
3472
|
-
const colorMatch = rawLabel.match(/\(([^)]+)\)\s*$/);
|
|
3473
|
-
if (colorMatch) {
|
|
3474
|
-
pointColor = resolveColor(colorMatch[1].trim(), palette);
|
|
3475
|
-
rawLabel = rawLabel.substring(0, colorMatch.index).trim();
|
|
3476
|
-
}
|
|
3427
|
+
const { label: rawLabel, color: pointColor } = extractColor(trimmed.substring(0, colonIndex).trim(), palette);
|
|
3477
3428
|
result.data.push({
|
|
3478
3429
|
label: rawLabel,
|
|
3479
3430
|
value: numValue,
|
|
@@ -3520,30 +3471,21 @@ function parseEChart(content, palette) {
|
|
|
3520
3471
|
}
|
|
3521
3472
|
return result;
|
|
3522
3473
|
}
|
|
3523
|
-
function
|
|
3474
|
+
function buildChartCommons(parsed, palette, isDark) {
|
|
3524
3475
|
const textColor = palette.text;
|
|
3525
3476
|
const axisLineColor = palette.border;
|
|
3477
|
+
const splitLineColor = palette.border;
|
|
3526
3478
|
const gridOpacity = isDark ? 0.7 : 0.55;
|
|
3527
3479
|
const colors = getSeriesColors(palette);
|
|
3480
|
+
const titleConfig = parsed.title ? { text: parsed.title, left: "center", top: 8, textStyle: { color: textColor, fontSize: 20, fontWeight: "bold", fontFamily: FONT_FAMILY } } : void 0;
|
|
3481
|
+
const tooltipTheme = { backgroundColor: palette.surface, borderColor: palette.border, textStyle: { color: palette.text } };
|
|
3482
|
+
return { textColor, axisLineColor, splitLineColor, gridOpacity, colors, titleConfig, tooltipTheme };
|
|
3483
|
+
}
|
|
3484
|
+
function buildEChartsOption(parsed, palette, isDark) {
|
|
3528
3485
|
if (parsed.error) {
|
|
3529
3486
|
return {};
|
|
3530
3487
|
}
|
|
3531
|
-
const titleConfig = parsed
|
|
3532
|
-
text: parsed.title,
|
|
3533
|
-
left: "center",
|
|
3534
|
-
top: 8,
|
|
3535
|
-
textStyle: {
|
|
3536
|
-
color: textColor,
|
|
3537
|
-
fontSize: 20,
|
|
3538
|
-
fontWeight: "bold",
|
|
3539
|
-
fontFamily: FONT_FAMILY
|
|
3540
|
-
}
|
|
3541
|
-
} : void 0;
|
|
3542
|
-
const tooltipTheme = {
|
|
3543
|
-
backgroundColor: palette.surface,
|
|
3544
|
-
borderColor: palette.border,
|
|
3545
|
-
textStyle: { color: palette.text }
|
|
3546
|
-
};
|
|
3488
|
+
const { textColor, axisLineColor, gridOpacity, colors, titleConfig, tooltipTheme } = buildChartCommons(parsed, palette, isDark);
|
|
3547
3489
|
if (parsed.type === "sankey") {
|
|
3548
3490
|
return buildSankeyOption(
|
|
3549
3491
|
parsed,
|
|
@@ -3619,8 +3561,7 @@ function buildSankeyOption(parsed, textColor, colors, titleConfig, tooltipTheme)
|
|
|
3619
3561
|
}
|
|
3620
3562
|
}));
|
|
3621
3563
|
return {
|
|
3622
|
-
|
|
3623
|
-
animation: false,
|
|
3564
|
+
...CHART_BASE,
|
|
3624
3565
|
title: titleConfig,
|
|
3625
3566
|
tooltip: {
|
|
3626
3567
|
show: false,
|
|
@@ -3677,8 +3618,7 @@ function buildChordOption(parsed, textColor, colors, titleConfig, tooltipTheme)
|
|
|
3677
3618
|
}
|
|
3678
3619
|
}));
|
|
3679
3620
|
return {
|
|
3680
|
-
|
|
3681
|
-
animation: false,
|
|
3621
|
+
...CHART_BASE,
|
|
3682
3622
|
title: titleConfig,
|
|
3683
3623
|
tooltip: {
|
|
3684
3624
|
trigger: "item",
|
|
@@ -3780,15 +3720,11 @@ function buildFunctionOption(parsed, palette, textColor, axisLineColor, gridOpac
|
|
|
3780
3720
|
itemStyle: {
|
|
3781
3721
|
color: fnColor
|
|
3782
3722
|
},
|
|
3783
|
-
emphasis:
|
|
3784
|
-
focus: "self",
|
|
3785
|
-
blurScope: "global"
|
|
3786
|
-
}
|
|
3723
|
+
emphasis: EMPHASIS_SELF
|
|
3787
3724
|
};
|
|
3788
3725
|
});
|
|
3789
3726
|
return {
|
|
3790
|
-
|
|
3791
|
-
animation: false,
|
|
3727
|
+
...CHART_BASE,
|
|
3792
3728
|
title: titleConfig,
|
|
3793
3729
|
tooltip: {
|
|
3794
3730
|
trigger: "axis",
|
|
@@ -3933,8 +3869,7 @@ function buildScatterOption(parsed, palette, textColor, axisLineColor, gridOpaci
|
|
|
3933
3869
|
const xPad = (xMax - xMin) * 0.1 || 1;
|
|
3934
3870
|
const yPad = (yMax - yMin) * 0.1 || 1;
|
|
3935
3871
|
return {
|
|
3936
|
-
|
|
3937
|
-
animation: false,
|
|
3872
|
+
...CHART_BASE,
|
|
3938
3873
|
title: titleConfig,
|
|
3939
3874
|
tooltip,
|
|
3940
3875
|
...legendData && {
|
|
@@ -4019,8 +3954,7 @@ function buildHeatmapOption(parsed, palette, textColor, axisLineColor, titleConf
|
|
|
4019
3954
|
});
|
|
4020
3955
|
});
|
|
4021
3956
|
return {
|
|
4022
|
-
|
|
4023
|
-
animation: false,
|
|
3957
|
+
...CHART_BASE,
|
|
4024
3958
|
title: titleConfig,
|
|
4025
3959
|
tooltip: {
|
|
4026
3960
|
trigger: "item",
|
|
@@ -4097,8 +4031,7 @@ function buildHeatmapOption(parsed, palette, textColor, axisLineColor, titleConf
|
|
|
4097
4031
|
fontWeight: "bold"
|
|
4098
4032
|
},
|
|
4099
4033
|
emphasis: {
|
|
4100
|
-
|
|
4101
|
-
blurScope: "global",
|
|
4034
|
+
...EMPHASIS_SELF,
|
|
4102
4035
|
itemStyle: {
|
|
4103
4036
|
shadowBlur: 10,
|
|
4104
4037
|
shadowColor: "rgba(0, 0, 0, 0.5)"
|
|
@@ -4137,8 +4070,7 @@ function buildFunnelOption(parsed, textColor, colors, titleConfig, tooltipTheme)
|
|
|
4137
4070
|
minSize: "8%"
|
|
4138
4071
|
};
|
|
4139
4072
|
return {
|
|
4140
|
-
|
|
4141
|
-
animation: false,
|
|
4073
|
+
...CHART_BASE,
|
|
4142
4074
|
title: titleConfig,
|
|
4143
4075
|
tooltip: {
|
|
4144
4076
|
trigger: "item",
|
|
@@ -4176,8 +4108,7 @@ function buildFunnelOption(parsed, textColor, colors, titleConfig, tooltipTheme)
|
|
|
4176
4108
|
lineStyle: { color: textColor, opacity: 0.3 }
|
|
4177
4109
|
},
|
|
4178
4110
|
emphasis: {
|
|
4179
|
-
|
|
4180
|
-
blurScope: "global",
|
|
4111
|
+
...EMPHASIS_SELF,
|
|
4181
4112
|
label: {
|
|
4182
4113
|
fontSize: 15
|
|
4183
4114
|
}
|
|
@@ -4260,27 +4191,7 @@ function makeGridAxis(type, textColor, axisLineColor, splitLineColor, gridOpacit
|
|
|
4260
4191
|
}
|
|
4261
4192
|
function buildEChartsOptionFromChart(parsed, palette, isDark, chartWidth) {
|
|
4262
4193
|
if (parsed.error) return {};
|
|
4263
|
-
const textColor = palette
|
|
4264
|
-
const axisLineColor = palette.border;
|
|
4265
|
-
const splitLineColor = palette.border;
|
|
4266
|
-
const gridOpacity = isDark ? 0.7 : 0.55;
|
|
4267
|
-
const colors = getSeriesColors(palette);
|
|
4268
|
-
const titleConfig = parsed.title ? {
|
|
4269
|
-
text: parsed.title,
|
|
4270
|
-
left: "center",
|
|
4271
|
-
top: 8,
|
|
4272
|
-
textStyle: {
|
|
4273
|
-
color: textColor,
|
|
4274
|
-
fontSize: 20,
|
|
4275
|
-
fontWeight: "bold",
|
|
4276
|
-
fontFamily: FONT_FAMILY
|
|
4277
|
-
}
|
|
4278
|
-
} : void 0;
|
|
4279
|
-
const tooltipTheme = {
|
|
4280
|
-
backgroundColor: palette.surface,
|
|
4281
|
-
borderColor: palette.border,
|
|
4282
|
-
textStyle: { color: palette.text }
|
|
4283
|
-
};
|
|
4194
|
+
const { textColor, axisLineColor, splitLineColor, gridOpacity, colors, titleConfig, tooltipTheme } = buildChartCommons(parsed, palette, isDark);
|
|
4284
4195
|
switch (parsed.type) {
|
|
4285
4196
|
case "bar":
|
|
4286
4197
|
return buildBarOption(parsed, textColor, axisLineColor, splitLineColor, gridOpacity, colors, titleConfig, tooltipTheme, chartWidth);
|
|
@@ -4300,6 +4211,15 @@ function buildEChartsOptionFromChart(parsed, palette, isDark, chartWidth) {
|
|
|
4300
4211
|
return buildPolarAreaOption(parsed, textColor, getSegmentColors(palette, parsed.data.length), titleConfig, tooltipTheme);
|
|
4301
4212
|
}
|
|
4302
4213
|
}
|
|
4214
|
+
function makeChartGrid(options) {
|
|
4215
|
+
return {
|
|
4216
|
+
left: options.yLabel ? "12%" : "3%",
|
|
4217
|
+
right: "4%",
|
|
4218
|
+
bottom: options.hasLegend ? "15%" : options.xLabel ? "10%" : "3%",
|
|
4219
|
+
top: options.hasTitle ? "15%" : "5%",
|
|
4220
|
+
containLabel: true
|
|
4221
|
+
};
|
|
4222
|
+
}
|
|
4303
4223
|
function buildBarOption(parsed, textColor, axisLineColor, splitLineColor, gridOpacity, colors, titleConfig, tooltipTheme, chartWidth) {
|
|
4304
4224
|
const { xLabel, yLabel } = resolveAxisLabels(parsed);
|
|
4305
4225
|
const isHorizontal = parsed.orientation === "horizontal";
|
|
@@ -4312,31 +4232,21 @@ function buildBarOption(parsed, textColor, axisLineColor, splitLineColor, gridOp
|
|
|
4312
4232
|
const categoryAxis = makeGridAxis("category", textColor, axisLineColor, splitLineColor, gridOpacity, isHorizontal ? yLabel : xLabel, labels, hCatGap, !isHorizontal ? chartWidth : void 0);
|
|
4313
4233
|
const valueAxis = makeGridAxis("value", textColor, axisLineColor, splitLineColor, gridOpacity, isHorizontal ? xLabel : yLabel);
|
|
4314
4234
|
return {
|
|
4315
|
-
|
|
4316
|
-
animation: false,
|
|
4235
|
+
...CHART_BASE,
|
|
4317
4236
|
title: titleConfig,
|
|
4318
4237
|
tooltip: {
|
|
4319
4238
|
trigger: "axis",
|
|
4320
4239
|
...tooltipTheme,
|
|
4321
4240
|
axisPointer: { type: "shadow" }
|
|
4322
4241
|
},
|
|
4323
|
-
grid: {
|
|
4324
|
-
left: yLabel ? "12%" : "3%",
|
|
4325
|
-
right: "4%",
|
|
4326
|
-
bottom: xLabel ? "10%" : "3%",
|
|
4327
|
-
top: parsed.title ? "15%" : "5%",
|
|
4328
|
-
containLabel: true
|
|
4329
|
-
},
|
|
4242
|
+
grid: makeChartGrid({ xLabel, yLabel, hasTitle: !!parsed.title }),
|
|
4330
4243
|
xAxis: isHorizontal ? valueAxis : categoryAxis,
|
|
4331
4244
|
yAxis: isHorizontal ? categoryAxis : valueAxis,
|
|
4332
4245
|
series: [
|
|
4333
4246
|
{
|
|
4334
4247
|
type: "bar",
|
|
4335
4248
|
data,
|
|
4336
|
-
emphasis:
|
|
4337
|
-
focus: "self",
|
|
4338
|
-
blurScope: "global"
|
|
4339
|
-
}
|
|
4249
|
+
emphasis: EMPHASIS_SELF
|
|
4340
4250
|
}
|
|
4341
4251
|
]
|
|
4342
4252
|
};
|
|
@@ -4347,21 +4257,14 @@ function buildLineOption(parsed, palette, textColor, axisLineColor, splitLineCol
|
|
|
4347
4257
|
const labels = parsed.data.map((d) => d.label);
|
|
4348
4258
|
const values = parsed.data.map((d) => d.value);
|
|
4349
4259
|
return {
|
|
4350
|
-
|
|
4351
|
-
animation: false,
|
|
4260
|
+
...CHART_BASE,
|
|
4352
4261
|
title: titleConfig,
|
|
4353
4262
|
tooltip: {
|
|
4354
4263
|
trigger: "axis",
|
|
4355
4264
|
...tooltipTheme,
|
|
4356
4265
|
axisPointer: { type: "line" }
|
|
4357
4266
|
},
|
|
4358
|
-
grid: {
|
|
4359
|
-
left: yLabel ? "12%" : "3%",
|
|
4360
|
-
right: "4%",
|
|
4361
|
-
bottom: xLabel ? "10%" : "3%",
|
|
4362
|
-
top: parsed.title ? "15%" : "5%",
|
|
4363
|
-
containLabel: true
|
|
4364
|
-
},
|
|
4267
|
+
grid: makeChartGrid({ xLabel, yLabel, hasTitle: !!parsed.title }),
|
|
4365
4268
|
xAxis: makeGridAxis("category", textColor, axisLineColor, splitLineColor, gridOpacity, xLabel, labels, void 0, chartWidth),
|
|
4366
4269
|
yAxis: makeGridAxis("value", textColor, axisLineColor, splitLineColor, gridOpacity, yLabel),
|
|
4367
4270
|
series: [
|
|
@@ -4372,10 +4275,7 @@ function buildLineOption(parsed, palette, textColor, axisLineColor, splitLineCol
|
|
|
4372
4275
|
symbolSize: 8,
|
|
4373
4276
|
lineStyle: { color: lineColor, width: 3 },
|
|
4374
4277
|
itemStyle: { color: lineColor },
|
|
4375
|
-
emphasis:
|
|
4376
|
-
focus: "self",
|
|
4377
|
-
blurScope: "global"
|
|
4378
|
-
}
|
|
4278
|
+
emphasis: EMPHASIS_SELF
|
|
4379
4279
|
}
|
|
4380
4280
|
]
|
|
4381
4281
|
};
|
|
@@ -4397,15 +4297,11 @@ function buildMultiLineOption(parsed, textColor, axisLineColor, splitLineColor,
|
|
|
4397
4297
|
symbolSize: 8,
|
|
4398
4298
|
lineStyle: { color, width: 3 },
|
|
4399
4299
|
itemStyle: { color },
|
|
4400
|
-
emphasis:
|
|
4401
|
-
focus: "self",
|
|
4402
|
-
blurScope: "global"
|
|
4403
|
-
}
|
|
4300
|
+
emphasis: EMPHASIS_SELF
|
|
4404
4301
|
};
|
|
4405
4302
|
});
|
|
4406
4303
|
return {
|
|
4407
|
-
|
|
4408
|
-
animation: false,
|
|
4304
|
+
...CHART_BASE,
|
|
4409
4305
|
title: titleConfig,
|
|
4410
4306
|
tooltip: {
|
|
4411
4307
|
trigger: "axis",
|
|
@@ -4417,13 +4313,7 @@ function buildMultiLineOption(parsed, textColor, axisLineColor, splitLineColor,
|
|
|
4417
4313
|
bottom: 10,
|
|
4418
4314
|
textStyle: { color: textColor }
|
|
4419
4315
|
},
|
|
4420
|
-
grid: {
|
|
4421
|
-
left: yLabel ? "12%" : "3%",
|
|
4422
|
-
right: "4%",
|
|
4423
|
-
bottom: "15%",
|
|
4424
|
-
top: parsed.title ? "15%" : "5%",
|
|
4425
|
-
containLabel: true
|
|
4426
|
-
},
|
|
4316
|
+
grid: makeChartGrid({ xLabel, yLabel, hasTitle: !!parsed.title, hasLegend: true }),
|
|
4427
4317
|
xAxis: makeGridAxis("category", textColor, axisLineColor, splitLineColor, gridOpacity, xLabel, labels, void 0, chartWidth),
|
|
4428
4318
|
yAxis: makeGridAxis("value", textColor, axisLineColor, splitLineColor, gridOpacity, yLabel),
|
|
4429
4319
|
series
|
|
@@ -4435,21 +4325,14 @@ function buildAreaOption(parsed, palette, textColor, axisLineColor, splitLineCol
|
|
|
4435
4325
|
const labels = parsed.data.map((d) => d.label);
|
|
4436
4326
|
const values = parsed.data.map((d) => d.value);
|
|
4437
4327
|
return {
|
|
4438
|
-
|
|
4439
|
-
animation: false,
|
|
4328
|
+
...CHART_BASE,
|
|
4440
4329
|
title: titleConfig,
|
|
4441
4330
|
tooltip: {
|
|
4442
4331
|
trigger: "axis",
|
|
4443
4332
|
...tooltipTheme,
|
|
4444
4333
|
axisPointer: { type: "line" }
|
|
4445
4334
|
},
|
|
4446
|
-
grid: {
|
|
4447
|
-
left: yLabel ? "12%" : "3%",
|
|
4448
|
-
right: "4%",
|
|
4449
|
-
bottom: xLabel ? "10%" : "3%",
|
|
4450
|
-
top: parsed.title ? "15%" : "5%",
|
|
4451
|
-
containLabel: true
|
|
4452
|
-
},
|
|
4335
|
+
grid: makeChartGrid({ xLabel, yLabel, hasTitle: !!parsed.title }),
|
|
4453
4336
|
xAxis: makeGridAxis("category", textColor, axisLineColor, splitLineColor, gridOpacity, xLabel, labels, void 0, chartWidth),
|
|
4454
4337
|
yAxis: makeGridAxis("value", textColor, axisLineColor, splitLineColor, gridOpacity, yLabel),
|
|
4455
4338
|
series: [
|
|
@@ -4461,10 +4344,7 @@ function buildAreaOption(parsed, palette, textColor, axisLineColor, splitLineCol
|
|
|
4461
4344
|
lineStyle: { color: lineColor, width: 3 },
|
|
4462
4345
|
itemStyle: { color: lineColor },
|
|
4463
4346
|
areaStyle: { opacity: 0.25 },
|
|
4464
|
-
emphasis:
|
|
4465
|
-
focus: "self",
|
|
4466
|
-
blurScope: "global"
|
|
4467
|
-
}
|
|
4347
|
+
emphasis: EMPHASIS_SELF
|
|
4468
4348
|
}
|
|
4469
4349
|
]
|
|
4470
4350
|
};
|
|
@@ -4488,8 +4368,7 @@ function buildPieOption(parsed, textColor, colors, titleConfig, tooltipTheme, is
|
|
|
4488
4368
|
itemStyle: { color: d.color ?? colors[i % colors.length] }
|
|
4489
4369
|
}));
|
|
4490
4370
|
return {
|
|
4491
|
-
|
|
4492
|
-
animation: false,
|
|
4371
|
+
...CHART_BASE,
|
|
4493
4372
|
title: titleConfig,
|
|
4494
4373
|
tooltip: {
|
|
4495
4374
|
trigger: "item",
|
|
@@ -4507,10 +4386,7 @@ function buildPieOption(parsed, textColor, colors, titleConfig, tooltipTheme, is
|
|
|
4507
4386
|
fontFamily: FONT_FAMILY
|
|
4508
4387
|
},
|
|
4509
4388
|
labelLine: { show: true },
|
|
4510
|
-
emphasis:
|
|
4511
|
-
focus: "self",
|
|
4512
|
-
blurScope: "global"
|
|
4513
|
-
}
|
|
4389
|
+
emphasis: EMPHASIS_SELF
|
|
4514
4390
|
}
|
|
4515
4391
|
]
|
|
4516
4392
|
};
|
|
@@ -4524,8 +4400,7 @@ function buildRadarOption(parsed, palette, textColor, gridOpacity, colors, title
|
|
|
4524
4400
|
max: maxValue
|
|
4525
4401
|
}));
|
|
4526
4402
|
return {
|
|
4527
|
-
|
|
4528
|
-
animation: false,
|
|
4403
|
+
...CHART_BASE,
|
|
4529
4404
|
title: titleConfig,
|
|
4530
4405
|
tooltip: {
|
|
4531
4406
|
trigger: "item",
|
|
@@ -4567,10 +4442,7 @@ function buildRadarOption(parsed, palette, textColor, gridOpacity, colors, title
|
|
|
4567
4442
|
}
|
|
4568
4443
|
}
|
|
4569
4444
|
],
|
|
4570
|
-
emphasis:
|
|
4571
|
-
focus: "self",
|
|
4572
|
-
blurScope: "global"
|
|
4573
|
-
}
|
|
4445
|
+
emphasis: EMPHASIS_SELF
|
|
4574
4446
|
}
|
|
4575
4447
|
]
|
|
4576
4448
|
};
|
|
@@ -4582,8 +4454,7 @@ function buildPolarAreaOption(parsed, textColor, colors, titleConfig, tooltipThe
|
|
|
4582
4454
|
itemStyle: { color: d.color ?? colors[i % colors.length] }
|
|
4583
4455
|
}));
|
|
4584
4456
|
return {
|
|
4585
|
-
|
|
4586
|
-
animation: false,
|
|
4457
|
+
...CHART_BASE,
|
|
4587
4458
|
title: titleConfig,
|
|
4588
4459
|
tooltip: {
|
|
4589
4460
|
trigger: "item",
|
|
@@ -4602,10 +4473,7 @@ function buildPolarAreaOption(parsed, textColor, colors, titleConfig, tooltipThe
|
|
|
4602
4473
|
fontFamily: FONT_FAMILY
|
|
4603
4474
|
},
|
|
4604
4475
|
labelLine: { show: true },
|
|
4605
|
-
emphasis:
|
|
4606
|
-
focus: "self",
|
|
4607
|
-
blurScope: "global"
|
|
4608
|
-
}
|
|
4476
|
+
emphasis: EMPHASIS_SELF
|
|
4609
4477
|
}
|
|
4610
4478
|
]
|
|
4611
4479
|
};
|
|
@@ -4635,10 +4503,7 @@ function buildBarStackedOption(parsed, textColor, axisLineColor, splitLineColor,
|
|
|
4635
4503
|
fontWeight: "bold",
|
|
4636
4504
|
fontFamily: FONT_FAMILY
|
|
4637
4505
|
},
|
|
4638
|
-
emphasis:
|
|
4639
|
-
focus: "self",
|
|
4640
|
-
blurScope: "global"
|
|
4641
|
-
}
|
|
4506
|
+
emphasis: EMPHASIS_SELF
|
|
4642
4507
|
};
|
|
4643
4508
|
});
|
|
4644
4509
|
const hCatGap = isHorizontal && yLabel ? Math.max(40, Math.max(...labels.map((l) => l.length)) * 8 + 16) : void 0;
|
|
@@ -4646,8 +4511,7 @@ function buildBarStackedOption(parsed, textColor, axisLineColor, splitLineColor,
|
|
|
4646
4511
|
const hValueGap = isHorizontal && xLabel ? 40 : void 0;
|
|
4647
4512
|
const valueAxis = makeGridAxis("value", textColor, axisLineColor, splitLineColor, gridOpacity, isHorizontal ? xLabel : yLabel, void 0, hValueGap);
|
|
4648
4513
|
return {
|
|
4649
|
-
|
|
4650
|
-
animation: false,
|
|
4514
|
+
...CHART_BASE,
|
|
4651
4515
|
title: titleConfig,
|
|
4652
4516
|
tooltip: {
|
|
4653
4517
|
trigger: "axis",
|
|
@@ -4659,13 +4523,7 @@ function buildBarStackedOption(parsed, textColor, axisLineColor, splitLineColor,
|
|
|
4659
4523
|
bottom: 10,
|
|
4660
4524
|
textStyle: { color: textColor }
|
|
4661
4525
|
},
|
|
4662
|
-
grid: {
|
|
4663
|
-
left: yLabel ? "12%" : "3%",
|
|
4664
|
-
right: "4%",
|
|
4665
|
-
bottom: "15%",
|
|
4666
|
-
top: parsed.title ? "15%" : "5%",
|
|
4667
|
-
containLabel: true
|
|
4668
|
-
},
|
|
4526
|
+
grid: makeChartGrid({ xLabel, yLabel, hasTitle: !!parsed.title, hasLegend: true }),
|
|
4669
4527
|
xAxis: isHorizontal ? valueAxis : categoryAxis,
|
|
4670
4528
|
yAxis: isHorizontal ? categoryAxis : valueAxis,
|
|
4671
4529
|
series
|
|
@@ -4712,31 +4570,22 @@ async function renderEChartsForExport(content, theme, palette, options) {
|
|
|
4712
4570
|
chart.dispose();
|
|
4713
4571
|
}
|
|
4714
4572
|
}
|
|
4715
|
-
var echarts, ECHART_EXPORT_WIDTH, ECHART_EXPORT_HEIGHT
|
|
4573
|
+
var echarts, EMPHASIS_SELF, CHART_BASE, ECHART_EXPORT_WIDTH, ECHART_EXPORT_HEIGHT;
|
|
4716
4574
|
var init_echarts = __esm({
|
|
4717
4575
|
"src/echarts.ts"() {
|
|
4718
4576
|
"use strict";
|
|
4719
4577
|
echarts = __toESM(require("echarts"), 1);
|
|
4720
4578
|
init_fonts();
|
|
4721
4579
|
init_branding();
|
|
4722
|
-
init_colors();
|
|
4723
4580
|
init_palettes();
|
|
4724
4581
|
init_chart();
|
|
4725
4582
|
init_diagnostics();
|
|
4726
4583
|
init_parsing();
|
|
4584
|
+
init_dgmo_router();
|
|
4585
|
+
EMPHASIS_SELF = { focus: "self", blurScope: "global" };
|
|
4586
|
+
CHART_BASE = { backgroundColor: "transparent", animation: false };
|
|
4727
4587
|
ECHART_EXPORT_WIDTH = 1200;
|
|
4728
4588
|
ECHART_EXPORT_HEIGHT = 800;
|
|
4729
|
-
STANDARD_CHART_TYPES = /* @__PURE__ */ new Set([
|
|
4730
|
-
"bar",
|
|
4731
|
-
"line",
|
|
4732
|
-
"multi-line",
|
|
4733
|
-
"area",
|
|
4734
|
-
"pie",
|
|
4735
|
-
"doughnut",
|
|
4736
|
-
"radar",
|
|
4737
|
-
"polar-area",
|
|
4738
|
-
"bar-stacked"
|
|
4739
|
-
]);
|
|
4740
4589
|
}
|
|
4741
4590
|
});
|
|
4742
4591
|
|
|
@@ -6066,6 +5915,7 @@ var init_parser7 = __esm({
|
|
|
6066
5915
|
var dgmo_router_exports = {};
|
|
6067
5916
|
__export(dgmo_router_exports, {
|
|
6068
5917
|
DGMO_CHART_TYPE_MAP: () => DGMO_CHART_TYPE_MAP,
|
|
5918
|
+
STANDARD_CHART_TYPES: () => STANDARD_CHART_TYPES,
|
|
6069
5919
|
getDgmoFramework: () => getDgmoFramework,
|
|
6070
5920
|
parseDgmo: () => parseDgmo,
|
|
6071
5921
|
parseDgmoChartType: () => parseDgmoChartType
|
|
@@ -6093,53 +5943,19 @@ function parseDgmoChartType(content) {
|
|
|
6093
5943
|
function parseDgmo(content) {
|
|
6094
5944
|
const chartType = parseDgmoChartType(content);
|
|
6095
5945
|
if (!chartType) {
|
|
6096
|
-
|
|
6097
|
-
return { diagnostics: parsed2.diagnostics };
|
|
6098
|
-
}
|
|
6099
|
-
if (chartType === "sequence") {
|
|
6100
|
-
const parsed2 = parseSequenceDgmo(content);
|
|
6101
|
-
return { diagnostics: parsed2.diagnostics };
|
|
6102
|
-
}
|
|
6103
|
-
if (chartType === "flowchart") {
|
|
6104
|
-
const parsed2 = parseFlowchart(content);
|
|
6105
|
-
return { diagnostics: parsed2.diagnostics };
|
|
6106
|
-
}
|
|
6107
|
-
if (chartType === "class") {
|
|
6108
|
-
const parsed2 = parseClassDiagram(content);
|
|
6109
|
-
return { diagnostics: parsed2.diagnostics };
|
|
6110
|
-
}
|
|
6111
|
-
if (chartType === "er") {
|
|
6112
|
-
const parsed2 = parseERDiagram(content);
|
|
6113
|
-
return { diagnostics: parsed2.diagnostics };
|
|
6114
|
-
}
|
|
6115
|
-
if (chartType === "org") {
|
|
6116
|
-
const parsed2 = parseOrg(content);
|
|
6117
|
-
return { diagnostics: parsed2.diagnostics };
|
|
6118
|
-
}
|
|
6119
|
-
if (chartType === "kanban") {
|
|
6120
|
-
const parsed2 = parseKanban(content);
|
|
6121
|
-
return { diagnostics: parsed2.diagnostics };
|
|
6122
|
-
}
|
|
6123
|
-
if (chartType === "c4") {
|
|
6124
|
-
const parsed2 = parseC4(content);
|
|
6125
|
-
return { diagnostics: parsed2.diagnostics };
|
|
6126
|
-
}
|
|
6127
|
-
if (chartType === "initiative-status") {
|
|
6128
|
-
const parsed2 = parseInitiativeStatus(content);
|
|
6129
|
-
return { diagnostics: parsed2.diagnostics };
|
|
5946
|
+
return { diagnostics: parseD3(content).diagnostics };
|
|
6130
5947
|
}
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
5948
|
+
const directParser = PARSE_DISPATCH.get(chartType);
|
|
5949
|
+
if (directParser) return { diagnostics: directParser(content).diagnostics };
|
|
5950
|
+
if (STANDARD_CHART_TYPES.has(chartType)) {
|
|
5951
|
+
return { diagnostics: parseChart(content).diagnostics };
|
|
6134
5952
|
}
|
|
6135
5953
|
if (ECHART_TYPES.has(chartType)) {
|
|
6136
|
-
|
|
6137
|
-
return { diagnostics: parsed2.diagnostics };
|
|
5954
|
+
return { diagnostics: parseEChart(content).diagnostics };
|
|
6138
5955
|
}
|
|
6139
|
-
|
|
6140
|
-
return { diagnostics: parsed.diagnostics };
|
|
5956
|
+
return { diagnostics: parseD3(content).diagnostics };
|
|
6141
5957
|
}
|
|
6142
|
-
var DGMO_CHART_TYPE_MAP,
|
|
5958
|
+
var DGMO_CHART_TYPE_MAP, STANDARD_CHART_TYPES, ECHART_TYPES, PARSE_DISPATCH;
|
|
6143
5959
|
var init_dgmo_router = __esm({
|
|
6144
5960
|
"src/dgmo-router.ts"() {
|
|
6145
5961
|
"use strict";
|
|
@@ -6188,7 +6004,7 @@ var init_dgmo_router = __esm({
|
|
|
6188
6004
|
c4: "d3",
|
|
6189
6005
|
"initiative-status": "d3"
|
|
6190
6006
|
};
|
|
6191
|
-
|
|
6007
|
+
STANDARD_CHART_TYPES = /* @__PURE__ */ new Set([
|
|
6192
6008
|
"bar",
|
|
6193
6009
|
"line",
|
|
6194
6010
|
"multi-line",
|
|
@@ -6207,6 +6023,16 @@ var init_dgmo_router = __esm({
|
|
|
6207
6023
|
"heatmap",
|
|
6208
6024
|
"funnel"
|
|
6209
6025
|
]);
|
|
6026
|
+
PARSE_DISPATCH = /* @__PURE__ */ new Map([
|
|
6027
|
+
["sequence", (c) => parseSequenceDgmo(c)],
|
|
6028
|
+
["flowchart", (c) => parseFlowchart(c)],
|
|
6029
|
+
["class", (c) => parseClassDiagram(c)],
|
|
6030
|
+
["er", (c) => parseERDiagram(c)],
|
|
6031
|
+
["org", (c) => parseOrg(c)],
|
|
6032
|
+
["kanban", (c) => parseKanban(c)],
|
|
6033
|
+
["c4", (c) => parseC4(c)],
|
|
6034
|
+
["initiative-status", (c) => parseInitiativeStatus(c)]
|
|
6035
|
+
]);
|
|
6210
6036
|
}
|
|
6211
6037
|
});
|
|
6212
6038
|
|
|
@@ -12205,7 +12031,7 @@ function buildRenderSequence(messages) {
|
|
|
12205
12031
|
type: "return",
|
|
12206
12032
|
from: top.to,
|
|
12207
12033
|
to: top.from,
|
|
12208
|
-
label:
|
|
12034
|
+
label: "",
|
|
12209
12035
|
messageIndex: top.messageIndex
|
|
12210
12036
|
});
|
|
12211
12037
|
}
|
|
@@ -12231,12 +12057,8 @@ function buildRenderSequence(messages) {
|
|
|
12231
12057
|
to: msg.to,
|
|
12232
12058
|
label: msg.label,
|
|
12233
12059
|
messageIndex: mi,
|
|
12234
|
-
...msg.async ? { async: true } : {}
|
|
12235
|
-
...msg.bidirectional ? { bidirectional: true } : {}
|
|
12060
|
+
...msg.async ? { async: true } : {}
|
|
12236
12061
|
});
|
|
12237
|
-
if (msg.bidirectional) {
|
|
12238
|
-
continue;
|
|
12239
|
-
}
|
|
12240
12062
|
if (msg.async) {
|
|
12241
12063
|
continue;
|
|
12242
12064
|
}
|
|
@@ -12245,14 +12067,13 @@ function buildRenderSequence(messages) {
|
|
|
12245
12067
|
type: "return",
|
|
12246
12068
|
from: msg.to,
|
|
12247
12069
|
to: msg.from,
|
|
12248
|
-
label:
|
|
12070
|
+
label: "",
|
|
12249
12071
|
messageIndex: mi
|
|
12250
12072
|
});
|
|
12251
12073
|
} else {
|
|
12252
12074
|
stack.push({
|
|
12253
12075
|
from: msg.from,
|
|
12254
12076
|
to: msg.to,
|
|
12255
|
-
returnLabel: msg.returnLabel,
|
|
12256
12077
|
messageIndex: mi
|
|
12257
12078
|
});
|
|
12258
12079
|
}
|
|
@@ -12263,7 +12084,7 @@ function buildRenderSequence(messages) {
|
|
|
12263
12084
|
type: "return",
|
|
12264
12085
|
from: top.to,
|
|
12265
12086
|
to: top.from,
|
|
12266
|
-
label:
|
|
12087
|
+
label: "",
|
|
12267
12088
|
messageIndex: top.messageIndex
|
|
12268
12089
|
});
|
|
12269
12090
|
}
|
|
@@ -12728,14 +12549,6 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
12728
12549
|
"points",
|
|
12729
12550
|
`0,0 ${ARROWHEAD_SIZE},${ARROWHEAD_SIZE / 2} 0,${ARROWHEAD_SIZE}`
|
|
12730
12551
|
).attr("fill", "none").attr("stroke", palette.text).attr("stroke-width", 1.2);
|
|
12731
|
-
defs.append("marker").attr("id", "seq-arrowhead-reverse").attr("viewBox", `0 0 ${ARROWHEAD_SIZE} ${ARROWHEAD_SIZE}`).attr("refX", 0).attr("refY", ARROWHEAD_SIZE / 2).attr("markerWidth", ARROWHEAD_SIZE).attr("markerHeight", ARROWHEAD_SIZE).attr("orient", "auto").append("polygon").attr(
|
|
12732
|
-
"points",
|
|
12733
|
-
`${ARROWHEAD_SIZE},0 0,${ARROWHEAD_SIZE / 2} ${ARROWHEAD_SIZE},${ARROWHEAD_SIZE}`
|
|
12734
|
-
).attr("fill", palette.text);
|
|
12735
|
-
defs.append("marker").attr("id", "seq-arrowhead-async-reverse").attr("viewBox", `0 0 ${ARROWHEAD_SIZE} ${ARROWHEAD_SIZE}`).attr("refX", 0).attr("refY", ARROWHEAD_SIZE / 2).attr("markerWidth", ARROWHEAD_SIZE).attr("markerHeight", ARROWHEAD_SIZE).attr("orient", "auto").append("polyline").attr(
|
|
12736
|
-
"points",
|
|
12737
|
-
`${ARROWHEAD_SIZE},0 0,${ARROWHEAD_SIZE / 2} ${ARROWHEAD_SIZE},${ARROWHEAD_SIZE}`
|
|
12738
|
-
).attr("fill", "none").attr("stroke", palette.text).attr("stroke-width", 1.2);
|
|
12739
12552
|
if (title) {
|
|
12740
12553
|
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", svgWidth / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", palette.text).attr("font-size", 20).attr("font-weight", "bold").text(title);
|
|
12741
12554
|
if (parsed.titleLineNumber) {
|
|
@@ -13016,17 +12829,10 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
13016
12829
|
const x1 = arrowEdgeX(step.from, i, goingRight ? "right" : "left");
|
|
13017
12830
|
const x2 = arrowEdgeX(step.to, i, goingRight ? "left" : "right");
|
|
13018
12831
|
const markerRef = step.async ? "url(#seq-arrowhead-async)" : "url(#seq-arrowhead)";
|
|
13019
|
-
|
|
13020
|
-
const line7 = svg.append("line").attr("x1", x1).attr("y1", y).attr("x2", x2).attr("y2", y).attr("stroke", palette.text).attr("stroke-width", 1.2).attr("marker-end", markerRef).attr("class", "message-arrow").attr(
|
|
12832
|
+
svg.append("line").attr("x1", x1).attr("y1", y).attr("x2", x2).attr("y2", y).attr("stroke", palette.text).attr("stroke-width", 1.2).attr("marker-end", markerRef).attr("class", "message-arrow").attr(
|
|
13021
12833
|
"data-line-number",
|
|
13022
12834
|
String(messages[step.messageIndex].lineNumber)
|
|
13023
12835
|
).attr("data-msg-index", String(step.messageIndex)).attr("data-step-index", String(i));
|
|
13024
|
-
if (markerStartRef) {
|
|
13025
|
-
line7.attr("marker-start", markerStartRef);
|
|
13026
|
-
}
|
|
13027
|
-
if (step.bidirectional && step.async) {
|
|
13028
|
-
line7.attr("stroke-dasharray", "6 4");
|
|
13029
|
-
}
|
|
13030
12836
|
if (step.label) {
|
|
13031
12837
|
const midX = (x1 + x2) / 2;
|
|
13032
12838
|
const labelEl = svg.append("text").attr("x", midX).attr("y", y - 8).attr("text-anchor", "middle").attr("fill", palette.text).attr("font-size", 12).attr("class", "message-label").attr(
|
|
@@ -13253,6 +13059,32 @@ var init_renderer7 = __esm({
|
|
|
13253
13059
|
});
|
|
13254
13060
|
|
|
13255
13061
|
// src/d3.ts
|
|
13062
|
+
function renderChartTitle(svg, title, titleLineNumber, width, textColor, onClickItem) {
|
|
13063
|
+
if (!title) return;
|
|
13064
|
+
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && titleLineNumber ? "pointer" : "default").text(title);
|
|
13065
|
+
if (titleLineNumber) {
|
|
13066
|
+
titleEl.attr("data-line-number", titleLineNumber);
|
|
13067
|
+
if (onClickItem) {
|
|
13068
|
+
titleEl.on("click", () => onClickItem(titleLineNumber)).on("mouseenter", function() {
|
|
13069
|
+
d3Selection9.select(this).attr("opacity", 0.7);
|
|
13070
|
+
}).on("mouseleave", function() {
|
|
13071
|
+
d3Selection9.select(this).attr("opacity", 1);
|
|
13072
|
+
});
|
|
13073
|
+
}
|
|
13074
|
+
}
|
|
13075
|
+
}
|
|
13076
|
+
function initD3Chart(container, palette, exportDims) {
|
|
13077
|
+
d3Selection9.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
13078
|
+
const width = exportDims?.width ?? container.clientWidth;
|
|
13079
|
+
const height = exportDims?.height ?? container.clientHeight;
|
|
13080
|
+
if (width <= 0 || height <= 0) return null;
|
|
13081
|
+
const textColor = palette.text;
|
|
13082
|
+
const mutedColor = palette.border;
|
|
13083
|
+
const bgColor = palette.bg;
|
|
13084
|
+
const colors = getSeriesColors(palette);
|
|
13085
|
+
const svg = d3Selection9.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
13086
|
+
return { svg, width, height, textColor, mutedColor, bgColor, colors };
|
|
13087
|
+
}
|
|
13256
13088
|
function parseTimelineDate(s) {
|
|
13257
13089
|
const parts = s.split("-").map((p) => parseInt(p, 10));
|
|
13258
13090
|
const year = parts[0];
|
|
@@ -13815,26 +13647,28 @@ function tokenizeFreeformText(text) {
|
|
|
13815
13647
|
}
|
|
13816
13648
|
return Array.from(counts.entries()).map(([text2, count]) => ({ text: text2, weight: count, lineNumber: 0 })).sort((a, b) => b.weight - a.weight);
|
|
13817
13649
|
}
|
|
13818
|
-
function resolveVerticalCollisions(items, minGap) {
|
|
13650
|
+
function resolveVerticalCollisions(items, minGap, maxY) {
|
|
13819
13651
|
if (items.length === 0) return [];
|
|
13820
13652
|
const sorted = items.map((it, i) => ({ ...it, idx: i })).sort((a, b) => a.naturalY - b.naturalY);
|
|
13821
13653
|
const adjustedY = new Array(items.length);
|
|
13822
13654
|
let prevBottom = -Infinity;
|
|
13823
13655
|
for (const item of sorted) {
|
|
13824
13656
|
const halfH = item.height / 2;
|
|
13825
|
-
|
|
13657
|
+
let top = Math.max(item.naturalY - halfH, prevBottom + minGap);
|
|
13658
|
+
if (maxY !== void 0) {
|
|
13659
|
+
top = Math.min(top, maxY - item.height);
|
|
13660
|
+
}
|
|
13826
13661
|
adjustedY[item.idx] = top + halfH;
|
|
13827
13662
|
prevBottom = top + item.height;
|
|
13828
13663
|
}
|
|
13829
13664
|
return adjustedY;
|
|
13830
13665
|
}
|
|
13831
13666
|
function renderSlopeChart(container, parsed, palette, isDark, onClickItem, exportDims) {
|
|
13832
|
-
d3Selection9.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
13833
13667
|
const { periods, data, title } = parsed;
|
|
13834
13668
|
if (data.length === 0 || periods.length < 2) return;
|
|
13835
|
-
const
|
|
13836
|
-
|
|
13837
|
-
|
|
13669
|
+
const init2 = initD3Chart(container, palette, exportDims);
|
|
13670
|
+
if (!init2) return;
|
|
13671
|
+
const { svg, width, height, textColor, mutedColor, bgColor, colors } = init2;
|
|
13838
13672
|
const maxLabelText = data.reduce((longest, item) => {
|
|
13839
13673
|
const text = `${item.values[item.values.length - 1]} \u2014 ${item.label}`;
|
|
13840
13674
|
return text.length > longest.length ? text : longest;
|
|
@@ -13847,31 +13681,14 @@ function renderSlopeChart(container, parsed, palette, isDark, onClickItem, expor
|
|
|
13847
13681
|
);
|
|
13848
13682
|
const innerWidth = width - SLOPE_MARGIN.left - rightMargin;
|
|
13849
13683
|
const innerHeight = height - SLOPE_MARGIN.top - SLOPE_MARGIN.bottom;
|
|
13850
|
-
const textColor = palette.text;
|
|
13851
|
-
const mutedColor = palette.border;
|
|
13852
|
-
const bgColor = palette.bg;
|
|
13853
|
-
const colors = getSeriesColors(palette);
|
|
13854
13684
|
const allValues = data.flatMap((d) => d.values);
|
|
13855
13685
|
const [minVal, maxVal] = d3Array.extent(allValues);
|
|
13856
13686
|
const valuePadding = (maxVal - minVal) * 0.1 || 1;
|
|
13857
13687
|
const yScale = d3Scale.scaleLinear().domain([minVal - valuePadding, maxVal + valuePadding]).range([innerHeight, 0]);
|
|
13858
13688
|
const xScale = d3Scale.scalePoint().domain(periods).range([0, innerWidth]).padding(0);
|
|
13859
|
-
const svg = d3Selection9.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
13860
13689
|
const g = svg.append("g").attr("transform", `translate(${SLOPE_MARGIN.left},${SLOPE_MARGIN.top})`);
|
|
13861
13690
|
const tooltip = createTooltip(container, palette, isDark);
|
|
13862
|
-
|
|
13863
|
-
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
13864
|
-
if (parsed.titleLineNumber) {
|
|
13865
|
-
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
13866
|
-
if (onClickItem) {
|
|
13867
|
-
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
13868
|
-
d3Selection9.select(this).attr("opacity", 0.7);
|
|
13869
|
-
}).on("mouseleave", function() {
|
|
13870
|
-
d3Selection9.select(this).attr("opacity", 1);
|
|
13871
|
-
});
|
|
13872
|
-
}
|
|
13873
|
-
}
|
|
13874
|
-
}
|
|
13691
|
+
renderChartTitle(svg, title, parsed.titleLineNumber, width, textColor, onClickItem);
|
|
13875
13692
|
for (const period of periods) {
|
|
13876
13693
|
const x = xScale(period);
|
|
13877
13694
|
g.append("text").attr("x", x).attr("y", -15).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "18px").attr("font-weight", "600").text(period);
|
|
@@ -13934,13 +13751,13 @@ function renderSlopeChart(container, parsed, palette, isDark, onClickItem, expor
|
|
|
13934
13751
|
naturalY: yScale(item.values[pi]),
|
|
13935
13752
|
height: leftLabelHeight
|
|
13936
13753
|
}));
|
|
13937
|
-
leftLabelCollisions.set(pi, resolveVerticalCollisions(entries, 4));
|
|
13754
|
+
leftLabelCollisions.set(pi, resolveVerticalCollisions(entries, 4, innerHeight));
|
|
13938
13755
|
}
|
|
13939
13756
|
const rightEntries = seriesInfo.map((si) => ({
|
|
13940
13757
|
naturalY: yScale(si.lastVal),
|
|
13941
13758
|
height: Math.max(si.labelHeight, SLOPE_LABEL_FONT_SIZE * 1.4)
|
|
13942
13759
|
}));
|
|
13943
|
-
const rightAdjustedY = resolveVerticalCollisions(rightEntries, 4);
|
|
13760
|
+
const rightAdjustedY = resolveVerticalCollisions(rightEntries, 4, innerHeight);
|
|
13944
13761
|
data.forEach((item, idx) => {
|
|
13945
13762
|
const si = seriesInfo[idx];
|
|
13946
13763
|
const color = si.color;
|
|
@@ -14080,12 +13897,11 @@ function orderArcNodes(links, order, groups) {
|
|
|
14080
13897
|
return allNodes;
|
|
14081
13898
|
}
|
|
14082
13899
|
function renderArcDiagram(container, parsed, palette, _isDark, onClickItem, exportDims) {
|
|
14083
|
-
d3Selection9.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
14084
13900
|
const { links, title, orientation, arcOrder, arcNodeGroups } = parsed;
|
|
14085
13901
|
if (links.length === 0) return;
|
|
14086
|
-
const
|
|
14087
|
-
|
|
14088
|
-
|
|
13902
|
+
const init2 = initD3Chart(container, palette, exportDims);
|
|
13903
|
+
if (!init2) return;
|
|
13904
|
+
const { svg, width, height, textColor, mutedColor, bgColor, colors } = init2;
|
|
14089
13905
|
const isVertical = orientation === "vertical";
|
|
14090
13906
|
const margin = isVertical ? {
|
|
14091
13907
|
top: ARC_MARGIN.top,
|
|
@@ -14095,10 +13911,6 @@ function renderArcDiagram(container, parsed, palette, _isDark, onClickItem, expo
|
|
|
14095
13911
|
} : ARC_MARGIN;
|
|
14096
13912
|
const innerWidth = width - margin.left - margin.right;
|
|
14097
13913
|
const innerHeight = height - margin.top - margin.bottom;
|
|
14098
|
-
const textColor = palette.text;
|
|
14099
|
-
const mutedColor = palette.border;
|
|
14100
|
-
const bgColor = palette.bg;
|
|
14101
|
-
const colors = getSeriesColors(palette);
|
|
14102
13914
|
const nodes = orderArcNodes(links, arcOrder, arcNodeGroups);
|
|
14103
13915
|
const nodeColorMap = /* @__PURE__ */ new Map();
|
|
14104
13916
|
for (const group of arcNodeGroups) {
|
|
@@ -14117,21 +13929,8 @@ function renderArcDiagram(container, parsed, palette, _isDark, onClickItem, expo
|
|
|
14117
13929
|
const values = links.map((l) => l.value);
|
|
14118
13930
|
const [minVal, maxVal] = d3Array.extent(values);
|
|
14119
13931
|
const strokeScale = d3Scale.scaleLinear().domain([minVal, maxVal]).range([1.5, 6]);
|
|
14120
|
-
const svg = d3Selection9.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
14121
13932
|
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
14122
|
-
|
|
14123
|
-
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
14124
|
-
if (parsed.titleLineNumber) {
|
|
14125
|
-
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
14126
|
-
if (onClickItem) {
|
|
14127
|
-
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
14128
|
-
d3Selection9.select(this).attr("opacity", 0.7);
|
|
14129
|
-
}).on("mouseleave", function() {
|
|
14130
|
-
d3Selection9.select(this).attr("opacity", 1);
|
|
14131
|
-
});
|
|
14132
|
-
}
|
|
14133
|
-
}
|
|
14134
|
-
}
|
|
13933
|
+
renderChartTitle(svg, title, parsed.titleLineNumber, width, textColor, onClickItem);
|
|
14135
13934
|
const neighbors = /* @__PURE__ */ new Map();
|
|
14136
13935
|
for (const node of nodes) neighbors.set(node, /* @__PURE__ */ new Set());
|
|
14137
13936
|
for (const link of links) {
|
|
@@ -14667,19 +14466,7 @@ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
14667
14466
|
const yScale = d3Scale.scaleLinear().domain([minDate - datePadding, maxDate + datePadding]).range([0, innerHeight]);
|
|
14668
14467
|
const svg = d3Selection9.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
14669
14468
|
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
14670
|
-
|
|
14671
|
-
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
14672
|
-
if (parsed.titleLineNumber) {
|
|
14673
|
-
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
14674
|
-
if (onClickItem) {
|
|
14675
|
-
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
14676
|
-
d3Selection9.select(this).attr("opacity", 0.7);
|
|
14677
|
-
}).on("mouseleave", function() {
|
|
14678
|
-
d3Selection9.select(this).attr("opacity", 1);
|
|
14679
|
-
});
|
|
14680
|
-
}
|
|
14681
|
-
}
|
|
14682
|
-
}
|
|
14469
|
+
renderChartTitle(svg, title, parsed.titleLineNumber, width, textColor, onClickItem);
|
|
14683
14470
|
renderEras(
|
|
14684
14471
|
g,
|
|
14685
14472
|
timelineEras,
|
|
@@ -14782,19 +14569,7 @@ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
14782
14569
|
const sorted = timelineEvents.slice().sort((a, b) => parseTimelineDate(a.date) - parseTimelineDate(b.date));
|
|
14783
14570
|
const svg = d3Selection9.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
14784
14571
|
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
14785
|
-
|
|
14786
|
-
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
14787
|
-
if (parsed.titleLineNumber) {
|
|
14788
|
-
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
14789
|
-
if (onClickItem) {
|
|
14790
|
-
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
14791
|
-
d3Selection9.select(this).attr("opacity", 0.7);
|
|
14792
|
-
}).on("mouseleave", function() {
|
|
14793
|
-
d3Selection9.select(this).attr("opacity", 1);
|
|
14794
|
-
});
|
|
14795
|
-
}
|
|
14796
|
-
}
|
|
14797
|
-
}
|
|
14572
|
+
renderChartTitle(svg, title, parsed.titleLineNumber, width, textColor, onClickItem);
|
|
14798
14573
|
renderEras(
|
|
14799
14574
|
g,
|
|
14800
14575
|
timelineEras,
|
|
@@ -14926,19 +14701,7 @@ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
14926
14701
|
const xScale = d3Scale.scaleLinear().domain([minDate - datePadding, maxDate + datePadding]).range([0, innerWidth]);
|
|
14927
14702
|
const svg = d3Selection9.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
14928
14703
|
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
14929
|
-
|
|
14930
|
-
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
14931
|
-
if (parsed.titleLineNumber) {
|
|
14932
|
-
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
14933
|
-
if (onClickItem) {
|
|
14934
|
-
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
14935
|
-
d3Selection9.select(this).attr("opacity", 0.7);
|
|
14936
|
-
}).on("mouseleave", function() {
|
|
14937
|
-
d3Selection9.select(this).attr("opacity", 1);
|
|
14938
|
-
});
|
|
14939
|
-
}
|
|
14940
|
-
}
|
|
14941
|
-
}
|
|
14704
|
+
renderChartTitle(svg, title, parsed.titleLineNumber, width, textColor, onClickItem);
|
|
14942
14705
|
renderEras(
|
|
14943
14706
|
g,
|
|
14944
14707
|
timelineEras,
|
|
@@ -15081,19 +14844,7 @@ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
15081
14844
|
const xScale = d3Scale.scaleLinear().domain([minDate - datePadding, maxDate + datePadding]).range([0, innerWidth]);
|
|
15082
14845
|
const svg = d3Selection9.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
15083
14846
|
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
15084
|
-
|
|
15085
|
-
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
15086
|
-
if (parsed.titleLineNumber) {
|
|
15087
|
-
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
15088
|
-
if (onClickItem) {
|
|
15089
|
-
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
15090
|
-
d3Selection9.select(this).attr("opacity", 0.7);
|
|
15091
|
-
}).on("mouseleave", function() {
|
|
15092
|
-
d3Selection9.select(this).attr("opacity", 1);
|
|
15093
|
-
});
|
|
15094
|
-
}
|
|
15095
|
-
}
|
|
15096
|
-
}
|
|
14847
|
+
renderChartTitle(svg, title, parsed.titleLineNumber, width, textColor, onClickItem);
|
|
15097
14848
|
renderEras(
|
|
15098
14849
|
g,
|
|
15099
14850
|
timelineEras,
|
|
@@ -15220,17 +14971,13 @@ function getRotateFn(mode) {
|
|
|
15220
14971
|
return () => 0;
|
|
15221
14972
|
}
|
|
15222
14973
|
function renderWordCloud(container, parsed, palette, _isDark, onClickItem, exportDims) {
|
|
15223
|
-
d3Selection9.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
15224
14974
|
const { words, title, cloudOptions } = parsed;
|
|
15225
14975
|
if (words.length === 0) return;
|
|
15226
|
-
const
|
|
15227
|
-
|
|
15228
|
-
|
|
14976
|
+
const init2 = initD3Chart(container, palette, exportDims);
|
|
14977
|
+
if (!init2) return;
|
|
14978
|
+
const { svg, width, height, textColor, colors } = init2;
|
|
15229
14979
|
const titleHeight = title ? 40 : 0;
|
|
15230
14980
|
const cloudHeight = height - titleHeight;
|
|
15231
|
-
const textColor = palette.text;
|
|
15232
|
-
const bgColor = palette.bg;
|
|
15233
|
-
const colors = getSeriesColors(palette);
|
|
15234
14981
|
const { minSize, maxSize } = cloudOptions;
|
|
15235
14982
|
const weights = words.map((w) => w.weight);
|
|
15236
14983
|
const minWeight = Math.min(...weights);
|
|
@@ -15241,20 +14988,7 @@ function renderWordCloud(container, parsed, palette, _isDark, onClickItem, expor
|
|
|
15241
14988
|
return minSize + t * (maxSize - minSize);
|
|
15242
14989
|
};
|
|
15243
14990
|
const rotateFn = getRotateFn(cloudOptions.rotate);
|
|
15244
|
-
|
|
15245
|
-
if (title) {
|
|
15246
|
-
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
15247
|
-
if (parsed.titleLineNumber) {
|
|
15248
|
-
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
15249
|
-
if (onClickItem) {
|
|
15250
|
-
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
15251
|
-
d3Selection9.select(this).attr("opacity", 0.7);
|
|
15252
|
-
}).on("mouseleave", function() {
|
|
15253
|
-
d3Selection9.select(this).attr("opacity", 1);
|
|
15254
|
-
});
|
|
15255
|
-
}
|
|
15256
|
-
}
|
|
15257
|
-
}
|
|
14991
|
+
renderChartTitle(svg, title, parsed.titleLineNumber, width, textColor, onClickItem);
|
|
15258
14992
|
const g = svg.append("g").attr(
|
|
15259
14993
|
"transform",
|
|
15260
14994
|
`translate(${width / 2},${titleHeight + cloudHeight / 2})`
|
|
@@ -15305,12 +15039,7 @@ function renderWordCloudAsync(container, parsed, palette, _isDark, exportDims) {
|
|
|
15305
15039
|
};
|
|
15306
15040
|
const rotateFn = getRotateFn(cloudOptions.rotate);
|
|
15307
15041
|
const svg = d3Selection9.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
15308
|
-
|
|
15309
|
-
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").text(title);
|
|
15310
|
-
if (parsed.titleLineNumber) {
|
|
15311
|
-
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
15312
|
-
}
|
|
15313
|
-
}
|
|
15042
|
+
renderChartTitle(svg, title, parsed.titleLineNumber, width, textColor);
|
|
15314
15043
|
const g = svg.append("g").attr(
|
|
15315
15044
|
"transform",
|
|
15316
15045
|
`translate(${width / 2},${titleHeight + cloudHeight / 2})`
|
|
@@ -15441,15 +15170,11 @@ function regionCentroid(circles, inside) {
|
|
|
15441
15170
|
return { x: sx / count, y: sy / count };
|
|
15442
15171
|
}
|
|
15443
15172
|
function renderVenn(container, parsed, palette, isDark, onClickItem, exportDims) {
|
|
15444
|
-
d3Selection9.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
15445
15173
|
const { vennSets, vennOverlaps, vennShowValues, title } = parsed;
|
|
15446
15174
|
if (vennSets.length < 2) return;
|
|
15447
|
-
const
|
|
15448
|
-
|
|
15449
|
-
|
|
15450
|
-
const textColor = palette.text;
|
|
15451
|
-
const bgColor = palette.bg;
|
|
15452
|
-
const colors = getSeriesColors(palette);
|
|
15175
|
+
const init2 = initD3Chart(container, palette, exportDims);
|
|
15176
|
+
if (!init2) return;
|
|
15177
|
+
const { svg, width, height, textColor, colors } = init2;
|
|
15453
15178
|
const titleHeight = title ? 40 : 0;
|
|
15454
15179
|
const radii = vennSets.map((s) => radiusFromArea(s.size));
|
|
15455
15180
|
const overlapMap = /* @__PURE__ */ new Map();
|
|
@@ -15528,21 +15253,8 @@ function renderVenn(container, parsed, palette, isDark, onClickItem, exportDims)
|
|
|
15528
15253
|
marginTop,
|
|
15529
15254
|
marginBottom
|
|
15530
15255
|
).map((c) => ({ ...c, y: c.y + titleHeight }));
|
|
15531
|
-
const svg = d3Selection9.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
15532
15256
|
const tooltip = createTooltip(container, palette, isDark);
|
|
15533
|
-
|
|
15534
|
-
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style("cursor", onClickItem && parsed.titleLineNumber ? "pointer" : "default").text(title);
|
|
15535
|
-
if (parsed.titleLineNumber) {
|
|
15536
|
-
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
15537
|
-
if (onClickItem) {
|
|
15538
|
-
titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
|
|
15539
|
-
d3Selection9.select(this).attr("opacity", 0.7);
|
|
15540
|
-
}).on("mouseleave", function() {
|
|
15541
|
-
d3Selection9.select(this).attr("opacity", 1);
|
|
15542
|
-
});
|
|
15543
|
-
}
|
|
15544
|
-
}
|
|
15545
|
-
}
|
|
15257
|
+
renderChartTitle(svg, title, parsed.titleLineNumber, width, textColor, onClickItem);
|
|
15546
15258
|
const circleEls = [];
|
|
15547
15259
|
const circleGroup = svg.append("g");
|
|
15548
15260
|
circles.forEach((c, i) => {
|
|
@@ -15686,7 +15398,6 @@ function renderVenn(container, parsed, palette, isDark, onClickItem, exportDims)
|
|
|
15686
15398
|
});
|
|
15687
15399
|
}
|
|
15688
15400
|
function renderQuadrant(container, parsed, palette, isDark, onClickItem, exportDims) {
|
|
15689
|
-
d3Selection9.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
15690
15401
|
const {
|
|
15691
15402
|
title,
|
|
15692
15403
|
quadrantLabels,
|
|
@@ -15698,12 +15409,10 @@ function renderQuadrant(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
15698
15409
|
quadrantYAxisLineNumber
|
|
15699
15410
|
} = parsed;
|
|
15700
15411
|
if (quadrantPoints.length === 0) return;
|
|
15701
|
-
const
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
const textColor = palette.text;
|
|
15412
|
+
const init2 = initD3Chart(container, palette, exportDims);
|
|
15413
|
+
if (!init2) return;
|
|
15414
|
+
const { svg, width, height, textColor } = init2;
|
|
15705
15415
|
const mutedColor = palette.textMuted;
|
|
15706
|
-
const bgColor = palette.bg;
|
|
15707
15416
|
const borderColor = palette.border;
|
|
15708
15417
|
const defaultColors = [
|
|
15709
15418
|
palette.colors.blue,
|
|
@@ -15718,24 +15427,8 @@ function renderQuadrant(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
15718
15427
|
const chartHeight = height - margin.top - margin.bottom;
|
|
15719
15428
|
const xScale = d3Scale.scaleLinear().domain([0, 1]).range([0, chartWidth]);
|
|
15720
15429
|
const yScale = d3Scale.scaleLinear().domain([0, 1]).range([chartHeight, 0]);
|
|
15721
|
-
const svg = d3Selection9.select(container).append("svg").attr("width", width).attr("height", height).style("background", bgColor);
|
|
15722
15430
|
const tooltip = createTooltip(container, palette, isDark);
|
|
15723
|
-
|
|
15724
|
-
const titleText = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", 30).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "20px").attr("font-weight", "700").style(
|
|
15725
|
-
"cursor",
|
|
15726
|
-
onClickItem && quadrantTitleLineNumber ? "pointer" : "default"
|
|
15727
|
-
).text(title);
|
|
15728
|
-
if (quadrantTitleLineNumber) {
|
|
15729
|
-
titleText.attr("data-line-number", quadrantTitleLineNumber);
|
|
15730
|
-
}
|
|
15731
|
-
if (onClickItem && quadrantTitleLineNumber) {
|
|
15732
|
-
titleText.on("click", () => onClickItem(quadrantTitleLineNumber)).on("mouseenter", function() {
|
|
15733
|
-
d3Selection9.select(this).attr("opacity", 0.7);
|
|
15734
|
-
}).on("mouseleave", function() {
|
|
15735
|
-
d3Selection9.select(this).attr("opacity", 1);
|
|
15736
|
-
});
|
|
15737
|
-
}
|
|
15738
|
-
}
|
|
15431
|
+
renderChartTitle(svg, title, quadrantTitleLineNumber, width, textColor, onClickItem);
|
|
15739
15432
|
const chartG = svg.append("g").attr("transform", `translate(${margin.left}, ${margin.top})`);
|
|
15740
15433
|
const mixHex = (a, b, pct) => {
|
|
15741
15434
|
const parse = (h) => {
|
|
@@ -15984,6 +15677,38 @@ function renderQuadrant(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
15984
15677
|
}
|
|
15985
15678
|
});
|
|
15986
15679
|
}
|
|
15680
|
+
async function resolveExportPalette(theme, palette) {
|
|
15681
|
+
if (palette) return palette;
|
|
15682
|
+
const { getPalette: getPalette2 } = await Promise.resolve().then(() => (init_palettes(), palettes_exports));
|
|
15683
|
+
return theme === "dark" ? getPalette2("nord").dark : getPalette2("nord").light;
|
|
15684
|
+
}
|
|
15685
|
+
function createExportContainer(width, height) {
|
|
15686
|
+
const container = document.createElement("div");
|
|
15687
|
+
container.style.width = `${width}px`;
|
|
15688
|
+
container.style.height = `${height}px`;
|
|
15689
|
+
container.style.position = "absolute";
|
|
15690
|
+
container.style.left = "-9999px";
|
|
15691
|
+
document.body.appendChild(container);
|
|
15692
|
+
return container;
|
|
15693
|
+
}
|
|
15694
|
+
function finalizeSvgExport(container, theme, palette, options) {
|
|
15695
|
+
const svgEl = container.querySelector("svg");
|
|
15696
|
+
if (!svgEl) return "";
|
|
15697
|
+
if (theme === "transparent") {
|
|
15698
|
+
svgEl.style.background = "none";
|
|
15699
|
+
} else if (!svgEl.style.background) {
|
|
15700
|
+
svgEl.style.background = palette.bg;
|
|
15701
|
+
}
|
|
15702
|
+
svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
15703
|
+
svgEl.style.fontFamily = FONT_FAMILY;
|
|
15704
|
+
const svgHtml = svgEl.outerHTML;
|
|
15705
|
+
document.body.removeChild(container);
|
|
15706
|
+
if (options?.branding !== false) {
|
|
15707
|
+
const brandColor = theme === "transparent" ? "#888" : palette.textMuted;
|
|
15708
|
+
return injectBranding(svgHtml, brandColor);
|
|
15709
|
+
}
|
|
15710
|
+
return svgHtml;
|
|
15711
|
+
}
|
|
15987
15712
|
async function renderD3ForExport(content, theme, palette, orgExportState, options) {
|
|
15988
15713
|
const { parseDgmoChartType: parseDgmoChartType2 } = await Promise.resolve().then(() => (init_dgmo_router(), dgmo_router_exports));
|
|
15989
15714
|
const detectedType = parseDgmoChartType2(content);
|
|
@@ -15993,8 +15718,7 @@ async function renderD3ForExport(content, theme, palette, orgExportState, option
|
|
|
15993
15718
|
const { collapseOrgTree: collapseOrgTree2 } = await Promise.resolve().then(() => (init_collapse(), collapse_exports));
|
|
15994
15719
|
const { renderOrg: renderOrg2 } = await Promise.resolve().then(() => (init_renderer(), renderer_exports));
|
|
15995
15720
|
const isDark2 = theme === "dark";
|
|
15996
|
-
const
|
|
15997
|
-
const effectivePalette2 = palette ?? (isDark2 ? getPalette3("nord").dark : getPalette3("nord").light);
|
|
15721
|
+
const effectivePalette2 = await resolveExportPalette(theme, palette);
|
|
15998
15722
|
const orgParsed = parseOrg2(content, effectivePalette2);
|
|
15999
15723
|
if (orgParsed.error) return "";
|
|
16000
15724
|
const collapsedNodes = orgExportState?.collapsedNodes;
|
|
@@ -16011,83 +15735,28 @@ async function renderD3ForExport(content, theme, palette, orgExportState, option
|
|
|
16011
15735
|
const titleOffset = effectiveParsed.title ? 30 : 0;
|
|
16012
15736
|
const exportWidth = orgLayout.width + PADDING * 2;
|
|
16013
15737
|
const exportHeight = orgLayout.height + PADDING * 2 + titleOffset;
|
|
16014
|
-
const container2 =
|
|
16015
|
-
container2
|
|
16016
|
-
container2
|
|
16017
|
-
container2.style.position = "absolute";
|
|
16018
|
-
container2.style.left = "-9999px";
|
|
16019
|
-
document.body.appendChild(container2);
|
|
16020
|
-
try {
|
|
16021
|
-
renderOrg2(
|
|
16022
|
-
container2,
|
|
16023
|
-
effectiveParsed,
|
|
16024
|
-
orgLayout,
|
|
16025
|
-
effectivePalette2,
|
|
16026
|
-
isDark2,
|
|
16027
|
-
void 0,
|
|
16028
|
-
{ width: exportWidth, height: exportHeight },
|
|
16029
|
-
activeTagGroup,
|
|
16030
|
-
hiddenAttributes
|
|
16031
|
-
);
|
|
16032
|
-
const svgEl = container2.querySelector("svg");
|
|
16033
|
-
if (!svgEl) return "";
|
|
16034
|
-
if (theme === "transparent") {
|
|
16035
|
-
svgEl.style.background = "none";
|
|
16036
|
-
} else if (!svgEl.style.background) {
|
|
16037
|
-
svgEl.style.background = effectivePalette2.bg;
|
|
16038
|
-
}
|
|
16039
|
-
svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
16040
|
-
svgEl.style.fontFamily = FONT_FAMILY;
|
|
16041
|
-
const svgHtml = svgEl.outerHTML;
|
|
16042
|
-
if (options?.branding !== false) {
|
|
16043
|
-
const brandColor = theme === "transparent" ? "#888" : effectivePalette2.textMuted;
|
|
16044
|
-
return injectBranding(svgHtml, brandColor);
|
|
16045
|
-
}
|
|
16046
|
-
return svgHtml;
|
|
16047
|
-
} finally {
|
|
16048
|
-
document.body.removeChild(container2);
|
|
16049
|
-
}
|
|
15738
|
+
const container2 = createExportContainer(exportWidth, exportHeight);
|
|
15739
|
+
renderOrg2(container2, effectiveParsed, orgLayout, effectivePalette2, isDark2, void 0, { width: exportWidth, height: exportHeight }, activeTagGroup, hiddenAttributes);
|
|
15740
|
+
return finalizeSvgExport(container2, theme, effectivePalette2, options);
|
|
16050
15741
|
}
|
|
16051
15742
|
if (detectedType === "kanban") {
|
|
16052
15743
|
const { parseKanban: parseKanban2 } = await Promise.resolve().then(() => (init_parser5(), parser_exports5));
|
|
16053
15744
|
const { renderKanban: renderKanban2 } = await Promise.resolve().then(() => (init_renderer2(), renderer_exports2));
|
|
16054
|
-
const
|
|
16055
|
-
const { getPalette: getPalette3 } = await Promise.resolve().then(() => (init_palettes(), palettes_exports));
|
|
16056
|
-
const effectivePalette2 = palette ?? (isDark2 ? getPalette3("nord").dark : getPalette3("nord").light);
|
|
15745
|
+
const effectivePalette2 = await resolveExportPalette(theme, palette);
|
|
16057
15746
|
const kanbanParsed = parseKanban2(content, effectivePalette2);
|
|
16058
15747
|
if (kanbanParsed.error || kanbanParsed.columns.length === 0) return "";
|
|
16059
15748
|
const container2 = document.createElement("div");
|
|
16060
15749
|
container2.style.position = "absolute";
|
|
16061
15750
|
container2.style.left = "-9999px";
|
|
16062
15751
|
document.body.appendChild(container2);
|
|
16063
|
-
|
|
16064
|
-
|
|
16065
|
-
const svgEl = container2.querySelector("svg");
|
|
16066
|
-
if (!svgEl) return "";
|
|
16067
|
-
if (theme === "transparent") {
|
|
16068
|
-
svgEl.style.background = "none";
|
|
16069
|
-
} else if (!svgEl.style.background) {
|
|
16070
|
-
svgEl.style.background = effectivePalette2.bg;
|
|
16071
|
-
}
|
|
16072
|
-
svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
16073
|
-
svgEl.style.fontFamily = FONT_FAMILY;
|
|
16074
|
-
const svgHtml = svgEl.outerHTML;
|
|
16075
|
-
if (options?.branding !== false) {
|
|
16076
|
-
const brandColor = theme === "transparent" ? "#888" : effectivePalette2.textMuted;
|
|
16077
|
-
return injectBranding(svgHtml, brandColor);
|
|
16078
|
-
}
|
|
16079
|
-
return svgHtml;
|
|
16080
|
-
} finally {
|
|
16081
|
-
document.body.removeChild(container2);
|
|
16082
|
-
}
|
|
15752
|
+
renderKanban2(container2, kanbanParsed, effectivePalette2, theme === "dark");
|
|
15753
|
+
return finalizeSvgExport(container2, theme, effectivePalette2, options);
|
|
16083
15754
|
}
|
|
16084
15755
|
if (detectedType === "class") {
|
|
16085
15756
|
const { parseClassDiagram: parseClassDiagram2 } = await Promise.resolve().then(() => (init_parser2(), parser_exports2));
|
|
16086
15757
|
const { layoutClassDiagram: layoutClassDiagram2 } = await Promise.resolve().then(() => (init_layout2(), layout_exports2));
|
|
16087
15758
|
const { renderClassDiagram: renderClassDiagram2 } = await Promise.resolve().then(() => (init_renderer3(), renderer_exports3));
|
|
16088
|
-
const
|
|
16089
|
-
const { getPalette: getPalette3 } = await Promise.resolve().then(() => (init_palettes(), palettes_exports));
|
|
16090
|
-
const effectivePalette2 = palette ?? (isDark2 ? getPalette3("nord").dark : getPalette3("nord").light);
|
|
15759
|
+
const effectivePalette2 = await resolveExportPalette(theme, palette);
|
|
16091
15760
|
const classParsed = parseClassDiagram2(content, effectivePalette2);
|
|
16092
15761
|
if (classParsed.error || classParsed.classes.length === 0) return "";
|
|
16093
15762
|
const classLayout = layoutClassDiagram2(classParsed);
|
|
@@ -16095,48 +15764,15 @@ async function renderD3ForExport(content, theme, palette, orgExportState, option
|
|
|
16095
15764
|
const titleOffset = classParsed.title ? 40 : 0;
|
|
16096
15765
|
const exportWidth = classLayout.width + PADDING * 2;
|
|
16097
15766
|
const exportHeight = classLayout.height + PADDING * 2 + titleOffset;
|
|
16098
|
-
const container2 =
|
|
16099
|
-
container2
|
|
16100
|
-
container2
|
|
16101
|
-
container2.style.position = "absolute";
|
|
16102
|
-
container2.style.left = "-9999px";
|
|
16103
|
-
document.body.appendChild(container2);
|
|
16104
|
-
try {
|
|
16105
|
-
renderClassDiagram2(
|
|
16106
|
-
container2,
|
|
16107
|
-
classParsed,
|
|
16108
|
-
classLayout,
|
|
16109
|
-
effectivePalette2,
|
|
16110
|
-
isDark2,
|
|
16111
|
-
void 0,
|
|
16112
|
-
{ width: exportWidth, height: exportHeight }
|
|
16113
|
-
);
|
|
16114
|
-
const svgEl = container2.querySelector("svg");
|
|
16115
|
-
if (!svgEl) return "";
|
|
16116
|
-
if (theme === "transparent") {
|
|
16117
|
-
svgEl.style.background = "none";
|
|
16118
|
-
} else if (!svgEl.style.background) {
|
|
16119
|
-
svgEl.style.background = effectivePalette2.bg;
|
|
16120
|
-
}
|
|
16121
|
-
svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
16122
|
-
svgEl.style.fontFamily = FONT_FAMILY;
|
|
16123
|
-
const svgHtml = svgEl.outerHTML;
|
|
16124
|
-
if (options?.branding !== false) {
|
|
16125
|
-
const brandColor = theme === "transparent" ? "#888" : effectivePalette2.textMuted;
|
|
16126
|
-
return injectBranding(svgHtml, brandColor);
|
|
16127
|
-
}
|
|
16128
|
-
return svgHtml;
|
|
16129
|
-
} finally {
|
|
16130
|
-
document.body.removeChild(container2);
|
|
16131
|
-
}
|
|
15767
|
+
const container2 = createExportContainer(exportWidth, exportHeight);
|
|
15768
|
+
renderClassDiagram2(container2, classParsed, classLayout, effectivePalette2, theme === "dark", void 0, { width: exportWidth, height: exportHeight });
|
|
15769
|
+
return finalizeSvgExport(container2, theme, effectivePalette2, options);
|
|
16132
15770
|
}
|
|
16133
15771
|
if (detectedType === "er") {
|
|
16134
15772
|
const { parseERDiagram: parseERDiagram2 } = await Promise.resolve().then(() => (init_parser3(), parser_exports3));
|
|
16135
15773
|
const { layoutERDiagram: layoutERDiagram2 } = await Promise.resolve().then(() => (init_layout3(), layout_exports3));
|
|
16136
15774
|
const { renderERDiagram: renderERDiagram2 } = await Promise.resolve().then(() => (init_renderer4(), renderer_exports4));
|
|
16137
|
-
const
|
|
16138
|
-
const { getPalette: getPalette3 } = await Promise.resolve().then(() => (init_palettes(), palettes_exports));
|
|
16139
|
-
const effectivePalette2 = palette ?? (isDark2 ? getPalette3("nord").dark : getPalette3("nord").light);
|
|
15775
|
+
const effectivePalette2 = await resolveExportPalette(theme, palette);
|
|
16140
15776
|
const erParsed = parseERDiagram2(content, effectivePalette2);
|
|
16141
15777
|
if (erParsed.error || erParsed.tables.length === 0) return "";
|
|
16142
15778
|
const erLayout = layoutERDiagram2(erParsed);
|
|
@@ -16144,48 +15780,15 @@ async function renderD3ForExport(content, theme, palette, orgExportState, option
|
|
|
16144
15780
|
const titleOffset = erParsed.title ? 40 : 0;
|
|
16145
15781
|
const exportWidth = erLayout.width + PADDING * 2;
|
|
16146
15782
|
const exportHeight = erLayout.height + PADDING * 2 + titleOffset;
|
|
16147
|
-
const container2 =
|
|
16148
|
-
container2
|
|
16149
|
-
container2
|
|
16150
|
-
container2.style.position = "absolute";
|
|
16151
|
-
container2.style.left = "-9999px";
|
|
16152
|
-
document.body.appendChild(container2);
|
|
16153
|
-
try {
|
|
16154
|
-
renderERDiagram2(
|
|
16155
|
-
container2,
|
|
16156
|
-
erParsed,
|
|
16157
|
-
erLayout,
|
|
16158
|
-
effectivePalette2,
|
|
16159
|
-
isDark2,
|
|
16160
|
-
void 0,
|
|
16161
|
-
{ width: exportWidth, height: exportHeight }
|
|
16162
|
-
);
|
|
16163
|
-
const svgEl = container2.querySelector("svg");
|
|
16164
|
-
if (!svgEl) return "";
|
|
16165
|
-
if (theme === "transparent") {
|
|
16166
|
-
svgEl.style.background = "none";
|
|
16167
|
-
} else if (!svgEl.style.background) {
|
|
16168
|
-
svgEl.style.background = effectivePalette2.bg;
|
|
16169
|
-
}
|
|
16170
|
-
svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
16171
|
-
svgEl.style.fontFamily = FONT_FAMILY;
|
|
16172
|
-
const svgHtml = svgEl.outerHTML;
|
|
16173
|
-
if (options?.branding !== false) {
|
|
16174
|
-
const brandColor = theme === "transparent" ? "#888" : effectivePalette2.textMuted;
|
|
16175
|
-
return injectBranding(svgHtml, brandColor);
|
|
16176
|
-
}
|
|
16177
|
-
return svgHtml;
|
|
16178
|
-
} finally {
|
|
16179
|
-
document.body.removeChild(container2);
|
|
16180
|
-
}
|
|
15783
|
+
const container2 = createExportContainer(exportWidth, exportHeight);
|
|
15784
|
+
renderERDiagram2(container2, erParsed, erLayout, effectivePalette2, theme === "dark", void 0, { width: exportWidth, height: exportHeight });
|
|
15785
|
+
return finalizeSvgExport(container2, theme, effectivePalette2, options);
|
|
16181
15786
|
}
|
|
16182
15787
|
if (detectedType === "initiative-status") {
|
|
16183
15788
|
const { parseInitiativeStatus: parseInitiativeStatus2 } = await Promise.resolve().then(() => (init_parser7(), parser_exports7));
|
|
16184
15789
|
const { layoutInitiativeStatus: layoutInitiativeStatus2 } = await Promise.resolve().then(() => (init_layout4(), layout_exports4));
|
|
16185
15790
|
const { renderInitiativeStatus: renderInitiativeStatus2 } = await Promise.resolve().then(() => (init_renderer5(), renderer_exports5));
|
|
16186
|
-
const
|
|
16187
|
-
const { getPalette: getPalette3 } = await Promise.resolve().then(() => (init_palettes(), palettes_exports));
|
|
16188
|
-
const effectivePalette2 = palette ?? (isDark2 ? getPalette3("nord").dark : getPalette3("nord").light);
|
|
15791
|
+
const effectivePalette2 = await resolveExportPalette(theme, palette);
|
|
16189
15792
|
const isParsed = parseInitiativeStatus2(content);
|
|
16190
15793
|
if (isParsed.error || isParsed.nodes.length === 0) return "";
|
|
16191
15794
|
const isLayout = layoutInitiativeStatus2(isParsed);
|
|
@@ -16193,48 +15796,15 @@ async function renderD3ForExport(content, theme, palette, orgExportState, option
|
|
|
16193
15796
|
const titleOffset = isParsed.title ? 40 : 0;
|
|
16194
15797
|
const exportWidth = isLayout.width + PADDING * 2;
|
|
16195
15798
|
const exportHeight = isLayout.height + PADDING * 2 + titleOffset;
|
|
16196
|
-
const container2 =
|
|
16197
|
-
container2
|
|
16198
|
-
container2
|
|
16199
|
-
container2.style.position = "absolute";
|
|
16200
|
-
container2.style.left = "-9999px";
|
|
16201
|
-
document.body.appendChild(container2);
|
|
16202
|
-
try {
|
|
16203
|
-
renderInitiativeStatus2(
|
|
16204
|
-
container2,
|
|
16205
|
-
isParsed,
|
|
16206
|
-
isLayout,
|
|
16207
|
-
effectivePalette2,
|
|
16208
|
-
isDark2,
|
|
16209
|
-
void 0,
|
|
16210
|
-
{ width: exportWidth, height: exportHeight }
|
|
16211
|
-
);
|
|
16212
|
-
const svgEl = container2.querySelector("svg");
|
|
16213
|
-
if (!svgEl) return "";
|
|
16214
|
-
if (theme === "transparent") {
|
|
16215
|
-
svgEl.style.background = "none";
|
|
16216
|
-
} else if (!svgEl.style.background) {
|
|
16217
|
-
svgEl.style.background = effectivePalette2.bg;
|
|
16218
|
-
}
|
|
16219
|
-
svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
16220
|
-
svgEl.style.fontFamily = FONT_FAMILY;
|
|
16221
|
-
const svgHtml = svgEl.outerHTML;
|
|
16222
|
-
if (options?.branding !== false) {
|
|
16223
|
-
const brandColor = theme === "transparent" ? "#888" : effectivePalette2.textMuted;
|
|
16224
|
-
return injectBranding(svgHtml, brandColor);
|
|
16225
|
-
}
|
|
16226
|
-
return svgHtml;
|
|
16227
|
-
} finally {
|
|
16228
|
-
document.body.removeChild(container2);
|
|
16229
|
-
}
|
|
15799
|
+
const container2 = createExportContainer(exportWidth, exportHeight);
|
|
15800
|
+
renderInitiativeStatus2(container2, isParsed, isLayout, effectivePalette2, theme === "dark", void 0, { width: exportWidth, height: exportHeight });
|
|
15801
|
+
return finalizeSvgExport(container2, theme, effectivePalette2, options);
|
|
16230
15802
|
}
|
|
16231
15803
|
if (detectedType === "c4") {
|
|
16232
15804
|
const { parseC4: parseC42 } = await Promise.resolve().then(() => (init_parser6(), parser_exports6));
|
|
16233
15805
|
const { layoutC4Context: layoutC4Context2, layoutC4Containers: layoutC4Containers2, layoutC4Components: layoutC4Components2, layoutC4Deployment: layoutC4Deployment2 } = await Promise.resolve().then(() => (init_layout5(), layout_exports5));
|
|
16234
15806
|
const { renderC4Context: renderC4Context2, renderC4Containers: renderC4Containers2 } = await Promise.resolve().then(() => (init_renderer6(), renderer_exports6));
|
|
16235
|
-
const
|
|
16236
|
-
const { getPalette: getPalette3 } = await Promise.resolve().then(() => (init_palettes(), palettes_exports));
|
|
16237
|
-
const effectivePalette2 = palette ?? (isDark2 ? getPalette3("nord").dark : getPalette3("nord").light);
|
|
15807
|
+
const effectivePalette2 = await resolveExportPalette(theme, palette);
|
|
16238
15808
|
const c4Parsed = parseC42(content, effectivePalette2);
|
|
16239
15809
|
if (c4Parsed.error || c4Parsed.elements.length === 0) return "";
|
|
16240
15810
|
const c4Level = options?.c4Level ?? "context";
|
|
@@ -16246,81 +15816,22 @@ async function renderD3ForExport(content, theme, palette, orgExportState, option
|
|
|
16246
15816
|
const titleOffset = c4Parsed.title ? 40 : 0;
|
|
16247
15817
|
const exportWidth = c4Layout.width + PADDING * 2;
|
|
16248
15818
|
const exportHeight = c4Layout.height + PADDING * 2 + titleOffset;
|
|
16249
|
-
const container2 =
|
|
16250
|
-
|
|
16251
|
-
container2
|
|
16252
|
-
container2
|
|
16253
|
-
container2.style.left = "-9999px";
|
|
16254
|
-
document.body.appendChild(container2);
|
|
16255
|
-
try {
|
|
16256
|
-
const renderFn = c4Level === "deployment" || c4Level === "components" && c4System && c4Container || c4Level === "containers" && c4System ? renderC4Containers2 : renderC4Context2;
|
|
16257
|
-
renderFn(
|
|
16258
|
-
container2,
|
|
16259
|
-
c4Parsed,
|
|
16260
|
-
c4Layout,
|
|
16261
|
-
effectivePalette2,
|
|
16262
|
-
isDark2,
|
|
16263
|
-
void 0,
|
|
16264
|
-
{ width: exportWidth, height: exportHeight }
|
|
16265
|
-
);
|
|
16266
|
-
const svgEl = container2.querySelector("svg");
|
|
16267
|
-
if (!svgEl) return "";
|
|
16268
|
-
if (theme === "transparent") {
|
|
16269
|
-
svgEl.style.background = "none";
|
|
16270
|
-
} else if (!svgEl.style.background) {
|
|
16271
|
-
svgEl.style.background = effectivePalette2.bg;
|
|
16272
|
-
}
|
|
16273
|
-
svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
16274
|
-
svgEl.style.fontFamily = FONT_FAMILY;
|
|
16275
|
-
const svgHtml = svgEl.outerHTML;
|
|
16276
|
-
if (options?.branding !== false) {
|
|
16277
|
-
const brandColor = theme === "transparent" ? "#888" : effectivePalette2.textMuted;
|
|
16278
|
-
return injectBranding(svgHtml, brandColor);
|
|
16279
|
-
}
|
|
16280
|
-
return svgHtml;
|
|
16281
|
-
} finally {
|
|
16282
|
-
document.body.removeChild(container2);
|
|
16283
|
-
}
|
|
15819
|
+
const container2 = createExportContainer(exportWidth, exportHeight);
|
|
15820
|
+
const renderFn = c4Level === "deployment" || c4Level === "components" && c4System && c4Container || c4Level === "containers" && c4System ? renderC4Containers2 : renderC4Context2;
|
|
15821
|
+
renderFn(container2, c4Parsed, c4Layout, effectivePalette2, theme === "dark", void 0, { width: exportWidth, height: exportHeight });
|
|
15822
|
+
return finalizeSvgExport(container2, theme, effectivePalette2, options);
|
|
16284
15823
|
}
|
|
16285
15824
|
if (detectedType === "flowchart") {
|
|
16286
15825
|
const { parseFlowchart: parseFlowchart2 } = await Promise.resolve().then(() => (init_flowchart_parser(), flowchart_parser_exports));
|
|
16287
15826
|
const { layoutGraph: layoutGraph2 } = await Promise.resolve().then(() => (init_layout6(), layout_exports6));
|
|
16288
15827
|
const { renderFlowchart: renderFlowchart2 } = await Promise.resolve().then(() => (init_flowchart_renderer(), flowchart_renderer_exports));
|
|
16289
|
-
const
|
|
16290
|
-
const { getPalette: getPalette3 } = await Promise.resolve().then(() => (init_palettes(), palettes_exports));
|
|
16291
|
-
const effectivePalette2 = palette ?? (isDark2 ? getPalette3("nord").dark : getPalette3("nord").light);
|
|
15828
|
+
const effectivePalette2 = await resolveExportPalette(theme, palette);
|
|
16292
15829
|
const fcParsed = parseFlowchart2(content, effectivePalette2);
|
|
16293
15830
|
if (fcParsed.error || fcParsed.nodes.length === 0) return "";
|
|
16294
15831
|
const layout = layoutGraph2(fcParsed);
|
|
16295
|
-
const container2 =
|
|
16296
|
-
container2
|
|
16297
|
-
container2
|
|
16298
|
-
container2.style.position = "absolute";
|
|
16299
|
-
container2.style.left = "-9999px";
|
|
16300
|
-
document.body.appendChild(container2);
|
|
16301
|
-
try {
|
|
16302
|
-
renderFlowchart2(container2, fcParsed, layout, effectivePalette2, isDark2, void 0, {
|
|
16303
|
-
width: EXPORT_WIDTH,
|
|
16304
|
-
height: EXPORT_HEIGHT
|
|
16305
|
-
});
|
|
16306
|
-
const svgEl = container2.querySelector("svg");
|
|
16307
|
-
if (!svgEl) return "";
|
|
16308
|
-
if (theme === "transparent") {
|
|
16309
|
-
svgEl.style.background = "none";
|
|
16310
|
-
} else if (!svgEl.style.background) {
|
|
16311
|
-
svgEl.style.background = effectivePalette2.bg;
|
|
16312
|
-
}
|
|
16313
|
-
svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
16314
|
-
svgEl.style.fontFamily = FONT_FAMILY;
|
|
16315
|
-
const svgHtml = svgEl.outerHTML;
|
|
16316
|
-
if (options?.branding !== false) {
|
|
16317
|
-
const brandColor = theme === "transparent" ? "#888" : effectivePalette2.textMuted;
|
|
16318
|
-
return injectBranding(svgHtml, brandColor);
|
|
16319
|
-
}
|
|
16320
|
-
return svgHtml;
|
|
16321
|
-
} finally {
|
|
16322
|
-
document.body.removeChild(container2);
|
|
16323
|
-
}
|
|
15832
|
+
const container2 = createExportContainer(EXPORT_WIDTH, EXPORT_HEIGHT);
|
|
15833
|
+
renderFlowchart2(container2, fcParsed, layout, effectivePalette2, theme === "dark", void 0, { width: EXPORT_WIDTH, height: EXPORT_HEIGHT });
|
|
15834
|
+
return finalizeSvgExport(container2, theme, effectivePalette2, options);
|
|
16324
15835
|
}
|
|
16325
15836
|
const parsed = parseD3(content, palette);
|
|
16326
15837
|
if (parsed.error && parsed.type !== "sequence") {
|
|
@@ -16336,56 +15847,32 @@ async function renderD3ForExport(content, theme, palette, orgExportState, option
|
|
|
16336
15847
|
if (parsed.type === "venn" && parsed.vennSets.length < 2) return "";
|
|
16337
15848
|
if (parsed.type === "quadrant" && parsed.quadrantPoints.length === 0)
|
|
16338
15849
|
return "";
|
|
15850
|
+
const effectivePalette = await resolveExportPalette(theme, palette);
|
|
16339
15851
|
const isDark = theme === "dark";
|
|
16340
|
-
const
|
|
16341
|
-
const effectivePalette = palette ?? (isDark ? getPalette2("nord").dark : getPalette2("nord").light);
|
|
16342
|
-
const container = document.createElement("div");
|
|
16343
|
-
container.style.width = `${EXPORT_WIDTH}px`;
|
|
16344
|
-
container.style.height = `${EXPORT_HEIGHT}px`;
|
|
16345
|
-
container.style.position = "absolute";
|
|
16346
|
-
container.style.left = "-9999px";
|
|
16347
|
-
document.body.appendChild(container);
|
|
15852
|
+
const container = createExportContainer(EXPORT_WIDTH, EXPORT_HEIGHT);
|
|
16348
15853
|
const dims = { width: EXPORT_WIDTH, height: EXPORT_HEIGHT };
|
|
16349
|
-
|
|
16350
|
-
|
|
16351
|
-
|
|
16352
|
-
|
|
16353
|
-
|
|
16354
|
-
|
|
16355
|
-
|
|
16356
|
-
|
|
16357
|
-
|
|
16358
|
-
|
|
16359
|
-
|
|
16360
|
-
|
|
16361
|
-
|
|
16362
|
-
|
|
16363
|
-
|
|
16364
|
-
|
|
16365
|
-
|
|
16366
|
-
|
|
16367
|
-
|
|
16368
|
-
|
|
16369
|
-
renderSlopeChart(container, parsed, effectivePalette, isDark, void 0, dims);
|
|
16370
|
-
}
|
|
16371
|
-
const svgEl = container.querySelector("svg");
|
|
16372
|
-
if (!svgEl) return "";
|
|
16373
|
-
if (theme === "transparent") {
|
|
16374
|
-
svgEl.style.background = "none";
|
|
16375
|
-
} else if (!svgEl.style.background) {
|
|
16376
|
-
svgEl.style.background = effectivePalette.bg;
|
|
16377
|
-
}
|
|
16378
|
-
svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
16379
|
-
svgEl.style.fontFamily = FONT_FAMILY;
|
|
16380
|
-
const svgHtml = svgEl.outerHTML;
|
|
16381
|
-
if (options?.branding !== false) {
|
|
16382
|
-
const brandColor = theme === "transparent" ? "#888" : effectivePalette.textMuted;
|
|
16383
|
-
return injectBranding(svgHtml, brandColor);
|
|
16384
|
-
}
|
|
16385
|
-
return svgHtml;
|
|
16386
|
-
} finally {
|
|
16387
|
-
document.body.removeChild(container);
|
|
15854
|
+
if (parsed.type === "sequence") {
|
|
15855
|
+
const { parseSequenceDgmo: parseSequenceDgmo2 } = await Promise.resolve().then(() => (init_parser(), parser_exports));
|
|
15856
|
+
const { renderSequenceDiagram: renderSequenceDiagram2 } = await Promise.resolve().then(() => (init_renderer7(), renderer_exports7));
|
|
15857
|
+
const seqParsed = parseSequenceDgmo2(content);
|
|
15858
|
+
if (seqParsed.error || seqParsed.participants.length === 0) return "";
|
|
15859
|
+
renderSequenceDiagram2(container, seqParsed, effectivePalette, isDark, void 0, {
|
|
15860
|
+
exportWidth: EXPORT_WIDTH
|
|
15861
|
+
});
|
|
15862
|
+
} else if (parsed.type === "wordcloud") {
|
|
15863
|
+
await renderWordCloudAsync(container, parsed, effectivePalette, isDark, dims);
|
|
15864
|
+
} else if (parsed.type === "arc") {
|
|
15865
|
+
renderArcDiagram(container, parsed, effectivePalette, isDark, void 0, dims);
|
|
15866
|
+
} else if (parsed.type === "timeline") {
|
|
15867
|
+
renderTimeline(container, parsed, effectivePalette, isDark, void 0, dims);
|
|
15868
|
+
} else if (parsed.type === "venn") {
|
|
15869
|
+
renderVenn(container, parsed, effectivePalette, isDark, void 0, dims);
|
|
15870
|
+
} else if (parsed.type === "quadrant") {
|
|
15871
|
+
renderQuadrant(container, parsed, effectivePalette, isDark, void 0, dims);
|
|
15872
|
+
} else {
|
|
15873
|
+
renderSlopeChart(container, parsed, effectivePalette, isDark, void 0, dims);
|
|
16388
15874
|
}
|
|
15875
|
+
return finalizeSvgExport(container, theme, effectivePalette, options);
|
|
16389
15876
|
}
|
|
16390
15877
|
var d3Scale, d3Selection9, d3Shape6, d3Array, import_d3_cloud, DEFAULT_CLOUD_OPTIONS, STOP_WORDS, SLOPE_MARGIN, SLOPE_LABEL_FONT_SIZE, SLOPE_CHAR_WIDTH, ARC_MARGIN, MONTH_ABBR, EXPORT_WIDTH, EXPORT_HEIGHT;
|
|
16391
15878
|
var init_d3 = __esm({
|
|
@@ -16547,6 +16034,7 @@ var index_exports = {};
|
|
|
16547
16034
|
__export(index_exports, {
|
|
16548
16035
|
DGMO_CHART_TYPE_MAP: () => DGMO_CHART_TYPE_MAP,
|
|
16549
16036
|
RULE_COUNT: () => RULE_COUNT,
|
|
16037
|
+
STANDARD_CHART_TYPES: () => STANDARD_CHART_TYPES,
|
|
16550
16038
|
addDurationToDate: () => addDurationToDate,
|
|
16551
16039
|
applyGroupOrdering: () => applyGroupOrdering,
|
|
16552
16040
|
applyPositionOverrides: () => applyPositionOverrides,
|
|
@@ -17229,6 +16717,7 @@ init_branding();
|
|
|
17229
16717
|
0 && (module.exports = {
|
|
17230
16718
|
DGMO_CHART_TYPE_MAP,
|
|
17231
16719
|
RULE_COUNT,
|
|
16720
|
+
STANDARD_CHART_TYPES,
|
|
17232
16721
|
addDurationToDate,
|
|
17233
16722
|
applyGroupOrdering,
|
|
17234
16723
|
applyPositionOverrides,
|