@diagrammo/dgmo 0.14.1 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +14 -1
  2. package/dist/advanced.cjs +53069 -0
  3. package/dist/advanced.d.cts +4691 -0
  4. package/dist/advanced.d.ts +4691 -0
  5. package/dist/advanced.js +52823 -0
  6. package/dist/auto.cjs +1557 -1295
  7. package/dist/auto.js +132 -713
  8. package/dist/auto.mjs +1553 -1291
  9. package/dist/cli.cjs +173 -150
  10. package/dist/editor.cjs +1 -0
  11. package/dist/editor.js +1 -0
  12. package/dist/highlight.cjs +1 -0
  13. package/dist/highlight.js +1 -0
  14. package/dist/index.cjs +2031 -4722
  15. package/dist/index.d.cts +96 -4464
  16. package/dist/index.d.ts +96 -4464
  17. package/dist/index.js +2024 -4475
  18. package/dist/internal.cjs +51930 -553
  19. package/dist/internal.d.cts +4526 -102
  20. package/dist/internal.d.ts +4526 -102
  21. package/dist/internal.js +51721 -548
  22. package/dist/pert.cjs +1 -1
  23. package/dist/pert.js +1 -1
  24. package/docs/language-reference.md +67 -17
  25. package/package.json +18 -3
  26. package/src/advanced.ts +731 -0
  27. package/src/auto/index.ts +14 -13
  28. package/src/boxes-and-lines/layout.ts +481 -445
  29. package/src/c4/parser.ts +7 -7
  30. package/src/chart-types.ts +0 -5
  31. package/src/class/parser.ts +1 -9
  32. package/src/cli.ts +9 -7
  33. package/src/completion-types.ts +28 -0
  34. package/src/completion.ts +15 -18
  35. package/src/cycle/layout.ts +2 -2
  36. package/src/d3.ts +1455 -1122
  37. package/src/echarts.ts +11 -11
  38. package/src/editor/keywords.ts +1 -0
  39. package/src/er/parser.ts +1 -9
  40. package/src/er/renderer.ts +1 -1
  41. package/src/gantt/calculator.ts +1 -11
  42. package/src/gantt/parser.ts +16 -16
  43. package/src/gantt/renderer.ts +2 -2
  44. package/src/graph/flowchart-parser.ts +1 -1
  45. package/src/graph/flowchart-renderer.ts +1 -1
  46. package/src/graph/state-renderer.ts +1 -1
  47. package/src/index.ts +213 -690
  48. package/src/infra/parser.ts +57 -25
  49. package/src/infra/renderer.ts +2 -2
  50. package/src/internal.ts +11 -17
  51. package/src/kanban/parser.ts +2 -2
  52. package/src/mindmap/layout.ts +1 -1
  53. package/src/mindmap/parser.ts +1 -1
  54. package/src/org/parser.ts +1 -1
  55. package/src/org/renderer.ts +1 -1
  56. package/src/palettes/index.ts +39 -0
  57. package/src/pert/layout.ts +1 -1
  58. package/src/pert/monte-carlo.ts +2 -2
  59. package/src/pert/parser.ts +3 -3
  60. package/src/raci/parser.ts +4 -4
  61. package/src/raci/renderer.ts +1 -1
  62. package/src/render.ts +17 -1
  63. package/src/sequence/renderer.ts +1 -4
  64. package/src/sitemap/parser.ts +1 -1
  65. package/src/tech-radar/interactive.ts +1 -1
  66. package/src/tech-radar/renderer.ts +1 -1
  67. package/src/themes.ts +22 -0
  68. package/src/utils/tag-groups.ts +11 -12
  69. package/src/wireframe/layout.ts +11 -7
  70. package/src/wireframe/parser.ts +2 -2
  71. package/src/wireframe/renderer.ts +5 -2
package/src/c4/parser.ts CHANGED
@@ -421,7 +421,7 @@ export function parseC4(content: string, palette?: PaletteColors): ParsedC4 {
421
421
  );
422
422
  const shape = inferC4Shape(
423
423
  nodeName,
424
- metadata.tech ?? metadata.technology
424
+ metadata['tech'] ?? metadata['technology']
425
425
  );
426
426
 
427
427
  const dNode: C4DeploymentNode = {
@@ -555,11 +555,11 @@ export function parseC4(content: string, palette?: PaletteColors): ParsedC4 {
555
555
  // parsePipeMetadata expects segments split by |; first segment is pre-pipe
556
556
  const meta = parsePipeMetadata(['', metaPart], metaAliasMap);
557
557
  // tech/technology on pipe overrides [tech] in label
558
- if (meta.tech) {
559
- technology = meta.tech;
558
+ if (meta['tech']) {
559
+ technology = meta['tech'];
560
560
  }
561
- if (meta.technology) {
562
- technology = meta.technology;
561
+ if (meta['technology']) {
562
+ technology = meta['technology'];
563
563
  }
564
564
  }
565
565
 
@@ -729,7 +729,7 @@ export function parseC4(content: string, palette?: PaletteColors): ParsedC4 {
729
729
 
730
730
  const shape =
731
731
  explicitShape ??
732
- inferC4Shape(namePart, metadata.tech ?? metadata.technology);
732
+ inferC4Shape(namePart, metadata['tech'] ?? metadata['technology']);
733
733
 
734
734
  // Extract description from pipe metadata into dedicated field
735
735
  let isADescription: string[] | undefined;
@@ -806,7 +806,7 @@ export function parseC4(content: string, palette?: PaletteColors): ParsedC4 {
806
806
  // Determine shape: explicit > inference
807
807
  const shape =
808
808
  explicitShape ??
809
- inferC4Shape(namePart, metadata.tech ?? metadata.technology);
809
+ inferC4Shape(namePart, metadata['tech'] ?? metadata['technology']);
810
810
 
811
811
  // Extract description from pipe metadata into dedicated field
812
812
  let prefixDescription: string[] | undefined;
@@ -490,8 +490,3 @@ export const chartTypes: readonly ChartTypeMeta[] = [
490
490
  fallback: true,
491
491
  },
492
492
  ] as const;
493
-
494
- // Chart-type ids currently flagged as beta. Renderers/UIs use this set to
495
- // surface a "β BETA" badge next to titles, nav entries, and template tiles.
496
- // Promote/demote by editing this set + the corresponding registry titles.
497
- export const BETA_CHART_IDS: ReadonlySet<string> = new Set(['c4', 'venn']);
@@ -184,14 +184,6 @@ export function parseClassDiagram(
184
184
  error: null,
185
185
  };
186
186
 
187
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
188
- const _fail = (line: number, message: string): ParsedClassDiagram => {
189
- const diag = makeDgmoError(line, message);
190
- result.diagnostics.push(diag);
191
- result.error = formatDgmoError(diag);
192
- return result;
193
- };
194
-
195
187
  const classMap = new Map<string, ClassNode>();
196
188
 
197
189
  // Per-parse alias literal → canonical class id (TD-18). Per C8.
@@ -548,7 +540,7 @@ export function looksLikeClassDiagram(content: string): boolean {
548
540
  // Symbol extraction (for completion API)
549
541
  // ============================================================
550
542
 
551
- import type { DiagramSymbols } from '../completion';
543
+ import type { DiagramSymbols } from '../completion-types';
552
544
 
553
545
  /**
554
546
  * Extract class names (entities) from class diagram document text.
package/src/cli.ts CHANGED
@@ -705,7 +705,9 @@ async function main(): Promise<void> {
705
705
 
706
706
  if (opts.cat) {
707
707
  const useColor =
708
- !opts.noColor && !process.env.NO_COLOR && process.stdout.isTTY === true;
708
+ !opts.noColor &&
709
+ !process.env['NO_COLOR'] &&
710
+ process.stdout.isTTY === true;
709
711
 
710
712
  let catContent: string;
711
713
  if (opts.input && opts.input !== '-') {
@@ -822,9 +824,9 @@ async function main(): Promise<void> {
822
824
  }
823
825
  }
824
826
  const mcpServers =
825
- (settings.mcpServers as Record<string, unknown> | undefined) ?? {};
827
+ (settings['mcpServers'] as Record<string, unknown> | undefined) ?? {};
826
828
  mcpServers['dgmo'] = mcpEntry;
827
- settings.mcpServers = mcpServers;
829
+ settings['mcpServers'] = mcpServers;
828
830
  writeFileSync(
829
831
  settingsPath,
830
832
  JSON.stringify(settings, null, 2) + '\n',
@@ -842,9 +844,9 @@ async function main(): Promise<void> {
842
844
  }
843
845
  }
844
846
  const mcpServers =
845
- (mcp.mcpServers as Record<string, unknown> | undefined) ?? {};
847
+ (mcp['mcpServers'] as Record<string, unknown> | undefined) ?? {};
846
848
  mcpServers['dgmo'] = mcpEntry;
847
- mcp.mcpServers = mcpServers;
849
+ mcp['mcpServers'] = mcpServers;
848
850
  writeFileSync(mcpPath, JSON.stringify(mcp, null, 2) + '\n', 'utf-8');
849
851
  console.log(
850
852
  `✓ MCP server configured: ${join(process.cwd(), '.mcp.json')}`
@@ -1118,7 +1120,7 @@ async function main(): Promise<void> {
1118
1120
  );
1119
1121
  } else if (os === 'win32') {
1120
1122
  const appData =
1121
- process.env.APPDATA ?? join(homedir(), 'AppData', 'Roaming');
1123
+ process.env['APPDATA'] ?? join(homedir(), 'AppData', 'Roaming');
1122
1124
  configPath = join(appData, 'Claude', 'claude_desktop_config.json');
1123
1125
  } else {
1124
1126
  configPath = join(
@@ -1154,7 +1156,7 @@ async function main(): Promise<void> {
1154
1156
  }
1155
1157
  }
1156
1158
 
1157
- const existingDgmo = config.mcpServers?.dgmo;
1159
+ const existingDgmo = config.mcpServers?.['dgmo'];
1158
1160
  if (existingDgmo && existingDgmo.command === 'dgmo-mcp') {
1159
1161
  console.log(`✓ dgmo MCP server already configured in ${configPath}`);
1160
1162
  } else {
@@ -0,0 +1,28 @@
1
+ // ============================================================
2
+ // Completion / symbol-extraction shared types
3
+ // ============================================================
4
+ //
5
+ // Lives in its own leaf module so chart-type parsers (Class, ER,
6
+ // Flowchart, Infra, Pert) can `import type { DiagramSymbols }` here
7
+ // without depending on completion.ts — which itself imports those
8
+ // parsers' extractSymbols() functions, producing a cycle hub.
9
+ //
10
+ // Keep this file dependency-free.
11
+
12
+ // ChartType is just a string — alias for documentation clarity.
13
+ export type ChartType = string;
14
+
15
+ export interface DiagramSymbols {
16
+ kind: ChartType;
17
+ entities: string[]; // table names, node IDs, class names, etc.
18
+ keywords: string[]; // diagram-specific reserved words
19
+ /**
20
+ * Map of alias-literal → canonical entity name, collected from
21
+ * `Name as <alias>` declarations in the document. Editor surfaces
22
+ * both forms in autocomplete; selecting an alias inserts the alias
23
+ * literal (the alias is input convenience, not a display name).
24
+ */
25
+ aliases?: Record<string, string>;
26
+ }
27
+
28
+ export type ExtractFn = (docText: string) => DiagramSymbols;
package/src/completion.ts CHANGED
@@ -17,29 +17,22 @@ import { extractSymbols as extractInfraSymbols } from './infra/parser';
17
17
  import { extractSymbols as extractClassSymbols } from './class/parser';
18
18
  import { extractPertSymbols } from './pert/parser';
19
19
  import { parseFirstLine, ALL_CHART_TYPES } from './utils/parsing';
20
- import { CHART_TYPE_DESCRIPTIONS } from './dgmo-router';
20
+ // Read chart-type descriptions directly from the source-of-truth data
21
+ // module instead of via dgmo-router.ts. dgmo-router imports every
22
+ // parser, and the parsers (Class/ER/Infra/Pert/Flowchart) type-only
23
+ // import DiagramSymbols back from this file — creating a hub of cycles
24
+ // through completion ↔ dgmo-router. Going through chart-types.ts (a
25
+ // leaf module with zero imports) breaks 7 of the 10 known cycles.
26
+ import { chartTypes } from './chart-types';
21
27
 
22
28
  // ============================================================
23
29
  // Symbol extraction
24
30
  // ============================================================
25
31
 
26
- // ChartType is just a string alias here for documentation clarity.
27
- export type ChartType = string;
28
-
29
- export interface DiagramSymbols {
30
- kind: ChartType;
31
- entities: string[]; // table names, node IDs, class names, etc.
32
- keywords: string[]; // diagram-specific reserved words
33
- /**
34
- * Map of alias-literal → canonical entity name, collected from
35
- * `Name as <alias>` declarations in the document. Editor surfaces
36
- * both forms in autocomplete; selecting an alias inserts the alias
37
- * literal (the alias is input convenience, not a display name).
38
- */
39
- aliases?: Record<string, string>;
40
- }
41
-
42
- export type ExtractFn = (docText: string) => DiagramSymbols;
32
+ // Types live in ./completion-types so the chart-type parsers can
33
+ // import them without taking a cycle through this file.
34
+ import type { ChartType, DiagramSymbols, ExtractFn } from './completion-types';
35
+ export type { ChartType, DiagramSymbols, ExtractFn };
43
36
 
44
37
  const extractorRegistry = new Map<ChartType, ExtractFn>();
45
38
 
@@ -575,6 +568,10 @@ for (const [type, spec] of COMPLETION_REGISTRY) {
575
568
  // ============================================================
576
569
 
577
570
  /** All chart types with descriptions, for chart type autocomplete. Excludes `multi-line` alias. */
571
+ const CHART_TYPE_DESCRIPTIONS: Record<string, string> = Object.fromEntries(
572
+ chartTypes.map((c) => [c.id, c.description])
573
+ );
574
+
578
575
  export const CHART_TYPES: ReadonlyArray<{ name: string; description: string }> =
579
576
  [...ALL_CHART_TYPES]
580
577
  .filter((t) => t !== 'multi-line')
@@ -863,8 +863,8 @@ function fitToCanvas(
863
863
  nodes: CycleLayoutNode[],
864
864
  edges: CycleLayoutEdge[],
865
865
  parsed: ParsedCycle,
866
- cx: number,
867
- cy: number,
866
+ _cx: number,
867
+ _cy: number,
868
868
  radius: number,
869
869
  width: number,
870
870
  height: number,