astro-archify 0.3.4

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 (30) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +169 -0
  3. package/astro-archify-integration.d.ts +100 -0
  4. package/astro-archify-integration.js +0 -0
  5. package/package.json +64 -0
  6. package/vendor/archify/LICENSE +22 -0
  7. package/vendor/archify/NOTICE.md +48 -0
  8. package/vendor/archify/assets/template.html +14787 -0
  9. package/vendor/archify/renderers/architecture/grid.mjs +62 -0
  10. package/vendor/archify/renderers/architecture/render-architecture.mjs +1089 -0
  11. package/vendor/archify/renderers/dataflow/render-dataflow.mjs +482 -0
  12. package/vendor/archify/renderers/lifecycle/render-lifecycle.mjs +570 -0
  13. package/vendor/archify/renderers/sequence/render-sequence.mjs +468 -0
  14. package/vendor/archify/renderers/shared/brand-marks.mjs +563 -0
  15. package/vendor/archify/renderers/shared/cli.mjs +220 -0
  16. package/vendor/archify/renderers/shared/desktop-readability.mjs +26 -0
  17. package/vendor/archify/renderers/shared/diagnostics.mjs +116 -0
  18. package/vendor/archify/renderers/shared/engineering-profiles.mjs +157 -0
  19. package/vendor/archify/renderers/shared/generated-brand-marks.mjs +2003 -0
  20. package/vendor/archify/renderers/shared/generated-validators.mjs +13 -0
  21. package/vendor/archify/renderers/shared/geometry.mjs +1334 -0
  22. package/vendor/archify/renderers/shared/i18n.mjs +594 -0
  23. package/vendor/archify/renderers/shared/layout-report.mjs +40 -0
  24. package/vendor/archify/renderers/shared/legend.mjs +217 -0
  25. package/vendor/archify/renderers/shared/output-path.mjs +321 -0
  26. package/vendor/archify/renderers/shared/repository-evidence.mjs +235 -0
  27. package/vendor/archify/renderers/shared/text-fit.mjs +49 -0
  28. package/vendor/archify/renderers/shared/utils.mjs +232 -0
  29. package/vendor/archify/renderers/shared/validator.mjs +86 -0
  30. package/vendor/archify/renderers/workflow/render-workflow.mjs +749 -0
@@ -0,0 +1,62 @@
1
+ /** Grid placement for architecture IR (#8). Not auto-layout — fixed cell math only. */
2
+
3
+ export const DEFAULT_GRID = {
4
+ mode: 'grid',
5
+ origin: [40, 80],
6
+ cols: 4,
7
+ gapX: 30,
8
+ gapY: 40,
9
+ cellW: 130,
10
+ cellH: 64,
11
+ };
12
+
13
+ export function gridLayout(arch) {
14
+ const raw = arch.layout;
15
+ if (!raw || raw.mode !== 'grid') return null;
16
+ return { ...DEFAULT_GRID, ...raw };
17
+ }
18
+
19
+ export function resolveComponentPos(component, grid) {
20
+ if (Array.isArray(component.pos) && component.pos.length === 2) {
21
+ return component.pos;
22
+ }
23
+ if (!grid) return [NaN, NaN];
24
+ if (!Number.isInteger(component.row) || !Number.isInteger(component.col)) {
25
+ return [NaN, NaN];
26
+ }
27
+ const [ox, oy] = grid.origin;
28
+ const stepX = grid.cellW + grid.gapX;
29
+ const stepY = grid.cellH + grid.gapY;
30
+ return [ox + component.col * stepX, oy + component.row * stepY];
31
+ }
32
+
33
+ export function validateGridPlacement(arch, grid, problems) {
34
+ if (!grid) return;
35
+ if (arch.layout !== undefined && arch.layout.mode !== 'grid') {
36
+ problems.push('layout.mode must be "grid" when layout is set (free placement omits layout entirely).');
37
+ return;
38
+ }
39
+ const seen = new Map();
40
+ for (const c of arch.components ?? []) {
41
+ const hasPos = Array.isArray(c.pos) && c.pos.length === 2;
42
+ const hasCell = Number.isInteger(c.row) && Number.isInteger(c.col);
43
+ if (hasPos) continue; // pos wins; row/col are optional hints only
44
+ if (!hasPos && !hasCell) {
45
+ problems.push(`Component "${c.id}" needs pos [x,y] or grid row/col when layout.mode is "grid".`);
46
+ continue;
47
+ }
48
+ if (c.row < 0 || c.col < 0) {
49
+ problems.push(`Component "${c.id}" row/col must be non-negative integers.`);
50
+ continue;
51
+ }
52
+ if (c.col >= grid.cols) {
53
+ problems.push(`Component "${c.id}" col ${c.col} exceeds layout.cols ${grid.cols} (valid: 0..${grid.cols - 1}).`);
54
+ }
55
+ const key = `${c.row},${c.col}`;
56
+ if (seen.has(key)) {
57
+ problems.push(`Components "${seen.get(key)}" and "${c.id}" share grid cell row ${c.row} col ${c.col}.`);
58
+ } else {
59
+ seen.set(key, c.id);
60
+ }
61
+ }
62
+ }