@diagrammo/dgmo 0.8.23 → 0.8.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/dgmo.md +60 -72
- package/dist/cli.cjs +119 -114
- package/dist/editor.cjs +0 -2
- package/dist/editor.cjs.map +1 -1
- package/dist/editor.js +0 -2
- package/dist/editor.js.map +1 -1
- package/dist/highlight.cjs +0 -2
- package/dist/highlight.cjs.map +1 -1
- package/dist/highlight.js +0 -2
- package/dist/highlight.js.map +1 -1
- package/dist/index.cjs +690 -278
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -18
- package/dist/index.d.ts +105 -18
- package/dist/index.js +680 -277
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +348 -51
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +93 -5
- package/dist/internal.d.ts +93 -5
- package/dist/internal.js +334 -38
- package/dist/internal.js.map +1 -1
- package/docs/guide/chart-area.md +17 -17
- package/docs/guide/chart-bar-stacked.md +12 -12
- package/docs/guide/chart-doughnut.md +10 -10
- package/docs/guide/chart-funnel.md +9 -9
- package/docs/guide/chart-heatmap.md +10 -10
- package/docs/guide/chart-kanban.md +2 -0
- package/docs/guide/chart-line.md +19 -19
- package/docs/guide/chart-multi-line.md +16 -16
- package/docs/guide/chart-pie.md +11 -11
- package/docs/guide/chart-polar-area.md +10 -10
- package/docs/guide/chart-radar.md +9 -9
- package/docs/guide/chart-scatter.md +24 -27
- package/docs/guide/index.md +3 -3
- package/docs/language-reference.md +46 -25
- package/fonts/Inter-Bold.ttf +0 -0
- package/fonts/Inter-Regular.ttf +0 -0
- package/fonts/LICENSE-Inter.txt +92 -0
- package/gallery/fixtures/bar-stacked.dgmo +12 -6
- package/gallery/fixtures/heatmap.dgmo +12 -6
- package/gallery/fixtures/multi-line.dgmo +11 -7
- package/gallery/fixtures/quadrant.dgmo +8 -8
- package/gallery/fixtures/scatter.dgmo +12 -12
- package/package.json +4 -2
- package/src/boxes-and-lines/parser.ts +13 -2
- package/src/boxes-and-lines/renderer.ts +22 -13
- package/src/chart-type-scoring.ts +162 -0
- package/src/chart-types.ts +437 -0
- package/src/cli.ts +147 -66
- package/src/completion.ts +0 -4
- package/src/d3.ts +9 -2
- package/src/dgmo-router.ts +85 -130
- package/src/editor/keywords.ts +0 -2
- package/src/fonts.ts +3 -2
- package/src/gantt/parser.ts +5 -1
- package/src/index.ts +24 -1
- package/src/infra/parser.ts +1 -1
- package/src/internal.ts +6 -2
- package/src/journey-map/layout.ts +7 -3
- package/src/journey-map/parser.ts +5 -1
- package/src/kanban/parser.ts +5 -1
- package/src/org/collapse.ts +1 -4
- package/src/org/parser.ts +1 -1
- package/src/org/renderer.ts +26 -17
- package/src/sequence/parser.ts +2 -2
- package/src/sequence/participant-inference.ts +0 -1
- package/src/sequence/renderer.ts +95 -263
- package/src/sharing.ts +0 -1
- package/src/sitemap/parser.ts +1 -1
- package/src/utils/tag-groups.ts +35 -5
- package/src/wireframe/parser.ts +3 -1
package/dist/index.js
CHANGED
|
@@ -2084,7 +2084,8 @@ function validateTagValues(entities, tagGroups, pushWarning, suggestFn) {
|
|
|
2084
2084
|
}
|
|
2085
2085
|
}
|
|
2086
2086
|
}
|
|
2087
|
-
function validateTagGroupNames(tagGroups, pushWarning) {
|
|
2087
|
+
function validateTagGroupNames(tagGroups, pushWarning, pushError) {
|
|
2088
|
+
const report = pushError ?? pushWarning;
|
|
2088
2089
|
for (const group of tagGroups) {
|
|
2089
2090
|
if (group.name.toLowerCase() === "none") {
|
|
2090
2091
|
pushWarning(
|
|
@@ -2092,6 +2093,18 @@ function validateTagGroupNames(tagGroups, pushWarning) {
|
|
|
2092
2093
|
`'none' is a reserved keyword and cannot be used as a tag group name`
|
|
2093
2094
|
);
|
|
2094
2095
|
}
|
|
2096
|
+
if (!VALID_TAG_IDENT_RE.test(group.name)) {
|
|
2097
|
+
report(
|
|
2098
|
+
group.lineNumber,
|
|
2099
|
+
`Tag group name "${group.name}" contains invalid characters \u2014 use a single identifier (letters, digits, underscore, hyphen)`
|
|
2100
|
+
);
|
|
2101
|
+
}
|
|
2102
|
+
if (group.alias != null && !VALID_TAG_IDENT_RE.test(group.alias)) {
|
|
2103
|
+
report(
|
|
2104
|
+
group.lineNumber,
|
|
2105
|
+
`Tag group alias "${group.alias}" contains invalid characters \u2014 use a single identifier (letters, digits, underscore, hyphen)`
|
|
2106
|
+
);
|
|
2107
|
+
}
|
|
2095
2108
|
}
|
|
2096
2109
|
}
|
|
2097
2110
|
function injectDefaultTagMetadata(entities, tagGroups, skip) {
|
|
@@ -2130,12 +2143,13 @@ function resolveActiveTagGroup(tagGroups, explicitActiveTag, programmaticOverrid
|
|
|
2130
2143
|
function matchTagBlockHeading(trimmed) {
|
|
2131
2144
|
return parseTagDeclaration(trimmed);
|
|
2132
2145
|
}
|
|
2133
|
-
var TAG_BLOCK_NOCOLON_RE;
|
|
2146
|
+
var TAG_BLOCK_NOCOLON_RE, VALID_TAG_IDENT_RE;
|
|
2134
2147
|
var init_tag_groups = __esm({
|
|
2135
2148
|
"src/utils/tag-groups.ts"() {
|
|
2136
2149
|
"use strict";
|
|
2137
2150
|
init_parsing();
|
|
2138
2151
|
TAG_BLOCK_NOCOLON_RE = /^tag\s+/i;
|
|
2152
|
+
VALID_TAG_IDENT_RE = /^[A-Za-z_][A-Za-z0-9_-]*$/;
|
|
2139
2153
|
}
|
|
2140
2154
|
});
|
|
2141
2155
|
|
|
@@ -3071,7 +3085,6 @@ var init_participant_inference = __esm({
|
|
|
3071
3085
|
{ pattern: /^Admin$/i, type: "actor" },
|
|
3072
3086
|
{ pattern: /^User$/i, type: "actor" },
|
|
3073
3087
|
{ pattern: /^Customer$/i, type: "actor" },
|
|
3074
|
-
{ pattern: /^Client$/i, type: "actor" },
|
|
3075
3088
|
{ pattern: /^Agent$/i, type: "actor" },
|
|
3076
3089
|
{ pattern: /^Person$/i, type: "actor" },
|
|
3077
3090
|
{ pattern: /^Buyer$/i, type: "actor" },
|
|
@@ -4069,7 +4082,7 @@ function parseSequenceDgmo(content) {
|
|
|
4069
4082
|
entities.push({ metadata: g.metadata, lineNumber: g.lineNumber });
|
|
4070
4083
|
}
|
|
4071
4084
|
validateTagValues(entities, result.tagGroups, pushWarning, suggest);
|
|
4072
|
-
validateTagGroupNames(result.tagGroups, pushWarning);
|
|
4085
|
+
validateTagGroupNames(result.tagGroups, pushWarning, pushError);
|
|
4073
4086
|
}
|
|
4074
4087
|
return result;
|
|
4075
4088
|
}
|
|
@@ -4092,7 +4105,7 @@ var init_parser = __esm({
|
|
|
4092
4105
|
init_parsing();
|
|
4093
4106
|
init_tag_groups();
|
|
4094
4107
|
KNOWN_SEQ_OPTIONS = /* @__PURE__ */ new Set(["active-tag"]);
|
|
4095
|
-
KNOWN_SEQ_BOOLEANS = /* @__PURE__ */ new Set(["activations"
|
|
4108
|
+
KNOWN_SEQ_BOOLEANS = /* @__PURE__ */ new Set(["activations"]);
|
|
4096
4109
|
VALID_PARTICIPANT_TYPES = /* @__PURE__ */ new Set([
|
|
4097
4110
|
"service",
|
|
4098
4111
|
"database",
|
|
@@ -8468,7 +8481,7 @@ function parseOrg(content, palette) {
|
|
|
8468
8481
|
};
|
|
8469
8482
|
collectAll(result.roots);
|
|
8470
8483
|
validateTagValues(allNodes, result.tagGroups, pushWarning, suggest);
|
|
8471
|
-
validateTagGroupNames(result.tagGroups, pushWarning);
|
|
8484
|
+
validateTagGroupNames(result.tagGroups, pushWarning, pushError);
|
|
8472
8485
|
}
|
|
8473
8486
|
if (result.roots.length === 0 && result.tagGroups.length === 0 && !result.error) {
|
|
8474
8487
|
const diag = makeDgmoError(1, "No nodes found in org chart");
|
|
@@ -8801,7 +8814,11 @@ function parseKanban(content, palette) {
|
|
|
8801
8814
|
if (result.columns.length === 0 && !result.error) {
|
|
8802
8815
|
return fail(1, "No columns found. Use [Column Name] to define columns");
|
|
8803
8816
|
}
|
|
8804
|
-
validateTagGroupNames(result.tagGroups, warn)
|
|
8817
|
+
validateTagGroupNames(result.tagGroups, warn, (line11, msg) => {
|
|
8818
|
+
const diag = makeDgmoError(line11, msg);
|
|
8819
|
+
result.diagnostics.push(diag);
|
|
8820
|
+
if (!result.error) result.error = formatDgmoError(diag);
|
|
8821
|
+
});
|
|
8805
8822
|
return result;
|
|
8806
8823
|
}
|
|
8807
8824
|
function parseCardLine(trimmed, lineNumber, counter, aliasMap, _palette, _diagnostics) {
|
|
@@ -9927,7 +9944,7 @@ function parseSitemap(content, palette) {
|
|
|
9927
9944
|
};
|
|
9928
9945
|
collectAll(result.roots);
|
|
9929
9946
|
validateTagValues(allNodes, result.tagGroups, pushWarning, suggest);
|
|
9930
|
-
validateTagGroupNames(result.tagGroups, pushWarning);
|
|
9947
|
+
validateTagGroupNames(result.tagGroups, pushWarning, pushError);
|
|
9931
9948
|
}
|
|
9932
9949
|
if (result.roots.length === 0 && result.tagGroups.length === 0 && !result.error) {
|
|
9933
9950
|
const diag = makeDgmoError(1, "No pages found in sitemap");
|
|
@@ -10564,7 +10581,7 @@ function parseInfra(content) {
|
|
|
10564
10581
|
}
|
|
10565
10582
|
}
|
|
10566
10583
|
}
|
|
10567
|
-
validateTagGroupNames(result.tagGroups, warn);
|
|
10584
|
+
validateTagGroupNames(result.tagGroups, warn, setError);
|
|
10568
10585
|
return result;
|
|
10569
10586
|
}
|
|
10570
10587
|
function extractSymbols4(docText) {
|
|
@@ -11505,7 +11522,11 @@ function parseGantt(content, palette) {
|
|
|
11505
11522
|
warn(0, "sort tag has no effect \u2014 no tag groups defined.");
|
|
11506
11523
|
result.options.sort = "default";
|
|
11507
11524
|
}
|
|
11508
|
-
validateTagGroupNames(result.tagGroups, warn)
|
|
11525
|
+
validateTagGroupNames(result.tagGroups, warn, (line11, msg) => {
|
|
11526
|
+
const diag = makeDgmoError(line11, msg);
|
|
11527
|
+
diagnostics.push(diag);
|
|
11528
|
+
if (!result.error) result.error = formatDgmoError(diag);
|
|
11529
|
+
});
|
|
11509
11530
|
const hasSprintOption = result.options.sprintLength !== null || result.options.sprintNumber !== null || result.options.sprintStart !== null;
|
|
11510
11531
|
const hasSprintUnit = hasSprintDurationUnit(result.nodes);
|
|
11511
11532
|
if (hasSprintOption) {
|
|
@@ -11769,6 +11790,7 @@ function parseBoxesAndLines(content) {
|
|
|
11769
11790
|
const groupLabels = /* @__PURE__ */ new Set();
|
|
11770
11791
|
let lastNodeLabel = null;
|
|
11771
11792
|
let lastSourceIsGroup = false;
|
|
11793
|
+
let lastNodeIndent = 0;
|
|
11772
11794
|
let descState = null;
|
|
11773
11795
|
function flushDescription() {
|
|
11774
11796
|
if (descState && descState.lines.length > 0) {
|
|
@@ -12066,7 +12088,8 @@ function parseBoxesAndLines(content) {
|
|
|
12066
12088
|
if (trimmed.startsWith("->") || /^-[^>].*->/.test(trimmed)) {
|
|
12067
12089
|
const gs2 = currentGroupState();
|
|
12068
12090
|
const inGroup = gs2 && indent > gs2.indent;
|
|
12069
|
-
|
|
12091
|
+
const indentedUnderNode = lastNodeLabel && !lastSourceIsGroup && indent > lastNodeIndent;
|
|
12092
|
+
if (inGroup && !indentedUnderNode) {
|
|
12070
12093
|
const sourcePrefix = `[${gs2.group.label}]`;
|
|
12071
12094
|
edgeText = `${sourcePrefix} ${trimmed}`;
|
|
12072
12095
|
} else if (lastNodeLabel) {
|
|
@@ -12106,6 +12129,7 @@ function parseBoxesAndLines(content) {
|
|
|
12106
12129
|
}
|
|
12107
12130
|
lastNodeLabel = node.label;
|
|
12108
12131
|
lastSourceIsGroup = false;
|
|
12132
|
+
lastNodeIndent = indent;
|
|
12109
12133
|
const gs = currentGroupState();
|
|
12110
12134
|
const isGroupChild = gs && indent > gs.indent;
|
|
12111
12135
|
if (nodeLabels.has(node.label)) {
|
|
@@ -12174,7 +12198,11 @@ function parseBoxesAndLines(content) {
|
|
|
12174
12198
|
if (result.tagGroups.length > 0) {
|
|
12175
12199
|
injectDefaultTagMetadata(result.nodes, result.tagGroups);
|
|
12176
12200
|
validateTagValues(result.nodes, result.tagGroups, pushWarning, suggest);
|
|
12177
|
-
validateTagGroupNames(result.tagGroups, pushWarning)
|
|
12201
|
+
validateTagGroupNames(result.tagGroups, pushWarning, (line11, msg) => {
|
|
12202
|
+
const diag = makeDgmoError(line11, msg);
|
|
12203
|
+
result.diagnostics.push(diag);
|
|
12204
|
+
if (!result.error) result.error = diag.message;
|
|
12205
|
+
});
|
|
12178
12206
|
}
|
|
12179
12207
|
return result;
|
|
12180
12208
|
}
|
|
@@ -13150,7 +13178,9 @@ function parseWireframe(content) {
|
|
|
13150
13178
|
}
|
|
13151
13179
|
}
|
|
13152
13180
|
}
|
|
13153
|
-
validateTagGroupNames(tagGroups, pushWarning)
|
|
13181
|
+
validateTagGroupNames(tagGroups, pushWarning, (line11, msg) => {
|
|
13182
|
+
diagnostics.push(makeDgmoError(line11, msg));
|
|
13183
|
+
});
|
|
13154
13184
|
const error = diagnostics.find((d) => d.severity === "error") ? formatDgmoError(diagnostics.find((d) => d.severity === "error")) : null;
|
|
13155
13185
|
return {
|
|
13156
13186
|
title,
|
|
@@ -14078,7 +14108,11 @@ function parseJourneyMap(content, palette) {
|
|
|
14078
14108
|
if (result.phases.length === 0 && result.steps.length === 0 && !result.error) {
|
|
14079
14109
|
return fail(1, "No phases or steps found");
|
|
14080
14110
|
}
|
|
14081
|
-
validateTagGroupNames(result.tagGroups, warn)
|
|
14111
|
+
validateTagGroupNames(result.tagGroups, warn, (line11, msg) => {
|
|
14112
|
+
const diag = makeDgmoError(line11, msg);
|
|
14113
|
+
result.diagnostics.push(diag);
|
|
14114
|
+
if (!result.error) result.error = formatDgmoError(diag);
|
|
14115
|
+
});
|
|
14082
14116
|
return result;
|
|
14083
14117
|
}
|
|
14084
14118
|
function parseStepLine(trimmed, lineNumber, counter, aliasMap, warn) {
|
|
@@ -14308,13 +14342,425 @@ var init_parser16 = __esm({
|
|
|
14308
14342
|
}
|
|
14309
14343
|
});
|
|
14310
14344
|
|
|
14345
|
+
// src/chart-types.ts
|
|
14346
|
+
var chartTypes;
|
|
14347
|
+
var init_chart_types = __esm({
|
|
14348
|
+
"src/chart-types.ts"() {
|
|
14349
|
+
"use strict";
|
|
14350
|
+
chartTypes = [
|
|
14351
|
+
// ── Tier 1 — Narrative / architecture diagrams ────────────
|
|
14352
|
+
{
|
|
14353
|
+
id: "journey-map",
|
|
14354
|
+
description: "User experience flow with emotion scores, phases, and annotations",
|
|
14355
|
+
triggers: [
|
|
14356
|
+
"user journey",
|
|
14357
|
+
"customer journey",
|
|
14358
|
+
"customer experience",
|
|
14359
|
+
"customer goes through",
|
|
14360
|
+
"user goes through",
|
|
14361
|
+
"customer path",
|
|
14362
|
+
"customer touchpoints",
|
|
14363
|
+
"cx flow",
|
|
14364
|
+
"ux journey",
|
|
14365
|
+
"onboarding flow",
|
|
14366
|
+
"persona journey",
|
|
14367
|
+
"empathy map",
|
|
14368
|
+
"service blueprint"
|
|
14369
|
+
]
|
|
14370
|
+
},
|
|
14371
|
+
{
|
|
14372
|
+
id: "c4",
|
|
14373
|
+
description: "System architecture (context, container, component, deployment)",
|
|
14374
|
+
triggers: [
|
|
14375
|
+
"c4 diagram",
|
|
14376
|
+
"system context",
|
|
14377
|
+
"container diagram",
|
|
14378
|
+
"component diagram",
|
|
14379
|
+
"architecture overview",
|
|
14380
|
+
"software architecture"
|
|
14381
|
+
]
|
|
14382
|
+
},
|
|
14383
|
+
{
|
|
14384
|
+
id: "er",
|
|
14385
|
+
description: "Database schemas and relationships",
|
|
14386
|
+
triggers: [
|
|
14387
|
+
"database schema",
|
|
14388
|
+
"er diagram",
|
|
14389
|
+
"entity relationship",
|
|
14390
|
+
"data model",
|
|
14391
|
+
"tables and relationships",
|
|
14392
|
+
"foreign keys"
|
|
14393
|
+
]
|
|
14394
|
+
},
|
|
14395
|
+
{
|
|
14396
|
+
id: "class",
|
|
14397
|
+
description: "UML class hierarchies",
|
|
14398
|
+
triggers: [
|
|
14399
|
+
"uml class",
|
|
14400
|
+
"class hierarchy",
|
|
14401
|
+
"class diagram",
|
|
14402
|
+
"inheritance tree",
|
|
14403
|
+
"oop structure"
|
|
14404
|
+
]
|
|
14405
|
+
},
|
|
14406
|
+
{
|
|
14407
|
+
id: "sequence",
|
|
14408
|
+
description: "Message / interaction flows",
|
|
14409
|
+
triggers: [
|
|
14410
|
+
"sequence diagram",
|
|
14411
|
+
"message flow",
|
|
14412
|
+
"api call flow",
|
|
14413
|
+
"request lifecycle",
|
|
14414
|
+
"interaction diagram",
|
|
14415
|
+
"call sequence"
|
|
14416
|
+
],
|
|
14417
|
+
fallback: true
|
|
14418
|
+
},
|
|
14419
|
+
{
|
|
14420
|
+
id: "state",
|
|
14421
|
+
description: "State machine / lifecycle transitions",
|
|
14422
|
+
triggers: [
|
|
14423
|
+
"state diagram",
|
|
14424
|
+
"state machine",
|
|
14425
|
+
"state transitions",
|
|
14426
|
+
"lifecycle diagram",
|
|
14427
|
+
"status transitions"
|
|
14428
|
+
]
|
|
14429
|
+
},
|
|
14430
|
+
{
|
|
14431
|
+
id: "infra",
|
|
14432
|
+
description: "Infrastructure traffic flow with RPS computation",
|
|
14433
|
+
triggers: [
|
|
14434
|
+
"infrastructure diagram",
|
|
14435
|
+
"traffic flow",
|
|
14436
|
+
"request path",
|
|
14437
|
+
"rps",
|
|
14438
|
+
"capacity planning",
|
|
14439
|
+
"network topology"
|
|
14440
|
+
]
|
|
14441
|
+
},
|
|
14442
|
+
{
|
|
14443
|
+
id: "gantt",
|
|
14444
|
+
description: "Project scheduling with task dependencies and milestones",
|
|
14445
|
+
triggers: [
|
|
14446
|
+
"gantt chart",
|
|
14447
|
+
"project schedule",
|
|
14448
|
+
"sprint plan",
|
|
14449
|
+
"project timeline",
|
|
14450
|
+
"task dependencies",
|
|
14451
|
+
"project milestones"
|
|
14452
|
+
]
|
|
14453
|
+
},
|
|
14454
|
+
// ── Tier 2 — Specialized structural diagrams ──────────────
|
|
14455
|
+
{
|
|
14456
|
+
id: "timeline",
|
|
14457
|
+
description: "Events, eras, and date ranges",
|
|
14458
|
+
triggers: [
|
|
14459
|
+
"event timeline",
|
|
14460
|
+
"historical timeline",
|
|
14461
|
+
"era chart",
|
|
14462
|
+
"period chart",
|
|
14463
|
+
"project history"
|
|
14464
|
+
]
|
|
14465
|
+
},
|
|
14466
|
+
{
|
|
14467
|
+
id: "org",
|
|
14468
|
+
description: "Reporting hierarchy",
|
|
14469
|
+
triggers: [
|
|
14470
|
+
"org chart",
|
|
14471
|
+
"organization chart",
|
|
14472
|
+
"reporting structure",
|
|
14473
|
+
"hierarchy chart",
|
|
14474
|
+
"team structure"
|
|
14475
|
+
]
|
|
14476
|
+
},
|
|
14477
|
+
{
|
|
14478
|
+
id: "sitemap",
|
|
14479
|
+
description: "Site / app navigation structure",
|
|
14480
|
+
triggers: [
|
|
14481
|
+
"sitemap",
|
|
14482
|
+
"site structure",
|
|
14483
|
+
"page hierarchy",
|
|
14484
|
+
"navigation structure",
|
|
14485
|
+
"app navigation"
|
|
14486
|
+
]
|
|
14487
|
+
},
|
|
14488
|
+
{
|
|
14489
|
+
id: "kanban",
|
|
14490
|
+
description: "Task board columns",
|
|
14491
|
+
triggers: [
|
|
14492
|
+
"kanban board",
|
|
14493
|
+
"task board",
|
|
14494
|
+
"workflow columns",
|
|
14495
|
+
"todo doing done",
|
|
14496
|
+
"agile board"
|
|
14497
|
+
]
|
|
14498
|
+
},
|
|
14499
|
+
{
|
|
14500
|
+
id: "tech-radar",
|
|
14501
|
+
description: "Technology adoption quadrants (adopt/trial/assess/hold)",
|
|
14502
|
+
triggers: [
|
|
14503
|
+
"tech radar",
|
|
14504
|
+
"technology radar",
|
|
14505
|
+
"tech adoption",
|
|
14506
|
+
"adopt trial assess hold",
|
|
14507
|
+
"tech choices"
|
|
14508
|
+
]
|
|
14509
|
+
},
|
|
14510
|
+
{
|
|
14511
|
+
id: "mindmap",
|
|
14512
|
+
description: "Radial hierarchy of ideas branching from a central topic",
|
|
14513
|
+
triggers: [
|
|
14514
|
+
"mind map",
|
|
14515
|
+
"brainstorm diagram",
|
|
14516
|
+
"concept map",
|
|
14517
|
+
"idea tree",
|
|
14518
|
+
"radial ideas"
|
|
14519
|
+
]
|
|
14520
|
+
},
|
|
14521
|
+
{
|
|
14522
|
+
id: "wireframe",
|
|
14523
|
+
description: "Low-fidelity UI layout with panels, controls, and annotations",
|
|
14524
|
+
triggers: [
|
|
14525
|
+
"wireframe",
|
|
14526
|
+
"ui mockup",
|
|
14527
|
+
"screen layout",
|
|
14528
|
+
"page layout",
|
|
14529
|
+
"low-fidelity mockup"
|
|
14530
|
+
]
|
|
14531
|
+
},
|
|
14532
|
+
{
|
|
14533
|
+
id: "cycle",
|
|
14534
|
+
description: "Cyclical process visualization (PDCA, OODA, DevOps loops)",
|
|
14535
|
+
triggers: [
|
|
14536
|
+
"pdca cycle",
|
|
14537
|
+
"ooda loop",
|
|
14538
|
+
"feedback loop",
|
|
14539
|
+
"cyclical process",
|
|
14540
|
+
"devops loop",
|
|
14541
|
+
"continuous loop"
|
|
14542
|
+
]
|
|
14543
|
+
},
|
|
14544
|
+
{
|
|
14545
|
+
id: "pyramid",
|
|
14546
|
+
description: "Stacked hierarchy of layers with descriptions (Maslow, DIKW)",
|
|
14547
|
+
triggers: [
|
|
14548
|
+
"pyramid diagram",
|
|
14549
|
+
"layered hierarchy",
|
|
14550
|
+
"maslow hierarchy",
|
|
14551
|
+
"dikw pyramid",
|
|
14552
|
+
"layered model"
|
|
14553
|
+
]
|
|
14554
|
+
},
|
|
14555
|
+
// ── Tier 3 — Specialized analytical charts ────────────────
|
|
14556
|
+
{
|
|
14557
|
+
id: "quadrant",
|
|
14558
|
+
description: "2x2 positioning matrix",
|
|
14559
|
+
triggers: [
|
|
14560
|
+
"2x2 matrix",
|
|
14561
|
+
"priority matrix",
|
|
14562
|
+
"quadrant chart",
|
|
14563
|
+
"impact effort matrix",
|
|
14564
|
+
"positioning matrix"
|
|
14565
|
+
]
|
|
14566
|
+
},
|
|
14567
|
+
{
|
|
14568
|
+
id: "venn",
|
|
14569
|
+
description: "Set overlaps",
|
|
14570
|
+
triggers: [
|
|
14571
|
+
"venn diagram",
|
|
14572
|
+
"set overlap",
|
|
14573
|
+
"intersection of",
|
|
14574
|
+
"shared traits",
|
|
14575
|
+
"overlapping circles"
|
|
14576
|
+
]
|
|
14577
|
+
},
|
|
14578
|
+
{
|
|
14579
|
+
id: "funnel",
|
|
14580
|
+
description: "Conversion pipeline",
|
|
14581
|
+
triggers: [
|
|
14582
|
+
"conversion funnel",
|
|
14583
|
+
"sales funnel",
|
|
14584
|
+
"user funnel",
|
|
14585
|
+
"pipeline stages",
|
|
14586
|
+
"drop-off funnel"
|
|
14587
|
+
]
|
|
14588
|
+
},
|
|
14589
|
+
{
|
|
14590
|
+
id: "slope",
|
|
14591
|
+
description: "Change between two periods",
|
|
14592
|
+
triggers: [
|
|
14593
|
+
"slope chart",
|
|
14594
|
+
"before and after",
|
|
14595
|
+
"two-period change",
|
|
14596
|
+
"delta chart",
|
|
14597
|
+
"shift comparison"
|
|
14598
|
+
]
|
|
14599
|
+
},
|
|
14600
|
+
{
|
|
14601
|
+
id: "sankey",
|
|
14602
|
+
description: "Flow / allocation visualization",
|
|
14603
|
+
triggers: [
|
|
14604
|
+
"sankey diagram",
|
|
14605
|
+
"flow allocation",
|
|
14606
|
+
"budget flow",
|
|
14607
|
+
"energy flow",
|
|
14608
|
+
"traffic allocation"
|
|
14609
|
+
]
|
|
14610
|
+
},
|
|
14611
|
+
{
|
|
14612
|
+
id: "chord",
|
|
14613
|
+
description: "Circular flow relationships",
|
|
14614
|
+
triggers: [
|
|
14615
|
+
"chord diagram",
|
|
14616
|
+
"circular flow",
|
|
14617
|
+
"relationship wheel",
|
|
14618
|
+
"team connections"
|
|
14619
|
+
]
|
|
14620
|
+
},
|
|
14621
|
+
{
|
|
14622
|
+
id: "arc",
|
|
14623
|
+
description: "Network relationships",
|
|
14624
|
+
triggers: [
|
|
14625
|
+
"arc diagram",
|
|
14626
|
+
"relationship chart",
|
|
14627
|
+
"connection arcs",
|
|
14628
|
+
"network arcs"
|
|
14629
|
+
]
|
|
14630
|
+
},
|
|
14631
|
+
{
|
|
14632
|
+
id: "wordcloud",
|
|
14633
|
+
description: "Term frequency visualization",
|
|
14634
|
+
triggers: [
|
|
14635
|
+
"word cloud",
|
|
14636
|
+
"tag cloud",
|
|
14637
|
+
"term frequency",
|
|
14638
|
+
"keyword frequency"
|
|
14639
|
+
]
|
|
14640
|
+
},
|
|
14641
|
+
{
|
|
14642
|
+
id: "heatmap",
|
|
14643
|
+
description: "Matrix intensity visualization",
|
|
14644
|
+
triggers: [
|
|
14645
|
+
"heatmap",
|
|
14646
|
+
"intensity matrix",
|
|
14647
|
+
"activity heatmap",
|
|
14648
|
+
"correlation matrix"
|
|
14649
|
+
]
|
|
14650
|
+
},
|
|
14651
|
+
{
|
|
14652
|
+
id: "function",
|
|
14653
|
+
description: "Mathematical expressions",
|
|
14654
|
+
triggers: [
|
|
14655
|
+
"function plot",
|
|
14656
|
+
"mathematical plot",
|
|
14657
|
+
"equation chart",
|
|
14658
|
+
"graph y=f(x)"
|
|
14659
|
+
]
|
|
14660
|
+
},
|
|
14661
|
+
// ── Tier 4 — General-purpose data charts ──────────────────
|
|
14662
|
+
{
|
|
14663
|
+
id: "bar",
|
|
14664
|
+
description: "Categorical comparisons",
|
|
14665
|
+
triggers: ["bar chart", "categorical comparison", "bar graph"],
|
|
14666
|
+
fallback: true
|
|
14667
|
+
},
|
|
14668
|
+
{
|
|
14669
|
+
id: "line",
|
|
14670
|
+
description: "Trends over time",
|
|
14671
|
+
triggers: ["line chart", "trend over time", "time series"],
|
|
14672
|
+
fallback: true
|
|
14673
|
+
},
|
|
14674
|
+
{
|
|
14675
|
+
id: "multi-line",
|
|
14676
|
+
description: "Multiple series trends over time",
|
|
14677
|
+
triggers: [
|
|
14678
|
+
"multi-line chart",
|
|
14679
|
+
"multiple trends",
|
|
14680
|
+
"multiple series over time"
|
|
14681
|
+
]
|
|
14682
|
+
},
|
|
14683
|
+
{
|
|
14684
|
+
id: "area",
|
|
14685
|
+
description: "Filled line chart",
|
|
14686
|
+
triggers: ["area chart", "filled line", "cumulative trend"]
|
|
14687
|
+
},
|
|
14688
|
+
{
|
|
14689
|
+
id: "pie",
|
|
14690
|
+
description: "Part-to-whole proportions",
|
|
14691
|
+
triggers: ["pie chart", "part to whole", "percentage breakdown"]
|
|
14692
|
+
},
|
|
14693
|
+
{
|
|
14694
|
+
id: "doughnut",
|
|
14695
|
+
description: "Ring-style pie chart",
|
|
14696
|
+
triggers: ["doughnut chart", "donut chart", "ring chart"]
|
|
14697
|
+
},
|
|
14698
|
+
{
|
|
14699
|
+
id: "radar",
|
|
14700
|
+
description: "Multi-dimensional metrics",
|
|
14701
|
+
triggers: ["radar chart", "spider chart", "multi-dimensional metrics"]
|
|
14702
|
+
},
|
|
14703
|
+
{
|
|
14704
|
+
id: "polar-area",
|
|
14705
|
+
description: "Radial bar chart",
|
|
14706
|
+
triggers: ["polar area", "radial bar chart"]
|
|
14707
|
+
},
|
|
14708
|
+
{
|
|
14709
|
+
id: "bar-stacked",
|
|
14710
|
+
description: "Multi-series categorical",
|
|
14711
|
+
triggers: [
|
|
14712
|
+
"stacked bar",
|
|
14713
|
+
"stacked bar chart",
|
|
14714
|
+
"multi-series bar",
|
|
14715
|
+
"composite bar"
|
|
14716
|
+
]
|
|
14717
|
+
},
|
|
14718
|
+
{
|
|
14719
|
+
id: "scatter",
|
|
14720
|
+
description: "2D data points or bubble chart",
|
|
14721
|
+
triggers: [
|
|
14722
|
+
"scatter plot",
|
|
14723
|
+
"correlation plot",
|
|
14724
|
+
"bubble chart",
|
|
14725
|
+
"2d data points"
|
|
14726
|
+
]
|
|
14727
|
+
},
|
|
14728
|
+
// ── Tier 5 — Generic catch-alls (listed last on purpose) ──
|
|
14729
|
+
{
|
|
14730
|
+
id: "flowchart",
|
|
14731
|
+
description: "Decision trees and process flows",
|
|
14732
|
+
triggers: [
|
|
14733
|
+
"flowchart",
|
|
14734
|
+
"decision tree",
|
|
14735
|
+
"if-then diagram",
|
|
14736
|
+
"process flow with decisions"
|
|
14737
|
+
],
|
|
14738
|
+
fallback: true
|
|
14739
|
+
},
|
|
14740
|
+
{
|
|
14741
|
+
id: "boxes-and-lines",
|
|
14742
|
+
description: "General-purpose node-edge diagrams with groups and tags",
|
|
14743
|
+
triggers: [
|
|
14744
|
+
"boxes and lines",
|
|
14745
|
+
"nodes and edges",
|
|
14746
|
+
"generic diagram",
|
|
14747
|
+
"general-purpose network"
|
|
14748
|
+
],
|
|
14749
|
+
fallback: true
|
|
14750
|
+
}
|
|
14751
|
+
];
|
|
14752
|
+
}
|
|
14753
|
+
});
|
|
14754
|
+
|
|
14311
14755
|
// src/dgmo-router.ts
|
|
14312
14756
|
var dgmo_router_exports = {};
|
|
14313
14757
|
__export(dgmo_router_exports, {
|
|
14314
14758
|
CHART_TYPE_DESCRIPTIONS: () => CHART_TYPE_DESCRIPTIONS,
|
|
14759
|
+
chartTypeParsers: () => chartTypeParsers,
|
|
14315
14760
|
getAllChartTypes: () => getAllChartTypes,
|
|
14316
14761
|
getRenderCategory: () => getRenderCategory,
|
|
14317
14762
|
isExtendedChartType: () => isExtendedChartType,
|
|
14763
|
+
knownChartTypeIds: () => knownChartTypeIds,
|
|
14318
14764
|
looksLikeC4: () => looksLikeC4,
|
|
14319
14765
|
looksLikeGantt: () => looksLikeGantt,
|
|
14320
14766
|
parseDgmo: () => parseDgmo,
|
|
@@ -14373,7 +14819,7 @@ function isExtendedChartType(chartType) {
|
|
|
14373
14819
|
return EXTENDED_CHART_TYPES.has(chartType.toLowerCase());
|
|
14374
14820
|
}
|
|
14375
14821
|
function getAllChartTypes() {
|
|
14376
|
-
return
|
|
14822
|
+
return chartTypes.map((c) => c.id);
|
|
14377
14823
|
}
|
|
14378
14824
|
function parseDgmo(content) {
|
|
14379
14825
|
const chartType = parseDgmoChartType(content);
|
|
@@ -14388,23 +14834,9 @@ function parseDgmo(content) {
|
|
|
14388
14834
|
chartType: null
|
|
14389
14835
|
};
|
|
14390
14836
|
}
|
|
14391
|
-
const
|
|
14392
|
-
if (
|
|
14393
|
-
const result2 =
|
|
14394
|
-
return {
|
|
14395
|
-
diagnostics: [...result2.diagnostics, ...detectEmptyContent(content)],
|
|
14396
|
-
chartType
|
|
14397
|
-
};
|
|
14398
|
-
}
|
|
14399
|
-
if (STANDARD_CHART_TYPES2.has(chartType)) {
|
|
14400
|
-
const result2 = parseChart(content);
|
|
14401
|
-
return {
|
|
14402
|
-
diagnostics: [...result2.diagnostics, ...detectEmptyContent(content)],
|
|
14403
|
-
chartType
|
|
14404
|
-
};
|
|
14405
|
-
}
|
|
14406
|
-
if (ECHART_TYPES.has(chartType)) {
|
|
14407
|
-
const result2 = parseExtendedChart(content);
|
|
14837
|
+
const parser = PARSER_BY_ID.get(chartType);
|
|
14838
|
+
if (parser) {
|
|
14839
|
+
const result2 = parser(content);
|
|
14408
14840
|
return {
|
|
14409
14841
|
diagnostics: [...result2.diagnostics, ...detectEmptyContent(content)],
|
|
14410
14842
|
chartType
|
|
@@ -14456,7 +14888,7 @@ function detectEmptyContent(content) {
|
|
|
14456
14888
|
}
|
|
14457
14889
|
return [];
|
|
14458
14890
|
}
|
|
14459
|
-
var GANTT_DURATION_RE, GANTT_DATE_RE, C4_TYPE_RE, DATA_CHART_TYPES, VISUALIZATION_TYPES, DIAGRAM_TYPES, EXTENDED_CHART_TYPES,
|
|
14891
|
+
var GANTT_DURATION_RE, GANTT_DATE_RE, C4_TYPE_RE, DATA_CHART_TYPES, VISUALIZATION_TYPES, DIAGRAM_TYPES, EXTENDED_CHART_TYPES, CHART_TYPE_DESCRIPTIONS, chartTypeParsers, knownChartTypeIds, PARSER_BY_ID, ALL_KNOWN_TYPES;
|
|
14460
14892
|
var init_dgmo_router = __esm({
|
|
14461
14893
|
"src/dgmo-router.ts"() {
|
|
14462
14894
|
"use strict";
|
|
@@ -14483,6 +14915,7 @@ var init_dgmo_router = __esm({
|
|
|
14483
14915
|
init_parser16();
|
|
14484
14916
|
init_parsing();
|
|
14485
14917
|
init_diagnostics();
|
|
14918
|
+
init_chart_types();
|
|
14486
14919
|
GANTT_DURATION_RE = /^\d+(?:\.\d+)?(?:min|bd|d|w|m|q|y|h)(?:\?)?\s+/;
|
|
14487
14920
|
GANTT_DATE_RE = /^\d{4}-\d{2}-\d{2}(?:\s\d{2}:\d{2})?\s+/;
|
|
14488
14921
|
C4_TYPE_RE = /\bis\s+an?\s+(person|system|container|component)\b/i;
|
|
@@ -14539,91 +14972,57 @@ var init_dgmo_router = __esm({
|
|
|
14539
14972
|
"heatmap",
|
|
14540
14973
|
"funnel"
|
|
14541
14974
|
]);
|
|
14542
|
-
|
|
14543
|
-
|
|
14544
|
-
|
|
14545
|
-
"
|
|
14546
|
-
"
|
|
14547
|
-
"
|
|
14548
|
-
"
|
|
14549
|
-
"
|
|
14550
|
-
"
|
|
14551
|
-
"
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
"
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
14561
|
-
"
|
|
14562
|
-
"
|
|
14563
|
-
|
|
14564
|
-
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14574
|
-
|
|
14575
|
-
"
|
|
14576
|
-
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
};
|
|
14594
|
-
ECHART_TYPES = /* @__PURE__ */ new Set([
|
|
14595
|
-
"scatter",
|
|
14596
|
-
"sankey",
|
|
14597
|
-
"chord",
|
|
14598
|
-
"function",
|
|
14599
|
-
"heatmap",
|
|
14600
|
-
"funnel"
|
|
14601
|
-
]);
|
|
14602
|
-
PARSE_DISPATCH = /* @__PURE__ */ new Map([
|
|
14603
|
-
["sequence", (c) => parseSequenceDgmo(c)],
|
|
14604
|
-
["flowchart", (c) => parseFlowchart(c)],
|
|
14605
|
-
["class", (c) => parseClassDiagram(c)],
|
|
14606
|
-
["er", (c) => parseERDiagram(c)],
|
|
14607
|
-
["org", (c) => parseOrg(c)],
|
|
14608
|
-
["kanban", (c) => parseKanban(c)],
|
|
14609
|
-
["c4", (c) => parseC4(c)],
|
|
14610
|
-
["state", (c) => parseState(c)],
|
|
14611
|
-
["sitemap", (c) => parseSitemap(c)],
|
|
14612
|
-
["infra", (c) => parseInfra(c)],
|
|
14613
|
-
["gantt", (c) => parseGantt(c)],
|
|
14614
|
-
["boxes-and-lines", (c) => parseBoxesAndLines(c)],
|
|
14615
|
-
["mindmap", (c) => parseMindmap(c)],
|
|
14616
|
-
["wireframe", (c) => parseWireframe(c)],
|
|
14617
|
-
["tech-radar", (c) => parseTechRadar(c)],
|
|
14618
|
-
["cycle", (c) => parseCycle(c)],
|
|
14619
|
-
["journey-map", (c) => parseJourneyMap(c)],
|
|
14620
|
-
["pyramid", (c) => parsePyramid(c)]
|
|
14621
|
-
]);
|
|
14622
|
-
ALL_KNOWN_TYPES = /* @__PURE__ */ new Set([
|
|
14623
|
-
...DATA_CHART_TYPES,
|
|
14624
|
-
...VISUALIZATION_TYPES,
|
|
14625
|
-
...DIAGRAM_TYPES
|
|
14626
|
-
]);
|
|
14975
|
+
CHART_TYPE_DESCRIPTIONS = Object.fromEntries(chartTypes.map((c) => [c.id, c.description]));
|
|
14976
|
+
chartTypeParsers = [
|
|
14977
|
+
// Structured diagrams (direct parsers)
|
|
14978
|
+
["sequence", parseSequenceDgmo],
|
|
14979
|
+
["flowchart", parseFlowchart],
|
|
14980
|
+
["class", parseClassDiagram],
|
|
14981
|
+
["er", parseERDiagram],
|
|
14982
|
+
["state", parseState],
|
|
14983
|
+
["org", parseOrg],
|
|
14984
|
+
["kanban", parseKanban],
|
|
14985
|
+
["c4", parseC4],
|
|
14986
|
+
["sitemap", parseSitemap],
|
|
14987
|
+
["infra", parseInfra],
|
|
14988
|
+
["gantt", parseGantt],
|
|
14989
|
+
["boxes-and-lines", parseBoxesAndLines],
|
|
14990
|
+
["mindmap", parseMindmap],
|
|
14991
|
+
["wireframe", parseWireframe],
|
|
14992
|
+
["tech-radar", parseTechRadar],
|
|
14993
|
+
["cycle", parseCycle],
|
|
14994
|
+
["journey-map", parseJourneyMap],
|
|
14995
|
+
["pyramid", parsePyramid],
|
|
14996
|
+
// Standard ECharts charts (parseChart)
|
|
14997
|
+
["bar", parseChart],
|
|
14998
|
+
["line", parseChart],
|
|
14999
|
+
["multi-line", parseChart],
|
|
15000
|
+
["area", parseChart],
|
|
15001
|
+
["pie", parseChart],
|
|
15002
|
+
["doughnut", parseChart],
|
|
15003
|
+
["radar", parseChart],
|
|
15004
|
+
["polar-area", parseChart],
|
|
15005
|
+
["bar-stacked", parseChart],
|
|
15006
|
+
// Extended ECharts charts (parseExtendedChart)
|
|
15007
|
+
["scatter", parseExtendedChart],
|
|
15008
|
+
["sankey", parseExtendedChart],
|
|
15009
|
+
["chord", parseExtendedChart],
|
|
15010
|
+
["function", parseExtendedChart],
|
|
15011
|
+
["heatmap", parseExtendedChart],
|
|
15012
|
+
["funnel", parseExtendedChart],
|
|
15013
|
+
// D3 visualizations (parseVisualization)
|
|
15014
|
+
["slope", parseVisualization],
|
|
15015
|
+
["wordcloud", parseVisualization],
|
|
15016
|
+
["arc", parseVisualization],
|
|
15017
|
+
["timeline", parseVisualization],
|
|
15018
|
+
["venn", parseVisualization],
|
|
15019
|
+
["quadrant", parseVisualization]
|
|
15020
|
+
];
|
|
15021
|
+
knownChartTypeIds = chartTypeParsers.map(
|
|
15022
|
+
([id]) => id
|
|
15023
|
+
);
|
|
15024
|
+
PARSER_BY_ID = new Map(chartTypeParsers);
|
|
15025
|
+
ALL_KNOWN_TYPES = new Set(knownChartTypeIds);
|
|
14627
15026
|
}
|
|
14628
15027
|
});
|
|
14629
15028
|
|
|
@@ -19661,7 +20060,16 @@ function renderBoxesAndLines(container, parsed, layout, palette, isDark, options
|
|
|
19661
20060
|
const clipId = `bl-clip-${group.label.replace(/[[\]\s]/g, "")}`;
|
|
19662
20061
|
groupG.append("clipPath").attr("id", clipId).append("rect").attr("x", gx).attr("y", gy).attr("width", group.width).attr("height", group.height).attr("rx", NODE_RX);
|
|
19663
20062
|
groupG.append("rect").attr("x", gx).attr("y", gy + group.height - COLLAPSE_BAR_HEIGHT3).attr("width", group.width).attr("height", COLLAPSE_BAR_HEIGHT3).attr("fill", strokeColor).attr("clip-path", `url(#${clipId})`).attr("class", "bl-collapse-bar");
|
|
19664
|
-
|
|
20063
|
+
const maxLabelLines = Math.max(
|
|
20064
|
+
2,
|
|
20065
|
+
Math.floor((group.height - 16) / (MIN_NODE_FONT_SIZE * 1.3))
|
|
20066
|
+
);
|
|
20067
|
+
const fitted = fitLabelToHeader(group.label, group.width, maxLabelLines);
|
|
20068
|
+
const lineH = fitted.fontSize * 1.3;
|
|
20069
|
+
const totalH = fitted.lines.length * lineH;
|
|
20070
|
+
for (let li = 0; li < fitted.lines.length; li++) {
|
|
20071
|
+
groupG.append("text").attr("class", "bl-group-label").attr("x", group.x).attr("y", group.y - totalH / 2 + lineH / 2 + li * lineH).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("font-family", FONT_FAMILY).attr("font-size", fitted.fontSize).attr("font-weight", "600").attr("fill", palette.text).text(fitted.lines[li]);
|
|
20072
|
+
}
|
|
19665
20073
|
} else {
|
|
19666
20074
|
groupG.append("rect").attr("x", gx).attr("y", gy).attr("width", group.width).attr("height", groupHeight).attr("rx", GROUP_RX).attr("ry", GROUP_RX).attr("fill", mix(palette.surface, palette.bg, 40)).attr("stroke", palette.textMuted).attr("stroke-width", 1).attr("stroke-opacity", 0.35);
|
|
19667
20075
|
groupG.append("text").attr("class", "bl-group-label").attr("x", gx + group.width / 2).attr("y", gy + 18).attr("text-anchor", "middle").attr("font-family", FONT_FAMILY).attr("font-size", GROUP_LABEL_FONT_SIZE).attr("font-weight", "600").attr("fill", palette.text).text(group.label);
|
|
@@ -32170,7 +32578,8 @@ function layoutJourneyMap(parsed, palette, options) {
|
|
|
32170
32578
|
const annoIconIndent = ANNO_ICON_SIZE + ANNO_ICON_GAP;
|
|
32171
32579
|
const annoTextW = STEP_CARD_WIDTH - CARD_PADDING_X2 * 2 - annoIconIndent;
|
|
32172
32580
|
const descTextWidth = STEP_CARD_WIDTH - CARD_PADDING_X2 * 2;
|
|
32173
|
-
const
|
|
32581
|
+
const FONT_SIZE_META2 = 10;
|
|
32582
|
+
const charWidth = FONT_SIZE_META2 * 0.6;
|
|
32174
32583
|
const titleTextWidth = STEP_CARD_WIDTH - CARD_PADDING_X2 * 2;
|
|
32175
32584
|
const titleCharWidth = 6.5;
|
|
32176
32585
|
const TITLE_LINE_HEIGHT2 = 16;
|
|
@@ -34553,7 +34962,6 @@ __export(renderer_exports16, {
|
|
|
34553
34962
|
applyPositionOverrides: () => applyPositionOverrides,
|
|
34554
34963
|
buildNoteMessageMap: () => buildNoteMessageMap,
|
|
34555
34964
|
buildRenderSequence: () => buildRenderSequence,
|
|
34556
|
-
collectNoteLineNumbers: () => collectNoteLineNumbers,
|
|
34557
34965
|
computeActivations: () => computeActivations,
|
|
34558
34966
|
groupMessagesBySection: () => groupMessagesBySection,
|
|
34559
34967
|
parseInlineMarkdown: () => parseInlineMarkdown,
|
|
@@ -34937,9 +35345,6 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
34937
35345
|
const groups = collapsed ? collapsed.groups : parsed.groups;
|
|
34938
35346
|
const collapsedGroupIds = collapsed?.collapsedGroupIds ?? /* @__PURE__ */ new Map();
|
|
34939
35347
|
const collapsedSections = options?.collapsedSections;
|
|
34940
|
-
const expandedNoteLines = options?.expandedNoteLines;
|
|
34941
|
-
const collapseNotesDisabled = parsedOptions["collapse-notes"]?.toLowerCase() === "no";
|
|
34942
|
-
const isNoteExpanded = (note) => expandedNoteLines === void 0 || collapseNotesDisabled || expandedNoteLines.has(note.lineNumber);
|
|
34943
35348
|
const sourceParticipants = collapsed ? collapsed.participants : parsed.participants;
|
|
34944
35349
|
const participants = applyPositionOverrides(
|
|
34945
35350
|
applyGroupOrdering(sourceParticipants, groups, messages)
|
|
@@ -35108,7 +35513,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
35108
35513
|
const note = els[j];
|
|
35109
35514
|
const sc = isNoteAfterSelfCall(note);
|
|
35110
35515
|
const maxW = noteEffectiveMaxW(note.participantId, note.position, sc);
|
|
35111
|
-
const noteH =
|
|
35516
|
+
const noteH = computeNoteHeight(note.text, charsForWidth(maxW));
|
|
35112
35517
|
totalExtent += noteH + NOTE_OFFSET_BELOW;
|
|
35113
35518
|
j++;
|
|
35114
35519
|
}
|
|
@@ -35304,7 +35709,10 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
35304
35709
|
prevNote.position,
|
|
35305
35710
|
isNoteAfterSelfCall(prevNote)
|
|
35306
35711
|
);
|
|
35307
|
-
const prevNoteH =
|
|
35712
|
+
const prevNoteH = computeNoteHeight(
|
|
35713
|
+
prevNote.text,
|
|
35714
|
+
charsForWidth(prevMaxW)
|
|
35715
|
+
);
|
|
35308
35716
|
noteTopY = prevNoteY + prevNoteH + NOTE_OFFSET_BELOW;
|
|
35309
35717
|
} else {
|
|
35310
35718
|
noteTopY = stepY(si) + noteOffsetBelow(el);
|
|
@@ -35335,7 +35743,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
35335
35743
|
note.position,
|
|
35336
35744
|
isNoteAfterSelfCall(note)
|
|
35337
35745
|
);
|
|
35338
|
-
const noteH =
|
|
35746
|
+
const noteH = computeNoteHeight(note.text, charsForWidth(maxW));
|
|
35339
35747
|
contentBottomY = Math.max(
|
|
35340
35748
|
contentBottomY,
|
|
35341
35749
|
noteTopY + noteH + NOTE_TRAILING_GAP
|
|
@@ -35405,24 +35813,6 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
35405
35813
|
titleEl.attr("data-line-number", parsed.titleLineNumber);
|
|
35406
35814
|
}
|
|
35407
35815
|
}
|
|
35408
|
-
const allNoteLineNumbers = [];
|
|
35409
|
-
const collectNoteLines = (els) => {
|
|
35410
|
-
for (const el of els) {
|
|
35411
|
-
if (isSequenceNote(el)) {
|
|
35412
|
-
allNoteLineNumbers.push(el.lineNumber);
|
|
35413
|
-
} else if (isSequenceBlock(el)) {
|
|
35414
|
-
collectNoteLines(el.children);
|
|
35415
|
-
if ("elseChildren" in el) collectNoteLines(el.elseChildren);
|
|
35416
|
-
if ("branches" in el && Array.isArray(el.branches)) {
|
|
35417
|
-
for (const branch of el.branches) {
|
|
35418
|
-
collectNoteLines(branch.children);
|
|
35419
|
-
}
|
|
35420
|
-
}
|
|
35421
|
-
}
|
|
35422
|
-
}
|
|
35423
|
-
};
|
|
35424
|
-
collectNoteLines(elements);
|
|
35425
|
-
const showNotesControl = allNoteLineNumbers.length > 0 && !collapseNotesDisabled && expandedNoteLines !== void 0;
|
|
35426
35816
|
const hasTagGroups = parsed.tagGroups.length > 0;
|
|
35427
35817
|
const collapsedGroupNames = /* @__PURE__ */ new Set();
|
|
35428
35818
|
const collapsedGroupMeta = /* @__PURE__ */ new Map();
|
|
@@ -35834,7 +36224,6 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
35834
36224
|
}
|
|
35835
36225
|
});
|
|
35836
36226
|
const noteFill = isDark ? mix(palette.surface, palette.bg, 50) : mix(palette.bg, palette.surface, 15);
|
|
35837
|
-
const collapsedNoteFill = mix(palette.textMuted, palette.bg, 15);
|
|
35838
36227
|
const renderNoteElements = (els) => {
|
|
35839
36228
|
for (const el of els) {
|
|
35840
36229
|
if (isSequenceNote(el)) {
|
|
@@ -35842,83 +36231,54 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
35842
36231
|
if (px === void 0) continue;
|
|
35843
36232
|
const noteTopY = noteYMap.get(el);
|
|
35844
36233
|
if (noteTopY === void 0) continue;
|
|
35845
|
-
const expanded = isNoteExpanded(el);
|
|
35846
36234
|
const isRight = el.position === "right";
|
|
35847
|
-
|
|
35848
|
-
|
|
35849
|
-
|
|
35850
|
-
|
|
35851
|
-
|
|
35852
|
-
|
|
35853
|
-
|
|
35854
|
-
|
|
35855
|
-
|
|
35856
|
-
|
|
35857
|
-
|
|
35858
|
-
|
|
35859
|
-
|
|
35860
|
-
|
|
35861
|
-
|
|
35862
|
-
|
|
35863
|
-
|
|
35864
|
-
|
|
35865
|
-
|
|
35866
|
-
|
|
35867
|
-
|
|
35868
|
-
|
|
35869
|
-
|
|
35870
|
-
|
|
35871
|
-
|
|
35872
|
-
|
|
35873
|
-
|
|
35874
|
-
|
|
35875
|
-
|
|
35876
|
-
|
|
35877
|
-
|
|
35878
|
-
|
|
35879
|
-
|
|
35880
|
-
|
|
35881
|
-
|
|
35882
|
-
|
|
35883
|
-
|
|
35884
|
-
|
|
35885
|
-
|
|
35886
|
-
|
|
35887
|
-
|
|
35888
|
-
|
|
35889
|
-
|
|
35890
|
-
|
|
35891
|
-
|
|
35892
|
-
|
|
35893
|
-
|
|
35894
|
-
});
|
|
35895
|
-
} else {
|
|
35896
|
-
const cFold = 6;
|
|
35897
|
-
const afterSelfCallC = isNoteAfterSelfCall(el);
|
|
35898
|
-
const rightOffsetC = afterSelfCallC && isRight ? ACTIVATION_WIDTH / 2 + SELF_CALL_WIDTH + NOTE_GAP : ACTIVATION_WIDTH + NOTE_GAP;
|
|
35899
|
-
const noteX = isRight ? px + rightOffsetC : px - ACTIVATION_WIDTH - NOTE_GAP - COLLAPSED_NOTE_W;
|
|
35900
|
-
const noteG = svg.append("g").attr("class", "note note-collapsed").attr("data-note-toggle", "").attr("data-line-number", String(el.lineNumber)).attr("data-line-end", String(el.endLineNumber)).style("cursor", "pointer");
|
|
35901
|
-
noteG.append("path").attr(
|
|
35902
|
-
"d",
|
|
35903
|
-
[
|
|
35904
|
-
`M ${noteX} ${noteTopY}`,
|
|
35905
|
-
`L ${noteX + COLLAPSED_NOTE_W - cFold} ${noteTopY}`,
|
|
35906
|
-
`L ${noteX + COLLAPSED_NOTE_W} ${noteTopY + cFold}`,
|
|
35907
|
-
`L ${noteX + COLLAPSED_NOTE_W} ${noteTopY + COLLAPSED_NOTE_H}`,
|
|
35908
|
-
`L ${noteX} ${noteTopY + COLLAPSED_NOTE_H}`,
|
|
35909
|
-
"Z"
|
|
35910
|
-
].join(" ")
|
|
35911
|
-
).attr("fill", collapsedNoteFill).attr("stroke", palette.border).attr("stroke-width", 0.75).attr("class", "note-box");
|
|
35912
|
-
noteG.append("path").attr(
|
|
35913
|
-
"d",
|
|
35914
|
-
[
|
|
35915
|
-
`M ${noteX + COLLAPSED_NOTE_W - cFold} ${noteTopY}`,
|
|
35916
|
-
`L ${noteX + COLLAPSED_NOTE_W - cFold} ${noteTopY + cFold}`,
|
|
35917
|
-
`L ${noteX + COLLAPSED_NOTE_W} ${noteTopY + cFold}`
|
|
35918
|
-
].join(" ")
|
|
35919
|
-
).attr("fill", "none").attr("stroke", palette.border).attr("stroke-width", 0.75).attr("class", "note-fold");
|
|
35920
|
-
noteG.append("text").attr("x", noteX + COLLAPSED_NOTE_W / 2).attr("y", noteTopY + COLLAPSED_NOTE_H / 2 + 3).attr("text-anchor", "middle").attr("fill", palette.textMuted).attr("font-size", 9).attr("class", "note-text").text("\u2026");
|
|
35921
|
-
}
|
|
36235
|
+
const afterSelfCall = isNoteAfterSelfCall(el);
|
|
36236
|
+
const maxW = noteEffectiveMaxW(
|
|
36237
|
+
el.participantId,
|
|
36238
|
+
el.position,
|
|
36239
|
+
afterSelfCall
|
|
36240
|
+
);
|
|
36241
|
+
const maxChars = charsForWidth(maxW);
|
|
36242
|
+
const wrappedLines = wrapTextLines(el.text, maxChars);
|
|
36243
|
+
const noteH = wrappedLines.length * NOTE_LINE_H + NOTE_PAD_V * 2;
|
|
36244
|
+
const maxLineLen = Math.max(...wrappedLines.map((l) => l.length));
|
|
36245
|
+
const noteW = Math.min(
|
|
36246
|
+
maxW,
|
|
36247
|
+
Math.max(80, maxLineLen * NOTE_CHAR_W + NOTE_PAD_H * 2 + NOTE_FOLD)
|
|
36248
|
+
);
|
|
36249
|
+
const rightOffset = afterSelfCall && isRight ? ACTIVATION_WIDTH / 2 + SELF_CALL_WIDTH + NOTE_GAP : ACTIVATION_WIDTH + NOTE_GAP;
|
|
36250
|
+
const noteX = isRight ? px + rightOffset : px - ACTIVATION_WIDTH - NOTE_GAP - noteW;
|
|
36251
|
+
const noteG = svg.append("g").attr("class", "note").attr("data-note-toggle", "").attr("data-line-number", String(el.lineNumber)).attr("data-line-end", String(el.endLineNumber));
|
|
36252
|
+
noteG.append("path").attr(
|
|
36253
|
+
"d",
|
|
36254
|
+
[
|
|
36255
|
+
`M ${noteX} ${noteTopY}`,
|
|
36256
|
+
`L ${noteX + noteW - NOTE_FOLD} ${noteTopY}`,
|
|
36257
|
+
`L ${noteX + noteW} ${noteTopY + NOTE_FOLD}`,
|
|
36258
|
+
`L ${noteX + noteW} ${noteTopY + noteH}`,
|
|
36259
|
+
`L ${noteX} ${noteTopY + noteH}`,
|
|
36260
|
+
"Z"
|
|
36261
|
+
].join(" ")
|
|
36262
|
+
).attr("fill", noteFill).attr("stroke", palette.textMuted).attr("stroke-width", 0.75).attr("class", "note-box");
|
|
36263
|
+
noteG.append("path").attr(
|
|
36264
|
+
"d",
|
|
36265
|
+
[
|
|
36266
|
+
`M ${noteX + noteW - NOTE_FOLD} ${noteTopY}`,
|
|
36267
|
+
`L ${noteX + noteW - NOTE_FOLD} ${noteTopY + NOTE_FOLD}`,
|
|
36268
|
+
`L ${noteX + noteW} ${noteTopY + NOTE_FOLD}`
|
|
36269
|
+
].join(" ")
|
|
36270
|
+
).attr("fill", "none").attr("stroke", palette.textMuted).attr("stroke-width", 0.75).attr("class", "note-fold");
|
|
36271
|
+
wrappedLines.forEach((line11, li) => {
|
|
36272
|
+
const textY = noteTopY + NOTE_PAD_V + (li + 1) * NOTE_LINE_H - 3;
|
|
36273
|
+
const isBullet = line11.startsWith("- ");
|
|
36274
|
+
const bulletIndent = isBullet ? 10 : 0;
|
|
36275
|
+
const displayLine = isBullet ? line11.slice(2) : line11;
|
|
36276
|
+
const textEl = noteG.append("text").attr("x", noteX + NOTE_PAD_H + bulletIndent).attr("y", textY).attr("fill", palette.text).attr("font-size", NOTE_FONT_SIZE).attr("class", "note-text");
|
|
36277
|
+
if (isBullet) {
|
|
36278
|
+
noteG.append("text").attr("x", noteX + NOTE_PAD_H).attr("y", textY).attr("fill", palette.text).attr("font-size", NOTE_FONT_SIZE).text("\u2022");
|
|
36279
|
+
}
|
|
36280
|
+
renderInlineText(textEl, displayLine, palette, NOTE_FONT_SIZE);
|
|
36281
|
+
});
|
|
35922
36282
|
} else if (isSequenceBlock(el)) {
|
|
35923
36283
|
renderNoteElements(el.children);
|
|
35924
36284
|
if (el.elseIfBranches) {
|
|
@@ -35933,8 +36293,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
35933
36293
|
if (elements && elements.length > 0) {
|
|
35934
36294
|
renderNoteElements(elements);
|
|
35935
36295
|
}
|
|
35936
|
-
if (hasTagGroups
|
|
35937
|
-
const controlsExpanded = options?.controlsExpanded ?? false;
|
|
36296
|
+
if (hasTagGroups) {
|
|
35938
36297
|
const legendY = TOP_MARGIN + titleOffset;
|
|
35939
36298
|
const resolvedGroups = parsed.tagGroups.filter((tg) => tg.entries.length > 0).map((tg) => ({
|
|
35940
36299
|
name: tg.name,
|
|
@@ -35943,37 +36302,16 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
35943
36302
|
color: e.color
|
|
35944
36303
|
}))
|
|
35945
36304
|
}));
|
|
35946
|
-
const allExpanded = showNotesControl && (options?.expandAllNotes ?? false);
|
|
35947
|
-
const controlsGroup = showNotesControl ? {
|
|
35948
|
-
toggles: [
|
|
35949
|
-
{
|
|
35950
|
-
id: "expand-all-notes",
|
|
35951
|
-
type: "toggle",
|
|
35952
|
-
label: "Expand Notes",
|
|
35953
|
-
active: allExpanded,
|
|
35954
|
-
onToggle: () => {
|
|
35955
|
-
}
|
|
35956
|
-
}
|
|
35957
|
-
]
|
|
35958
|
-
} : void 0;
|
|
35959
36305
|
const legendConfig = {
|
|
35960
36306
|
groups: resolvedGroups,
|
|
35961
36307
|
position: { placement: "top-center", titleRelation: "below-title" },
|
|
35962
|
-
mode: "fixed"
|
|
35963
|
-
controlsGroup
|
|
36308
|
+
mode: "fixed"
|
|
35964
36309
|
};
|
|
35965
36310
|
const legendState = {
|
|
35966
36311
|
activeGroup: activeTagGroup ?? null,
|
|
35967
|
-
controlsExpanded
|
|
35968
|
-
};
|
|
35969
|
-
const legendCallbacks = {
|
|
35970
|
-
onControlsExpand: () => {
|
|
35971
|
-
options?.onToggleControlsExpand?.();
|
|
35972
|
-
},
|
|
35973
|
-
onControlsToggle: (_toggleId, active) => {
|
|
35974
|
-
options?.onExpandAllNotes?.(active);
|
|
35975
|
-
}
|
|
36312
|
+
controlsExpanded: false
|
|
35976
36313
|
};
|
|
36314
|
+
const legendCallbacks = {};
|
|
35977
36315
|
const legendG = svg.append("g").attr("class", "sequence-legend").attr("transform", `translate(0,${legendY})`);
|
|
35978
36316
|
renderLegendD3(
|
|
35979
36317
|
legendG,
|
|
@@ -36012,26 +36350,6 @@ function buildNoteMessageMap(elements) {
|
|
|
36012
36350
|
walk(elements);
|
|
36013
36351
|
return map;
|
|
36014
36352
|
}
|
|
36015
|
-
function collectNoteLineNumbers(elements) {
|
|
36016
|
-
const result = [];
|
|
36017
|
-
const walk = (els) => {
|
|
36018
|
-
for (const el of els) {
|
|
36019
|
-
if (isSequenceNote(el)) {
|
|
36020
|
-
result.push(el.lineNumber);
|
|
36021
|
-
} else if (isSequenceBlock(el)) {
|
|
36022
|
-
walk(el.children);
|
|
36023
|
-
if (el.elseIfBranches) {
|
|
36024
|
-
for (const branch of el.elseIfBranches) {
|
|
36025
|
-
walk(branch.children);
|
|
36026
|
-
}
|
|
36027
|
-
}
|
|
36028
|
-
walk(el.elseChildren);
|
|
36029
|
-
}
|
|
36030
|
-
}
|
|
36031
|
-
};
|
|
36032
|
-
walk(elements);
|
|
36033
|
-
return result;
|
|
36034
|
-
}
|
|
36035
36353
|
function renderParticipant(svg, participant, cx, cy, palette, isDark, color, tagAttr) {
|
|
36036
36354
|
const g = svg.append("g").attr("transform", `translate(${cx}, ${cy})`).attr("class", "participant").attr("data-participant-id", participant.id);
|
|
36037
36355
|
if (tagAttr) {
|
|
@@ -36087,7 +36405,7 @@ function renderParticipant(svg, participant, cx, cy, palette, isDark, color, tag
|
|
|
36087
36405
|
});
|
|
36088
36406
|
}
|
|
36089
36407
|
}
|
|
36090
|
-
var PARTICIPANT_GAP, PARTICIPANT_BOX_WIDTH, PARTICIPANT_BOX_HEIGHT, TOP_MARGIN, TITLE_HEIGHT8, PARTICIPANT_Y_OFFSET, SERVICE_BORDER_RADIUS, MESSAGE_START_OFFSET, LIFELINE_TAIL, ARROWHEAD_SIZE, NOTE_MAX_W, NOTE_FOLD, NOTE_PAD_H, NOTE_PAD_V, NOTE_FONT_SIZE, NOTE_LINE_H, NOTE_GAP, NOTE_CHAR_W, NOTE_CHARS_PER_LINE,
|
|
36408
|
+
var PARTICIPANT_GAP, PARTICIPANT_BOX_WIDTH, PARTICIPANT_BOX_HEIGHT, TOP_MARGIN, TITLE_HEIGHT8, PARTICIPANT_Y_OFFSET, SERVICE_BORDER_RADIUS, MESSAGE_START_OFFSET, LIFELINE_TAIL, ARROWHEAD_SIZE, NOTE_MAX_W, NOTE_FOLD, NOTE_PAD_H, NOTE_PAD_V, NOTE_FONT_SIZE, NOTE_LINE_H, NOTE_GAP, NOTE_CHAR_W, NOTE_CHARS_PER_LINE, ACTIVATION_WIDTH, SELF_CALL_HEIGHT, SELF_CALL_WIDTH, NOTE_LANE_MAX, LABEL_CHAR_WIDTH, LABEL_MAX_CHARS, fill, stroke, SW, W, H;
|
|
36091
36409
|
var init_renderer16 = __esm({
|
|
36092
36410
|
"src/sequence/renderer.ts"() {
|
|
36093
36411
|
"use strict";
|
|
@@ -36122,8 +36440,6 @@ var init_renderer16 = __esm({
|
|
|
36122
36440
|
NOTE_CHARS_PER_LINE = Math.floor(
|
|
36123
36441
|
(NOTE_MAX_W - NOTE_PAD_H * 2 - NOTE_FOLD) / NOTE_CHAR_W
|
|
36124
36442
|
);
|
|
36125
|
-
COLLAPSED_NOTE_H = 20;
|
|
36126
|
-
COLLAPSED_NOTE_W = 40;
|
|
36127
36443
|
ACTIVATION_WIDTH = 10;
|
|
36128
36444
|
SELF_CALL_HEIGHT = 25;
|
|
36129
36445
|
SELF_CALL_WIDTH = 30;
|
|
@@ -37094,7 +37410,12 @@ function parseVisualization(content, palette) {
|
|
|
37094
37410
|
);
|
|
37095
37411
|
validateTagGroupNames(
|
|
37096
37412
|
result.timelineTagGroups,
|
|
37097
|
-
(line11, msg) => result.diagnostics.push(makeDgmoError(line11, msg, "warning"))
|
|
37413
|
+
(line11, msg) => result.diagnostics.push(makeDgmoError(line11, msg, "warning")),
|
|
37414
|
+
(line11, msg) => {
|
|
37415
|
+
const diag = makeDgmoError(line11, msg);
|
|
37416
|
+
result.diagnostics.push(diag);
|
|
37417
|
+
if (!result.error) result.error = formatDgmoError(diag);
|
|
37418
|
+
}
|
|
37098
37419
|
);
|
|
37099
37420
|
for (const group of result.timelineTagGroups) {
|
|
37100
37421
|
if (!group.defaultValue) continue;
|
|
@@ -40958,6 +41279,83 @@ async function render(content, options) {
|
|
|
40958
41279
|
return { svg, diagnostics };
|
|
40959
41280
|
}
|
|
40960
41281
|
|
|
41282
|
+
// src/index.ts
|
|
41283
|
+
init_chart_types();
|
|
41284
|
+
|
|
41285
|
+
// src/chart-type-scoring.ts
|
|
41286
|
+
init_chart_types();
|
|
41287
|
+
var TYPOGRAPHIC_REPLACEMENTS = [
|
|
41288
|
+
[/[‘’]/g, "'"],
|
|
41289
|
+
// curly single quotes
|
|
41290
|
+
[/[“”]/g, '"'],
|
|
41291
|
+
// curly double quotes
|
|
41292
|
+
[/[–—]/g, "-"],
|
|
41293
|
+
// en/em dash
|
|
41294
|
+
[/×/g, "x"]
|
|
41295
|
+
// unicode multiplication → ASCII (for "2×2" vs "2x2")
|
|
41296
|
+
];
|
|
41297
|
+
function normalize(s) {
|
|
41298
|
+
let out = s.normalize("NFKD").toLowerCase();
|
|
41299
|
+
for (const [re, repl] of TYPOGRAPHIC_REPLACEMENTS)
|
|
41300
|
+
out = out.replace(re, repl);
|
|
41301
|
+
return out.split(/[^a-z0-9]+/).filter(Boolean);
|
|
41302
|
+
}
|
|
41303
|
+
function matchesContiguously(promptTokens, triggerTokens) {
|
|
41304
|
+
if (triggerTokens.length === 0 || triggerTokens.length > promptTokens.length)
|
|
41305
|
+
return false;
|
|
41306
|
+
outer: for (let i = 0; i <= promptTokens.length - triggerTokens.length; i++) {
|
|
41307
|
+
for (let j = 0; j < triggerTokens.length; j++) {
|
|
41308
|
+
if (promptTokens[i + j] !== triggerTokens[j]) continue outer;
|
|
41309
|
+
}
|
|
41310
|
+
return true;
|
|
41311
|
+
}
|
|
41312
|
+
return false;
|
|
41313
|
+
}
|
|
41314
|
+
function scoreChartType(prompt, type) {
|
|
41315
|
+
const promptTokens = normalize(prompt);
|
|
41316
|
+
const matched = [];
|
|
41317
|
+
let score = 0;
|
|
41318
|
+
for (const trigger of type.triggers) {
|
|
41319
|
+
const triggerTokens = normalize(trigger);
|
|
41320
|
+
if (matchesContiguously(promptTokens, triggerTokens)) {
|
|
41321
|
+
matched.push(trigger);
|
|
41322
|
+
score += triggerTokens.length;
|
|
41323
|
+
}
|
|
41324
|
+
}
|
|
41325
|
+
const descTokens = new Set(normalize(type.description));
|
|
41326
|
+
let descHits = 0;
|
|
41327
|
+
for (const t of promptTokens) if (descTokens.has(t)) descHits++;
|
|
41328
|
+
score += descHits * 0.25;
|
|
41329
|
+
return { score, matched };
|
|
41330
|
+
}
|
|
41331
|
+
var MIN_PRIMARY_SCORE = 1;
|
|
41332
|
+
var AMBIGUITY_THRESHOLD = 0.5;
|
|
41333
|
+
function confidence(top, second) {
|
|
41334
|
+
if (top < MIN_PRIMARY_SCORE) return "ambiguous";
|
|
41335
|
+
if (second === 0) return "high";
|
|
41336
|
+
if (top >= second * 2) return "high";
|
|
41337
|
+
if (top - second < AMBIGUITY_THRESHOLD) return "ambiguous";
|
|
41338
|
+
return "medium";
|
|
41339
|
+
}
|
|
41340
|
+
function suggestChartTypes(prompt) {
|
|
41341
|
+
const scored = [];
|
|
41342
|
+
for (const type of chartTypes) {
|
|
41343
|
+
const { score, matched } = scoreChartType(prompt, type);
|
|
41344
|
+
if (score > 0) scored.push({ type, score, matched });
|
|
41345
|
+
}
|
|
41346
|
+
scored.sort((a, b) => b.score - a.score);
|
|
41347
|
+
const fallback = chartTypes.filter((c) => c.fallback);
|
|
41348
|
+
const topScore = scored[0]?.score ?? 0;
|
|
41349
|
+
const secondScore = scored[1]?.score ?? 0;
|
|
41350
|
+
const fellBack = topScore < MIN_PRIMARY_SCORE;
|
|
41351
|
+
return {
|
|
41352
|
+
ranked: scored,
|
|
41353
|
+
fallback,
|
|
41354
|
+
confidence: confidence(topScore, secondScore),
|
|
41355
|
+
fellBack
|
|
41356
|
+
};
|
|
41357
|
+
}
|
|
41358
|
+
|
|
40961
41359
|
// src/index.ts
|
|
40962
41360
|
init_dgmo_router();
|
|
40963
41361
|
init_chart();
|
|
@@ -41869,10 +42267,6 @@ var COMPLETION_REGISTRY = /* @__PURE__ */ new Map([
|
|
|
41869
42267
|
description: "Show activation bars",
|
|
41870
42268
|
values: ["on", "off"]
|
|
41871
42269
|
},
|
|
41872
|
-
"collapse-notes": {
|
|
41873
|
-
description: "Collapse note blocks",
|
|
41874
|
-
values: ["yes", "no"]
|
|
41875
|
-
},
|
|
41876
42270
|
"active-tag": { description: "Active tag group name" }
|
|
41877
42271
|
})
|
|
41878
42272
|
],
|
|
@@ -42609,6 +43003,7 @@ function extractJourneyMapSymbols(docText) {
|
|
|
42609
43003
|
init_parsing();
|
|
42610
43004
|
export {
|
|
42611
43005
|
ALL_CHART_TYPES,
|
|
43006
|
+
AMBIGUITY_THRESHOLD,
|
|
42612
43007
|
ARROW_DIAGNOSTIC_CODES,
|
|
42613
43008
|
CHART_TYPES,
|
|
42614
43009
|
CHART_TYPE_DESCRIPTIONS,
|
|
@@ -42617,6 +43012,7 @@ export {
|
|
|
42617
43012
|
INFRA_BEHAVIOR_KEYS,
|
|
42618
43013
|
LEGEND_HEIGHT,
|
|
42619
43014
|
METADATA_KEY_SET,
|
|
43015
|
+
MIN_PRIMARY_SCORE,
|
|
42620
43016
|
PIPE_METADATA,
|
|
42621
43017
|
RECOGNIZED_COLOR_NAMES,
|
|
42622
43018
|
RULE_COUNT,
|
|
@@ -42632,13 +43028,15 @@ export {
|
|
|
42632
43028
|
buildTagLaneRowList,
|
|
42633
43029
|
calculateSchedule,
|
|
42634
43030
|
catppuccinPalette,
|
|
43031
|
+
confidence as chartTypeConfidence,
|
|
43032
|
+
chartTypeParsers,
|
|
43033
|
+
chartTypes,
|
|
42635
43034
|
collapseBoxesAndLines,
|
|
42636
43035
|
collapseMindmapTree,
|
|
42637
43036
|
collapseOrgTree,
|
|
42638
43037
|
collapseSitemapTree,
|
|
42639
43038
|
collapseStateGroups,
|
|
42640
43039
|
collectDiagramRoles,
|
|
42641
|
-
collectNoteLineNumbers,
|
|
42642
43040
|
collectTasks,
|
|
42643
43041
|
colorNames,
|
|
42644
43042
|
computeActivations,
|
|
@@ -42684,6 +43082,7 @@ export {
|
|
|
42684
43082
|
isSequenceBlock,
|
|
42685
43083
|
isSequenceNote,
|
|
42686
43084
|
isValidHex,
|
|
43085
|
+
knownChartTypeIds,
|
|
42687
43086
|
layoutBoxesAndLines,
|
|
42688
43087
|
layoutC4Components,
|
|
42689
43088
|
layoutC4Containers,
|
|
@@ -42706,10 +43105,12 @@ export {
|
|
|
42706
43105
|
looksLikeState,
|
|
42707
43106
|
makeDgmoError,
|
|
42708
43107
|
matchColorParens,
|
|
43108
|
+
matchesContiguously,
|
|
42709
43109
|
mix,
|
|
42710
43110
|
monokaiPalette,
|
|
42711
43111
|
nord,
|
|
42712
43112
|
nordPalette,
|
|
43113
|
+
normalize as normalizeChartTypePrompt,
|
|
42713
43114
|
oneDarkPalette,
|
|
42714
43115
|
orderArcNodes,
|
|
42715
43116
|
parseAndLayoutInfra,
|
|
@@ -42801,9 +43202,11 @@ export {
|
|
|
42801
43202
|
resolveTaskName,
|
|
42802
43203
|
rollUpContextRelationships,
|
|
42803
43204
|
rosePinePalette,
|
|
43205
|
+
scoreChartType,
|
|
42804
43206
|
seriesColors,
|
|
42805
43207
|
shade,
|
|
42806
43208
|
solarizedPalette,
|
|
43209
|
+
suggestChartTypes,
|
|
42807
43210
|
tint,
|
|
42808
43211
|
tokyoNightPalette,
|
|
42809
43212
|
truncateBareUrl,
|