@diagrammo/dgmo 0.8.19 → 0.8.21

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 (74) hide show
  1. package/dist/cli.cjs +92 -131
  2. package/dist/editor.cjs +13 -1
  3. package/dist/editor.cjs.map +1 -1
  4. package/dist/editor.js +13 -1
  5. package/dist/editor.js.map +1 -1
  6. package/dist/highlight.cjs +13 -1
  7. package/dist/highlight.cjs.map +1 -1
  8. package/dist/highlight.js +13 -1
  9. package/dist/highlight.js.map +1 -1
  10. package/dist/index.cjs +4524 -1511
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +427 -186
  13. package/dist/index.d.ts +427 -186
  14. package/dist/index.js +4526 -1503
  15. package/dist/index.js.map +1 -1
  16. package/docs/guide/chart-mindmap.md +198 -0
  17. package/docs/guide/chart-sequence.md +23 -1
  18. package/docs/guide/chart-wireframe.md +100 -0
  19. package/docs/guide/index.md +8 -0
  20. package/docs/language-reference.md +210 -2
  21. package/package.json +22 -9
  22. package/src/boxes-and-lines/collapse.ts +21 -3
  23. package/src/boxes-and-lines/layout.ts +51 -9
  24. package/src/boxes-and-lines/parser.ts +16 -4
  25. package/src/boxes-and-lines/renderer.ts +121 -23
  26. package/src/boxes-and-lines/types.ts +1 -0
  27. package/src/c4/parser.ts +8 -7
  28. package/src/class/parser.ts +6 -0
  29. package/src/cli.ts +1 -9
  30. package/src/completion.ts +26 -0
  31. package/src/d3.ts +169 -266
  32. package/src/dgmo-router.ts +103 -5
  33. package/src/diagnostics.ts +16 -6
  34. package/src/echarts.ts +43 -10
  35. package/src/editor/keywords.ts +12 -0
  36. package/src/er/parser.ts +22 -2
  37. package/src/gantt/renderer.ts +2 -2
  38. package/src/graph/flowchart-parser.ts +89 -52
  39. package/src/graph/layout.ts +73 -9
  40. package/src/graph/state-collapse.ts +78 -0
  41. package/src/graph/state-parser.ts +60 -35
  42. package/src/graph/state-renderer.ts +139 -34
  43. package/src/index.ts +41 -16
  44. package/src/infra/parser.ts +9 -2
  45. package/src/kanban/renderer.ts +305 -59
  46. package/src/mindmap/collapse.ts +88 -0
  47. package/src/mindmap/layout.ts +605 -0
  48. package/src/mindmap/parser.ts +379 -0
  49. package/src/mindmap/renderer.ts +543 -0
  50. package/src/mindmap/text-wrap.ts +207 -0
  51. package/src/mindmap/types.ts +55 -0
  52. package/src/palettes/color-utils.ts +4 -12
  53. package/src/palettes/index.ts +0 -4
  54. package/src/render.ts +31 -20
  55. package/src/sequence/parser.ts +7 -2
  56. package/src/sequence/renderer.ts +141 -21
  57. package/src/sharing.ts +2 -0
  58. package/src/sitemap/layout.ts +35 -12
  59. package/src/sitemap/renderer.ts +1 -6
  60. package/src/utils/arrows.ts +180 -11
  61. package/src/utils/d3-types.ts +4 -0
  62. package/src/utils/export-container.ts +3 -2
  63. package/src/utils/legend-constants.ts +0 -4
  64. package/src/utils/legend-d3.ts +1 -0
  65. package/src/utils/legend-layout.ts +2 -2
  66. package/src/utils/parsing.ts +2 -0
  67. package/src/utils/time-ticks.ts +213 -0
  68. package/src/wireframe/layout.ts +460 -0
  69. package/src/wireframe/parser.ts +956 -0
  70. package/src/wireframe/renderer.ts +1293 -0
  71. package/src/wireframe/types.ts +110 -0
  72. package/src/branding.ts +0 -67
  73. package/src/dgmo-mermaid.ts +0 -262
  74. package/src/palettes/mermaid-bridge.ts +0 -220
package/src/index.ts CHANGED
@@ -5,6 +5,18 @@
5
5
  export { makeDgmoError, formatDgmoError } from './diagnostics';
6
6
  export type { DgmoError, DgmoSeverity } from './diagnostics';
7
7
 
8
+ // ============================================================
9
+ // Arrow helpers (in-arrow label validation)
10
+ // ============================================================
11
+
12
+ export {
13
+ parseInArrowLabel,
14
+ validateLabelCharacters,
15
+ matchColorParens,
16
+ ARROW_DIAGNOSTIC_CODES,
17
+ } from './utils/arrows';
18
+ export type { ParseInArrowLabelResult } from './utils/arrows';
19
+
8
20
  // ============================================================
9
21
  // Unified API
10
22
  // ============================================================
@@ -38,9 +50,9 @@ export {
38
50
  orderArcNodes,
39
51
  parseTimelineDate,
40
52
  addDurationToDate,
41
- computeTimeTicks,
42
53
  formatDateLabel,
43
54
  } from './d3';
55
+ export { computeTimeTicks } from './utils/time-ticks';
44
56
  export type {
45
57
  ParsedVisualization,
46
58
  VisualizationType,
@@ -73,13 +85,12 @@ export {
73
85
  RULE_COUNT,
74
86
  } from './sequence/participant-inference';
75
87
 
76
- export { parseQuadrant } from './dgmo-mermaid';
77
- export type { ParsedQuadrant } from './dgmo-mermaid';
78
-
79
88
  export { parseFlowchart, looksLikeFlowchart } from './graph/flowchart-parser';
80
89
 
81
90
  export { parseState, looksLikeState } from './graph/state-parser';
82
91
  export { renderState, renderStateForExport } from './graph/state-renderer';
92
+ export { collapseStateGroups } from './graph/state-collapse';
93
+ export type { StateCollapseResult } from './graph/state-collapse';
83
94
 
84
95
  export { parseClassDiagram, looksLikeClassDiagram } from './class/parser';
85
96
 
@@ -323,6 +334,30 @@ export type {
323
334
  export { collapseOrgTree } from './org/collapse';
324
335
  export type { CollapsedOrgResult } from './org/collapse';
325
336
 
337
+ export { parseMindmap } from './mindmap/parser';
338
+ export type {
339
+ MindmapNode,
340
+ ParsedMindmap,
341
+ MindmapLayoutNode,
342
+ MindmapLayoutEdge,
343
+ MindmapLayoutResult,
344
+ } from './mindmap/types';
345
+ export { layoutMindmap } from './mindmap/layout';
346
+ export { renderMindmap, renderMindmapForExport } from './mindmap/renderer';
347
+ export { collapseMindmapTree } from './mindmap/collapse';
348
+ export type { CollapsedMindmapResult } from './mindmap/collapse';
349
+
350
+ export { parseWireframe } from './wireframe/parser';
351
+ export type {
352
+ ParsedWireframe,
353
+ WireframeElement,
354
+ WireframeElementType,
355
+ WireframeFormFactor,
356
+ } from './wireframe/types';
357
+ export { layoutWireframe } from './wireframe/layout';
358
+ export type { WireframeLayout, WireframeLayoutNode } from './wireframe/layout';
359
+ export { renderWireframe } from './wireframe/renderer';
360
+
326
361
  export { resolveOrgImports } from './org/resolver';
327
362
  export type {
328
363
  ReadFileFn,
@@ -336,6 +371,7 @@ export type {
336
371
  LayoutNode,
337
372
  LayoutEdge,
338
373
  LayoutGroup,
374
+ LayoutOptions,
339
375
  } from './graph/layout';
340
376
 
341
377
  export {
@@ -378,8 +414,6 @@ export type {
378
414
  LegendHandle,
379
415
  LegendPalette,
380
416
  } from './utils/legend-types';
381
- export { buildMermaidQuadrant } from './dgmo-mermaid';
382
-
383
417
  // ============================================================
384
418
  // Renderers (produce SVG output)
385
419
  // ============================================================
@@ -437,7 +471,6 @@ export {
437
471
  hexToHSL,
438
472
  hslToHex,
439
473
  hexToHSLString,
440
- mute,
441
474
  tint,
442
475
  shade,
443
476
  getSeriesColors,
@@ -453,12 +486,10 @@ export {
453
486
  boldPalette,
454
487
  draculaPalette,
455
488
  monokaiPalette,
456
- // Mermaid bridge
457
- buildMermaidThemeVars,
458
- buildThemeCSS,
459
489
  } from './palettes';
460
490
 
461
491
  export type { PaletteConfig, PaletteColors } from './palettes';
492
+ export { mix } from './palettes/color-utils';
462
493
 
463
494
  // ============================================================
464
495
  // Sharing (URL encoding/decoding)
@@ -500,9 +531,3 @@ export type {
500
531
  } from './completion';
501
532
 
502
533
  export { parseFirstLine, ALL_CHART_TYPES } from './utils/parsing';
503
-
504
- // ============================================================
505
- // Branding
506
- // ============================================================
507
-
508
- export { injectBranding } from './branding';
@@ -8,6 +8,7 @@
8
8
 
9
9
  import { makeDgmoError, formatDgmoError, suggest } from '../diagnostics';
10
10
  import { resolveColorWithDiagnostic } from '../colors';
11
+ import { parseInArrowLabel } from '../utils/arrows';
11
12
  import {
12
13
  measureIndent,
13
14
  parseFirstLine,
@@ -477,7 +478,10 @@ export function parseInfra(content: string): ParsedInfra {
477
478
  // Async labeled connection: ~label~> Target
478
479
  const asyncConnMatch = trimmed.match(ASYNC_CONNECTION_RE);
479
480
  if (asyncConnMatch) {
480
- const label = asyncConnMatch[1]?.trim() || '';
481
+ const rawLabel = asyncConnMatch[1] ?? '';
482
+ const labelResult = parseInArrowLabel(rawLabel, lineNumber);
483
+ result.diagnostics.push(...labelResult.diagnostics);
484
+ const label = labelResult.label ?? '';
481
485
  const targetRaw = asyncConnMatch[2].trim();
482
486
  const pipeMeta = extractPipeMetadata(targetRaw);
483
487
  const targetName = pipeMeta.clean || targetRaw;
@@ -551,7 +555,10 @@ export function parseInfra(content: string): ParsedInfra {
551
555
  // Labeled connection: -label-> Target | split: N%, fanout: 3
552
556
  const connMatch = trimmed.match(CONNECTION_RE);
553
557
  if (connMatch) {
554
- const label = connMatch[1]?.trim() || '';
558
+ const rawLabel = connMatch[1] ?? '';
559
+ const labelResult = parseInArrowLabel(rawLabel, lineNumber);
560
+ result.diagnostics.push(...labelResult.diagnostics);
561
+ const label = labelResult.label ?? '';
555
562
  const targetRaw = connMatch[2].trim();
556
563
  const pipeMeta = extractPipeMetadata(targetRaw);
557
564
  const targetName = pipeMeta.clean || targetRaw;