Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
fix(viewer): keep compact guided views clear of toolbar
tt-a1i056e0357fb2f
diff --git a/archify/assets/template.html b/archify/assets/template.htmlindex 0d6afbb5..f2edcd10 100644--- a/archify/assets/template.html+++ b/archify/assets/template.html@@ -3049,7 +3049,9 @@ OTHER DEALINGS IN THE FONT SOFTWARE..header { margin-bottom: 0.875rem; }.cards { margin-top: 0.75rem; }html[data-nav-stage-rail="true"] body { padding-block: 0.375rem; }- html[data-nav-stage-rail="true"] .header { margin-bottom: 0.5rem; }+ /* The fixed toolbar ends at 60px; compact top padding must still leave+ the following guide below its hit area, even with a one-line title. */+ html[data-nav-stage-rail="true"] .header { min-height: 3.375rem; margin-bottom: 0.5rem; }html[data-nav-stage-rail="true"] .guided-views { margin-bottom: 0.375rem; }html[data-nav-stage-rail="true"] .diagram-container[data-nav-stage-rail="true"] { padding-top: 0.5rem; }html[data-nav-stage-rail="true"] .cards { margin-top: 0.375rem; }diff --git a/archify/test/compact-header-clearance.test.mjs b/archify/test/compact-header-clearance.test.mjsnew file mode 100644index 00000000..b2777712--- /dev/null+++ b/archify/test/compact-header-clearance.test.mjs@@ -0,0 +1,65 @@+import test from 'node:test';+import assert from 'node:assert/strict';+import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { execFileSync } from 'node:child_process';+import { fileURLToPath, pathToFileURL } from 'node:url';+import { ChromeVisualBrowser, findChrome } from '../bin/visual-check.mjs';++const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');+test('compact stage rail keeps guided views below the fixed toolbar', async (t) => {+ if (!Object.hasOwn(process.env, 'ARCHIFY_CHROME')) return t.skip('Set ARCHIFY_CHROME for real browser checks');+ const chrome = findChrome();+ assert.ok(chrome);+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-header-clearance-'));+ const spec = JSON.parse(fs.readFileSync(path.join(root, 'examples/web-app.architecture.json'), 'utf8'));+ spec.meta.title = 'Service map';+ delete spec.meta.subtitle;+ const input = path.join(dir, 'input.json');+ const output = path.join(dir, 'output.html');+ fs.writeFileSync(input, JSON.stringify(spec));+ execFileSync(process.execPath, [path.join(root, 'bin/archify.mjs'), 'render', 'architecture', input, output]);+ const browser = new ChromeVisualBrowser(chrome);+ try {+ const session = await browser.sessionPromise;+ const send = (method, params = {}) => browser.cdp.send(method, params, session);+ const evaluate = async (expression) => {+ const result = await send('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true });+ assert.equal(result.exceptionDetails, undefined);+ return result.result?.value;+ };+ let geometry;+ for (const [width, height] of [[1440, 900], [1600, 900], [2048, 1320]]) {+ await send('Emulation.setDeviceMetricsOverride', { width, height, deviceScaleFactor: 1, mobile: false });+ const loaded = browser.cdp.waitFor('Page.loadEventFired', session);+ await send('Page.navigate', { url: pathToFileURL(output).href });+ await loaded;+ for (const theme of ['light', 'dark']) {+ const observed = await evaluate(`(async () => {+ await document.fonts.ready;+ if (document.documentElement.dataset.theme !== '${theme}') document.getElementById('btn-theme').click();+ await Archify.layoutStability.whenStable();+ const toolbar = document.querySelector('.toolbar').getBoundingClientRect();+ const guide = document.querySelector('.guided-views').getBoundingClientRect();+ const svg = document.querySelector('.diagram-container > svg');+ return { rail: document.documentElement.dataset.navStageRail,+ toolbarBottom: toolbar.bottom, guideTop: guide.top, guideWidth: guide.width,+ scrollWidth: document.documentElement.scrollWidth,+ geometry: [svg.getAttribute('viewBox'), ...Array.from(svg.querySelectorAll('[data-node-id]')).map(node =>+ [node.getAttribute('transform'), ...Array.from(node.querySelectorAll('text')).map(text => text.getAttribute('font-size'))])] };+ })()`);+ const label = `${width}x${height}/${theme}`;+ assert.equal(observed.rail, 'true', label + ': fixture must exercise the compact rail');+ assert.ok(observed.guideWidth > 0, label + ': guide must be visible');+ assert.ok(observed.guideTop >= observed.toolbarBottom + 4, label + ': toolbar overlaps guide ' + JSON.stringify(observed));+ assert.ok(observed.scrollWidth <= width, label + ': horizontal overflow');+ if (geometry) assert.deepEqual(observed.geometry, geometry, label + ': authored node geometry/font changed');+ else geometry = observed.geometry;+ }+ }+ } finally {+ await browser.close();+ fs.rmSync(dir, { recursive: true, force: true });+ }+});diff --git a/scripts/run-browser-tests.mjs b/scripts/run-browser-tests.mjsindex 96f1f4ef..13474011 100644--- a/scripts/run-browser-tests.mjs+++ b/scripts/run-browser-tests.mjs@@ -15,6 +15,7 @@ const testFiles = ['reader-layout-settle-browser.test.mjs','joint-layout-browser.test.mjs','sequence-header-clearance.test.mjs',+ 'compact-header-clearance.test.mjs','lifecycle-rail-browser.test.mjs','export-cleanup-browser.test.mjs','offline-font-browser.test.mjs',diff --git a/viewer/viewer.css b/viewer/viewer.cssindex bf5f7513..670e0522 100644--- a/viewer/viewer.css+++ b/viewer/viewer.css@@ -2880,7 +2880,9 @@ html[data-preset="signal-flow"][data-theme="light"] .card {.header { margin-bottom: 0.875rem; }.cards { margin-top: 0.75rem; }html[data-nav-stage-rail="true"] body { padding-block: 0.375rem; }- html[data-nav-stage-rail="true"] .header { margin-bottom: 0.5rem; }+ /* The fixed toolbar ends at 60px; compact top padding must still leave+ the following guide below its hit area, even with a one-line title. */+ html[data-nav-stage-rail="true"] .header { min-height: 3.375rem; margin-bottom: 0.5rem; }html[data-nav-stage-rail="true"] .guided-views { margin-bottom: 0.375rem; }html[data-nav-stage-rail="true"] .diagram-container[data-nav-stage-rail="true"] { padding-top: 0.5rem; }html[data-nav-stage-rail="true"] .cards { margin-top: 0.375rem; }