@cristianormazabal/triton-core 0.1.4 → 0.1.6

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 (39) hide show
  1. package/dist/diagrams/triton/ds/graph/graph.d.ts +1 -0
  2. package/dist/diagrams/triton/ds/graph/graph.d.ts.map +1 -1
  3. package/dist/diagrams/triton/ds/graph/graph.js +19 -4
  4. package/dist/diagrams/triton/ds/graph/graph.js.map +1 -1
  5. package/dist/diagrams/triton/ds/matrix/matrix.d.ts +2 -0
  6. package/dist/diagrams/triton/ds/matrix/matrix.d.ts.map +1 -1
  7. package/dist/diagrams/triton/ds/matrix/matrix.js +17 -2
  8. package/dist/diagrams/triton/ds/matrix/matrix.js.map +1 -1
  9. package/dist/diagrams/triton/ds/struct/array.d.ts +7 -0
  10. package/dist/diagrams/triton/ds/struct/array.d.ts.map +1 -1
  11. package/dist/diagrams/triton/ds/struct/array.js +27 -3
  12. package/dist/diagrams/triton/ds/struct/array.js.map +1 -1
  13. package/dist/diagrams/triton/ds/struct/shared.d.ts +8 -1
  14. package/dist/diagrams/triton/ds/struct/shared.d.ts.map +1 -1
  15. package/dist/diagrams/triton/ds/struct/shared.js +9 -2
  16. package/dist/diagrams/triton/ds/struct/shared.js.map +1 -1
  17. package/dist/diagrams/triton/ds/tree/index.d.ts.map +1 -1
  18. package/dist/diagrams/triton/ds/tree/index.js +38 -2
  19. package/dist/diagrams/triton/ds/tree/index.js.map +1 -1
  20. package/dist/diagrams/triton/ds/tree/ir.d.ts +2 -0
  21. package/dist/diagrams/triton/ds/tree/ir.d.ts.map +1 -1
  22. package/dist/diagrams/triton/ds/tree/layout.d.ts.map +1 -1
  23. package/dist/diagrams/triton/ds/tree/layout.js +8 -3
  24. package/dist/diagrams/triton/ds/tree/layout.js.map +1 -1
  25. package/dist/diagrams/triton/poster/index.d.ts.map +1 -1
  26. package/dist/diagrams/triton/poster/index.js +37 -2
  27. package/dist/diagrams/triton/poster/index.js.map +1 -1
  28. package/dist/diagrams/triton/poster/ir.d.ts +9 -0
  29. package/dist/diagrams/triton/poster/ir.d.ts.map +1 -1
  30. package/dist/diagrams/triton/poster/layout.d.ts.map +1 -1
  31. package/dist/diagrams/triton/poster/layout.js +67 -2
  32. package/dist/diagrams/triton/poster/layout.js.map +1 -1
  33. package/dist/index.js +192 -22
  34. package/dist/index.js.map +3 -3
  35. package/dist/scene/strip.d.ts +4 -0
  36. package/dist/scene/strip.d.ts.map +1 -1
  37. package/dist/scene/strip.js +1 -1
  38. package/dist/scene/strip.js.map +1 -1
  39. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10462,7 +10462,7 @@ function connectorExtents(elements) {
10462
10462
  // src/diagrams/triton/ds/struct/shared.ts
10463
10463
  var ARROW_ID2 = "struct-arrow";
10464
10464
  function arrowDef(color) {
10465
- return `<marker id="${ARROW_ID2}" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto"><path d="M0 0 L8 4 L0 8 z" fill="${color}" /></marker>`;
10465
+ return `<marker id="${ARROW_ID2}" markerWidth="12" markerHeight="12" refX="10" refY="6" orient="auto" markerUnits="userSpaceOnUse"><path d="M0 0 L12 6 L0 12 z" fill="${color}" /></marker>`;
10466
10466
  }
10467
10467
  function lines(input) {
10468
10468
  return input.split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
@@ -10513,6 +10513,8 @@ function parse(input) {
10513
10513
  let indexSide = "before";
10514
10514
  let indexOrder = "normal";
10515
10515
  const ptrs = [];
10516
+ let highlights;
10517
+ let win;
10516
10518
  for (const line of lines(input)) {
10517
10519
  const t = tokenizeDirective(line);
10518
10520
  if (t.length === 0) continue;
@@ -10541,6 +10543,15 @@ function parse(input) {
10541
10543
  }
10542
10544
  continue;
10543
10545
  }
10546
+ if (t[0] === "highlight") {
10547
+ highlights = t.slice(1).map(Number).filter((n) => !isNaN(n) && Number.isInteger(n));
10548
+ continue;
10549
+ }
10550
+ if (t[0] === "window" && t[1]) {
10551
+ const m = t[1].match(/^(\d+)-(\d+)$/);
10552
+ if (m) win = { start: Number(m[1]), end: Number(m[2]) };
10553
+ continue;
10554
+ }
10544
10555
  if (t[0] === "ptr" && t.length >= 4 && t[2] === "->") {
10545
10556
  ptrs.push({ id: t[1], target: parsePointerTarget(t[3]), ...t[4] !== void 0 ? { label: t[4] } : {} });
10546
10557
  }
@@ -10550,7 +10561,9 @@ function parse(input) {
10550
10561
  axis,
10551
10562
  index: { show: indexShow, side: indexSide, order: indexOrder },
10552
10563
  cells: cells2,
10553
- ptrs
10564
+ ptrs,
10565
+ ...highlights !== void 0 && highlights.length > 0 ? { highlights } : {},
10566
+ ...win !== void 0 ? { window: win } : {}
10554
10567
  };
10555
10568
  }
10556
10569
  function parseCells(tokens) {
@@ -10649,9 +10662,15 @@ function layoutArray(inputDoc, theme) {
10649
10662
  elements.push(p.text("\u2026", slot.x + cellW / 2, slot.y + cellH / 2 + 5, font, palette.textMuted, { anchor: "middle", weight: "bold" }));
10650
10663
  return;
10651
10664
  }
10652
- elements.push(p.rect(slot, palette.surface, palette.border, 1.5, { rx: 3 }));
10653
- elements.push(p.text(cell.value, slot.x + cellW / 2, slot.y + cellH / 2 + 5, font, palette.text, { anchor: "middle", weight: "bold" }));
10654
- const logical = meta.physicalToLogical[physical];
10665
+ const logicalMaybe = meta.physicalToLogical[physical];
10666
+ const logical = logicalMaybe ?? null;
10667
+ const isHighlit = logical !== null && ((doc.highlights?.includes(logical) ?? false) || doc.window !== void 0 && logical >= doc.window.start && logical <= doc.window.end);
10668
+ if (isHighlit) {
10669
+ elements.push(p.rect(slot, palette.primary, palette.primary, 2, { rx: 3, fillOpacity: 0.22 }));
10670
+ } else {
10671
+ elements.push(p.rect(slot, palette.surface, palette.border, 1.5, { rx: 3 }));
10672
+ }
10673
+ elements.push(p.text(cell.value, slot.x + cellW / 2, slot.y + cellH / 2 + 5, font, isHighlit ? palette.primary : palette.text, { anchor: "middle", weight: "bold" }));
10655
10674
  if (doc.index.show && logical !== null) {
10656
10675
  elements.push(renderIndexText(p, theme, String(logical), slot, cellW, cellH, doc.axis, doc.index.side, indexPad));
10657
10676
  }
@@ -10707,7 +10726,9 @@ function normalizeArrayDoc(doc) {
10707
10726
  ptrs: (doc.ptrs ?? []).map((ptr) => {
10708
10727
  if ("idx" in ptr) return { id: ptr.name ?? ptr.id, target: { raw: String(ptr.idx), value: Number(ptr.idx) } };
10709
10728
  return ptr;
10710
- })
10729
+ }),
10730
+ ...Array.isArray(doc.highlights) && doc.highlights.length > 0 ? { highlights: doc.highlights } : {},
10731
+ ...doc.window !== void 0 ? { window: doc.window } : {}
10711
10732
  };
10712
10733
  }
10713
10734
  function buildSlots(count, origin, cellW, cellH, axis) {
@@ -10974,7 +10995,8 @@ function layoutPoster(ir, theme) {
10974
10995
  const contentW = colW - inset * 2;
10975
10996
  const scale = Math.min(contentW / Math.max(result.scene.viewBox.width, 1), 1);
10976
10997
  const effectiveScale = Math.max(scale, MIN_EMBED_SCALE);
10977
- const neededH = result.scene.viewBox.height * effectiveScale + cellTitleH + inset * 2;
10998
+ const captionH = cell.caption ? reservedCaptionHeight(cellTheme) : 0;
10999
+ const neededH = result.scene.viewBox.height * effectiveScale + cellTitleH + captionH + inset * 2;
10978
11000
  rowHeights[row] = Math.max(rowHeights[row], neededH);
10979
11001
  }
10980
11002
  }
@@ -11023,8 +11045,23 @@ function layoutPoster(ir, theme) {
11023
11045
  textOccupied.push(t.occupied);
11024
11046
  }
11025
11047
  const inset = unit / 2;
11026
- const contentRect = { x: cellX + inset, y: cellY + reservedTop + inset, width: cellW - inset * 2, height: cellH - reservedTop - inset * 2 };
11048
+ const captionH = cell.caption ? reservedCaptionHeight(cellTheme) : 0;
11049
+ const contentRect = {
11050
+ x: cellX + inset,
11051
+ y: cellY + reservedTop + inset,
11052
+ width: cellW - inset * 2,
11053
+ height: cellH - reservedTop - captionH - inset * 2
11054
+ };
11027
11055
  cellContent.push(embedScene(result.scene, contentRect));
11056
+ if (cell.caption) {
11057
+ const captionY = cellY + cellH - inset / 2;
11058
+ cellContent.push({ type: "text", content: cell.caption, position: { x: cellX + cellW / 2, y: captionY }, fontSize: cellTheme.typography.smallFontSize, fontFamily: cellTheme.typography.fontFamily, fill: cellTheme.palette.textMuted, anchor: "middle" });
11059
+ }
11060
+ if (cell.notes && cell.notes.length > 0) {
11061
+ for (const note of cell.notes) {
11062
+ cellContent.push(...buildNoteOverlay(note, contentRect, cellTheme));
11063
+ }
11064
+ }
11028
11065
  const scaleX = contentRect.width / Math.max(result.scene.viewBox.width, 1);
11029
11066
  const scaleY = contentRect.height / Math.max(result.scene.viewBox.height, 1);
11030
11067
  const scale = Math.min(scaleX, scaleY, 1);
@@ -11235,6 +11272,47 @@ function titleBoxHeight(theme) {
11235
11272
  const padY = theme.panel.titleChrome === "none" ? 0 : theme.spacing.unit * 0.4;
11236
11273
  return fs + padY * 2;
11237
11274
  }
11275
+ function reservedCaptionHeight(theme) {
11276
+ return theme.typography.smallFontSize + theme.spacing.unit;
11277
+ }
11278
+ function buildNoteOverlay(note, rect, theme) {
11279
+ const { palette, typography, spacing } = theme;
11280
+ const fs = typography.smallFontSize;
11281
+ const pad = spacing.unit * 0.5;
11282
+ const textW = note.text.length * fs * 0.62 + pad * 2;
11283
+ const boxH = fs + pad * 2;
11284
+ const pos = note.position ?? "top-right";
11285
+ let bx, by;
11286
+ switch (pos) {
11287
+ case "top-left":
11288
+ bx = rect.x + spacing.unit * 0.5;
11289
+ by = rect.y + spacing.unit * 0.5;
11290
+ break;
11291
+ case "top-right":
11292
+ bx = rect.x + rect.width - textW - spacing.unit * 0.5;
11293
+ by = rect.y + spacing.unit * 0.5;
11294
+ break;
11295
+ case "bottom-left":
11296
+ bx = rect.x + spacing.unit * 0.5;
11297
+ by = rect.y + rect.height - boxH - spacing.unit * 0.5;
11298
+ break;
11299
+ case "bottom-right":
11300
+ bx = rect.x + rect.width - textW - spacing.unit * 0.5;
11301
+ by = rect.y + rect.height - boxH - spacing.unit * 0.5;
11302
+ break;
11303
+ case "center":
11304
+ bx = rect.x + (rect.width - textW) / 2;
11305
+ by = rect.y + (rect.height - boxH) / 2;
11306
+ break;
11307
+ default:
11308
+ bx = rect.x + rect.width - textW - spacing.unit * 0.5;
11309
+ by = rect.y + spacing.unit * 0.5;
11310
+ }
11311
+ return [
11312
+ { type: "rect", bounds: { x: bx, y: by, width: textW, height: boxH }, fill: palette.surface, stroke: palette.primary, strokeWidth: 1, rx: boxH / 2, fillOpacity: 0.88 },
11313
+ { type: "text", content: note.text, position: { x: bx + textW / 2, y: by + pad + fs * 0.8 }, fontSize: fs, fontFamily: typography.fontFamily, fontWeight: "bold", fill: palette.primary, anchor: "middle" }
11314
+ ];
11315
+ }
11238
11316
  function buildCellTitle(title, cellX, cellY, cellW, theme) {
11239
11317
  const { palette, typography, panel, spacing } = theme;
11240
11318
  const unit = spacing.unit;
@@ -13953,8 +14031,18 @@ var poster = {
13953
14031
  parseMermaid(input) {
13954
14032
  const raw = peg$parse3(input);
13955
14033
  const cells2 = raw.cells.map((c) => {
13956
- const content = parseCell(c);
13957
- return { id: c.id, title: c.title, content, colSpan: c.span?.colSpan, rowSpan: c.span?.rowSpan, theme: c.theme };
14034
+ const { rawContent, caption, notes } = extractCellAnnotations(c.rawContent);
14035
+ const content = parseCell({ ...c, rawContent });
14036
+ return {
14037
+ id: c.id,
14038
+ title: c.title,
14039
+ content,
14040
+ colSpan: c.span?.colSpan,
14041
+ rowSpan: c.span?.rowSpan,
14042
+ theme: c.theme,
14043
+ ...caption ? { caption } : {},
14044
+ ...notes.length > 0 ? { notes } : {}
14045
+ };
13958
14046
  });
13959
14047
  const explicitLinks = raw.links ?? [];
13960
14048
  const allLinks = [...explicitLinks];
@@ -14009,6 +14097,7 @@ function inferCellKind(rawContent) {
14009
14097
  if (keyword.startsWith("nodegraph")) return "nodegraph";
14010
14098
  if (keyword.startsWith("plan")) return "plan";
14011
14099
  if (keyword.startsWith("btree")) return "btree";
14100
+ if (keyword.startsWith("tree")) return "tree";
14012
14101
  if (keyword.startsWith("page")) return "page";
14013
14102
  if (keyword.startsWith("memory")) return "memory";
14014
14103
  if (keyword.startsWith("linkedlist")) return "linkedlist";
@@ -14033,6 +14122,28 @@ function inferCellKind(rawContent) {
14033
14122
  if (trimmed.includes("|")) return "stat";
14034
14123
  return "text";
14035
14124
  }
14125
+ var CAPTION_RE = /^[ \t]*caption[ \t]+"([^"]*)"[ \t]*$/;
14126
+ var NOTE_RE = /^[ \t]*note[ \t]+"([^"]*)"(?:[ \t]+at[ \t]+(top-left|top-right|bottom-left|bottom-right|center))?[ \t]*$/;
14127
+ function extractCellAnnotations(rawContent) {
14128
+ const inputLines = rawContent.split("\n");
14129
+ const outLines = [];
14130
+ let caption;
14131
+ const notes = [];
14132
+ for (const line of inputLines) {
14133
+ const cm = line.match(CAPTION_RE);
14134
+ if (cm) {
14135
+ caption = cm[1];
14136
+ continue;
14137
+ }
14138
+ const nm = line.match(NOTE_RE);
14139
+ if (nm) {
14140
+ notes.push({ text: nm[1], ...nm[2] ? { position: nm[2] } : {} });
14141
+ continue;
14142
+ }
14143
+ outLines.push(line);
14144
+ }
14145
+ return { rawContent: outLines.join("\n"), caption, notes };
14146
+ }
14036
14147
 
14037
14148
  // src/diagrams/mermaid/pie/layout.ts
14038
14149
  function fmtNum(n) {
@@ -39248,7 +39359,7 @@ function nodeStyle(kinds, theme) {
39248
39359
  if (has("join")) return { shape, fill: palette.surface, stroke: palette.secondary, text: palette.text };
39249
39360
  if (has("build") || has("muted")) return { shape, fill: palette.surface, stroke: palette.textMuted, text: palette.text };
39250
39361
  const fill = palette.surface;
39251
- return { shape, fill, stroke: outlineStroke(fill, theme), text: palette.text };
39362
+ return { shape, fill, stroke: palette.primary, text: palette.text };
39252
39363
  }
39253
39364
  function infoLine(node) {
39254
39365
  return node.info;
@@ -39317,18 +39428,22 @@ function layoutTree(ir, theme) {
39317
39428
  ));
39318
39429
  }
39319
39430
  const byId = new Map(ir.nodes.map((n) => [n.id, n]));
39431
+ const activeEdgeSet = new Set((ir.activePaths ?? []).map(([a, b]) => `${a}:${b}`));
39320
39432
  for (const node of ir.nodes) {
39321
39433
  const pb = box(node.id);
39322
39434
  for (const cid of node.children) {
39323
39435
  const cb = box(cid);
39324
39436
  const { start, end } = connectSlots(pb, cb);
39325
- elements.push(p.path(`M ${rhu(start.x)} ${rhu(start.y)} L ${rhu(end.x)} ${rhu(end.y)}`, palette.textMuted, 1.5));
39437
+ const isActive = activeEdgeSet.has(`${node.id}:${cid}`);
39438
+ const edgeColor = isActive ? palette.primary : palette.textMuted;
39439
+ const edgeWidth = isActive ? 2.5 : 1.5;
39440
+ elements.push(p.path(`M ${rhu(start.x)} ${rhu(start.y)} L ${rhu(end.x)} ${rhu(end.y)}`, edgeColor, edgeWidth));
39326
39441
  const child = byId.get(cid);
39327
39442
  if (child.edgeLabel) {
39328
39443
  const mx = (start.x + end.x) / 2, my = (start.y + end.y) / 2;
39329
39444
  const w = measureText(child.edgeLabel, smallFont).width + 8;
39330
39445
  elements.push(p.rect({ x: mx - w / 2, y: my - 9, width: w, height: 16 }, palette.background, palette.background, 0, { rx: 3 }));
39331
- elements.push(p.text(child.edgeLabel, mx, my + 3, smallFont, palette.primary, { anchor: "middle", weight: "bold" }));
39446
+ elements.push(p.text(child.edgeLabel, mx, my + 3, smallFont, isActive ? palette.primary : palette.textMuted, { anchor: "middle", weight: "bold" }));
39332
39447
  }
39333
39448
  }
39334
39449
  }
@@ -40831,14 +40946,46 @@ function buildNodes(lines2) {
40831
40946
  }
40832
40947
 
40833
40948
  // src/diagrams/triton/ds/tree/index.ts
40949
+ function extractPathDirectives(input) {
40950
+ const cleanLines = [];
40951
+ const paths = [];
40952
+ const PATH_RE = /^[ \t]*path[ \t]+(.+)$/;
40953
+ for (const line of input.split("\n")) {
40954
+ const m = line.match(PATH_RE);
40955
+ if (m && m[1].includes("->")) {
40956
+ const nodes = m[1].split("->").map((s) => s.trim()).filter(Boolean);
40957
+ if (nodes.length >= 2) {
40958
+ paths.push(nodes);
40959
+ continue;
40960
+ }
40961
+ }
40962
+ cleanLines.push(line);
40963
+ }
40964
+ return { clean: cleanLines.join("\n"), paths };
40965
+ }
40834
40966
  var tree = {
40835
40967
  parseMermaid(input) {
40836
- const raw = parseLines(input);
40968
+ const { clean, paths } = extractPathDirectives(input);
40969
+ const raw = parseLines(clean);
40970
+ const nodes = buildNodes(raw.lines);
40971
+ const labelToId = /* @__PURE__ */ new Map();
40972
+ for (const node of nodes) {
40973
+ if (!labelToId.has(node.label)) labelToId.set(node.label, node.id);
40974
+ }
40975
+ const activePairs = [];
40976
+ for (const seg of paths) {
40977
+ for (let i = 0; i < seg.length - 1; i++) {
40978
+ const fromId = labelToId.get(seg[i]);
40979
+ const toId = labelToId.get(seg[i + 1]);
40980
+ if (fromId && toId) activePairs.push([fromId, toId]);
40981
+ }
40982
+ }
40837
40983
  return {
40838
40984
  version: raw.version,
40839
40985
  metadata: raw.metadata ?? {},
40840
40986
  direction: raw.direction,
40841
- nodes: buildNodes(raw.lines)
40987
+ nodes,
40988
+ ...activePairs.length > 0 ? { activePaths: activePairs } : {}
40842
40989
  };
40843
40990
  },
40844
40991
  parseYaml(input) {
@@ -41590,7 +41737,7 @@ function buildStrip(pen2, theme, cells2, options) {
41590
41737
  const y = origin.y + (horizontal ? 0 : i * step);
41591
41738
  const slot = { x, y, width: cellWidth, height: cellHeight };
41592
41739
  slots.push(slot);
41593
- elements.push(pen2.rect(slot, cell.fill ?? palette.surface, palette.border, 1.5, { rx: 3 }));
41740
+ elements.push(pen2.rect(slot, cell.fill ?? palette.surface, cell.stroke ?? palette.border, 1.5, { rx: 3, ...cell.fillOpacity !== void 0 ? { fillOpacity: cell.fillOpacity } : {} }));
41594
41741
  if (cell.label !== void 0) {
41595
41742
  elements.push(pen2.text(
41596
41743
  cell.label,
@@ -42429,6 +42576,7 @@ function parse11(input) {
42429
42576
  let title;
42430
42577
  const rows = [];
42431
42578
  let showIndex = true;
42579
+ const highlights = [];
42432
42580
  for (const line of input.split(/\r?\n/).map((l) => l.trimEnd())) {
42433
42581
  const trimmed = line.trim();
42434
42582
  if (!trimmed) continue;
@@ -42453,8 +42601,15 @@ function parse11(input) {
42453
42601
  rows.push(t.slice(1));
42454
42602
  continue;
42455
42603
  }
42604
+ if (t[0] === "highlight") {
42605
+ for (const tok of t.slice(1)) {
42606
+ const m = tok.match(/^(\d+),(\d+)$/);
42607
+ if (m) highlights.push([Number(m[1]), Number(m[2])]);
42608
+ }
42609
+ continue;
42610
+ }
42456
42611
  }
42457
- return { ...title !== void 0 ? { title } : {}, rows, showIndex };
42612
+ return { ...title !== void 0 ? { title } : {}, rows, showIndex, ...highlights.length > 0 ? { highlights } : {} };
42458
42613
  }
42459
42614
  function layoutMatrix(doc, theme) {
42460
42615
  const { palette, typography, spacing } = theme;
@@ -42477,7 +42632,10 @@ function layoutMatrix(doc, theme) {
42477
42632
  const anchors = {};
42478
42633
  grid.forEach((row, r) => {
42479
42634
  const rowOrigin = { x: origin.x, y: origin.y + r * cellH };
42480
- const cellInputs = row.map((v) => ({ label: v }));
42635
+ const cellInputs = row.map((v, c) => {
42636
+ const isHighlit = doc.highlights?.some(([hr, hc]) => hr === r && hc === c) ?? false;
42637
+ return isHighlit ? { label: v, fill: palette.primary, fillOpacity: 0.22, stroke: palette.primary } : { label: v };
42638
+ });
42481
42639
  const strip = buildStrip(p, theme, cellInputs, { origin: rowOrigin, cellWidth: cellW, cellHeight: cellH });
42482
42640
  elements.push(...strip.elements);
42483
42641
  strip.slots.forEach((slot, c) => {
@@ -42595,9 +42753,15 @@ function parse12(input) {
42595
42753
  const m = line.match(EDGE_RE);
42596
42754
  if (m) {
42597
42755
  const from = m[1], to = m[3];
42756
+ const rawLabel = m[4]?.trim();
42757
+ let label;
42758
+ let kind;
42759
+ if (rawLabel === "active") kind = "active";
42760
+ else if (rawLabel === "dashed") kind = "dashed";
42761
+ else label = rawLabel;
42598
42762
  ensure(from);
42599
42763
  ensure(to);
42600
- edges2.push({ from, to, ...m[4] ? { label: m[4].trim() } : {} });
42764
+ edges2.push({ from, to, ...label ? { label } : {}, ...kind ? { kind } : {} });
42601
42765
  }
42602
42766
  }
42603
42767
  const nodes = order.map((id) => ({ id, label: labels.get(id) }));
@@ -42628,13 +42792,19 @@ function layoutGraph(doc, theme) {
42628
42792
  const b = placed.boxes.has(e.to) ? box(e.to) : void 0;
42629
42793
  if (!a || !b) continue;
42630
42794
  const { start, end } = connectSlots(a, b);
42631
- const opts2 = doc.directed ? { markerEnd: ARROW_ID2 } : {};
42632
- elements.push(p.path(`M ${rhu(start.x)} ${rhu(start.y)} L ${rhu(end.x)} ${rhu(end.y)}`, palette.textMuted, 1.5, opts2));
42795
+ const isActive = e.kind === "active";
42796
+ const edgeColor = isActive ? palette.primary : palette.textMuted;
42797
+ const edgeWidth = isActive ? 2.5 : 1.5;
42798
+ const pathOpts = {
42799
+ ...doc.directed ? { markerEnd: ARROW_ID2 } : {},
42800
+ ...e.kind === "dashed" ? { dash: "6 3" } : {}
42801
+ };
42802
+ elements.push(p.path(`M ${rhu(start.x)} ${rhu(start.y)} L ${rhu(end.x)} ${rhu(end.y)}`, edgeColor, edgeWidth, pathOpts));
42633
42803
  if (e.label) {
42634
42804
  const mx = (start.x + end.x) / 2, my = (start.y + end.y) / 2;
42635
42805
  const w = measureText(e.label, small).width + 8;
42636
42806
  elements.push(p.rect({ x: mx - w / 2, y: my - 9, width: w, height: 16 }, palette.background, palette.background, 0, { rx: 3 }));
42637
- elements.push(p.text(e.label, mx, my + 3, small, palette.primary, { anchor: "middle", weight: "bold" }));
42807
+ elements.push(p.text(e.label, mx, my + 3, small, isActive ? palette.primary : palette.textMuted, { anchor: "middle", weight: "bold" }));
42638
42808
  }
42639
42809
  }
42640
42810
  const anchors = {};