@cristianormazabal/triton-latex 0.1.6 → 0.1.8

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.
package/dist/cli.cjs CHANGED
@@ -39455,11 +39455,23 @@ function layoutTree(ir, theme) {
39455
39455
  }
39456
39456
  const byId = new Map(ir.nodes.map((n) => [n.id, n]));
39457
39457
  const activeEdgeSet = new Set((ir.activePaths ?? []).map(([a, b]) => `${a}:${b}`));
39458
+ function circleBorder(center, radius, dir, sign) {
39459
+ return { x: rhu(center.x + sign * radius * dir.x), y: rhu(center.y + sign * radius * dir.y) };
39460
+ }
39458
39461
  for (const node of ir.nodes) {
39459
39462
  const pb = box(node.id);
39463
+ const parentShape = style.get(node.id).shape;
39460
39464
  for (const cid of node.children) {
39461
39465
  const cb = box(cid);
39462
- const { start, end } = connectSlots(pb, cb);
39466
+ const childShape = style.get(cid).shape;
39467
+ const pc = { x: pb.x + pb.width / 2, y: pb.y + pb.height / 2 };
39468
+ const cc = { x: cb.x + cb.width / 2, y: cb.y + cb.height / 2 };
39469
+ const dx = cc.x - pc.x, dy = cc.y - pc.y;
39470
+ const len = Math.hypot(dx, dy);
39471
+ const dir = len > 0 ? { x: dx / len, y: dy / len } : { x: 0, y: 1 };
39472
+ const { start: boxStart, end: boxEnd } = connectSlots(pb, cb);
39473
+ const start = parentShape === "circle" ? circleBorder(pc, pb.width / 2, dir, 1) : boxStart;
39474
+ const end = childShape === "circle" ? circleBorder(cc, cb.width / 2, dir, -1) : boxEnd;
39463
39475
  const isActive = activeEdgeSet.has(`${node.id}:${cid}`);
39464
39476
  const edgeColor = isActive ? palette.primary : palette.textMuted;
39465
39477
  const edgeWidth = isActive ? 2.5 : 1.5;
@@ -39502,7 +39514,7 @@ function layoutTree(ir, theme) {
39502
39514
  }
39503
39515
  if (node.badge !== void 0) {
39504
39516
  const bc = badgeColor(node.badge, theme);
39505
- elements.push(p.circle({ x: b.x + b.width - 3, y: b.y + 3 }, 9, palette.background, bc, 1.5));
39517
+ elements.push(p.circle({ x: b.x + b.width - 3, y: b.y + 3 }, 9, palette.surface, bc, 1.5));
39506
39518
  elements.push(p.text(node.badge, b.x + b.width - 3, b.y + 7, smallFont, bc, { anchor: "middle", weight: "bold" }));
39507
39519
  }
39508
39520
  }