- 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.
27 lines
1.1 KiB
JavaScript
27 lines
1.1 KiB
JavaScript
export const DESKTOP_READABILITY_VIEWPORT = Object.freeze({ width: 1440, height: 900 });
|
|
export const DESKTOP_READER_MIN_WIDTH = 960;
|
|
export const DESKTOP_READER_HORIZONTAL_CHROME = 30;
|
|
export const DESKTOP_READER_DIAGRAM_WIDTH = DESKTOP_READER_MIN_WIDTH - DESKTOP_READER_HORIZONTAL_CHROME;
|
|
export const MIN_PROJECTED_NODE_TEXT_PX = 6;
|
|
|
|
export function projectedNodeTextPx(sourceFontPx, viewBoxWidth, diagramWidth = DESKTOP_READER_DIAGRAM_WIDTH) {
|
|
if (![sourceFontPx, viewBoxWidth, diagramWidth].every(Number.isFinite) || viewBoxWidth <= 0 || diagramWidth <= 0) {
|
|
return Number.NaN;
|
|
}
|
|
return sourceFontPx * Math.min(1, diagramWidth / viewBoxWidth);
|
|
}
|
|
|
|
export function minimumReadableSourceTextPx(
|
|
viewBoxWidth,
|
|
diagramWidth = DESKTOP_READER_DIAGRAM_WIDTH,
|
|
minimumProjectedPx = MIN_PROJECTED_NODE_TEXT_PX,
|
|
) {
|
|
if (![viewBoxWidth, diagramWidth, minimumProjectedPx].every(Number.isFinite)
|
|
|| viewBoxWidth <= 0
|
|
|| diagramWidth <= 0
|
|
|| minimumProjectedPx <= 0) {
|
|
return Number.NaN;
|
|
}
|
|
return minimumProjectedPx / Math.min(1, diagramWidth / viewBoxWidth);
|
|
}
|