@markdy/renderer-dom 0.8.22 → 0.8.24

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 (2) hide show
  1. package/dist/index.js +23 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -280,6 +280,25 @@ function dedupePoints(points) {
280
280
  }
281
281
  return out.length >= 2 ? out : points;
282
282
  }
283
+ function circleBoundaryRoute(from, to) {
284
+ const fromCenter = { x: from.x + from.width / 2, y: from.y + from.height / 2 };
285
+ const toCenter = { x: to.x + to.width / 2, y: to.y + to.height / 2 };
286
+ const dx = toCenter.x - fromCenter.x;
287
+ const dy = toCenter.y - fromCenter.y;
288
+ const distance = Math.hypot(dx, dy) || 1;
289
+ const ux = dx / distance;
290
+ const uy = dy / distance;
291
+ const fromRadius = Math.min(from.width, from.height) / 2;
292
+ const toRadius = Math.min(to.width, to.height) / 2;
293
+ return dedupePoints([
294
+ { x: fromCenter.x + ux * fromRadius, y: fromCenter.y + uy * fromRadius },
295
+ { x: toCenter.x - ux * toRadius, y: toCenter.y - uy * toRadius }
296
+ ]);
297
+ }
298
+ function routeEdgePoints(from, to, routeObstacles, bounds, lane) {
299
+ if (from.shape === "circle" && to.shape === "circle") return circleBoundaryRoute(from, to);
300
+ return routeOrthogonal(boxRect(from), boxRect(to), routeObstacles, bounds, lane);
301
+ }
283
302
  function ensureEdgeLayer(scene) {
284
303
  const existing = scene.querySelector(`svg[${EDGE_LAYER_ATTR}='1']`);
285
304
  if (existing) return existing;
@@ -353,7 +372,7 @@ function createEdgeRuntime(svg, from, to, kind, label, theme, sceneId, routeObst
353
372
  const color = theme.edges[kind];
354
373
  const style = EDGE_STYLES[kind];
355
374
  const isSelfLoop = from.id === to.id;
356
- const points = isSelfLoop ? dedupePoints(selfLoopPath(from)) : dedupePoints(routeOrthogonal(boxRect(from), boxRect(to), routeObstacles, bounds, lane));
375
+ const points = isSelfLoop ? dedupePoints(selfLoopPath(from)) : dedupePoints(routeEdgePoints(from, to, routeObstacles, bounds, lane));
357
376
  const d = toPathD(points);
358
377
  const len = polylineLength(points);
359
378
  const group = document.createElementNS("http://www.w3.org/2000/svg", "g");
@@ -1148,10 +1167,12 @@ function ensureNodeStyles(doc) {
1148
1167
  min-height: 56px;
1149
1168
  }
1150
1169
  .markdy-node[data-shape="circle"],
1170
+ .markdy-node[data-kind="dot"] {
1171
+ border-radius: 50%;
1172
+ }
1151
1173
  .markdy-node[data-kind="dot"] {
1152
1174
  width: 64px;
1153
1175
  height: 64px;
1154
- border-radius: 50%;
1155
1176
  }
1156
1177
  .markdy-node[data-kind="matrix"] {
1157
1178
  background-image:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markdy/renderer-dom",
3
- "version": "0.8.22",
3
+ "version": "0.8.24",
4
4
  "description": "Browser renderer for diagram-native animated MarkdyScript architecture diagrams, built on the Web Animations API.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -44,14 +44,14 @@
44
44
  "access": "public"
45
45
  },
46
46
  "dependencies": {
47
- "@markdy/core": "0.8.22"
47
+ "@markdy/core": "0.8.24"
48
48
  },
49
49
  "devDependencies": {
50
50
  "jsdom": "^29.1.1",
51
51
  "tsup": "^8.5.1",
52
52
  "typescript": "^5.9.3",
53
53
  "vitest": "^4.1.7",
54
- "@markdy/stdlib-systems": "0.8.22"
54
+ "@markdy/stdlib-systems": "0.8.24"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "tsup",