@diagrammo/dgmo 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +15 -20
- package/README.md +56 -58
- package/dist/cli.cjs +188 -181
- package/dist/index.cjs +3529 -1061
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +196 -43
- package/dist/index.d.ts +196 -43
- package/dist/index.js +3516 -1061
- package/dist/index.js.map +1 -1
- package/docs/language-reference.md +629 -289
- package/package.json +1 -1
- package/src/c4/layout.ts +6 -9
- package/src/c4/parser.ts +189 -83
- package/src/c4/renderer.ts +8 -9
- package/src/chart.ts +296 -83
- package/src/class/parser.ts +54 -37
- package/src/class/renderer.ts +8 -8
- package/src/cli.ts +8 -8
- package/src/colors.ts +4 -1
- package/src/completion.ts +757 -10
- package/src/d3.ts +312 -73
- package/src/dgmo-router.ts +63 -8
- package/src/echarts.ts +726 -231
- package/src/er/parser.ts +94 -76
- package/src/er/renderer.ts +6 -5
- package/src/gantt/parser.ts +144 -69
- package/src/gantt/renderer.ts +50 -14
- package/src/gantt/types.ts +3 -3
- package/src/graph/flowchart-parser.ts +97 -37
- package/src/graph/flowchart-renderer.ts +4 -3
- package/src/graph/state-parser.ts +50 -31
- package/src/graph/state-renderer.ts +4 -3
- package/src/index.ts +14 -5
- package/src/infra/compute.ts +1 -0
- package/src/infra/layout.ts +3 -0
- package/src/infra/parser.ts +291 -92
- package/src/infra/renderer.ts +172 -30
- package/src/infra/types.ts +5 -0
- package/src/initiative-status/layout.ts +1 -1
- package/src/initiative-status/parser.ts +121 -47
- package/src/initiative-status/renderer.ts +82 -31
- package/src/initiative-status/types.ts +10 -2
- package/src/kanban/parser.ts +60 -37
- package/src/kanban/renderer.ts +2 -2
- package/src/kanban/types.ts +1 -0
- package/src/org/layout.ts +9 -9
- package/src/org/parser.ts +39 -40
- package/src/org/renderer.ts +5 -6
- package/src/org/resolver.ts +26 -19
- package/src/render.ts +1 -1
- package/src/sequence/parser.ts +304 -95
- package/src/sequence/renderer.ts +9 -9
- package/src/sitemap/layout.ts +3 -4
- package/src/sitemap/parser.ts +57 -49
- package/src/sitemap/renderer.ts +6 -7
- package/src/utils/arrows.ts +25 -6
- package/src/utils/duration.ts +43 -7
- package/src/utils/legend-constants.ts +26 -0
- package/src/utils/legend-svg.ts +167 -0
- package/src/utils/parsing.ts +247 -7
- package/src/utils/tag-groups.ts +160 -15
- package/src/utils/title-constants.ts +9 -0
package/src/class/renderer.ts
CHANGED
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
LEGEND_HEIGHT,
|
|
11
11
|
LEGEND_PILL_PAD,
|
|
12
12
|
LEGEND_PILL_FONT_SIZE,
|
|
13
|
-
LEGEND_PILL_FONT_W,
|
|
14
13
|
LEGEND_CAPSULE_PAD,
|
|
15
14
|
LEGEND_DOT_R,
|
|
16
15
|
LEGEND_ENTRY_FONT_SIZE,
|
|
17
|
-
LEGEND_ENTRY_FONT_W,
|
|
18
16
|
LEGEND_ENTRY_DOT_GAP,
|
|
19
17
|
LEGEND_ENTRY_TRAIL,
|
|
18
|
+
measureLegendText,
|
|
20
19
|
} from '../utils/legend-constants';
|
|
20
|
+
import { TITLE_FONT_SIZE, TITLE_FONT_WEIGHT, TITLE_Y } from '../utils/title-constants';
|
|
21
21
|
import type { PaletteColors } from '../palettes';
|
|
22
22
|
import { mix } from '../palettes/color-utils';
|
|
23
23
|
import type { ParsedClassDiagram, ClassModifier, RelationshipType } from './types';
|
|
@@ -97,7 +97,7 @@ const LEGEND_GROUP_NAME = 'Type';
|
|
|
97
97
|
function legendEntriesWidth(entries: ClassLegendEntry[]): number {
|
|
98
98
|
let w = 0;
|
|
99
99
|
for (const e of entries) {
|
|
100
|
-
w += LEGEND_DOT_R * 2 + LEGEND_ENTRY_DOT_GAP + e.label
|
|
100
|
+
w += LEGEND_DOT_R * 2 + LEGEND_ENTRY_DOT_GAP + measureLegendText(e.label, LEGEND_ENTRY_FONT_SIZE) + LEGEND_ENTRY_TRAIL;
|
|
101
101
|
}
|
|
102
102
|
return w;
|
|
103
103
|
}
|
|
@@ -286,11 +286,11 @@ export function renderClassDiagram(
|
|
|
286
286
|
.append('text')
|
|
287
287
|
.attr('class', 'chart-title')
|
|
288
288
|
.attr('x', width / 2)
|
|
289
|
-
.attr('y',
|
|
289
|
+
.attr('y', TITLE_Y)
|
|
290
290
|
.attr('text-anchor', 'middle')
|
|
291
291
|
.attr('fill', palette.text)
|
|
292
|
-
.attr('font-size',
|
|
293
|
-
.attr('font-weight',
|
|
292
|
+
.attr('font-size', TITLE_FONT_SIZE)
|
|
293
|
+
.attr('font-weight', TITLE_FONT_WEIGHT)
|
|
294
294
|
.style('cursor', onClickItem && parsed.titleLineNumber ? 'pointer' : 'default')
|
|
295
295
|
.text(parsed.title);
|
|
296
296
|
|
|
@@ -313,7 +313,7 @@ export function renderClassDiagram(
|
|
|
313
313
|
? mix(palette.surface, palette.bg, 50)
|
|
314
314
|
: mix(palette.surface, palette.bg, 30);
|
|
315
315
|
|
|
316
|
-
const pillWidth = LEGEND_GROUP_NAME
|
|
316
|
+
const pillWidth = measureLegendText(LEGEND_GROUP_NAME, LEGEND_PILL_FONT_SIZE) + LEGEND_PILL_PAD;
|
|
317
317
|
const pillH = LEGEND_HEIGHT - LEGEND_CAPSULE_PAD * 2;
|
|
318
318
|
const entriesW = legendEntriesWidth(legendEntries);
|
|
319
319
|
|
|
@@ -391,7 +391,7 @@ export function renderClassDiagram(
|
|
|
391
391
|
.attr('font-family', FONT_FAMILY)
|
|
392
392
|
.text(entry.label);
|
|
393
393
|
|
|
394
|
-
entryX += LEGEND_DOT_R * 2 + LEGEND_ENTRY_DOT_GAP + entry.label
|
|
394
|
+
entryX += LEGEND_DOT_R * 2 + LEGEND_ENTRY_DOT_GAP + measureLegendText(entry.label, LEGEND_ENTRY_FONT_SIZE) + LEGEND_ENTRY_TRAIL;
|
|
395
395
|
}
|
|
396
396
|
} else {
|
|
397
397
|
// Collapsed: single muted pill
|
package/src/cli.ts
CHANGED
|
@@ -158,7 +158,7 @@ Key options:
|
|
|
158
158
|
- \`--theme <theme>\` — \`light\` (default), \`dark\`, \`transparent\`
|
|
159
159
|
- \`--palette <name>\` — \`nord\` (default), \`solarized\`, \`catppuccin\`, \`rose-pine\`, \`gruvbox\`, \`tokyo-night\`, \`one-dark\`, \`bold\`
|
|
160
160
|
- \`--copy\` — copy the URL to clipboard (use with \`-o url\`)
|
|
161
|
-
- \`--
|
|
161
|
+
- \`--branding\` — add diagrammo.app branding to exports
|
|
162
162
|
- \`--chart-types\` — list all supported chart types
|
|
163
163
|
|
|
164
164
|
## Supported Chart Types
|
|
@@ -503,7 +503,7 @@ Options:
|
|
|
503
503
|
--c4-system <name> System to drill into (with --c4-level containers or components)
|
|
504
504
|
--c4-container <name> Container to drill into (with --c4-level components)
|
|
505
505
|
--tag-group <name> Pre-select a tag group for static export coloring
|
|
506
|
-
--
|
|
506
|
+
--branding Add diagrammo.app branding to exports
|
|
507
507
|
--copy Copy URL to clipboard (only with -o url)
|
|
508
508
|
--json Output structured JSON to stdout
|
|
509
509
|
--chart-types List all supported chart types
|
|
@@ -533,7 +533,7 @@ function parseArgs(argv: string[]): {
|
|
|
533
533
|
palette: string;
|
|
534
534
|
help: boolean;
|
|
535
535
|
version: boolean;
|
|
536
|
-
|
|
536
|
+
branding: boolean;
|
|
537
537
|
copy: boolean;
|
|
538
538
|
json: boolean;
|
|
539
539
|
chartTypes: boolean;
|
|
@@ -552,7 +552,7 @@ function parseArgs(argv: string[]): {
|
|
|
552
552
|
palette: 'nord',
|
|
553
553
|
help: false,
|
|
554
554
|
version: false,
|
|
555
|
-
|
|
555
|
+
branding: false,
|
|
556
556
|
copy: false,
|
|
557
557
|
json: false,
|
|
558
558
|
chartTypes: false,
|
|
@@ -619,8 +619,8 @@ function parseArgs(argv: string[]): {
|
|
|
619
619
|
} else if (arg === '--tag-group') {
|
|
620
620
|
result.tagGroup = args[++i];
|
|
621
621
|
i++;
|
|
622
|
-
} else if (arg === '--
|
|
623
|
-
result.
|
|
622
|
+
} else if (arg === '--branding') {
|
|
623
|
+
result.branding = true;
|
|
624
624
|
i++;
|
|
625
625
|
} else if (arg === '--json') {
|
|
626
626
|
result.json = true;
|
|
@@ -985,7 +985,7 @@ async function main(): Promise<void> {
|
|
|
985
985
|
// eslint-disable-next-line no-control-regex
|
|
986
986
|
content = content.replace(/\x1b\[[0-9;]*m/g, '');
|
|
987
987
|
|
|
988
|
-
// Resolve org chart imports (tags
|
|
988
|
+
// Resolve org chart imports (tags and import directives)
|
|
989
989
|
if (opts.input && parseDgmoChartType(content) === 'org') {
|
|
990
990
|
const inputPath = resolve(opts.input);
|
|
991
991
|
const resolved = await resolveOrgImports(
|
|
@@ -1115,7 +1115,7 @@ async function main(): Promise<void> {
|
|
|
1115
1115
|
const svg = await render(content, {
|
|
1116
1116
|
theme: opts.theme,
|
|
1117
1117
|
palette: opts.palette,
|
|
1118
|
-
branding:
|
|
1118
|
+
branding: opts.branding,
|
|
1119
1119
|
c4Level: opts.c4Level,
|
|
1120
1120
|
c4System: opts.c4System,
|
|
1121
1121
|
c4Container: opts.c4Container,
|
package/src/colors.ts
CHANGED
|
@@ -49,7 +49,10 @@ export const colorNames: Record<string, string> = {
|
|
|
49
49
|
export function resolveColor(
|
|
50
50
|
color: string,
|
|
51
51
|
palette?: { colors: Record<string, string> }
|
|
52
|
-
): string {
|
|
52
|
+
): string | null {
|
|
53
|
+
// Reject hex color codes — only named colors are supported
|
|
54
|
+
if (color.startsWith('#')) return null;
|
|
55
|
+
|
|
53
56
|
const lower = color.toLowerCase();
|
|
54
57
|
|
|
55
58
|
if (palette) {
|