@diagrammo/dgmo 0.15.0 → 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 (64) 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 +1495 -1288
  7. package/dist/auto.js +132 -109
  8. package/dist/auto.mjs +1491 -1284
  9. package/dist/cli.cjs +173 -150
  10. package/dist/index.cjs +1486 -1276
  11. package/dist/index.d.cts +45 -1
  12. package/dist/index.d.ts +45 -1
  13. package/dist/index.js +1481 -1272
  14. package/dist/internal.cjs +1497 -1289
  15. package/dist/internal.d.cts +80 -79
  16. package/dist/internal.d.ts +80 -79
  17. package/dist/internal.js +1492 -1285
  18. package/dist/pert.cjs +325 -0
  19. package/dist/pert.d.cts +542 -0
  20. package/dist/pert.d.ts +542 -0
  21. package/dist/pert.js +294 -0
  22. package/package.json +28 -3
  23. package/src/advanced.ts +731 -0
  24. package/src/auto/index.ts +14 -13
  25. package/src/boxes-and-lines/layout.ts +481 -445
  26. package/src/c4/parser.ts +7 -7
  27. package/src/chart-types.ts +0 -5
  28. package/src/class/parser.ts +1 -9
  29. package/src/cli.ts +9 -7
  30. package/src/completion-types.ts +28 -0
  31. package/src/completion.ts +15 -18
  32. package/src/cycle/layout.ts +2 -2
  33. package/src/d3.ts +1455 -1122
  34. package/src/echarts.ts +11 -11
  35. package/src/er/parser.ts +1 -9
  36. package/src/er/renderer.ts +1 -1
  37. package/src/gantt/calculator.ts +1 -11
  38. package/src/gantt/parser.ts +16 -16
  39. package/src/gantt/renderer.ts +2 -2
  40. package/src/graph/flowchart-parser.ts +1 -1
  41. package/src/graph/flowchart-renderer.ts +1 -1
  42. package/src/graph/state-renderer.ts +1 -1
  43. package/src/index.ts +17 -1
  44. package/src/infra/parser.ts +19 -19
  45. package/src/infra/renderer.ts +2 -2
  46. package/src/internal.ts +9 -721
  47. package/src/kanban/parser.ts +2 -2
  48. package/src/mindmap/layout.ts +1 -1
  49. package/src/mindmap/parser.ts +1 -1
  50. package/src/org/parser.ts +1 -1
  51. package/src/org/renderer.ts +1 -1
  52. package/src/pert/layout.ts +1 -1
  53. package/src/pert/monte-carlo.ts +2 -2
  54. package/src/pert/parser.ts +3 -3
  55. package/src/raci/parser.ts +4 -4
  56. package/src/raci/renderer.ts +1 -1
  57. package/src/sequence/renderer.ts +1 -4
  58. package/src/sitemap/parser.ts +1 -1
  59. package/src/tech-radar/interactive.ts +1 -1
  60. package/src/tech-radar/renderer.ts +1 -1
  61. package/src/utils/tag-groups.ts +11 -12
  62. package/src/wireframe/layout.ts +11 -7
  63. package/src/wireframe/parser.ts +2 -2
  64. package/src/wireframe/renderer.ts +5 -2
@@ -270,8 +270,8 @@ export function parseKanban(
270
270
  parsePipeMetadata(pipeSegments, metaAliasMap)
271
271
  );
272
272
  // Extract wip from metadata
273
- if (columnMetadata.wip) {
274
- const wipVal = parseInt(columnMetadata.wip, 10);
273
+ if (columnMetadata['wip']) {
274
+ const wipVal = parseInt(columnMetadata['wip'], 10);
275
275
  if (!isNaN(wipVal)) {
276
276
  wipLimit = wipVal;
277
277
  }
@@ -64,7 +64,7 @@ interface PositionedNode {
64
64
 
65
65
  export function layoutMindmap(
66
66
  parsed: ParsedMindmap,
67
- palette: PaletteColors,
67
+ _palette: PaletteColors,
68
68
  options?: {
69
69
  interactive?: boolean;
70
70
  hiddenCounts?: Map<string, number>;
@@ -297,7 +297,7 @@ export function parseMindmap(
297
297
  function parseNodeLine(
298
298
  trimmed: string,
299
299
  lineNumber: number,
300
- palette: PaletteColors | undefined,
300
+ _palette: PaletteColors | undefined,
301
301
  counter: number,
302
302
  aliasMap: Map<string, string>,
303
303
  warnFn: (line: number, msg: string) => void
package/src/org/parser.ts CHANGED
@@ -389,7 +389,7 @@ function parseNodeLabel(
389
389
  trimmed: string,
390
390
  _indent: number,
391
391
  lineNumber: number,
392
- palette: PaletteColors | undefined,
392
+ _palette: PaletteColors | undefined,
393
393
  counter: number,
394
394
  metaAliasMap: Map<string, string> = new Map(),
395
395
  warnFn?: (line: number, msg: string) => void,
@@ -235,7 +235,7 @@ export function renderOrg(
235
235
  const rootNodeIds = new Set(parsed.roots.map((r) => r.id));
236
236
 
237
237
  // Render container backgrounds (bottom layer)
238
- const colorOff = parsed.options?.color === 'off';
238
+ const colorOff = parsed.options?.['color'] === 'off';
239
239
  for (const c of layout.containers) {
240
240
  const cG = contentG
241
241
  .append('g')
@@ -488,7 +488,7 @@ export function relayoutPert(
488
488
  function applySwimLanes(
489
489
  g: any,
490
490
  resolved: ResolvedPert,
491
- memberToGroup: Map<string, string>,
491
+ _memberToGroup: Map<string, string>,
492
492
  collapsedGroupIds: ReadonlySet<string>
493
493
  ): boolean {
494
494
  const expanded = resolved.groups.filter(
@@ -134,8 +134,8 @@ interface SimulationOptions {
134
134
  function simulate(
135
135
  resolved: ResolvedPert,
136
136
  expanded: ExpandedActivity[],
137
- predecessors: Map<string, string[]>,
138
- successors: Map<string, string[]>,
137
+ _predecessors: Map<string, string[]>,
138
+ _successors: Map<string, string[]>,
139
139
  topo: string[],
140
140
  terminals: string[],
141
141
  poisoned: Set<string>,
@@ -42,7 +42,7 @@ import type {
42
42
  DeclarationSite,
43
43
  ReferenceSite,
44
44
  } from './internal';
45
- import type { DiagramSymbols } from '../completion';
45
+ import type { DiagramSymbols } from '../completion-types';
46
46
 
47
47
  // ============================================================
48
48
  // Regexes / constants
@@ -675,7 +675,7 @@ export function parsePert(
675
675
  id,
676
676
  name,
677
677
  activityIds: [],
678
- collapsed: meta.collapsed === 'true',
678
+ collapsed: meta['collapsed'] === 'true',
679
679
  lineNumber,
680
680
  ...(Object.keys(tags).length > 0 && { tags }),
681
681
  });
@@ -1027,7 +1027,7 @@ export function parsePert(
1027
1027
  name: decl.name,
1028
1028
  ...(decl.alias !== undefined && { alias: decl.alias }),
1029
1029
  duration: estimate,
1030
- ...(meta.confidence && { confidence: meta.confidence }),
1030
+ ...(meta['confidence'] && { confidence: meta['confidence'] }),
1031
1031
  ...(decl.groupHint !== undefined && { groupId: decl.groupHint }),
1032
1032
  lineNumber: decl.lineNumber,
1033
1033
  isMilestone,
@@ -389,9 +389,9 @@ export function parseRaci(
389
389
  let roleColor: string | undefined;
390
390
  if (segments.length > 1) {
391
391
  const meta = parsePipeMetadata(segments);
392
- if (meta.color) {
392
+ if (meta['color']) {
393
393
  roleColor = resolveColorWithDiagnostic(
394
- meta.color,
394
+ meta['color'],
395
395
  j + 1,
396
396
  result.diagnostics,
397
397
  palette
@@ -473,9 +473,9 @@ export function parseRaci(
473
473
  let phaseColor: string | undefined;
474
474
  if (phaseMatch[2]) {
475
475
  const meta = parsePipeMetadata(['', phaseMatch[2]]);
476
- if (meta.color) {
476
+ if (meta['color']) {
477
477
  phaseColor = resolveColorWithDiagnostic(
478
- meta.color,
478
+ meta['color'],
479
479
  lineNumber,
480
480
  result.diagnostics,
481
481
  palette
@@ -1150,7 +1150,7 @@ function renderTaskRow(
1150
1150
  surfaceBg: string,
1151
1151
  solid: boolean,
1152
1152
  taskDiagnostics: Map<string, TaskDiagnosticBucket> | null,
1153
- hasAnyDiagnostic: boolean,
1153
+ _hasAnyDiagnostic: boolean,
1154
1154
  rowContent: RowContent | undefined,
1155
1155
  onClickLine?: (lineNumber: number) => void,
1156
1156
  _onMarkerDragStart?: (source: RaciDragSource, e: PointerEvent) => void
@@ -949,9 +949,6 @@ export function renderSequenceDiagram(
949
949
  const messages = collapsed ? collapsed.messages : parsed.messages;
950
950
  const elements = collapsed ? collapsed.elements : parsed.elements;
951
951
  const groups = collapsed ? collapsed.groups : parsed.groups;
952
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
953
- const collapsedGroupIds = collapsed?.collapsedGroupIds ?? new Map();
954
-
955
952
  const collapsedSections = options?.collapsedSections;
956
953
 
957
954
  const sourceParticipants = collapsed
@@ -1006,7 +1003,7 @@ export function renderSequenceDiagram(
1006
1003
  const charsForWidth = (maxW: number): number =>
1007
1004
  Math.floor((maxW - NOTE_PAD_H * 2 - NOTE_FOLD) / NOTE_CHAR_W);
1008
1005
 
1009
- const activationsOff = parsedOptions.activations?.toLowerCase() === 'off';
1006
+ const activationsOff = parsedOptions['activations']?.toLowerCase() === 'off';
1010
1007
 
1011
1008
  // Tag resolution — shared utility handles priority chain:
1012
1009
  // programmatic override → diagram-level active-tag → auto-activate first group
@@ -566,7 +566,7 @@ export function parseSitemap(
566
566
  function parseNodeLabel(
567
567
  trimmed: string,
568
568
  lineNumber: number,
569
- palette: PaletteColors | undefined,
569
+ _palette: PaletteColors | undefined,
570
570
  counter: number,
571
571
  metaAliasMap: Map<string, string> = new Map(),
572
572
  warnFn?: (line: number, msg: string) => void,
@@ -188,7 +188,7 @@ function renderQuarterCircle(
188
188
  width: number,
189
189
  height: number,
190
190
  mutedColor: string,
191
- tooltip: HTMLDivElement,
191
+ _tooltip: HTMLDivElement,
192
192
  rootContainer: HTMLElement,
193
193
  onClickItem?: (lineNumber: number) => void
194
194
  ): void {
@@ -920,7 +920,7 @@ import type { TechRadarBlip } from './types';
920
920
 
921
921
  function createBlipPopover(
922
922
  container: HTMLElement,
923
- palette: PaletteColors,
923
+ _palette: PaletteColors,
924
924
  isDark: boolean
925
925
  ): HTMLDivElement {
926
926
  container.style.position = 'relative';
@@ -418,25 +418,21 @@ export function injectDefaultTagMetadata(
418
418
  *
419
419
  * 1. Programmatic override (from render API / CLI flag) — highest priority
420
420
  * 2. Diagram-level `active-tag` option (from parsed source)
421
- * 3. No coloring (null) collapsed-by-default
421
+ * 3. Auto-activate first declared tag group
422
+ * 4. No coloring (null)
422
423
  *
423
424
  * The sentinel value `"none"` (case-insensitive) at any level means
424
- * "suppress tag coloring."
425
+ * "suppress tag coloring." Diagrams with tag groups render colored by
426
+ * default across every render path (CLI, export, share-link, app); use
427
+ * `active-tag none` to opt out.
425
428
  *
426
- * Note: there is no auto-activate-first-group fallback. Coloring is
427
- * opt-in: either the source carries `active-tag <name>` or the caller
428
- * (typically the app on user click) supplies a programmatic override.
429
- * Static exports therefore render the legend as a row of collapsed
430
- * pills with nodes uncolored — consistent with the app's pre-click
431
- * default.
432
- *
433
- * @param _tagGroups Declared tag groups (kept for API stability; unused since auto-activation removed)
429
+ * @param tagGroups Declared tag groups (only `.name` is used)
434
430
  * @param explicitActiveTag Value of `active-tag` option from parsed diagram, if any
435
431
  * @param programmaticOverride Value from render API / CLI; `undefined` = not set,
436
432
  * `null` or `''` = explicitly no coloring
437
433
  */
438
434
  export function resolveActiveTagGroup(
439
- _tagGroups: ReadonlyArray<{ name: string }>,
435
+ tagGroups: ReadonlyArray<{ name: string }>,
440
436
  explicitActiveTag: string | undefined,
441
437
  programmaticOverride?: string | null
442
438
  ): string | null {
@@ -453,7 +449,10 @@ export function resolveActiveTagGroup(
453
449
  return explicitActiveTag;
454
450
  }
455
451
 
456
- // 3. No explicit activation → no coloring (collapsed-by-default)
452
+ // 3. Auto-activate first declared group
453
+ if (tagGroups.length > 0) return tagGroups[0].name;
454
+
455
+ // 4. No tag groups → no coloring
457
456
  return null;
458
457
  }
459
458
 
@@ -333,7 +333,8 @@ function layoutElement(
333
333
 
334
334
  // Container — layout children
335
335
  const isInlineRow =
336
- el.metadata._inlineRow === 'true' || el.metadata._labelField === 'true';
336
+ el.metadata['_inlineRow'] === 'true' ||
337
+ el.metadata['_labelField'] === 'true';
337
338
  const padTop = isInlineRow ? 0 : GROUP_PADDING_TOP;
338
339
  const padBottom = isInlineRow ? 0 : GROUP_PADDING_BOTTOM;
339
340
  const padX = isInlineRow ? 0 : GROUP_PADDING_X;
@@ -402,8 +403,8 @@ function allocateEqualWidths(
402
403
  function getElementHeight(el: WireframeElement): number {
403
404
  if (el.type === 'heading') {
404
405
  return el.headingLevel === 2
405
- ? (ELEMENT_HEIGHTS.subheading ?? 36)
406
- : (ELEMENT_HEIGHTS.heading ?? 48);
406
+ ? (ELEMENT_HEIGHTS['subheading'] ?? 36)
407
+ : (ELEMENT_HEIGHTS['heading'] ?? 48);
407
408
  }
408
409
 
409
410
  if (el.type === 'textInput' && el.fieldVariant === 'textarea') {
@@ -421,11 +422,11 @@ function getElementHeight(el: WireframeElement): number {
421
422
  if (el.type === 'image') {
422
423
  if (el.imageHint === 'round') return 80;
423
424
  if (el.imageHint === 'wide') return 80;
424
- return ELEMENT_HEIGHTS.image ?? 120;
425
+ return ELEMENT_HEIGHTS['image'] ?? 120;
425
426
  }
426
427
 
427
428
  // Label-field wrapper
428
- if (el.metadata._labelField === 'true') {
429
+ if (el.metadata['_labelField'] === 'true') {
429
430
  return 36; // input height
430
431
  }
431
432
 
@@ -434,7 +435,7 @@ function getElementHeight(el: WireframeElement): number {
434
435
 
435
436
  function getSpacingAfter(el: WireframeElement): number {
436
437
  if (el.type === 'heading' && el.headingLevel === 2) {
437
- return SPACING_AFTER.subheading ?? 12;
438
+ return SPACING_AFTER['subheading'] ?? 12;
438
439
  }
439
440
  return SPACING_AFTER[el.type] ?? 8;
440
441
  }
@@ -448,7 +449,10 @@ function computeFieldAlignX(children: WireframeElement[]): number {
448
449
  let labelFieldCount = 0;
449
450
 
450
451
  for (const child of children) {
451
- if (child.metadata._labelField === 'true' && child.children.length >= 2) {
452
+ if (
453
+ child.metadata['_labelField'] === 'true' &&
454
+ child.children.length >= 2
455
+ ) {
452
456
  const labelEl = child.children[0];
453
457
  const labelWidth = labelEl.label.length * CHAR_WIDTH;
454
458
  maxLabelWidth = Math.max(maxLabelWidth, labelWidth);
@@ -650,7 +650,7 @@ export function parseWireframe(content: string): ParsedWireframe {
650
650
  wrapper.isContainer = true;
651
651
  wrapper.orientation = 'horizontal';
652
652
  wrapper.children = children;
653
- wrapper.metadata._inlineRow = 'true';
653
+ wrapper.metadata['_inlineRow'] = 'true';
654
654
  pushElement(wrapper);
655
655
  }
656
656
 
@@ -852,7 +852,7 @@ export function parseWireframe(content: string): ParsedWireframe {
852
852
  wrapper.isContainer = true;
853
853
  wrapper.orientation = 'horizontal';
854
854
  wrapper.children.push(labelEl, fieldEl);
855
- wrapper.metadata._labelField = 'true';
855
+ wrapper.metadata['_labelField'] = 'true';
856
856
  pushElement(wrapper);
857
857
  }
858
858
  } else {
@@ -268,7 +268,10 @@ function renderGroup(
268
268
  const el = node.element;
269
269
 
270
270
  // Inline rows and label-field wrappers — no group chrome, just render children
271
- if (el.metadata._inlineRow === 'true' || el.metadata._labelField === 'true') {
271
+ if (
272
+ el.metadata['_inlineRow'] === 'true' ||
273
+ el.metadata['_labelField'] === 'true'
274
+ ) {
272
275
  for (const child of node.children) {
273
276
  renderNode(g, child, ctx, depth);
274
277
  }
@@ -637,7 +640,7 @@ function renderText(
637
640
  const el = node.element;
638
641
 
639
642
  // Check if this is a label-field wrapper
640
- if (el.metadata._labelField === 'true' && el.children.length >= 2) {
643
+ if (el.metadata['_labelField'] === 'true' && el.children.length >= 2) {
641
644
  for (const child of node.children) {
642
645
  renderNode(g, child, ctx, 0);
643
646
  }