@luhtech/site-template 0.14.3 → 0.14.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luhtech/site-template",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.4",
|
|
4
4
|
"description": "Shared Astro component library + content-instance contract for LuhTech venture marketing sites -- one template renders every site from content/page.schema.json + content/site.schema.json instances.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"luhtech": {
|
|
50
50
|
"schemaPins": {
|
|
51
|
-
"content/page.schema.json": "2.
|
|
51
|
+
"content/page.schema.json": "2.2.0",
|
|
52
52
|
"content/site.schema.json": "1.1.0",
|
|
53
53
|
"content/capability-claim.schema.json": "0.2.0",
|
|
54
54
|
"content/tool.schema.json": "1.1.0",
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import RingComparison from './diagrams/RingComparison.astro';
|
|
7
7
|
import VectorSum from './diagrams/VectorSum.astro';
|
|
8
8
|
import DataLineChart from './diagrams/DataLineChart.astro';
|
|
9
|
+
import ConnectionGraph from './diagrams/ConnectionGraph.astro';
|
|
9
10
|
|
|
10
11
|
export interface Props {
|
|
11
12
|
diagram: { diagramId: string; diagramType: string; caption?: string; data: any };
|
|
@@ -19,5 +20,8 @@ const { diagram, class: className = 'my-8' } = Astro.props;
|
|
|
19
20
|
{diagram.diagramType === 'data-line-chart' && (
|
|
20
21
|
<DataLineChart points={diagram.data.points} xLabel={diagram.data.xLabel} yLabel={diagram.data.yLabel} annotations={diagram.data.annotations} />
|
|
21
22
|
)}
|
|
23
|
+
{diagram.diagramType === 'connection-graph' && (
|
|
24
|
+
<ConnectionGraph diagramId={diagram.diagramId} nodes={diagram.data.nodes} edges={diagram.data.edges} />
|
|
25
|
+
)}
|
|
22
26
|
{diagram.caption && <figcaption class="text-sm text-ink/60 mt-2 text-center">{diagram.caption}</figcaption>}
|
|
23
27
|
</figure>
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
---
|
|
2
|
+
// d-2026-09-15-eb-platform-page-connection-diagram (C5, canonical-connection
|
|
3
|
+
// arc). A real node-and-edge relationship graph -- "what attaches to what" --
|
|
4
|
+
// distinct from RingComparison/VectorSum/DataLineChart, which all encode a
|
|
5
|
+
// single numeric comparison, not a structural relationship. Computed at
|
|
6
|
+
// build time (Astro frontmatter, server-side), matching RingComparison's
|
|
7
|
+
// own convention: the graph shape is fixed at author time, not user-editable.
|
|
8
|
+
//
|
|
9
|
+
// Layout: a longest-path layered (Sugiyama-style) DAG layout, generic over
|
|
10
|
+
// any real nodes[]/edges[] input -- not hand-tuned to one graph. Self-loops
|
|
11
|
+
// (a node citing itself, e.g. "a decision supersedes a decision") are
|
|
12
|
+
// excluded from layering and drawn as a small loop above the node instead.
|
|
13
|
+
export interface Node {
|
|
14
|
+
id: string;
|
|
15
|
+
label: string;
|
|
16
|
+
sub?: string;
|
|
17
|
+
hub?: boolean;
|
|
18
|
+
rail?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface Edge {
|
|
21
|
+
from: string;
|
|
22
|
+
to: string;
|
|
23
|
+
label?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface Props {
|
|
26
|
+
diagramId: string;
|
|
27
|
+
nodes: Node[];
|
|
28
|
+
edges: Edge[];
|
|
29
|
+
class?: string;
|
|
30
|
+
}
|
|
31
|
+
const { diagramId, nodes, edges, class: className = 'w-full h-auto' } = Astro.props;
|
|
32
|
+
|
|
33
|
+
const selfLoops = edges.filter((e) => e.from === e.to);
|
|
34
|
+
const crossEdges = edges.filter((e) => e.from !== e.to);
|
|
35
|
+
|
|
36
|
+
// Longest-path layering: layer(n) = 0 if no incoming cross-edge, else
|
|
37
|
+
// 1 + max(layer(source)) over incoming edges. Iterative relaxation with a
|
|
38
|
+
// bounded pass count (nodes.length) makes this safe even if the real data
|
|
39
|
+
// ever contains a longer cycle than a self-loop -- it converges to a stable
|
|
40
|
+
// (if imperfect) layering rather than looping forever.
|
|
41
|
+
const layer = new Map<string, number>(nodes.map((n) => [n.id, 0]));
|
|
42
|
+
for (let pass = 0; pass < nodes.length + 1; pass++) {
|
|
43
|
+
let changed = false;
|
|
44
|
+
for (const e of crossEdges) {
|
|
45
|
+
const want = (layer.get(e.from) ?? 0) + 1;
|
|
46
|
+
if (want > (layer.get(e.to) ?? 0)) {
|
|
47
|
+
layer.set(e.to, want);
|
|
48
|
+
changed = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!changed) break;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const maxLayer = Math.max(...Array.from(layer.values()), 0);
|
|
55
|
+
const columns: Node[][] = Array.from({ length: maxLayer + 1 }, () => []);
|
|
56
|
+
for (const n of nodes) columns[layer.get(n.id) ?? 0].push(n);
|
|
57
|
+
|
|
58
|
+
const NODE_W = 148;
|
|
59
|
+
const NODE_H = 56;
|
|
60
|
+
const ROW_GAP = 28;
|
|
61
|
+
const PAD = 24;
|
|
62
|
+
// COL_GAP must fit the longest cross-column edge label or the label
|
|
63
|
+
// overlaps both the node it leaves and the node it enters -- found live:
|
|
64
|
+
// "resolve to the cells they occupy" (33 chars) collided with both
|
|
65
|
+
// "Elements" and "The place" at a fixed 96px gap. ~5.4px/char is a safe
|
|
66
|
+
// upper-bound width estimate for JetBrains Mono at font-size 9 (no real
|
|
67
|
+
// text-measurement available at build time); same-column (bow) edges and
|
|
68
|
+
// self-loops don't consume COL_GAP, so only cross-column labels count.
|
|
69
|
+
const longestCrossLabel = Math.max(0, ...crossEdges.filter((e) => e.label).map((e) => e.label!.length));
|
|
70
|
+
const COL_GAP = Math.max(96, longestCrossLabel * 5.4 + 24);
|
|
71
|
+
// A node's own label/sub can be wider than NODE_W (centered text overflows
|
|
72
|
+
// evenly on both sides) -- for a node in the first or last column, that
|
|
73
|
+
// overflow can extend past the SVG's own viewBox edge and get clipped by
|
|
74
|
+
// the SVG itself, not just visually crowded. Found live: "Documents"'s sub
|
|
75
|
+
// "RFI · CO · submittal · drawing rev · BCF" (41 chars) overflowed ~36px
|
|
76
|
+
// past NODE_W/2 in column 0, landing at a negative x and losing its
|
|
77
|
+
// leading "RF" off the left edge of the canvas. Same char-width-estimate
|
|
78
|
+
// approach as COL_GAP above: Inter 600 12.5px runs wider per character
|
|
79
|
+
// than JetBrains Mono 9px, so it gets its own (more generous) rate.
|
|
80
|
+
const maxLabelOverflow = Math.max(
|
|
81
|
+
0,
|
|
82
|
+
...nodes.map((n) => (n.label.length * 7.3 - NODE_W) / 2),
|
|
83
|
+
...nodes.map((n) => (n.sub ? (n.sub.length * 5.4 - NODE_W) / 2 : 0)),
|
|
84
|
+
);
|
|
85
|
+
const PAD_X = PAD + Math.ceil(Math.max(0, maxLabelOverflow)) + 8;
|
|
86
|
+
// A self-loop draws its arc above the node and its label above the arc --
|
|
87
|
+
// both need real vertical room, not just PAD, or they render past y=0 and
|
|
88
|
+
// clip outside the viewBox (found live: the decision-supersedes-decision
|
|
89
|
+
// loop landed at y=-8, invisible in the built page). Reserved only when
|
|
90
|
+
// the graph actually has a self-loop, so every other diagram's canvas
|
|
91
|
+
// stays exactly as tight as before.
|
|
92
|
+
const LOOP_ROOM = selfLoops.length > 0 ? 40 : 0;
|
|
93
|
+
const topPad = PAD + LOOP_ROOM;
|
|
94
|
+
|
|
95
|
+
const maxRows = Math.max(...columns.map((c) => c.length), 1);
|
|
96
|
+
const colHeight = maxRows * NODE_H + (maxRows - 1) * ROW_GAP;
|
|
97
|
+
|
|
98
|
+
type Placed = Node & { x: number; y: number; cx: number; cy: number };
|
|
99
|
+
const positions = new Map<string, Placed>();
|
|
100
|
+
columns.forEach((col, ci) => {
|
|
101
|
+
const colH = col.length * NODE_H + (col.length - 1) * ROW_GAP;
|
|
102
|
+
const yOffset = topPad + (colHeight - colH) / 2;
|
|
103
|
+
col.forEach((n, ri) => {
|
|
104
|
+
const x = PAD_X + ci * (NODE_W + COL_GAP);
|
|
105
|
+
const y = yOffset + ri * (NODE_H + ROW_GAP);
|
|
106
|
+
positions.set(n.id, { ...n, x, y, cx: x + NODE_W / 2, cy: y + NODE_H / 2 });
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const width = PAD_X * 2 + (maxLayer + 1) * NODE_W + maxLayer * COL_GAP;
|
|
111
|
+
const height = topPad + PAD + colHeight;
|
|
112
|
+
|
|
113
|
+
// Cubic bezier from the right edge of `from` to the left edge of `to`
|
|
114
|
+
// (forward, cross-column edges), or a vertical bow between two nodes in
|
|
115
|
+
// the same column (a same-layer edge, e.g. cell -> ledger when both land
|
|
116
|
+
// in a late layer) -- a straight line between stacked nodes would pass
|
|
117
|
+
// straight through any node placed between them.
|
|
118
|
+
function edgePath(from: Placed, to: Placed): string {
|
|
119
|
+
if (from.x === to.x) {
|
|
120
|
+
const x1 = from.cx + NODE_W / 2 + 2;
|
|
121
|
+
const y1 = from.cy;
|
|
122
|
+
const x2 = to.cx + NODE_W / 2 + 2;
|
|
123
|
+
const y2 = to.cy;
|
|
124
|
+
const bow = 36;
|
|
125
|
+
return `M ${x1} ${y1} C ${x1 + bow} ${y1}, ${x2 + bow} ${y2}, ${x2} ${y2}`;
|
|
126
|
+
}
|
|
127
|
+
const x1 = from.x + NODE_W;
|
|
128
|
+
const y1 = from.cy;
|
|
129
|
+
const x2 = to.x;
|
|
130
|
+
const y2 = to.cy;
|
|
131
|
+
const mx = (x1 + x2) / 2;
|
|
132
|
+
return `M ${x1} ${y1} C ${mx} ${y1}, ${mx} ${y2}, ${x2} ${y2}`;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const drawnCrossEdges = crossEdges
|
|
136
|
+
.map((e) => {
|
|
137
|
+
const from = positions.get(e.from);
|
|
138
|
+
const to = positions.get(e.to);
|
|
139
|
+
if (!from || !to) return null;
|
|
140
|
+
return { ...e, from, to, path: edgePath(from, to) };
|
|
141
|
+
})
|
|
142
|
+
.filter((e): e is NonNullable<typeof e> => e !== null);
|
|
143
|
+
|
|
144
|
+
const drawnSelfLoops = selfLoops
|
|
145
|
+
.map((e) => {
|
|
146
|
+
const at = positions.get(e.from);
|
|
147
|
+
if (!at) return null;
|
|
148
|
+
const x = at.cx;
|
|
149
|
+
const yTop = at.y;
|
|
150
|
+
const r = 16;
|
|
151
|
+
const path = `M ${x - 10} ${yTop} C ${x - 10} ${yTop - r * 2}, ${x + 10} ${yTop - r * 2}, ${x + 10} ${yTop}`;
|
|
152
|
+
return { ...e, x, y: yTop - r * 2 - 6, path };
|
|
153
|
+
})
|
|
154
|
+
.filter((e): e is NonNullable<typeof e> => e !== null);
|
|
155
|
+
|
|
156
|
+
const markerId = `cg-arrow-${diagramId}`;
|
|
157
|
+
const ariaLabel = `Connection graph: ${nodes.length} nodes -- ${nodes.map((n) => n.label).join(', ')}. ${edges.length} relationships: ${edges
|
|
158
|
+
.map((e) => `${nodes.find((n) => n.id === e.from)?.label ?? e.from} to ${nodes.find((n) => n.id === e.to)?.label ?? e.to}${e.label ? ` (${e.label})` : ''}`)
|
|
159
|
+
.join('; ')}.`;
|
|
160
|
+
---
|
|
161
|
+
<svg
|
|
162
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
163
|
+
viewBox={`0 0 ${width} ${height}`}
|
|
164
|
+
class={className}
|
|
165
|
+
role="img"
|
|
166
|
+
aria-label={ariaLabel}
|
|
167
|
+
>
|
|
168
|
+
<defs>
|
|
169
|
+
<marker id={markerId} markerWidth="8" markerHeight="8" refX="6" refY="3" orient="auto" markerUnits="strokeWidth">
|
|
170
|
+
<path d="M0,0 L0,6 L6,3 z" fill="currentColor" fill-opacity="0.55" />
|
|
171
|
+
</marker>
|
|
172
|
+
</defs>
|
|
173
|
+
|
|
174
|
+
{drawnCrossEdges.map((e) => (
|
|
175
|
+
<g class="text-ink/50">
|
|
176
|
+
<path d={e.path} fill="none" stroke="currentColor" stroke-width="1.25" stroke-opacity="0.4" marker-end={`url(#${markerId})`} />
|
|
177
|
+
{e.label && (
|
|
178
|
+
<text
|
|
179
|
+
x={(e.from.x + NODE_W + e.to.x) / 2}
|
|
180
|
+
y={(e.from.cy + e.to.cy) / 2 - 5}
|
|
181
|
+
text-anchor="middle"
|
|
182
|
+
font-family="JetBrains Mono, monospace"
|
|
183
|
+
font-size="9"
|
|
184
|
+
fill="currentColor"
|
|
185
|
+
fill-opacity="0.65"
|
|
186
|
+
>{e.label}</text>
|
|
187
|
+
)}
|
|
188
|
+
</g>
|
|
189
|
+
))}
|
|
190
|
+
|
|
191
|
+
{drawnSelfLoops.map((e) => (
|
|
192
|
+
<g class="text-ink/50">
|
|
193
|
+
<path d={e.path} fill="none" stroke="currentColor" stroke-width="1.25" stroke-opacity="0.4" marker-end={`url(#${markerId})`} />
|
|
194
|
+
{e.label && (
|
|
195
|
+
<text x={e.x} y={e.y - 5} text-anchor="middle" font-family="JetBrains Mono, monospace" font-size="9" fill="currentColor" fill-opacity="0.65">{e.label}</text>
|
|
196
|
+
)}
|
|
197
|
+
</g>
|
|
198
|
+
))}
|
|
199
|
+
|
|
200
|
+
{Array.from(positions.values()).map((n) => (
|
|
201
|
+
<g>
|
|
202
|
+
<rect
|
|
203
|
+
x={n.x}
|
|
204
|
+
y={n.y}
|
|
205
|
+
width={NODE_W}
|
|
206
|
+
height={NODE_H}
|
|
207
|
+
rx={n.rail ? 6 : 10}
|
|
208
|
+
class={n.hub ? 'text-accent-primary' : 'text-ink'}
|
|
209
|
+
fill="currentColor"
|
|
210
|
+
fill-opacity={n.hub ? 0.14 : 0.04}
|
|
211
|
+
stroke="currentColor"
|
|
212
|
+
stroke-opacity={n.hub ? 0.7 : 0.35}
|
|
213
|
+
stroke-width={n.hub ? 2 : 1.25}
|
|
214
|
+
stroke-dasharray={n.rail ? '3 3' : undefined}
|
|
215
|
+
/>
|
|
216
|
+
<text
|
|
217
|
+
x={n.cx}
|
|
218
|
+
y={n.sub ? n.cy - 5 : n.cy + 4}
|
|
219
|
+
text-anchor="middle"
|
|
220
|
+
font-family="Inter, sans-serif"
|
|
221
|
+
font-weight="600"
|
|
222
|
+
font-size="12.5"
|
|
223
|
+
fill="currentColor"
|
|
224
|
+
class="text-ink"
|
|
225
|
+
>{n.label}</text>
|
|
226
|
+
{n.sub && (
|
|
227
|
+
<text
|
|
228
|
+
x={n.cx}
|
|
229
|
+
y={n.cy + 13}
|
|
230
|
+
text-anchor="middle"
|
|
231
|
+
font-family="JetBrains Mono, monospace"
|
|
232
|
+
font-size="9"
|
|
233
|
+
fill="currentColor"
|
|
234
|
+
fill-opacity="0.55"
|
|
235
|
+
class="text-ink"
|
|
236
|
+
>{n.sub}</text>
|
|
237
|
+
)}
|
|
238
|
+
</g>
|
|
239
|
+
))}
|
|
240
|
+
</svg>
|
|
@@ -8,15 +8,32 @@
|
|
|
8
8
|
// silently. Same fix shape as Section.astro's own crossLinks[] fix
|
|
9
9
|
// (see that file's comment): a documented, schema-legal mechanism that
|
|
10
10
|
// one section-kind component had quietly never wired up.
|
|
11
|
+
//
|
|
12
|
+
// diagrams pass-through (d-2026-09-15-eb-platform-page-connection-diagram,
|
|
13
|
+
// C5 of canonical-connection): Article.astro already passes section.diagrams
|
|
14
|
+
// into Block (and renders any diagram not referenced by a block, in its own
|
|
15
|
+
// fallback strip) -- Approach.astro never did either, so a page.schema.json
|
|
16
|
+
// mustCarry:"diagram" approach section (e.g. page-platform.json's own
|
|
17
|
+
// template) crashed the build the moment it actually carried one: Block.astro
|
|
18
|
+
// throws when a diagram-type block's diagramId can't resolve against an
|
|
19
|
+
// empty diagrams[] default. Same fix, same fallback-strip shape as Article.astro.
|
|
11
20
|
import Block from '../Block.astro';
|
|
21
|
+
import Diagram from '../Diagram.astro';
|
|
12
22
|
import SectionHeading from '../SectionHeading.astro';
|
|
13
23
|
import type { SectionIcons } from '../Section.astro';
|
|
14
24
|
|
|
15
25
|
export interface Props { section: any; icons?: SectionIcons }
|
|
16
26
|
const { section, icons } = Astro.props;
|
|
17
27
|
const sectionIcon = icons?.section?.[section.sectionId];
|
|
28
|
+
const referencedDiagramIds = new Set((section.blocks ?? []).filter((b: any) => b.blockType === 'diagram').map((b: any) => b.diagramId));
|
|
29
|
+
const unreferencedDiagrams = (section.diagrams ?? []).filter((d: any) => !referencedDiagramIds.has(d.diagramId));
|
|
18
30
|
---
|
|
19
31
|
<section id={section.sectionId} class="py-8" data-reveal>
|
|
20
32
|
<SectionHeading eyebrow={section.eyebrow} heading={section.heading} subheading={section.subheading} icon={sectionIcon} />
|
|
21
|
-
{section.blocks?.map((b: any) => <Block block={b} class="mb-3" />)}
|
|
33
|
+
{section.blocks?.map((b: any) => <Block block={b} diagrams={section.diagrams} class="mb-3" />)}
|
|
34
|
+
{unreferencedDiagrams.length > 0 && (
|
|
35
|
+
<div class="space-y-8 mt-8">
|
|
36
|
+
{unreferencedDiagrams.map((d: any) => <Diagram diagram={d} />)}
|
|
37
|
+
</div>
|
|
38
|
+
)}
|
|
22
39
|
</section>
|
package/src/content/loadPage.ts
CHANGED
|
@@ -3,7 +3,7 @@ import Ajv from 'ajv';
|
|
|
3
3
|
import addFormats from 'ajv-formats';
|
|
4
4
|
import { fetchSchema, fetchSupportSchema } from './schemaFetch.js';
|
|
5
5
|
|
|
6
|
-
const PAGE_PIN = '2.
|
|
6
|
+
const PAGE_PIN = '2.2.0';
|
|
7
7
|
const CAPABILITY_CLAIM_PIN = '0.2.0';
|
|
8
8
|
|
|
9
9
|
let validatorPromise: ReturnType<typeof buildValidator> | null = null;
|