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(delta): fill srcdoc slots only inside their canvas sections
uygnoey50de1c013069
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6c7a5199..b261525c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,7 +10,7 @@ All notable changes are documented here. Format loosely follows [Keep a Changelo- **Korean Viewer locale (`ko`) (#458).** All five renderers accept the optional `meta.locale` value `ko` alongside `en` and `zh-CN`, localizing renderer-owned Viewer UI, accessibility copy, default legends, document titles, and language metadata without translating authored content. Hangul in the monospace Viewer stack uses bundled D2Coding after JetBrains Mono; the editorial preset’s serif headings use Pretendard SemiBold ahead of the existing CJK serif fallback. Omitted locale remains backward-compatible English. Unsupported locale values still fail schema validation.### Fixed-- **Compare nested `srcdoc` trim.** Architecture-delta HTML no longer strips trailing whitespace inside the two nested viewer documents embedded in `<iframe srcdoc>`. Nested explorers are spliced into empty `srcdoc` slots by index after that trim, so authored copy cannot collide with a restoration token. The previous whole-document trim could corrupt verbatim nested payloads (exposed here by Pretendard’s OFL text).+- **Compare nested `srcdoc` trim.** Architecture-delta HTML no longer strips trailing whitespace inside the two nested viewer documents embedded in `<iframe srcdoc>`. Nested explorers are spliced into empty `srcdoc` slots after that trim, looking up each slot only inside its Before/After canvas so CSS or authored copy cannot steal the match. The previous whole-document trim could corrupt verbatim nested payloads (exposed here by Pretendard’s OFL text).- **Architecture Delta baseline arrowheads (#433).** Removed and rerouted baseline relationships retain their marker definitions in the composed Delta SVG, preserving their authored direction alongside current relationships.- **Compare rollback recovery (#438).** If restoring a previous output fails, compare preserves its recovery directory and reports backup-to-target paths instead of deleting the remaining backups during cleanup.- **固定提交的来源校验 (#420)。** 校验忽略本地 Git replacement refs,始终读取指定提交的原始对象,避免替换后的文件或行范围造成误接受或误拒绝;保留原有来源链接、诊断与用户 Git 配置。diff --git a/archify.zip b/archify.zipindex 0e1e99b6..c383258c 100644Binary files a/archify.zip and b/archify.zip differdiff --git a/archify/delta/architecture-delta.mjs b/archify/delta/architecture-delta.mjsindex 8b150c34..7c551923 100644--- a/archify/delta/architecture-delta.mjs+++ b/archify/delta/architecture-delta.mjs@@ -1166,18 +1166,23 @@ html[data-theme="dark"] body{background:#071019!important;background-image:none!}})();</script></body></html>`;return fillDeltaSrcdoc(html.replace(/[ \t]+$/gm, ''), [- [BASE_VIEW_SLOT, baseHtml],- [HEAD_VIEW_SLOT, headHtml],+ ['base', BASE_VIEW_SLOT, baseHtml],+ ['head', HEAD_VIEW_SLOT, headHtml],]);}function fillDeltaSrcdoc(html, slots) {const fills = [];- for (const [token, nested] of slots) {+ for (const [view, token, nested] of slots) {if (!nested) continue;- const index = html.indexOf(token);- if (index === -1) continue;- fills.push({ index, token, nested: esc(nested) });+ const open = html.match(new RegExp(`<section class="canvas" data-view="${view}"[^>]*>`));+ if (!open || open.index == null) continue;+ const regionStart = open.index + open[0].length;+ const regionEnd = html.indexOf('</section>', regionStart);+ if (regionEnd === -1) continue;+ const localIndex = html.slice(regionStart, regionEnd).indexOf(token);+ if (localIndex === -1) continue;+ fills.push({ index: regionStart + localIndex, token, nested: esc(nested) });}fills.sort((left, right) => right.index - left.index);let result = html;diff --git a/archify/test/architecture-delta.test.mjs b/archify/test/architecture-delta.test.mjsindex a53ae995..6aa3340c 100644--- a/archify/test/architecture-delta.test.mjs+++ b/archify/test/architecture-delta.test.mjs@@ -183,6 +183,37 @@ test('nested srcdoc restore ignores colliding tokens and keeps trailing spaces',assert.equal(frames[0][1].includes('head-only'), false);});+test('srcdoc slots are filled inside their canvas even when artifact CSS repeats the markup', () => {+ const receipt = compareArchitecture(read(baseFixture), read(headFixture));+ const baseSlot = '<iframe class="snapshot-frame" title="Before architecture explorer" srcdoc=""></iframe>';+ const headSlot = '<iframe class="snapshot-frame" title="After architecture explorer" srcdoc=""></iframe>';+ const baseHtml = '<!doctype html><title>css-base</title>';+ const headHtml = '<!doctype html><title>css-head</title>';+ const html = renderArchitectureDeltaHtml({+ receipt,+ baseSvg: '<svg viewBox="0 0 1 1"></svg>',+ deltaSvg: '<svg viewBox="0 0 1 1" role="img"></svg>',+ headSvg: '<svg viewBox="0 0 1 1"></svg>',+ baseHtml,+ headHtml,+ artifactCss: `/* ${baseSlot} ${headSlot} */`,+ });+ const style = html.match(/<style>([\s\S]*?)<\/style>/)?.[1] || '';+ assert.match(style, /\/\*[\s\S]*srcdoc=""[\s\S]*\*\//);+ assert.equal(style.includes('css-base'), false);+ assert.equal(style.includes('css-head'), false);+ const frames = [...html.matchAll(/<section class="canvas" data-view="(base|head)"[^>]*>([\s\S]*?)<\/section>/g)]+ .map(([, view, body]) => [view, body]);+ const srcdoc = (body) => body.match(/srcdoc="([^"]*)"/)?.[1]+ ?.replaceAll('"', '"')+ .replaceAll(''', "'")+ .replaceAll('<', '<')+ .replaceAll('>', '>')+ .replaceAll('&', '&');+ assert.equal(srcdoc(frames.find(([view]) => view === 'base')[1]), baseHtml);+ assert.equal(srcdoc(frames.find(([view]) => view === 'head')[1]), headHtml);+});+test('change navigator order is exact-ID based, complete, unique, and stable', () => {const receipt = compareArchitecture(read(baseFixture), read(headFixture));const rows = architectureDeltaChangeRows(receipt);