- Added a new Archify skill, enabling users to create polished architecture, workflow, sequence, data-flow, and lifecycle diagrams. - Implemented comprehensive functionality including rendering, validation, and delivery of diagrams in various formats. - Integrated a user-friendly command-line interface for generating and previewing diagrams. - Developed supporting files including package.json, LICENSE, and SKILL.md for documentation and licensing. - Added unit tests to ensure reliability and functionality of the new skill. These changes enhance the application by providing a structured approach to visualizing system architecture and workflows, improving user experience and data representation.
41 lines
1015 B
JavaScript
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) } : {}),
|
|
};
|
|
}
|