@diagrammo/dgmo 0.8.11 → 0.8.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +115 -719
- package/dist/index.cjs +196 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +194 -54
- package/dist/index.js.map +1 -1
- package/docs/guide/chart-arc.md +71 -0
- package/docs/guide/chart-area.md +73 -0
- package/docs/guide/chart-bar-stacked.md +61 -0
- package/docs/guide/chart-bar.md +62 -0
- package/docs/guide/chart-boxes-and-lines.md +243 -0
- package/docs/guide/chart-c4.md +300 -0
- package/docs/guide/chart-chord.md +43 -0
- package/docs/guide/chart-class.md +204 -0
- package/docs/guide/chart-doughnut.md +38 -0
- package/docs/guide/chart-er.md +218 -0
- package/docs/guide/chart-flowchart.md +102 -0
- package/docs/guide/chart-function.md +56 -0
- package/docs/guide/chart-funnel.md +38 -0
- package/docs/guide/chart-gantt.md +368 -0
- package/docs/guide/chart-heatmap.md +41 -0
- package/docs/guide/chart-infra.md +694 -0
- package/docs/guide/chart-kanban.md +156 -0
- package/docs/guide/chart-line.md +79 -0
- package/docs/guide/chart-multi-line.md +84 -0
- package/docs/guide/chart-org.md +209 -0
- package/docs/guide/chart-pie.md +39 -0
- package/docs/guide/chart-polar-area.md +38 -0
- package/docs/guide/chart-quadrant.md +69 -0
- package/docs/guide/chart-radar.md +38 -0
- package/docs/guide/chart-sankey.md +103 -0
- package/docs/guide/chart-scatter.md +94 -0
- package/docs/guide/chart-sequence.md +332 -0
- package/docs/guide/chart-sitemap.md +248 -0
- package/docs/guide/chart-slope.md +56 -0
- package/docs/guide/chart-state.md +171 -0
- package/docs/guide/chart-timeline.md +229 -0
- package/docs/guide/chart-venn.md +81 -0
- package/docs/guide/chart-wordcloud.md +66 -0
- package/docs/guide/colors.md +283 -0
- package/docs/guide/index.md +55 -0
- package/docs/guide/keyboard-shortcuts.md +49 -0
- package/docs/guide/registry.json +51 -0
- package/gallery/fixtures/boxes-and-lines.dgmo +4 -6
- package/gallery/fixtures/er.dgmo +36 -0
- package/gallery/fixtures/kanban.dgmo +27 -0
- package/package.json +1 -1
- package/src/boxes-and-lines/parser.ts +2 -0
- package/src/boxes-and-lines/renderer.ts +12 -4
- package/src/c4/parser.ts +5 -1
- package/src/completion.ts +17 -2
- package/src/d3.ts +140 -71
- package/src/echarts.ts +1 -1
- package/src/er/parser.ts +5 -1
- package/src/gantt/parser.ts +8 -0
- package/src/gantt/renderer.ts +6 -7
- package/src/gantt/types.ts +1 -0
- package/src/infra/parser.ts +4 -0
- package/src/kanban/parser.ts +4 -1
- package/src/kanban/renderer.ts +1 -1
- package/src/org/parser.ts +3 -0
- package/src/sequence/parser.ts +2 -0
- package/src/sequence/renderer.ts +8 -6
- package/src/sharing.ts +18 -9
- package/src/sitemap/parser.ts +2 -0
- package/src/utils/legend-layout.ts +7 -3
- package/src/utils/tag-groups.ts +64 -0
package/dist/index.d.cts
CHANGED
|
@@ -1751,6 +1751,7 @@ declare function renderBoxesAndLinesForExport(container: HTMLDivElement, parsed:
|
|
|
1751
1751
|
width: number;
|
|
1752
1752
|
height: number;
|
|
1753
1753
|
};
|
|
1754
|
+
activeTagGroup?: string | null;
|
|
1754
1755
|
}): void;
|
|
1755
1756
|
|
|
1756
1757
|
interface BLCollapseResult {
|
|
@@ -2266,6 +2267,7 @@ interface GanttOptions {
|
|
|
2266
2267
|
dependencies: boolean;
|
|
2267
2268
|
sort: 'default' | 'tag';
|
|
2268
2269
|
defaultSwimlaneGroup: string | null;
|
|
2270
|
+
activeTag: string | null;
|
|
2269
2271
|
/** Line numbers for option/block keywords — maps key to source line */
|
|
2270
2272
|
optionLineNumbers: Record<string, number>;
|
|
2271
2273
|
holidaysLineNumber: number | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -1751,6 +1751,7 @@ declare function renderBoxesAndLinesForExport(container: HTMLDivElement, parsed:
|
|
|
1751
1751
|
width: number;
|
|
1752
1752
|
height: number;
|
|
1753
1753
|
};
|
|
1754
|
+
activeTagGroup?: string | null;
|
|
1754
1755
|
}): void;
|
|
1755
1756
|
|
|
1756
1757
|
interface BLCollapseResult {
|
|
@@ -2266,6 +2267,7 @@ interface GanttOptions {
|
|
|
2266
2267
|
dependencies: boolean;
|
|
2267
2268
|
sort: 'default' | 'tag';
|
|
2268
2269
|
defaultSwimlaneGroup: string | null;
|
|
2270
|
+
activeTag: string | null;
|
|
2269
2271
|
/** Line numbers for option/block keywords — maps key to source line */
|
|
2270
2272
|
optionLineNumbers: Record<string, number>;
|
|
2271
2273
|
holidaysLineNumber: number | null;
|
package/dist/index.js
CHANGED
|
@@ -1929,6 +1929,16 @@ function validateTagValues(entities, tagGroups, pushWarning, suggestFn) {
|
|
|
1929
1929
|
}
|
|
1930
1930
|
}
|
|
1931
1931
|
}
|
|
1932
|
+
function validateTagGroupNames(tagGroups, pushWarning) {
|
|
1933
|
+
for (const group of tagGroups) {
|
|
1934
|
+
if (group.name.toLowerCase() === "none") {
|
|
1935
|
+
pushWarning(
|
|
1936
|
+
group.lineNumber,
|
|
1937
|
+
`'none' is a reserved keyword and cannot be used as a tag group name`
|
|
1938
|
+
);
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1932
1942
|
function injectDefaultTagMetadata(entities, tagGroups, skip) {
|
|
1933
1943
|
const defaults = [];
|
|
1934
1944
|
for (const group of tagGroups) {
|
|
@@ -1949,6 +1959,19 @@ function injectDefaultTagMetadata(entities, tagGroups, skip) {
|
|
|
1949
1959
|
}
|
|
1950
1960
|
}
|
|
1951
1961
|
}
|
|
1962
|
+
function resolveActiveTagGroup(tagGroups, explicitActiveTag, programmaticOverride) {
|
|
1963
|
+
if (programmaticOverride !== void 0) {
|
|
1964
|
+
if (!programmaticOverride) return null;
|
|
1965
|
+
if (programmaticOverride.toLowerCase() === "none") return null;
|
|
1966
|
+
return programmaticOverride;
|
|
1967
|
+
}
|
|
1968
|
+
if (explicitActiveTag) {
|
|
1969
|
+
if (explicitActiveTag.toLowerCase() === "none") return null;
|
|
1970
|
+
return explicitActiveTag;
|
|
1971
|
+
}
|
|
1972
|
+
if (tagGroups.length > 0) return tagGroups[0].name;
|
|
1973
|
+
return null;
|
|
1974
|
+
}
|
|
1952
1975
|
function matchTagBlockHeading(trimmed) {
|
|
1953
1976
|
return parseTagDeclaration(trimmed);
|
|
1954
1977
|
}
|
|
@@ -2252,13 +2275,15 @@ function computeLegendLayout(config, state, containerWidth) {
|
|
|
2252
2275
|
});
|
|
2253
2276
|
}
|
|
2254
2277
|
}
|
|
2278
|
+
const alignLeft = config.position.titleRelation === "inline-with-title";
|
|
2255
2279
|
const rows = layoutRows(
|
|
2256
2280
|
activeCapsule,
|
|
2257
2281
|
pills,
|
|
2258
2282
|
controlLayouts,
|
|
2259
2283
|
groupAvailW,
|
|
2260
2284
|
containerWidth,
|
|
2261
|
-
totalControlsW
|
|
2285
|
+
totalControlsW,
|
|
2286
|
+
alignLeft
|
|
2262
2287
|
);
|
|
2263
2288
|
const height = rows.length * LEGEND_HEIGHT;
|
|
2264
2289
|
const width = containerWidth;
|
|
@@ -2332,7 +2357,7 @@ function buildCapsuleLayout(group, containerWidth, addonWidth = 0) {
|
|
|
2332
2357
|
addonX: addonWidth > 0 ? LEGEND_CAPSULE_PAD + pw + 4 : void 0
|
|
2333
2358
|
};
|
|
2334
2359
|
}
|
|
2335
|
-
function layoutRows(activeCapsule, pills, controls, groupAvailW, containerWidth, totalControlsW) {
|
|
2360
|
+
function layoutRows(activeCapsule, pills, controls, groupAvailW, containerWidth, totalControlsW, alignLeft = false) {
|
|
2336
2361
|
const rows = [];
|
|
2337
2362
|
const groupItems = [];
|
|
2338
2363
|
if (activeCapsule) groupItems.push(activeCapsule);
|
|
@@ -2343,7 +2368,8 @@ function layoutRows(activeCapsule, pills, controls, groupAvailW, containerWidth,
|
|
|
2343
2368
|
for (const item of groupItems) {
|
|
2344
2369
|
const itemW = item.width + LEGEND_GROUP_GAP;
|
|
2345
2370
|
if (currentRowW + item.width > groupAvailW && currentRowItems.length > 0) {
|
|
2346
|
-
|
|
2371
|
+
if (!alignLeft)
|
|
2372
|
+
centerRowItems(currentRowItems, containerWidth, totalControlsW);
|
|
2347
2373
|
rows.push({ y: rowY, items: currentRowItems });
|
|
2348
2374
|
rowY += LEGEND_HEIGHT;
|
|
2349
2375
|
currentRowItems = [];
|
|
@@ -3747,6 +3773,7 @@ function parseSequenceDgmo(content) {
|
|
|
3747
3773
|
entities.push({ metadata: g.metadata, lineNumber: g.lineNumber });
|
|
3748
3774
|
}
|
|
3749
3775
|
validateTagValues(entities, result.tagGroups, pushWarning, suggest);
|
|
3776
|
+
validateTagGroupNames(result.tagGroups, pushWarning);
|
|
3750
3777
|
}
|
|
3751
3778
|
return result;
|
|
3752
3779
|
}
|
|
@@ -5023,6 +5050,10 @@ function parseERDiagram(content, palette) {
|
|
|
5023
5050
|
(line10, msg) => result.diagnostics.push(makeDgmoError(line10, msg, "warning")),
|
|
5024
5051
|
suggest
|
|
5025
5052
|
);
|
|
5053
|
+
validateTagGroupNames(
|
|
5054
|
+
result.tagGroups,
|
|
5055
|
+
(line10, msg) => result.diagnostics.push(makeDgmoError(line10, msg, "warning"))
|
|
5056
|
+
);
|
|
5026
5057
|
for (const group of result.tagGroups) {
|
|
5027
5058
|
if (!group.defaultValue) continue;
|
|
5028
5059
|
const key = group.name.toLowerCase();
|
|
@@ -5118,7 +5149,7 @@ var init_parser3 = __esm({
|
|
|
5118
5149
|
unique: "unique",
|
|
5119
5150
|
nullable: "nullable"
|
|
5120
5151
|
};
|
|
5121
|
-
KNOWN_OPTIONS = /* @__PURE__ */ new Set(["notation"]);
|
|
5152
|
+
KNOWN_OPTIONS = /* @__PURE__ */ new Set(["notation", "active-tag"]);
|
|
5122
5153
|
REL_SYMBOLIC_RE = /^([a-zA-Z_]\w*)\s+([1*?])\s*-{1,2}\s*([1*?])\s+([a-zA-Z_]\w*)(?:\s+(.+))?$/;
|
|
5123
5154
|
REL_KEYWORD_RE = /^([a-zA-Z_]\w*)\s+(one|many|zero)[- ]to[- ](one|many|zero)\s+([a-zA-Z_]\w*)(?:\s+(.+))?$/i;
|
|
5124
5155
|
KEYWORD_TO_SYMBOL = {
|
|
@@ -6212,7 +6243,7 @@ function buildChordOption(parsed, textColor, colors, bg, titleConfig) {
|
|
|
6212
6243
|
};
|
|
6213
6244
|
});
|
|
6214
6245
|
})(),
|
|
6215
|
-
roam:
|
|
6246
|
+
roam: false,
|
|
6216
6247
|
label: {
|
|
6217
6248
|
position: "right",
|
|
6218
6249
|
formatter: "{b}"
|
|
@@ -7967,6 +7998,7 @@ function parseOrg(content, palette) {
|
|
|
7967
7998
|
};
|
|
7968
7999
|
collectAll(result.roots);
|
|
7969
8000
|
validateTagValues(allNodes, result.tagGroups, pushWarning, suggest);
|
|
8001
|
+
validateTagGroupNames(result.tagGroups, pushWarning);
|
|
7970
8002
|
}
|
|
7971
8003
|
if (result.roots.length === 0 && result.tagGroups.length === 0 && !result.error) {
|
|
7972
8004
|
const diag = makeDgmoError(1, "No nodes found in org chart");
|
|
@@ -8033,7 +8065,8 @@ var init_parser4 = __esm({
|
|
|
8033
8065
|
KNOWN_OPTIONS3 = /* @__PURE__ */ new Set([
|
|
8034
8066
|
"sub-node-label",
|
|
8035
8067
|
"hide",
|
|
8036
|
-
"show-sub-node-count"
|
|
8068
|
+
"show-sub-node-count",
|
|
8069
|
+
"active-tag"
|
|
8037
8070
|
]);
|
|
8038
8071
|
KNOWN_BOOLEANS2 = /* @__PURE__ */ new Set(["show-sub-node-count", "direction-tb"]);
|
|
8039
8072
|
}
|
|
@@ -8294,6 +8327,7 @@ function parseKanban(content, palette) {
|
|
|
8294
8327
|
if (result.columns.length === 0 && !result.error) {
|
|
8295
8328
|
return fail(1, "No columns found. Use [Column Name] to define columns");
|
|
8296
8329
|
}
|
|
8330
|
+
validateTagGroupNames(result.tagGroups, warn);
|
|
8297
8331
|
return result;
|
|
8298
8332
|
}
|
|
8299
8333
|
function parseCardLine(trimmed, lineNumber, counter, aliasMap, palette) {
|
|
@@ -8339,7 +8373,7 @@ var init_parser5 = __esm({
|
|
|
8339
8373
|
init_parsing();
|
|
8340
8374
|
COLUMN_RE = /^\[(.+?)\](?:\s*\(([^)]+)\))?\s*(?:\|\s*(.+))?$/;
|
|
8341
8375
|
LEGACY_COLUMN_RE = /^==\s+(.+?)\s*(?:\[wip:\s*(\d+)\])?\s*==$/;
|
|
8342
|
-
KNOWN_OPTIONS4 = /* @__PURE__ */ new Set(["hide"]);
|
|
8376
|
+
KNOWN_OPTIONS4 = /* @__PURE__ */ new Set(["hide", "active-tag"]);
|
|
8343
8377
|
KNOWN_BOOLEANS3 = /* @__PURE__ */ new Set(["no-auto-color"]);
|
|
8344
8378
|
}
|
|
8345
8379
|
});
|
|
@@ -8882,6 +8916,10 @@ function parseC4(content, palette) {
|
|
|
8882
8916
|
}
|
|
8883
8917
|
validateRelationshipTargets(result, knownNames, pushError);
|
|
8884
8918
|
validateDeploymentRefs(result, knownNames, pushError);
|
|
8919
|
+
validateTagGroupNames(
|
|
8920
|
+
result.tagGroups,
|
|
8921
|
+
(line10, msg) => pushError(line10, msg, "warning")
|
|
8922
|
+
);
|
|
8885
8923
|
return result;
|
|
8886
8924
|
}
|
|
8887
8925
|
function findParentElement(indent, stack) {
|
|
@@ -9008,7 +9046,7 @@ var init_parser6 = __esm({
|
|
|
9008
9046
|
"cloud",
|
|
9009
9047
|
"external"
|
|
9010
9048
|
]);
|
|
9011
|
-
KNOWN_C4_OPTIONS = /* @__PURE__ */ new Set(["layout"]);
|
|
9049
|
+
KNOWN_C4_OPTIONS = /* @__PURE__ */ new Set(["layout", "active-tag"]);
|
|
9012
9050
|
KNOWN_C4_BOOLEANS = /* @__PURE__ */ new Set(["direction-tb"]);
|
|
9013
9051
|
ALL_CHART_TYPES2 = [
|
|
9014
9052
|
"c4",
|
|
@@ -9346,6 +9384,7 @@ function parseSitemap(content, palette) {
|
|
|
9346
9384
|
};
|
|
9347
9385
|
collectAll(result.roots);
|
|
9348
9386
|
validateTagValues(allNodes, result.tagGroups, pushWarning, suggest);
|
|
9387
|
+
validateTagGroupNames(result.tagGroups, pushWarning);
|
|
9349
9388
|
}
|
|
9350
9389
|
if (result.roots.length === 0 && result.tagGroups.length === 0 && !result.error) {
|
|
9351
9390
|
const diag = makeDgmoError(1, "No pages found in sitemap");
|
|
@@ -9946,6 +9985,7 @@ function parseInfra(content) {
|
|
|
9946
9985
|
}
|
|
9947
9986
|
}
|
|
9948
9987
|
}
|
|
9988
|
+
validateTagGroupNames(result.tagGroups, warn);
|
|
9949
9989
|
return result;
|
|
9950
9990
|
}
|
|
9951
9991
|
function extractSymbols4(docText) {
|
|
@@ -10024,7 +10064,8 @@ var init_parser8 = __esm({
|
|
|
10024
10064
|
"slo-warning-margin",
|
|
10025
10065
|
"default-latency-ms",
|
|
10026
10066
|
"default-uptime",
|
|
10027
|
-
"default-rps"
|
|
10067
|
+
"default-rps",
|
|
10068
|
+
"active-tag"
|
|
10028
10069
|
]);
|
|
10029
10070
|
UNPARSED_SPLIT_RE = /\bsplit\s+(\d+)%/;
|
|
10030
10071
|
}
|
|
@@ -10222,6 +10263,7 @@ function parseGantt(content, palette) {
|
|
|
10222
10263
|
dependencies: true,
|
|
10223
10264
|
sort: "default",
|
|
10224
10265
|
defaultSwimlaneGroup: null,
|
|
10266
|
+
activeTag: null,
|
|
10225
10267
|
optionLineNumbers: {},
|
|
10226
10268
|
holidaysLineNumber: null
|
|
10227
10269
|
},
|
|
@@ -10636,6 +10678,9 @@ function parseGantt(content, palette) {
|
|
|
10636
10678
|
);
|
|
10637
10679
|
}
|
|
10638
10680
|
break;
|
|
10681
|
+
case "active-tag":
|
|
10682
|
+
result.options.activeTag = value;
|
|
10683
|
+
break;
|
|
10639
10684
|
}
|
|
10640
10685
|
continue;
|
|
10641
10686
|
}
|
|
@@ -10815,6 +10860,7 @@ function parseGantt(content, palette) {
|
|
|
10815
10860
|
warn(0, "sort tag has no effect \u2014 no tag groups defined.");
|
|
10816
10861
|
result.options.sort = "default";
|
|
10817
10862
|
}
|
|
10863
|
+
validateTagGroupNames(result.tagGroups, warn);
|
|
10818
10864
|
return result;
|
|
10819
10865
|
function makeTask(labelRaw, duration, uncertain, ln, explicitStart) {
|
|
10820
10866
|
const segments = labelRaw.split("|");
|
|
@@ -10977,7 +11023,8 @@ var init_parser9 = __esm({
|
|
|
10977
11023
|
"critical-path",
|
|
10978
11024
|
"dependencies",
|
|
10979
11025
|
"chart",
|
|
10980
|
-
"sort"
|
|
11026
|
+
"sort",
|
|
11027
|
+
"active-tag"
|
|
10981
11028
|
]);
|
|
10982
11029
|
KNOWN_BOOLEANS4 = /* @__PURE__ */ new Set([
|
|
10983
11030
|
"critical-path",
|
|
@@ -11397,6 +11444,7 @@ function parseBoxesAndLines(content) {
|
|
|
11397
11444
|
if (result.tagGroups.length > 0) {
|
|
11398
11445
|
injectDefaultTagMetadata(result.nodes, result.tagGroups);
|
|
11399
11446
|
validateTagValues(result.nodes, result.tagGroups, pushWarning, suggest);
|
|
11447
|
+
validateTagGroupNames(result.tagGroups, pushWarning);
|
|
11400
11448
|
}
|
|
11401
11449
|
return result;
|
|
11402
11450
|
}
|
|
@@ -14272,7 +14320,7 @@ function renderKanban(container, parsed, palette, isDark, _onNavigateToLine, exp
|
|
|
14272
14320
|
const legendY = DIAGRAM_PADDING3 + (TITLE_FONT_SIZE - LEGEND_HEIGHT) / 2;
|
|
14273
14321
|
const legendConfig = {
|
|
14274
14322
|
groups: parsed.tagGroups,
|
|
14275
|
-
position: { placement: "top-center", titleRelation: "
|
|
14323
|
+
position: { placement: "top-center", titleRelation: "inline-with-title" },
|
|
14276
14324
|
mode: exportDims ? "inline" : "fixed"
|
|
14277
14325
|
};
|
|
14278
14326
|
const legendState = { activeGroup: activeTagGroup ?? null };
|
|
@@ -15955,7 +16003,11 @@ function renderBoxesAndLines(container, parsed, layout, palette, isDark, options
|
|
|
15955
16003
|
const width = exportDims?.width ?? container.clientWidth;
|
|
15956
16004
|
const height = exportDims?.height ?? container.clientHeight;
|
|
15957
16005
|
if (width <= 0 || height <= 0) return;
|
|
15958
|
-
const activeGroup =
|
|
16006
|
+
const activeGroup = resolveActiveTagGroup(
|
|
16007
|
+
parsed.tagGroups,
|
|
16008
|
+
parsed.options["active-tag"],
|
|
16009
|
+
activeTagGroup
|
|
16010
|
+
);
|
|
15959
16011
|
const hidden = hiddenTagValues ?? parsed.initialHiddenTagValues;
|
|
15960
16012
|
const nodeMap = /* @__PURE__ */ new Map();
|
|
15961
16013
|
for (const node of parsed.nodes) nodeMap.set(node.label, node);
|
|
@@ -16133,7 +16185,8 @@ function renderBoxesAndLines(container, parsed, layout, palette, isDark, options
|
|
|
16133
16185
|
}
|
|
16134
16186
|
function renderBoxesAndLinesForExport(container, parsed, layout, palette, isDark, options) {
|
|
16135
16187
|
renderBoxesAndLines(container, parsed, layout, palette, isDark, {
|
|
16136
|
-
exportDims: options?.exportDims
|
|
16188
|
+
exportDims: options?.exportDims,
|
|
16189
|
+
activeTagGroup: options?.activeTagGroup
|
|
16137
16190
|
});
|
|
16138
16191
|
}
|
|
16139
16192
|
var DIAGRAM_PADDING6, NODE_FONT_SIZE, MIN_NODE_FONT_SIZE, META_FONT_SIZE3, EDGE_LABEL_FONT_SIZE4, EDGE_STROKE_WIDTH5, NODE_STROKE_WIDTH5, NODE_RX, COLLAPSE_BAR_HEIGHT3, ARROWHEAD_W2, ARROWHEAD_H2, CHAR_WIDTH_RATIO2, NODE_TEXT_PADDING, GROUP_RX, GROUP_LABEL_FONT_SIZE, lineGeneratorLR, lineGeneratorTB, lineGeneratorLinear2;
|
|
@@ -22749,7 +22802,11 @@ function renderGantt(container, resolved, palette, isDark, options, exportDims)
|
|
|
22749
22802
|
const collapsedLanes = options?.collapsedLanes;
|
|
22750
22803
|
const onToggleLane = options?.onToggleLane;
|
|
22751
22804
|
const seriesColors2 = getSeriesColors(palette);
|
|
22752
|
-
let currentActiveGroup =
|
|
22805
|
+
let currentActiveGroup = resolveActiveTagGroup(
|
|
22806
|
+
resolved.tagGroups,
|
|
22807
|
+
resolved.options.activeTag ?? void 0,
|
|
22808
|
+
options?.currentActiveGroup
|
|
22809
|
+
);
|
|
22753
22810
|
let criticalPathActive = false;
|
|
22754
22811
|
const tagRows = currentSwimlaneGroup ? buildTagLaneRowList(resolved, currentSwimlaneGroup, collapsedLanes) : null;
|
|
22755
22812
|
const rows = tagRows ?? buildRowList(resolved, collapsedGroups);
|
|
@@ -25107,7 +25164,11 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
25107
25164
|
);
|
|
25108
25165
|
if (participants.length === 0) return;
|
|
25109
25166
|
const activationsOff = parsedOptions.activations?.toLowerCase() === "off";
|
|
25110
|
-
const activeTagGroup =
|
|
25167
|
+
const activeTagGroup = resolveActiveTagGroup(
|
|
25168
|
+
parsed.tagGroups,
|
|
25169
|
+
parsedOptions["active-tag"],
|
|
25170
|
+
options?.activeTagGroup
|
|
25171
|
+
) ?? void 0;
|
|
25111
25172
|
let tagMap;
|
|
25112
25173
|
const tagValueToColor = /* @__PURE__ */ new Map();
|
|
25113
25174
|
if (activeTagGroup) {
|
|
@@ -26109,6 +26170,7 @@ var init_renderer10 = __esm({
|
|
|
26109
26170
|
init_colors();
|
|
26110
26171
|
init_parser();
|
|
26111
26172
|
init_tag_resolution();
|
|
26173
|
+
init_tag_groups();
|
|
26112
26174
|
init_legend_constants();
|
|
26113
26175
|
init_legend_d3();
|
|
26114
26176
|
init_title_constants();
|
|
@@ -27069,6 +27131,10 @@ function parseVisualization(content, palette) {
|
|
|
27069
27131
|
(line10, msg) => result.diagnostics.push(makeDgmoError(line10, msg, "warning")),
|
|
27070
27132
|
suggest
|
|
27071
27133
|
);
|
|
27134
|
+
validateTagGroupNames(
|
|
27135
|
+
result.timelineTagGroups,
|
|
27136
|
+
(line10, msg) => result.diagnostics.push(makeDgmoError(line10, msg, "warning"))
|
|
27137
|
+
);
|
|
27072
27138
|
for (const group of result.timelineTagGroups) {
|
|
27073
27139
|
if (!group.defaultValue) continue;
|
|
27074
27140
|
const key = group.name.toLowerCase();
|
|
@@ -27965,6 +28031,26 @@ function buildEventTooltipHtml(ev) {
|
|
|
27965
28031
|
function buildEraTooltipHtml(era) {
|
|
27966
28032
|
return `<strong>${era.label}</strong><br>${formatDateLabel(era.startDate)} \u2192 ${formatDateLabel(era.endDate)}`;
|
|
27967
28033
|
}
|
|
28034
|
+
function renderTimelineGroupLegend(g, groups, groupColorMap, textColor, palette, isDark, legendY, onHover, onLeave) {
|
|
28035
|
+
const PILL_H = 22;
|
|
28036
|
+
const DOT_R = 4;
|
|
28037
|
+
const DOT_GAP = 4;
|
|
28038
|
+
const PAD_X = 10;
|
|
28039
|
+
const FONT_SIZE = 11;
|
|
28040
|
+
const GAP = 8;
|
|
28041
|
+
const pillBg = isDark ? mix(palette.surface, palette.bg, 50) : mix(palette.surface, palette.bg, 30);
|
|
28042
|
+
let legendX = 0;
|
|
28043
|
+
for (const grp of groups) {
|
|
28044
|
+
const color = groupColorMap.get(grp.name) ?? textColor;
|
|
28045
|
+
const textW = measureLegendText(grp.name, FONT_SIZE);
|
|
28046
|
+
const pillW = PAD_X + DOT_R * 2 + DOT_GAP + textW + PAD_X;
|
|
28047
|
+
const itemG = g.append("g").attr("class", "tl-legend-item").attr("data-group", grp.name).style("cursor", "pointer").on("mouseenter", () => onHover(grp.name)).on("mouseleave", () => onLeave());
|
|
28048
|
+
itemG.append("rect").attr("x", legendX).attr("y", legendY - PILL_H / 2).attr("width", pillW).attr("height", PILL_H).attr("rx", PILL_H / 2).attr("fill", pillBg);
|
|
28049
|
+
itemG.append("circle").attr("cx", legendX + PAD_X + DOT_R).attr("cy", legendY).attr("r", DOT_R).attr("fill", color);
|
|
28050
|
+
itemG.append("text").attr("x", legendX + PAD_X + DOT_R * 2 + DOT_GAP).attr("y", legendY).attr("dy", "0.35em").attr("fill", textColor).attr("font-size", `${FONT_SIZE}px`).attr("font-family", FONT_FAMILY).text(grp.name);
|
|
28051
|
+
legendX += pillW + GAP;
|
|
28052
|
+
}
|
|
28053
|
+
}
|
|
27968
28054
|
function renderTimeline(container, parsed, palette, isDark, onClickItem, exportDims, activeTagGroup, swimlaneTagGroup, onTagStateChange, viewMode) {
|
|
27969
28055
|
d3Selection13.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
27970
28056
|
const {
|
|
@@ -28356,15 +28442,17 @@ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
28356
28442
|
);
|
|
28357
28443
|
}
|
|
28358
28444
|
if (timelineGroups.length > 0) {
|
|
28359
|
-
|
|
28360
|
-
|
|
28361
|
-
|
|
28362
|
-
|
|
28363
|
-
|
|
28364
|
-
|
|
28365
|
-
|
|
28366
|
-
|
|
28367
|
-
|
|
28445
|
+
renderTimelineGroupLegend(
|
|
28446
|
+
g,
|
|
28447
|
+
timelineGroups,
|
|
28448
|
+
groupColorMap,
|
|
28449
|
+
textColor,
|
|
28450
|
+
palette,
|
|
28451
|
+
isDark,
|
|
28452
|
+
-55,
|
|
28453
|
+
(name) => fadeToGroup(g, name),
|
|
28454
|
+
() => fadeReset(g)
|
|
28455
|
+
);
|
|
28368
28456
|
}
|
|
28369
28457
|
g.append("line").attr("x1", axisX).attr("y1", 0).attr("x2", axisX).attr("y2", innerHeight).attr("stroke", mutedColor).attr("stroke-width", 1).attr("stroke-dasharray", "4,4");
|
|
28370
28458
|
for (const ev of sorted) {
|
|
@@ -28672,15 +28760,18 @@ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
28672
28760
|
);
|
|
28673
28761
|
}
|
|
28674
28762
|
if (timelineGroups.length > 0) {
|
|
28675
|
-
let legendX = 0;
|
|
28676
28763
|
const legendY = timelineScale ? -75 : -55;
|
|
28677
|
-
|
|
28678
|
-
|
|
28679
|
-
|
|
28680
|
-
|
|
28681
|
-
|
|
28682
|
-
|
|
28683
|
-
|
|
28764
|
+
renderTimelineGroupLegend(
|
|
28765
|
+
g,
|
|
28766
|
+
timelineGroups,
|
|
28767
|
+
groupColorMap,
|
|
28768
|
+
textColor,
|
|
28769
|
+
palette,
|
|
28770
|
+
isDark,
|
|
28771
|
+
legendY,
|
|
28772
|
+
(name) => fadeToGroup(g, name),
|
|
28773
|
+
() => fadeReset(g)
|
|
28774
|
+
);
|
|
28684
28775
|
}
|
|
28685
28776
|
sorted.forEach((ev, i) => {
|
|
28686
28777
|
const y = markerMargin + i * rowH + rowH / 2;
|
|
@@ -29792,7 +29883,11 @@ async function renderForExport(content, theme, palette, orgExportState, options)
|
|
|
29792
29883
|
const orgParsed = parseOrg2(content, effectivePalette2);
|
|
29793
29884
|
if (orgParsed.error) return "";
|
|
29794
29885
|
const collapsedNodes = orgExportState?.collapsedNodes;
|
|
29795
|
-
const activeTagGroup =
|
|
29886
|
+
const activeTagGroup = resolveActiveTagGroup(
|
|
29887
|
+
orgParsed.tagGroups,
|
|
29888
|
+
orgParsed.options["active-tag"],
|
|
29889
|
+
orgExportState?.activeTagGroup ?? options?.tagGroup
|
|
29890
|
+
);
|
|
29796
29891
|
const hiddenAttributes = orgExportState?.hiddenAttributes;
|
|
29797
29892
|
const { parsed: effectiveParsed, hiddenCounts } = collapsedNodes && collapsedNodes.size > 0 ? collapseOrgTree2(orgParsed, collapsedNodes) : { parsed: orgParsed, hiddenCounts: /* @__PURE__ */ new Map() };
|
|
29798
29893
|
const orgLayout = layoutOrg2(
|
|
@@ -29831,7 +29926,11 @@ async function renderForExport(content, theme, palette, orgExportState, options)
|
|
|
29831
29926
|
const sitemapParsed = parseSitemap2(content, effectivePalette2);
|
|
29832
29927
|
if (sitemapParsed.error || sitemapParsed.roots.length === 0) return "";
|
|
29833
29928
|
const collapsedNodes = orgExportState?.collapsedNodes;
|
|
29834
|
-
const activeTagGroup =
|
|
29929
|
+
const activeTagGroup = resolveActiveTagGroup(
|
|
29930
|
+
sitemapParsed.tagGroups,
|
|
29931
|
+
sitemapParsed.options["active-tag"],
|
|
29932
|
+
orgExportState?.activeTagGroup ?? options?.tagGroup
|
|
29933
|
+
);
|
|
29835
29934
|
const hiddenAttributes = orgExportState?.hiddenAttributes;
|
|
29836
29935
|
const { parsed: effectiveParsed, hiddenCounts } = collapsedNodes && collapsedNodes.size > 0 ? collapseSitemapTree2(sitemapParsed, collapsedNodes) : { parsed: sitemapParsed, hiddenCounts: /* @__PURE__ */ new Map() };
|
|
29837
29936
|
const sitemapLayout = layoutSitemap2(
|
|
@@ -29876,7 +29975,11 @@ async function renderForExport(content, theme, palette, orgExportState, options)
|
|
|
29876
29975
|
theme === "dark",
|
|
29877
29976
|
void 0,
|
|
29878
29977
|
void 0,
|
|
29879
|
-
|
|
29978
|
+
resolveActiveTagGroup(
|
|
29979
|
+
kanbanParsed.tagGroups,
|
|
29980
|
+
kanbanParsed.options["active-tag"],
|
|
29981
|
+
options?.tagGroup
|
|
29982
|
+
)
|
|
29880
29983
|
);
|
|
29881
29984
|
return finalizeSvgExport(container2, theme, effectivePalette2, options);
|
|
29882
29985
|
}
|
|
@@ -29925,7 +30028,11 @@ async function renderForExport(content, theme, palette, orgExportState, options)
|
|
|
29925
30028
|
theme === "dark",
|
|
29926
30029
|
void 0,
|
|
29927
30030
|
{ width: exportWidth, height: exportHeight },
|
|
29928
|
-
|
|
30031
|
+
resolveActiveTagGroup(
|
|
30032
|
+
erParsed.tagGroups,
|
|
30033
|
+
erParsed.options["active-tag"],
|
|
30034
|
+
options?.tagGroup
|
|
30035
|
+
)
|
|
29929
30036
|
);
|
|
29930
30037
|
return finalizeSvgExport(container2, theme, effectivePalette2, options);
|
|
29931
30038
|
}
|
|
@@ -29948,7 +30055,10 @@ async function renderForExport(content, theme, palette, orgExportState, options)
|
|
|
29948
30055
|
blLayout,
|
|
29949
30056
|
effectivePalette2,
|
|
29950
30057
|
theme === "dark",
|
|
29951
|
-
{
|
|
30058
|
+
{
|
|
30059
|
+
exportDims: { width: exportWidth, height: exportHeight },
|
|
30060
|
+
activeTagGroup: options?.tagGroup
|
|
30061
|
+
}
|
|
29952
30062
|
);
|
|
29953
30063
|
return finalizeSvgExport(container2, theme, effectivePalette2, options);
|
|
29954
30064
|
}
|
|
@@ -29983,7 +30093,11 @@ async function renderForExport(content, theme, palette, orgExportState, options)
|
|
|
29983
30093
|
theme === "dark",
|
|
29984
30094
|
void 0,
|
|
29985
30095
|
{ width: exportWidth, height: exportHeight },
|
|
29986
|
-
|
|
30096
|
+
resolveActiveTagGroup(
|
|
30097
|
+
c4Parsed.tagGroups,
|
|
30098
|
+
c4Parsed.options["active-tag"],
|
|
30099
|
+
options?.tagGroup
|
|
30100
|
+
)
|
|
29987
30101
|
);
|
|
29988
30102
|
return finalizeSvgExport(container2, theme, effectivePalette2, options);
|
|
29989
30103
|
}
|
|
@@ -30017,7 +30131,11 @@ async function renderForExport(content, theme, palette, orgExportState, options)
|
|
|
30017
30131
|
if (infraParsed.error || infraParsed.nodes.length === 0) return "";
|
|
30018
30132
|
const infraComputed = computeInfra2(infraParsed);
|
|
30019
30133
|
const infraLayout = layoutInfra2(infraComputed);
|
|
30020
|
-
const activeTagGroup =
|
|
30134
|
+
const activeTagGroup = resolveActiveTagGroup(
|
|
30135
|
+
infraParsed.tagGroups,
|
|
30136
|
+
infraParsed.options["active-tag"],
|
|
30137
|
+
options?.tagGroup
|
|
30138
|
+
);
|
|
30021
30139
|
const titleOffset = infraParsed.title ? 40 : 0;
|
|
30022
30140
|
const legendGroups = computeInfraLegendGroups2(
|
|
30023
30141
|
infraLayout.nodes,
|
|
@@ -30152,7 +30270,11 @@ async function renderForExport(content, theme, palette, orgExportState, options)
|
|
|
30152
30270
|
isDark,
|
|
30153
30271
|
void 0,
|
|
30154
30272
|
dims,
|
|
30155
|
-
|
|
30273
|
+
resolveActiveTagGroup(
|
|
30274
|
+
parsed.timelineTagGroups,
|
|
30275
|
+
void 0,
|
|
30276
|
+
orgExportState?.activeTagGroup ?? options?.tagGroup
|
|
30277
|
+
),
|
|
30156
30278
|
orgExportState?.swimlaneTagGroup
|
|
30157
30279
|
);
|
|
30158
30280
|
} else if (parsed.type === "venn") {
|
|
@@ -31116,18 +31238,20 @@ init_colors();
|
|
|
31116
31238
|
init_palettes();
|
|
31117
31239
|
|
|
31118
31240
|
// src/sharing.ts
|
|
31119
|
-
import
|
|
31120
|
-
|
|
31121
|
-
|
|
31122
|
-
} from "lz-string";
|
|
31123
|
-
var DEFAULT_BASE_URL = "https://diagrammo.app/view";
|
|
31241
|
+
import lzString from "lz-string";
|
|
31242
|
+
var { compressToEncodedURIComponent, decompressFromEncodedURIComponent } = lzString;
|
|
31243
|
+
var DEFAULT_BASE_URL = "https://online.diagrammo.app";
|
|
31124
31244
|
var COMPRESSED_SIZE_LIMIT = 8192;
|
|
31125
31245
|
function encodeDiagramUrl(dsl, options) {
|
|
31126
31246
|
const baseUrl = options?.baseUrl ?? DEFAULT_BASE_URL;
|
|
31127
31247
|
const compressed = compressToEncodedURIComponent(dsl);
|
|
31128
31248
|
const byteSize = new TextEncoder().encode(compressed).byteLength;
|
|
31129
31249
|
if (byteSize > COMPRESSED_SIZE_LIMIT) {
|
|
31130
|
-
return {
|
|
31250
|
+
return {
|
|
31251
|
+
error: "too-large",
|
|
31252
|
+
compressedSize: byteSize,
|
|
31253
|
+
limit: COMPRESSED_SIZE_LIMIT
|
|
31254
|
+
};
|
|
31131
31255
|
}
|
|
31132
31256
|
let hash = `dgmo=${compressed}`;
|
|
31133
31257
|
if (options?.viewState?.activeTagGroup) {
|
|
@@ -31178,7 +31302,8 @@ function decodeDiagramUrl(hash) {
|
|
|
31178
31302
|
viewState.collapsedLanes = val.split(",").filter(Boolean);
|
|
31179
31303
|
}
|
|
31180
31304
|
if (key === "pal" && val) viewState.palette = val;
|
|
31181
|
-
if (key === "th" && (val === "light" || val === "dark"))
|
|
31305
|
+
if (key === "th" && (val === "light" || val === "dark"))
|
|
31306
|
+
viewState.theme = val;
|
|
31182
31307
|
}
|
|
31183
31308
|
if (payload.startsWith("dgmo=")) {
|
|
31184
31309
|
payload = payload.slice(5);
|
|
@@ -31392,21 +31517,33 @@ var COMPLETION_REGISTRY = /* @__PURE__ */ new Map([
|
|
|
31392
31517
|
}
|
|
31393
31518
|
})
|
|
31394
31519
|
],
|
|
31395
|
-
[
|
|
31520
|
+
[
|
|
31521
|
+
"er",
|
|
31522
|
+
withGlobals({
|
|
31523
|
+
"active-tag": { description: "Active tag group name" }
|
|
31524
|
+
})
|
|
31525
|
+
],
|
|
31396
31526
|
[
|
|
31397
31527
|
"org",
|
|
31398
31528
|
withGlobals({
|
|
31399
31529
|
"sub-node-label": { description: "Label for sub-nodes" },
|
|
31400
|
-
"show-sub-node-count": { description: "Show sub-node counts" }
|
|
31530
|
+
"show-sub-node-count": { description: "Show sub-node counts" },
|
|
31531
|
+
"active-tag": { description: "Active tag group name" }
|
|
31401
31532
|
})
|
|
31402
31533
|
],
|
|
31403
31534
|
[
|
|
31404
31535
|
"kanban",
|
|
31405
31536
|
withGlobals({
|
|
31406
|
-
"no-auto-color": { description: "Disable automatic card coloring" }
|
|
31537
|
+
"no-auto-color": { description: "Disable automatic card coloring" },
|
|
31538
|
+
"active-tag": { description: "Active tag group name" }
|
|
31539
|
+
})
|
|
31540
|
+
],
|
|
31541
|
+
[
|
|
31542
|
+
"c4",
|
|
31543
|
+
withGlobals({
|
|
31544
|
+
"active-tag": { description: "Active tag group name" }
|
|
31407
31545
|
})
|
|
31408
31546
|
],
|
|
31409
|
-
["c4", withGlobals()],
|
|
31410
31547
|
[
|
|
31411
31548
|
"state",
|
|
31412
31549
|
withGlobals({
|
|
@@ -31417,7 +31554,8 @@ var COMPLETION_REGISTRY = /* @__PURE__ */ new Map([
|
|
|
31417
31554
|
[
|
|
31418
31555
|
"sitemap",
|
|
31419
31556
|
withGlobals({
|
|
31420
|
-
"direction-tb": { description: "Switch to top-to-bottom layout" }
|
|
31557
|
+
"direction-tb": { description: "Switch to top-to-bottom layout" },
|
|
31558
|
+
"active-tag": { description: "Active tag group name" }
|
|
31421
31559
|
})
|
|
31422
31560
|
],
|
|
31423
31561
|
[
|
|
@@ -31431,7 +31569,8 @@ var COMPLETION_REGISTRY = /* @__PURE__ */ new Map([
|
|
|
31431
31569
|
"default-rps": { description: "Default RPS capacity for all nodes" },
|
|
31432
31570
|
"slo-availability": { description: "SLO availability target (0-1)" },
|
|
31433
31571
|
"slo-p90-latency-ms": { description: "SLO p90 latency target in ms" },
|
|
31434
|
-
"slo-warning-margin": { description: "SLO warning margin percentage" }
|
|
31572
|
+
"slo-warning-margin": { description: "SLO warning margin percentage" },
|
|
31573
|
+
"active-tag": { description: "Active tag group name" }
|
|
31435
31574
|
})
|
|
31436
31575
|
],
|
|
31437
31576
|
[
|
|
@@ -31443,7 +31582,8 @@ var COMPLETION_REGISTRY = /* @__PURE__ */ new Map([
|
|
|
31443
31582
|
},
|
|
31444
31583
|
sort: { description: "Sort order", values: ["time", "group", "tag"] },
|
|
31445
31584
|
"critical-path": { description: "Show critical path" },
|
|
31446
|
-
dependencies: { description: "Show dependencies" }
|
|
31585
|
+
dependencies: { description: "Show dependencies" },
|
|
31586
|
+
"active-tag": { description: "Active tag group name" }
|
|
31447
31587
|
})
|
|
31448
31588
|
],
|
|
31449
31589
|
[
|