Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

Design the explainer toolbar as one set of controls

tt-a1i75c9010a82c0
diff --git a/archify/explainer/reader.css b/archify/explainer/reader.css
index 2a6a1a67..21d8edc4 100644
--- a/archify/explainer/reader.css
+++ b/archify/explainer/reader.css
@@ -27,11 +27,39 @@ code{font-size:.86em;background:var(--code);border:1px solid var(--rule);padding
.shell{width:min(1280px,calc(100% - 64px));margin:auto}
.masthead{display:flex;align-items:center;justify-content:space-between;gap:32px;padding:36px 0 22px}
h1{font:700 26px/1.35 var(--sans);color:var(--ink);letter-spacing:-.015em;max-width:900px;overflow-wrap:anywhere}
+/* Toolbar: one height, one radius, one type size for every control */
.js .tools{display:flex!important;align-items:center;gap:8px;flex-shrink:0}
-.tools button{font-size:12px;color:var(--muted)}
-.theme-controls{display:flex;border:1px solid var(--rule-strong);border-radius:8px;padding:2px;gap:2px;background:var(--panel)}
-.theme-controls button{border:0;border-radius:6px;padding:2px 10px;background:none}
-.theme-controls button[aria-pressed=true]{background:var(--sunk);color:var(--ink);font-weight:500}
+.tools button{font-size:12.5px;line-height:1;color:var(--secondary)}
+.tools :focus{outline:none}
+.tools :focus-visible{outline:2px solid var(--accent);outline-offset:2px}
+.tool-button{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 11px;border:1px solid var(--control-border,var(--rule-strong));border-radius:8px;background:var(--panel);box-shadow:0 1px 1px rgb(16 24 40/.03);transition:background .15s,border-color .15s,color .15s}
+.tool-button:hover{background:var(--sunk);color:var(--ink)}
+.tool-button:disabled{opacity:.55;cursor:progress}
+.tool-icon{width:15px;height:15px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
+.tool-button .tool-icon{color:var(--muted)}
+.tool-button:hover .tool-icon{color:var(--ink)}
+.theme-controls{display:flex;align-items:center;height:30px;border:1px solid var(--control-border,var(--rule-strong));border-radius:8px;padding:2px;gap:2px;background:var(--panel);box-shadow:0 1px 1px rgb(16 24 40/.03)}
+.theme-controls button{height:24px;border:0;border-radius:6px;padding:0 10px;background:none;color:var(--muted)}
+.theme-controls button:hover{color:var(--ink);background:var(--sunk)}
+.theme-controls button[aria-pressed=true]{background:var(--sunk);color:var(--ink);font-weight:600;box-shadow:inset 0 0 0 1px var(--rule)}
+.style-menu{position:relative}
+/* The same control shape for the walk-through bar, its start buttons and the question dialog */
+.walk-bar button,.walk-start:not(.text-button),.ask-dialog footer button{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 11px;border:1px solid var(--control-border,var(--rule-strong));border-radius:8px;font-size:12.5px;line-height:1}
+.ask-dialog footer button{height:32px;padding:0 14px}
+.style-menu [data-style-toggle] .tool-icon{width:13px;height:13px;margin-left:1px;transition:transform .15s}
+.style-menu [aria-expanded=true] .tool-icon{transform:rotate(180deg)}
+.style-swatch{width:14px;height:14px;flex-shrink:0;border-radius:50%;box-shadow:inset 0 0 0 1px rgb(0 0 0/.12)}
+.style-swatch[data-swatch=clean]{background:linear-gradient(135deg,#f4f5f7 50%,#2457d6 50%)}
+.style-swatch[data-swatch=editorial]{background:linear-gradient(135deg,#f6f2ea 50%,#9c2f1f 50%)}
+.style-swatch[data-swatch=product]{background:linear-gradient(135deg,#f1efff 50%,#5b4bf5 50%)}
+.style-swatch[data-swatch=swiss]{background:linear-gradient(135deg,#fff 50%,#ff4f00 50%)}
+.style-options{position:absolute;right:0;top:calc(100% + 6px);z-index:40;min-width:148px;padding:4px;background:var(--panel);border:1px solid var(--control-border,var(--rule-strong));border-radius:10px;box-shadow:0 12px 32px rgb(16 24 40/.14)}
+.style-options button{display:flex;align-items:center;gap:9px;width:100%;height:32px;padding:0 10px;border:0;border-radius:6px;background:none;text-align:left}
+.style-options button span:not(.style-swatch){flex:1}
+.style-options button:hover,.style-options button:focus-visible{background:var(--sunk);outline:none;color:var(--ink)}
+.style-options .tool-icon{width:14px;height:14px;color:var(--accent);visibility:hidden}
+.style-options [aria-checked=true]{color:var(--ink);font-weight:600}
+.style-options [aria-checked=true] .tool-icon{visibility:visible}
/* Board */
.board{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:16px;align-items:stretch}
@@ -285,16 +313,16 @@ dialog::backdrop{background:rgb(10 10 12/.55);backdrop-filter:blur(2px)}
light palette and a screen-only dark palette, so print always uses the light one. */
:root[data-style=editorial]{--paper:#f6f2ea;--panel:#fbf8f2;--surface:#fbf8f2;--sunk:#f1ece2;--zebra:#f3eee5;--code:#f1ece2;--ink:#1d1a16;--secondary:#3a352e;--muted:#7a7166;--faint:#a39a8e;--rule:#e4dccf;--rule-strong:#d4c9b8;--accent:#9c2f1f;--accent-soft:#f4e6df;--accent-ink:#86261a;--marker:#f0d9cf;--badge:#1d1a16;--badge-ink:#fbf8f2;--shadow:none;--serif:"Songti SC","Noto Serif SC","Source Han Serif SC",Georgia,"Times New Roman",serif}
:root[data-style=product]{--paper:#f3f4f8;--panel:#fff;--surface:#fff;--sunk:#f5f6fb;--zebra:#f7f8fc;--code:#f5f6fb;--ink:#0b0d12;--secondary:#272b35;--muted:#626a7b;--faint:#99a0ae;--rule:#e7e9f0;--rule-strong:#d7dbe6;--accent:#5b4bf5;--accent-soft:#f1efff;--accent-ink:#4a3be0;--marker:#e4e0ff;--badge:#5b4bf5;--badge-ink:#fff;--shadow:0 1px 2px rgb(16 24 40/.04),0 8px 24px rgb(16 24 40/.06)}
-:root[data-style=swiss]{--paper:#fff;--panel:#fff;--surface:#fff;--sunk:#f4f4f4;--zebra:#f7f7f7;--code:#f4f4f4;--ink:#000;--secondary:#1f1f1f;--muted:#6b6b6b;--faint:#a0a0a0;--rule:#e6e6e6;--rule-strong:#000;--accent:#ff4f00;--accent-soft:#fff0e8;--accent-ink:#d94300;--marker:#ffe0cf;--badge:#000;--badge-ink:#fff;--shadow:none}
+:root[data-style=swiss]{--control-border:#d4d4d4;--paper:#fff;--panel:#fff;--surface:#fff;--sunk:#f4f4f4;--zebra:#f7f7f7;--code:#f4f4f4;--ink:#000;--secondary:#1f1f1f;--muted:#6b6b6b;--faint:#a0a0a0;--rule:#e6e6e6;--rule-strong:#000;--accent:#ff4f00;--accent-soft:#fff0e8;--accent-ink:#d94300;--marker:#ffe0cf;--badge:#000;--badge-ink:#fff;--shadow:none}
@media screen{
:root[data-style=editorial][data-theme=dark]{--paper:#171512;--panel:#1d1a16;--surface:#1d1a16;--sunk:#24211c;--zebra:#211e19;--code:#24211c;--ink:#f2ece2;--secondary:#d8d0c4;--muted:#a1978a;--faint:#6f675d;--rule:#2e2a24;--rule-strong:#3d372f;--accent:#e0806b;--accent-soft:#2e1d18;--accent-ink:#f0a08c;--marker:#4a2a20;--badge:#f2ece2;--badge-ink:#171512}
:root[data-style=product][data-theme=dark]{--paper:#0d0e14;--panel:#161824;--surface:#161824;--sunk:#1c1f2e;--zebra:#1a1c29;--code:#1c1f2e;--ink:#f2f3f8;--secondary:#cfd2de;--muted:#8e93a8;--faint:#5d6278;--rule:#262a3b;--rule-strong:#333850;--accent:#8d80ff;--accent-soft:#211e40;--accent-ink:#b3aaff;--marker:#2f2a5c;--badge:#8d80ff;--badge-ink:#0d0e14;--shadow:0 1px 2px rgb(0 0 0/.4)}
-:root[data-style=swiss][data-theme=dark]{--paper:#0a0a0a;--panel:#0a0a0a;--surface:#0a0a0a;--sunk:#161616;--zebra:#121212;--code:#161616;--ink:#fff;--secondary:#e6e6e6;--muted:#9a9a9a;--faint:#5c5c5c;--rule:#262626;--rule-strong:#fff;--accent:#ff6a1f;--accent-soft:#2a1508;--accent-ink:#ff8a4d;--marker:#4a2410;--badge:#fff;--badge-ink:#000}
+:root[data-style=swiss][data-theme=dark]{--control-border:#363636;--paper:#0a0a0a;--panel:#0a0a0a;--surface:#0a0a0a;--sunk:#161616;--zebra:#121212;--code:#161616;--ink:#fff;--secondary:#e6e6e6;--muted:#9a9a9a;--faint:#5c5c5c;--rule:#262626;--rule-strong:#fff;--accent:#ff6a1f;--accent-soft:#2a1508;--accent-ink:#ff8a4d;--marker:#4a2410;--badge:#fff;--badge-ink:#000}
}
@media screen and (prefers-color-scheme:dark){
:root[data-style=editorial]:not([data-theme]){--paper:#171512;--panel:#1d1a16;--surface:#1d1a16;--sunk:#24211c;--zebra:#211e19;--code:#24211c;--ink:#f2ece2;--secondary:#d8d0c4;--muted:#a1978a;--faint:#6f675d;--rule:#2e2a24;--rule-strong:#3d372f;--accent:#e0806b;--accent-soft:#2e1d18;--accent-ink:#f0a08c;--badge:#f2ece2;--badge-ink:#171512}
:root[data-style=product]:not([data-theme]){--paper:#0d0e14;--panel:#161824;--surface:#161824;--sunk:#1c1f2e;--zebra:#1a1c29;--code:#1c1f2e;--ink:#f2f3f8;--secondary:#cfd2de;--muted:#8e93a8;--faint:#5d6278;--rule:#262a3b;--rule-strong:#333850;--accent:#8d80ff;--accent-soft:#211e40;--accent-ink:#b3aaff;--badge:#8d80ff;--badge-ink:#0d0e14}
-:root[data-style=swiss]:not([data-theme]){--paper:#0a0a0a;--panel:#0a0a0a;--surface:#0a0a0a;--sunk:#161616;--zebra:#121212;--code:#161616;--ink:#fff;--secondary:#e6e6e6;--muted:#9a9a9a;--faint:#5c5c5c;--rule:#262626;--rule-strong:#fff;--accent:#ff6a1f;--accent-soft:#2a1508;--accent-ink:#ff8a4d;--badge:#fff;--badge-ink:#000}
+:root[data-style=swiss]:not([data-theme]){--control-border:#363636;--paper:#0a0a0a;--panel:#0a0a0a;--surface:#0a0a0a;--sunk:#161616;--zebra:#121212;--code:#161616;--ink:#fff;--secondary:#e6e6e6;--muted:#9a9a9a;--faint:#5c5c5c;--rule:#262626;--rule-strong:#fff;--accent:#ff6a1f;--accent-soft:#2a1508;--accent-ink:#ff8a4d;--badge:#fff;--badge-ink:#000}
}
/* Editorial: a long read. Serif headings, hairline rules, no cards. */
[data-style=editorial] body{font-size:15px}
@@ -346,7 +374,6 @@ dialog::backdrop{background:rgb(10 10 12/.55);backdrop-filter:blur(2px)}
:root[data-style=editorial] .answer-id,:root[data-style=swiss] .answer-id{background:none;color:var(--accent)}
:root[data-style=product] .answer-id{color:var(--badge-ink)}
[data-style=editorial] .chart,[data-style=swiss] .chart{--pele-series-1:color-mix(in srgb,var(--ink) 45%,var(--paper));--pele-series-2:var(--accent)}
-.style-select{font:inherit;font-size:12px;color:var(--muted);background:var(--panel);border:1px solid var(--rule-strong);border-radius:8px;padding:3px 8px}
/* Narrow desktop windows */
@media(max-width:1255px){.diagram-panel,.diagram-panel+.panel,.panel:has(+.diagram-panel){grid-column:span 12}}
diff --git a/archify/explainer/reader.js b/archify/explainer/reader.js
index 175f7aca..e5e49364 100644
--- a/archify/explainer/reader.js
+++ b/archify/explainer/reader.js
@@ -211,9 +211,27 @@
preference.addEventListener?.('change',applyTheme);
document.querySelector('[data-print]').addEventListener('click',()=>window.print());
// The author picks a default style; a reader's own choice is kept for every explainer page.
- const styleChoice = document.querySelector('[data-style-choice]');
- try { const saved = localStorage.getItem('archify-explainer-style'); if (saved && [...styleChoice.options].some(option=>option.value === saved)) { root.dataset.style = saved; styleChoice.value = saved; } } catch {}
- styleChoice?.addEventListener('change',()=>{ root.dataset.style = styleChoice.value; try { localStorage.setItem('archify-explainer-style',styleChoice.value); } catch {} requestAnimationFrame(()=>{ layoutBoard(); ensureDiagramReadability(); }); });
+ // A small menu, not a native select, so it matches the toolbar; arrow keys move, Escape closes.
+ const styleToggle = document.querySelector('[data-style-toggle]'), styleMenu = document.querySelector('.style-options');
+ const styleItems = all('[data-style-choice]',styleMenu || document);
+ const setStyle = (style, remember) => {
+ if (!styleItems.some(item=>item.dataset.styleChoice === style)) return;
+ root.dataset.style = style;
+ styleItems.forEach(item=>item.setAttribute('aria-checked',String(item.dataset.styleChoice === style)));
+ styleToggle.querySelector('[data-style-label]').textContent = words.styles[style];
+ styleToggle.querySelector('.style-swatch').dataset.swatch = style;
+ if (remember) { try { localStorage.setItem('archify-explainer-style',style); } catch {} requestAnimationFrame(()=>{ layoutBoard(); ensureDiagramReadability(); }); }
+ };
+ const toggleMenu = open => { styleMenu.hidden = !open; styleToggle.setAttribute('aria-expanded',String(open)); if (open) (styleItems.find(item=>item.getAttribute('aria-checked') === 'true') || styleItems[0]).focus(); };
+ try { const saved = localStorage.getItem('archify-explainer-style'); if (saved) setStyle(saved,false); } catch {}
+ styleToggle?.addEventListener('click',()=>toggleMenu(styleMenu.hidden));
+ styleItems.forEach(item=>item.addEventListener('click',()=>{ setStyle(item.dataset.styleChoice,true); toggleMenu(false); styleToggle.focus(); }));
+ styleMenu?.addEventListener('keydown',event=>{
+ const index = styleItems.indexOf(document.activeElement);
+ if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); styleItems[(index + (event.key === 'ArrowDown' ? 1 : -1) + styleItems.length) % styleItems.length].focus(); }
+ else if (event.key === 'Escape' || event.key === 'Tab') { toggleMenu(false); if (event.key === 'Escape') styleToggle.focus(); }
+ });
+ document.addEventListener('click',event=>{ if (styleMenu && !styleMenu.hidden && !event.target.closest('.style-menu')) toggleMenu(false); });
// Long image: the page as laid out now, drawn through an SVG foreignObject at twice the pixel
// density. Controls, dialogs and walk-through bars are left out. Browsers that refuse to export a
// foreignObject canvas (Safari) get a notice pointing to Print / PDF.
diff --git a/archify/explainer/render.mjs b/archify/explainer/render.mjs
index 232e137f..2b739c49 100644
--- a/archify/explainer/render.mjs
+++ b/archify/explainer/render.mjs
@@ -12,6 +12,14 @@ const js = fs.readFileSync(new URL('./reader.js', import.meta.url), 'utf8');
const escape = value => String(value ?? '').replace(/[&<>"']/g, character => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[character]));
const json = value => JSON.stringify(value).replace(/[<>&\u2028\u2029]/g, character => `\\u${character.charCodeAt(0).toString(16).padStart(4, '0')}`);
const hash = text => createHash('sha256').update(text).digest('hex');
+// Toolbar glyphs, drawn with currentColor so they follow the theme.
+const icon = path => `<svg class="tool-icon" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="${path}"/></svg>`;
+const icons = {
+ chevron: icon('M4.5 6.5 8 10l3.5-3.5'),
+ check: icon('M3.5 8.5 6.5 11.5 12.5 4.5'),
+ image: icon('M2.5 3.5h11v9h-11zM2.5 10.5l3-3 3 3 2-2 3 3M10.5 6.25a.75.75 0 1 0 0 .01'),
+ print: icon('M4.5 6V2.5h7V6M4.5 11.5h-2v-5h11v5h-2M4.5 9.5h7v4h-7z'),
+};
const dictionaries = {
en:{answer:'Answer',answerMark:'A',scope:'Applies to',sources:'Sources',print:'Print / PDF',image:'Image',style:'Style',styles:{clean:'Clean',editorial:'Editorial',product:'Product',swiss:'Swiss'},auto:'System',light:'Light',dark:'Dark',typical:'Typical value',explore:'Explore diagram',close:'Close',loading:'Opening diagram…',graph:'Diagram structure',changes:'Structure changes',added:'Added',removed:'Removed',modified:'Modified',copy:'Copy',copied:'Copied',walk:'Step through',walkMessages:'Play messages',prev:'Back',next:'Next',end:'Done',ask:'Ask',askQuote:'Ask about this',askPlaceholder:'What is unclear, or what should this part cover?',askCopy:'Copy question',askCopied:'Copied. Paste it to your agent.',askCancel:'Cancel',askChips:['I do not follow this part','Go deeper','Give an example','What is this based on?'],askPage:'Page',askFile:'File',askWhere:'Where',askQuoteLabel:'Quote',askQuestion:'Question',askPatch:'Revise only this panel with Archify panel replacement (patch explainer), keeping its ID.'},
zh:{answer:'结论',answerMark:'答',scope:'适用于',sources:'来源',print:'打印 / PDF',image:'长图',style:'样式',styles:{clean:'简洁',editorial:'杂志',product:'产品',swiss:'网格'},auto:'系统',light:'浅色',dark:'深色',typical:'典型值',explore:'展开探索',close:'关闭',loading:'正在打开交互图…',graph:'图的结构',changes:'结构改动',added:'新增',removed:'删除',modified:'修改',copy:'复制',copied:'已复制',walk:'逐步看',walkMessages:'逐条看消息',prev:'上一步',next:'下一步',end:'结束',ask:'追问',askQuote:'追问这段',askPlaceholder:'哪里没看懂,或者希望这块补充什么?',askCopy:'复制追问',askCopied:'已复制,粘贴给 agent 即可',askCancel:'取消',askChips:['没看懂这块','展开讲讲','举个例子','依据是什么?'],askPage:'页面',askFile:'文件',askWhere:'位置',askQuoteLabel:'引用',askQuestion:'问题',askPatch:'请用 Archify 的面板替换(patch explainer)只更新这个面板,保留它的 ID。'}
@@ -97,7 +105,7 @@ export function renderExplainer(document, options = {}) {
manifest.dependencies = (bundle.dependencies || []).map(({contentBase64,...entry})=>entry);
if (!preparedBundle) bundle.digest = hash(JSON.stringify(bundle));
if (bundle.sourceText !== sourceText || JSON.stringify(bundle.document) !== JSON.stringify(document)) throw new Error('Prepared bundle differs from rendered source or canonical document.');
- return `<!doctype html>\n<html lang="${escape(locale)}" data-style="${escape(document.meta.style || 'clean')}" data-archify-artifact="explainer" data-artifact="${escape(document.meta.id)}" data-revision="${revision}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="color-scheme" content="light dark"><meta name="description" content="${escape(document.answer.summary)}"><title>${escape(document.meta.title)} · Archify</title><style>${css}</style></head><body><a class="skip-link" href="#board">${locale.startsWith('en')?'Skip to content':'跳至正文'}</a><div class="shell"><header class="masthead"><h1>${escape(document.meta.title)}</h1><div class="tools interactive"><div class="theme-controls" role="group" aria-label="${locale.startsWith('en')?'Theme':'主题'}">${['auto','light','dark'].map(theme=>`<button type="button" data-theme-choice="${theme}" aria-pressed="${theme === 'auto'}">${words[theme]}</button>`).join('')}</div><select class="style-select" data-style-choice aria-label="${words.style}">${['clean','editorial','product','swiss'].map(style=>`<option value="${style}"${style === (document.meta.style || 'clean') ? ' selected' : ''}>${words.styles[style]}</option>`).join('')}</select><button type="button" data-export-image>${words.image}</button><button type="button" data-print>${words.print}</button></div></header><main id="board"><div class="board">${panels}</div></main><footer>${footnotesHtml}<section class="sources"><h2>${words.sources}</h2><ol>${sourceList}</ol></section><p class="colophon">Archify</p></footer></div><dialog class="viewer-dialog" id="diagram-dialog" aria-labelledby="diagram-dialog-title"><header><h2 id="diagram-dialog-title"></h2><button type="button" data-close-diagram>${words.close} ×</button></header><p class="dialog-loading" role="status">${words.loading}</p></dialog><div id="toast" role="status" aria-live="polite"></div><script type="application/json" id="archify-explainer-prepared">${json(packPageBundle(bundle))}</script><script type="application/json" id="explainer-manifest">${json(manifest)}</script><script type="application/json" id="explainer-reader-words">${json(words)}</script><script>${js}</script></body></html>`;
+ return `<!doctype html>\n<html lang="${escape(locale)}" data-style="${escape(document.meta.style || 'clean')}" data-archify-artifact="explainer" data-artifact="${escape(document.meta.id)}" data-revision="${revision}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="color-scheme" content="light dark"><meta name="description" content="${escape(document.answer.summary)}"><title>${escape(document.meta.title)} · Archify</title><style>${css}</style></head><body><a class="skip-link" href="#board">${locale.startsWith('en')?'Skip to content':'跳至正文'}</a><div class="shell"><header class="masthead"><h1>${escape(document.meta.title)}</h1><div class="tools interactive"><div class="theme-controls" role="group" aria-label="${locale.startsWith('en')?'Theme':'主题'}">${['auto','light','dark'].map(theme=>`<button type="button" data-theme-choice="${theme}" aria-pressed="${theme === 'auto'}">${words[theme]}</button>`).join('')}</div><div class="style-menu"><button type="button" class="tool-button" data-style-toggle aria-haspopup="menu" aria-expanded="false" aria-label="${words.style}"><span class="style-swatch" data-swatch="${escape(document.meta.style || 'clean')}"></span><span data-style-label>${words.styles[document.meta.style || 'clean']}</span>${icons.chevron}</button><div class="style-options" role="menu" aria-label="${words.style}" hidden>${['clean','editorial','product','swiss'].map(style=>`<button type="button" role="menuitemradio" aria-checked="${style === (document.meta.style || 'clean')}" data-style-choice="${style}" tabindex="-1"><span class="style-swatch" data-swatch="${style}"></span><span>${words.styles[style]}</span>${icons.check}</button>`).join('')}</div></div><button type="button" class="tool-button" data-export-image>${icons.image}<span>${words.image}</span></button><button type="button" class="tool-button" data-print>${icons.print}<span>${words.print}</span></button></div></header><main id="board"><div class="board">${panels}</div></main><footer>${footnotesHtml}<section class="sources"><h2>${words.sources}</h2><ol>${sourceList}</ol></section><p class="colophon">Archify</p></footer></div><dialog class="viewer-dialog" id="diagram-dialog" aria-labelledby="diagram-dialog-title"><header><h2 id="diagram-dialog-title"></h2><button type="button" data-close-diagram>${words.close} ×</button></header><p class="dialog-loading" role="status">${words.loading}</p></dialog><div id="toast" role="status" aria-live="polite"></div><script type="application/json" id="archify-explainer-prepared">${json(packPageBundle(bundle))}</script><script type="application/json" id="explainer-manifest">${json(manifest)}</script><script type="application/json" id="explainer-reader-words">${json(words)}</script><script>${js}</script></body></html>`;
}
// Prefix native SVG identifiers in the preview only. Original native HTML is frozen above.
diff --git a/test/explainer-browser.test.mjs b/test/explainer-browser.test.mjs
index 921bf695..14b8140d 100644
--- a/test/explainer-browser.test.mjs
+++ b/test/explainer-browser.test.mjs
@@ -135,6 +135,8 @@ test('text names light their diagram nodes and walk-throughs step through steps
assert.match(result.copied,/Question: I do not follow this part/);
assert.match(result.copied,/patch explainer/);
assert.equal(result.open,false);
+ const style=await pageValue(browser,`(function(){const toggle=document.querySelector('[data-style-toggle]');toggle.click();const open=!document.querySelector('.style-options').hidden&&toggle.getAttribute('aria-expanded')==='true';document.querySelector('[data-style-choice=swiss]').click();return {open,closed:document.querySelector('.style-options').hidden,style:document.documentElement.dataset.style,label:document.querySelector('[data-style-label]').textContent,checked:document.querySelector('[data-style-choice=swiss]').getAttribute('aria-checked'),saved:localStorage.getItem('archify-explainer-style')};})()`);
+ assert.deepEqual(style,{open:true,closed:true,style:'swiss',label:'Swiss',checked:'true',saved:'swiss'});
const image=await pageValue(browser,`window.ArchifyExplainer.pageImage().then(blob=>({type:blob.type,size:blob.size}))`);
assert.equal(image.type,'image/png');assert.ok(image.size>20000,'the long image carries the rendered page');
}finally{await browser.close();}