fix: [verified] simplify Roadmap adoption timeline
Build and publish Eldorado documentation / build (pull_request) Successful in 54s
Build and publish Eldorado documentation / build (pull_request) Successful in 54s
This commit is contained in:
1 parent
63f38597a6
commit
2a4e058684
9 files changed
+185
-54
No files matched your search
@@ -20,23 +20,19 @@ export function roadmapViewer(html, spec) {
|
||||
if (start < 0 || next < start || end < next) throw new Error(`Roadmap node drift: ${node.id}`);
|
||||
const original = html.slice(start, end);
|
||||
const rect = /<rect x="([\d.-]+)" y="([\d.-]+)" width="([\d.]+)" height="([\d.]+)"/.exec(original);
|
||||
if (!rect || (original.match(/<text /g) || []).length !== 3) throw new Error(`Roadmap text contract drift: ${node.id}`);
|
||||
if (!rect || (original.match(/<text /g) || []).length !== 2) throw new Error(`Roadmap text contract drift: ${node.id}`);
|
||||
const [x,y,w,h] = rect.slice(1).map(Number);
|
||||
boxes.push({x,y,w,h});
|
||||
const text = (value, top, size, cls, attrs = 'data-detail="context"') => {
|
||||
const lines = wrap(value, size === 30 ? 18 : 21);
|
||||
const maxLines = top === 166 || top === 310 ? 3 : 2;
|
||||
const maxLines = top === 160 ? 3 : 2;
|
||||
if (lines.length > maxLines || lines.some(line => line.length > 21)) throw new Error(`Roadmap copy exceeds card capacity: ${node.id}`);
|
||||
return `<text x="${x+24}" y="${y+top}" font-size="${size}" class="${cls}" ${attrs}>${lines.map((line,i) => `<tspan x="${x+24}" dy="${i ? 34 : 0}">${escape(line)}</tspan>`).join('')}</text>`;
|
||||
};
|
||||
const [action, output] = node.sublabel.split('\nOutput: ');
|
||||
if (!action || !output || !node.tag.startsWith('Exit: ')) throw new Error(`Roadmap content contract drift: ${node.id}`);
|
||||
const content = text(String(index+1).padStart(2,'0'), 40, 26, 't-muted')
|
||||
if (!node.sublabel || node.tag || /Output:|Exit:|\n/.test(node.sublabel)) throw new Error(`Roadmap content contract drift: ${node.id}`);
|
||||
const content = text(String(index+1), 40, 26, 't-primary', 'data-stage-number="" font-weight="700"')
|
||||
+ text(node.label, 88, 30, 't-primary', 'data-node-label="" font-weight="700"')
|
||||
+ text(action, 166, 26, 't-primary')
|
||||
+ text('OUTPUT', 274, 20, 't-muted', 'font-weight="700"')
|
||||
+ text(output, 310, 26, 't-primary')
|
||||
+ text(node.tag, 416, 24, 't-primary');
|
||||
+ text(node.sublabel, 160, 26, 't-muted');
|
||||
// Preserve native node title/metadata and rectangles; replace sigil/text only.
|
||||
// Sigils are nested SVG groups. Anchor on the two native node rectangles.
|
||||
const rectangles = [...original.matchAll(/<rect\b[^>]*\/>/g)];
|
||||
@@ -58,7 +54,8 @@ export function roadmapViewer(html, spec) {
|
||||
[data-node-id] text {font-family: Arial, sans-serif;}
|
||||
svg[data-preset="classic"] [data-node-id] > rect.c-backend,
|
||||
svg[data-preset="editorial"] [data-node-id] > rect.c-backend {fill:var(--panel); stroke:var(--border);}
|
||||
svg[data-preset="classic"] .c-grid {opacity:0;}
|
||||
.c-grid {opacity:0;}
|
||||
|
||||
</style>`;
|
||||
html = html.replace(roots[0][0], root + styles);
|
||||
return html;
|
||||
|
||||
Reference in new issue
Block a user