@diagrammo/dgmo 0.25.4 → 0.26.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.
Files changed (57) hide show
  1. package/dist/advanced.cjs +62564 -0
  2. package/dist/advanced.d.cts +5702 -0
  3. package/dist/advanced.d.ts +5702 -0
  4. package/dist/advanced.js +62315 -0
  5. package/dist/auto.cjs +59851 -0
  6. package/dist/auto.css +214 -0
  7. package/dist/auto.d.cts +39 -0
  8. package/dist/auto.d.ts +39 -0
  9. package/dist/auto.js +437 -0
  10. package/dist/auto.mjs +59861 -0
  11. package/dist/cli.cjs +465 -0
  12. package/dist/editor.cjs +432 -0
  13. package/dist/editor.d.cts +26 -0
  14. package/dist/editor.d.ts +26 -0
  15. package/dist/editor.js +401 -0
  16. package/dist/highlight.cjs +720 -0
  17. package/dist/highlight.d.cts +32 -0
  18. package/dist/highlight.d.ts +32 -0
  19. package/dist/highlight.js +690 -0
  20. package/dist/index.cjs +59037 -0
  21. package/dist/index.d.cts +375 -0
  22. package/dist/index.d.ts +375 -0
  23. package/dist/index.js +59041 -0
  24. package/dist/internal.cjs +62566 -0
  25. package/dist/internal.d.cts +5702 -0
  26. package/dist/internal.d.ts +5702 -0
  27. package/dist/internal.js +62315 -0
  28. package/dist/map-data/PROVENANCE.json +1 -0
  29. package/dist/map-data/gazetteer.json +1 -0
  30. package/dist/map-data/lakes.json +1 -0
  31. package/dist/map-data/mountain-ranges.json +1 -0
  32. package/dist/map-data/na-lakes.json +1 -0
  33. package/dist/map-data/na-land.json +1 -0
  34. package/dist/map-data/region-names.json +1 -0
  35. package/dist/map-data/rivers.json +1 -0
  36. package/dist/map-data/us-states.json +1 -0
  37. package/dist/map-data/water-bodies.json +1 -0
  38. package/dist/map-data/world-coarse.json +1 -0
  39. package/dist/map-data/world-detail.json +1 -0
  40. package/dist/pert.cjs +325 -0
  41. package/dist/pert.d.cts +554 -0
  42. package/dist/pert.d.ts +554 -0
  43. package/dist/pert.js +294 -0
  44. package/package.json +1 -1
  45. package/src/advanced.ts +2 -0
  46. package/src/class/parser.ts +0 -1
  47. package/src/completion-types.ts +0 -1
  48. package/src/completion.ts +80 -39
  49. package/src/editor/dgmo.grammar.js +18 -0
  50. package/src/editor/dgmo.grammar.terms.js +35 -0
  51. package/src/er/parser.ts +0 -1
  52. package/src/graph/flowchart-parser.ts +1 -1
  53. package/src/graph/flowchart-renderer.ts +19 -5
  54. package/src/graph/state-renderer.ts +19 -5
  55. package/src/infra/parser.ts +1 -1
  56. package/src/pert/parser.ts +0 -14
  57. package/src/raci/renderer.ts +8 -2
@@ -476,10 +476,24 @@ export function renderFlowchart(
476
476
 
477
477
  const diagramW = layout.width;
478
478
  const diagramH = layout.height;
479
- const availH = height - titleHeight;
480
479
  const scaleX = (width - sDiagramPadding * 2) / diagramW;
481
- const scaleY = (availH - sDiagramPadding * 2) / diagramH;
482
- const scale = Math.min(MAX_SCALE, scaleX, scaleY);
480
+
481
+ // Export renders a fixed canvas (e.g. 1200×800). Fitting a small graph into
482
+ // it and top-anchoring leaves a tall band of dead space below. In export
483
+ // mode, scale to width (capped by MAX_SCALE) and size the canvas to the
484
+ // scaled content height. The interactive preview keeps the fit-to-pane
485
+ // behaviour so a small graph still fills its pane.
486
+ let scale: number;
487
+ let canvasHeight: number;
488
+ if (exportDims) {
489
+ scale = Math.min(MAX_SCALE, scaleX);
490
+ canvasHeight = titleHeight + diagramH * scale + sDiagramPadding * 2;
491
+ } else {
492
+ const availH = height - titleHeight;
493
+ const scaleY = (availH - sDiagramPadding * 2) / diagramH;
494
+ scale = Math.min(MAX_SCALE, scaleX, scaleY);
495
+ canvasHeight = height;
496
+ }
483
497
 
484
498
  const scaledW = diagramW * scale;
485
499
  const offsetX = (width - scaledW) / 2;
@@ -489,8 +503,8 @@ export function renderFlowchart(
489
503
  .select(container)
490
504
  .append('svg')
491
505
  .attr('width', width)
492
- .attr('height', height)
493
- .attr('viewBox', `0 0 ${width} ${height}`)
506
+ .attr('height', canvasHeight)
507
+ .attr('viewBox', `0 0 ${width} ${canvasHeight}`)
494
508
  .attr('preserveAspectRatio', 'xMidYMin meet')
495
509
  .style('font-family', FONT_FAMILY);
496
510
 
@@ -130,10 +130,24 @@ export function renderState(
130
130
 
131
131
  const diagramW = layout.width;
132
132
  const diagramH = layout.height;
133
- const availH = height - titleHeight;
134
133
  const scaleX = (width - sDiagramPadding * 2) / diagramW;
135
- const scaleY = (availH - sDiagramPadding * 2) / diagramH;
136
- const scale = Math.min(MAX_SCALE, scaleX, scaleY);
134
+
135
+ // Export renders a fixed canvas (e.g. 1200×800). Fitting a small graph into
136
+ // it and top-anchoring leaves a tall band of dead space below. In export
137
+ // mode, scale to width (capped by MAX_SCALE) and size the canvas to the
138
+ // scaled content height. The interactive preview keeps the fit-to-pane
139
+ // behaviour so a small graph still fills its pane.
140
+ let scale: number;
141
+ let canvasHeight: number;
142
+ if (exportDims) {
143
+ scale = Math.min(MAX_SCALE, scaleX);
144
+ canvasHeight = titleHeight + diagramH * scale + sDiagramPadding * 2;
145
+ } else {
146
+ const availH = height - titleHeight;
147
+ const scaleY = (availH - sDiagramPadding * 2) / diagramH;
148
+ scale = Math.min(MAX_SCALE, scaleX, scaleY);
149
+ canvasHeight = height;
150
+ }
137
151
 
138
152
  const scaledW = diagramW * scale;
139
153
  const offsetX = (width - scaledW) / 2;
@@ -143,8 +157,8 @@ export function renderState(
143
157
  .select(container)
144
158
  .append('svg')
145
159
  .attr('width', width)
146
- .attr('height', height)
147
- .attr('viewBox', `0 0 ${width} ${height}`)
160
+ .attr('height', canvasHeight)
161
+ .attr('viewBox', `0 0 ${width} ${canvasHeight}`)
148
162
  .attr('preserveAspectRatio', 'xMidYMin meet')
149
163
  .style('font-family', FONT_FAMILY);
150
164
 
@@ -1159,5 +1159,5 @@ export function extractSymbols(docText: string): DiagramSymbols {
1159
1159
  }
1160
1160
  }
1161
1161
  }
1162
- return { kind: 'infra', entities, keywords: [] };
1162
+ return { kind: 'infra', entities };
1163
1163
  }
@@ -1639,20 +1639,6 @@ export function extractPertSymbols(docText: string): DiagramSymbols {
1639
1639
  return {
1640
1640
  kind: 'pert',
1641
1641
  entities,
1642
- keywords: [
1643
- 'time-unit',
1644
- 'default-confidence',
1645
- 'direction',
1646
- 'node-detail',
1647
- 'trials',
1648
- 'seed',
1649
- 'scrubber-trials',
1650
- 'start-date',
1651
- 'end-date',
1652
- 'active-tag',
1653
- 'tag',
1654
- 'as',
1655
- ],
1656
1642
  };
1657
1643
  }
1658
1644
 
@@ -515,6 +515,12 @@ export function renderRaci(
515
515
  const colBottomY = cursorY + sColumnBottomPad;
516
516
  const totalHeight = colBottomY + sVMargin;
517
517
 
518
+ // Export renders a fixed canvas (e.g. 1200×800); a short matrix would
519
+ // otherwise reserve a tall band of dead space below the last row. Size the
520
+ // export canvas to the content height. The interactive preview keeps the
521
+ // `max(pane, content)` behaviour so a short matrix still fills the pane.
522
+ const svgHeight = exportDims ? totalHeight : Math.max(height, totalHeight);
523
+
518
524
  // ── SVG root ───────────────────────────────────────────────
519
525
 
520
526
  const svg = d3Selection
@@ -522,8 +528,8 @@ export function renderRaci(
522
528
  .append('svg')
523
529
  .attr('xmlns', 'http://www.w3.org/2000/svg')
524
530
  .attr('width', width)
525
- .attr('height', Math.max(height, totalHeight))
526
- .attr('viewBox', `0 0 ${width} ${Math.max(height, totalHeight)}`)
531
+ .attr('height', svgHeight)
532
+ .attr('viewBox', `0 0 ${width} ${svgHeight}`)
527
533
  .attr('preserveAspectRatio', 'xMidYMin meet')
528
534
  .attr('font-family', FONT_FAMILY)
529
535
  .style('background', 'transparent');