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
Redesign the follow-up question dialog
tt-a1ibdbbe44517d6
diff --git a/archify/explainer/reader.css b/archify/explainer/reader.cssindex 0c966ccc..05d55f9a 100644--- a/archify/explainer/reader.css+++ b/archify/explainer/reader.css@@ -311,20 +311,32 @@ footer{padding:28px 0 32px}.ask-button:hover{color:var(--accent);border-color:color-mix(in srgb,var(--accent) 40%,var(--rule))}.ask-floating{position:absolute;z-index:20;font-size:12px;padding:3px 10px;border-radius:999px;background:var(--ink);color:var(--paper);border:0;box-shadow:0 4px 14px rgb(0 0 0/.18)}.ask-floating:hover{background:var(--accent);color:#fff}-.ask-dialog{width:min(520px,calc(100vw - 32px));padding:0}-.ask-dialog form{margin:0;display:flex;flex-direction:column;gap:12px;padding:16px 18px 18px}-.ask-dialog header{display:flex;align-items:center;justify-content:space-between;gap:12px}-.ask-dialog h2{font-size:14.5px;font-weight:600;overflow-wrap:anywhere}-.ask-dialog header button{border:0;background:none;font-size:18px;line-height:1;padding:2px 6px;color:var(--muted)}-.ask-dialog blockquote{margin:0;padding:8px 12px;border-radius:8px;background:var(--sunk);box-shadow:inset 3px 0 0 var(--accent);font-size:13px;color:var(--secondary);max-height:120px;overflow:auto}+/* Follow-up dialog: where the question points, suggested questions, the reader's words, then copy. */+.ask-dialog{width:min(560px,calc(100vw - 32px));padding:0;border-radius:14px}+.ask-dialog form{margin:0;display:flex;flex-direction:column;gap:14px;padding:20px 22px 18px}+.ask-dialog header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}+.ask-dialog h2{font:600 16px/1.35 var(--sans);color:var(--ink)}+.ask-where{margin-top:3px;font-size:12.5px;line-height:1.5;color:var(--muted);overflow-wrap:anywhere}+.ask-close{display:grid;place-items:center;flex-shrink:0;width:30px;height:30px;margin:-4px -6px 0 0;border:0;border-radius:8px;background:none;color:var(--muted);transition:background .15s,color .15s}+.ask-close:hover{background:var(--sunk);color:var(--ink)}+.ask-close svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round}+.ask-dialog blockquote{margin:0;padding:9px 12px;border-radius:8px;background:var(--sunk);box-shadow:inset 3px 0 0 var(--accent);font-size:13px;line-height:1.6;color:var(--secondary);max-height:120px;overflow:auto}.ask-chips{display:flex;flex-wrap:wrap;gap:6px}-.ask-chips button{font-size:12px;padding:2px 10px;border-radius:999px;color:var(--secondary)}-.ask-chips button:hover{color:var(--accent);border-color:var(--accent)}-.ask-dialog textarea{font:inherit;font-size:13.5px;color:var(--ink);background:var(--panel);border:1px solid var(--rule-strong);border-radius:8px;padding:8px 10px;resize:vertical}-.ask-dialog textarea:focus{outline:2px solid var(--accent);outline-offset:0;border-color:transparent}-.ask-dialog footer{display:flex;justify-content:flex-end;gap:8px}-.ask-dialog .primary{background:var(--accent);border-color:var(--accent);color:#fff}+.ask-chips button{height:28px;padding:0 12px;border:1px solid var(--rule-strong);border-radius:999px;background:var(--panel);font-size:12.5px;line-height:1;color:var(--secondary);transition:background .15s,color .15s,border-color .15s}+.ask-chips button:hover{color:var(--accent-ink);border-color:color-mix(in srgb,var(--accent) 45%,var(--rule))}+.ask-chips button[aria-pressed=true]{background:var(--accent-soft);border-color:color-mix(in srgb,var(--accent) 55%,var(--rule));color:var(--accent-ink)}+.ask-dialog textarea{min-height:96px;font:inherit;font-size:14px;line-height:1.6;color:var(--ink);background:var(--paper);border:1px solid var(--rule-strong);border-radius:10px;padding:10px 12px;resize:vertical;transition:border-color .15s,box-shadow .15s}+.ask-dialog textarea::placeholder{color:var(--faint)}+.ask-dialog textarea:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 18%,transparent);background:var(--panel)}+.ask-dialog footer{display:flex;align-items:center;gap:8px;padding:0}+.ask-note{flex:1;min-width:0;margin-right:8px;font-size:11.5px;line-height:1.45;color:var(--muted)}+.ask-dialog footer button{background:var(--panel);color:var(--secondary)}+.ask-dialog footer button:hover{background:var(--sunk);color:var(--ink)}+.ask-dialog .primary,.ask-dialog .primary:hover{background:var(--accent);border-color:var(--accent);color:#fff;font-weight:600}+.ask-dialog .primary:hover{filter:brightness(1.06)}+.ask-dialog .primary kbd{margin-left:2px;font:500 10.5px/1 var(--sans);opacity:.75}:root[data-theme=dark] .ask-dialog .primary{color:#0c0d10}+@media(max-width:560px){.ask-note{flex-basis:100%;margin:0 0 4px}.ask-dialog footer{flex-wrap:wrap;justify-content:flex-end}}@media print{.ask-button,.ask-floating{display:none!important}}/* Dialogs */diff --git a/archify/explainer/reader.js b/archify/explainer/reader.jsindex cfd0b592..ced7b365 100644--- a/archify/explainer/reader.js+++ b/archify/explainer/reader.js@@ -489,7 +489,8 @@// message that names the page, the panel ID and the quote, so the agent can revise just that panel.function setupAsk() {const dialog = document.createElement('dialog'); dialog.className = 'ask-dialog';- dialog.innerHTML = `<form method="dialog"><header><h2></h2><button type="button" data-ask-cancel aria-label="${words.askCancel}">×</button></header><blockquote hidden></blockquote><div class="ask-chips">${words.askChips.map(chip=>`<button type="button" data-chip>${chip}</button>`).join('')}</div><textarea rows="3" placeholder="${words.askPlaceholder}"></textarea><footer><button type="button" data-ask-cancel>${words.askCancel}</button><button type="submit" class="primary">${words.askCopy}</button></footer></form>`;+ const mac = /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);+ dialog.innerHTML = `<form method="dialog"><header><div><h2 id="ask-title">${words.ask}</h2><p class="ask-where"></p></div><button type="button" class="ask-close" data-ask-cancel aria-label="${words.askCancel}"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 4l8 8M12 4l-8 8"/></svg></button></header><blockquote hidden></blockquote><div class="ask-chips" role="group" aria-label="${words.askQuestion}">${words.askChips.map(chip=>`<button type="button" data-chip>${chip}</button>`).join('')}</div><textarea rows="4" aria-labelledby="ask-title" placeholder="${words.askPlaceholder}"></textarea><footer><p class="ask-note">${words.askNote}</p><button type="button" data-ask-cancel>${words.askCancel}</button><button type="submit" class="primary">${words.askCopy}<kbd>${mac ? '⌘↵' : 'Ctrl ↵'}</kbd></button></footer></form>`;document.body.append(dialog);const area = dialog.querySelector('textarea'), quoteBox = dialog.querySelector('blockquote');let context = null;@@ -497,11 +498,18 @@const number = panel.id === 'answer' ? words.answer : panel.querySelector('.panel-id')?.textContent.trim();const title = panel.id === 'answer' ? words.answer : panel.dataset.title || panel.querySelector('h2')?.textContent.trim();context = {panel,quote,number,title};- dialog.querySelector('h2').textContent = `${words.ask} · ${panel.id === 'answer' ? title : `${number} ${title}`}`;+ dialog.querySelector('.ask-where').textContent = panel.id === 'answer' ? title : say(`Panel ${number} · ${title}`,`面板 ${number} · ${title}`);+ all('[data-chip]',dialog).forEach(chip=>chip.setAttribute('aria-pressed','false'));quoteBox.hidden = !quote; quoteBox.textContent = quote;area.value = ''; dialog.showModal(); area.focus();};- dialog.querySelectorAll('[data-chip]').forEach(chip=>chip.addEventListener('click',()=>{ area.value = area.value ? `${area.value}\n${chip.textContent}` : chip.textContent; area.focus(); }));+ // A suggested question is added once; choosing it again takes it back out.+ dialog.querySelectorAll('[data-chip]').forEach(chip=>chip.addEventListener('click',()=>{+ const lines = area.value.split('\n').filter(line=>line.trim()), on = !lines.includes(chip.textContent);+ area.value = (on ? [...lines,chip.textContent] : lines.filter(line=>line !== chip.textContent)).join('\n');+ chip.setAttribute('aria-pressed',String(on)); area.focus();+ }));+ area.addEventListener('keydown',event=>{ if (event.key === 'Enter' && (event.metaKey || event.ctrlKey)) { event.preventDefault(); dialog.querySelector('form').requestSubmit(); } });dialog.querySelectorAll('[data-ask-cancel]').forEach(button=>button.addEventListener('click',()=>dialog.close()));dialog.querySelector('form').addEventListener('submit',event=>{event.preventDefault();diff --git a/archify/explainer/render.mjs b/archify/explainer/render.mjsindex 3337d87b..4db57ec4 100644--- a/archify/explainer/render.mjs+++ b/archify/explainer/render.mjs@@ -25,8 +25,8 @@ const icons = {const mark = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 360" fill="none"><path d="M151 94 81 164C67 178 60 191 60 212V248H97V212C97 204 100 199 106 193L179 120Z" fill="#0856F5"/><path d="M238 135C252 132 261 126 270 116L321 167C334 180 339 194 339 213V248H303V213C303 204 300 199 294 193Z" fill="#1DBBB7"/><rect x="146" y="16" width="110" height="104" rx="30" fill="#0856F5"/><rect x="18" y="238" width="110" height="104" rx="28" fill="#0856F5"/><rect x="274" y="238" width="108" height="104" rx="28" fill="#1DBBB7"/></svg>';const favicon = `data:image/svg+xml,${encodeURIComponent(mark)}`;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:'Open interactive view',exploreHint:'Click a node to trace its links',exploreTitle:'Zoom, find nodes, trace paths, upstream and downstream, export images or motion',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.',tagline:'Turn anything you want to understand, plan, or share into an interactive visual.',facts:{panels:n=>`${n} ${n === 1 ? 'panel' : 'panels'}`,diagrams:n=>`${n} ${n === 1 ? 'diagram' : 'diagrams'} validated`,sources:n=>`${n} ${n === 1 ? 'source' : 'sources'}`,pinned:rev=>`code pinned to ${rev}`}},- zh:{answer:'结论',answerMark:'答',scope:'适用于',sources:'来源',print:'打印 / PDF',image:'长图',style:'样式',styles:{clean:'简洁',editorial:'杂志',product:'产品',swiss:'网格'},auto:'系统',light:'浅色',dark:'深色',typical:'典型值',explore:'打开交互图',exploreHint:'点节点看上下游',exploreTitle:'缩放、搜索节点、追踪路径和上下游,导出图片或动画',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。',tagline:'把你想理解、规划或分享的事,变成可以互动的可视化作品。',facts:{panels:n=>`${n} 个面板`,diagrams:n=>`${n} 张图已通过结构校验`,sources:n=>`${n} 个来源`,pinned:rev=>`代码固定在提交 ${rev}`}}+ 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:'Open interactive view',exploreHint:'Click a node to trace its links',exploreTitle:'Zoom, find nodes, trace paths, upstream and downstream, export images or motion',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',askNote:'Copies the page, the panel and its ID, so your agent can revise just this part.',askPatch:'Revise only this panel with Archify panel replacement (patch explainer), keeping its ID.',tagline:'Turn anything you want to understand, plan, or share into an interactive visual.',facts:{panels:n=>`${n} ${n === 1 ? 'panel' : 'panels'}`,diagrams:n=>`${n} ${n === 1 ? 'diagram' : 'diagrams'} validated`,sources:n=>`${n} ${n === 1 ? 'source' : 'sources'}`,pinned:rev=>`code pinned to ${rev}`}},+ zh:{answer:'结论',answerMark:'答',scope:'适用于',sources:'来源',print:'打印 / PDF',image:'长图',style:'样式',styles:{clean:'简洁',editorial:'杂志',product:'产品',swiss:'网格'},auto:'系统',light:'浅色',dark:'深色',typical:'典型值',explore:'打开交互图',exploreHint:'点节点看上下游',exploreTitle:'缩放、搜索节点、追踪路径和上下游,导出图片或动画',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:'问题',askNote:'会一并复制页面、面板位置和 ID,agent 可以只改这一块。',askPatch:'请用 Archify 的面板替换(patch explainer)只更新这个面板,保留它的 ID。',tagline:'把你想理解、规划或分享的事,变成可以互动的可视化作品。',facts:{panels:n=>`${n} 个面板`,diagrams:n=>`${n} 张图已通过结构校验`,sources:n=>`${n} 个来源`,pinned:rev=>`代码固定在提交 ${rev}`}}};/** Render a validated canonical explainer with separately prepared, immutable resources. */