Files
pi-config/skills/archify/renderers/shared/layout-report.mjs
Sam Rolfe 8e68df0830 Add archify skill (v2.14), pi-mermaid ext (v0.3.0), project-diagramming-mermaid + project-diagramming-archify skills
- skills/archify: vendored tt-a1i/archify 2.14.0 (MIT), pure Node 18+, zero deps
- extensions/pi-mermaid: renders mermaid blocks as ASCII in TUI; deps beautiful-mermaid + mermaid
- skills/project-diagramming-*: orchestration skills, per-project docs/ convention
2026-09-06 10:50:29 +10:00

41 lines
1015 B
JavaScript

/** Serialize computed layout for dry-run / inspect (#9). */
export function componentBox(c) {
return {
id: c.id,
type: c.type,
label: c.label,
x: Math.round(c.x),
y: Math.round(c.y),
width: c.width,
height: c.height,
...(Number.isInteger(c.row) ? { row: c.row } : {}),
...(Number.isInteger(c.col) ? { col: c.col } : {}),
...(Array.isArray(c.pos) ? { pos: c.pos.map(Math.round) } : {}),
};
}
export function boundaryBox(b) {
return {
kind: b.kind,
label: b.label,
x: Math.round(b.x),
y: Math.round(b.y),
width: Math.round(b.width),
height: Math.round(b.height),
wraps: b.wraps,
};
}
export function connectionPath(conn, routed, labelAt) {
return {
from: conn.from,
to: conn.to,
label: conn.label ?? null,
variant: conn.variant ?? 'default',
route: conn.route ?? 'auto',
points: routed.points.map(([x, y]) => [Math.round(x), Math.round(y)]),
...(labelAt ? { labelAt: labelAt.map(Math.round) } : {}),
};
}