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: adapt wide diagrams to viewport height
tt-a1i4f014fc096fa
diff --git a/archify.zip b/archify.zipindex 69c6ea33..c2b9ffdf 100644Binary files a/archify.zip and b/archify.zip differdiff --git a/archify/SKILL.md b/archify/SKILL.mdindex 8b280955..ee784425 100644--- a/archify/SKILL.md+++ b/archify/SKILL.md@@ -63,7 +63,7 @@ Read Mermaid for topology and meaning, then author fresh Archify JSON; do not me- One obvious main path; side branches leave the nearest main-path node. Remove low-value edges before adding routing controls.- Omit `meta.visual_preset` by default so every diagram opens in `classic`, regardless of whether its resolved color mode is light or dark. Color mode and visual preset are independent: switching Light / Dark must preserve the current preset. Set `signal-flow`, `blueprint`, or `editorial` only when the user explicitly requests that visual style.- Omit `meta.subtitle` by default. Never invent a subtitle that restates the title, nodes, or cards; include one short supporting line only when the user explicitly asks for it.-- Treat the standalone desktop viewer as a first-screen artifact by default, not a shallow strip. On a wide or tall desktop, use enough vertical rhythm that the diagram panel and its necessary conclusion cards occupy the screen as a balanced whole; do not create a conspicuous empty lower band by over-compressing authored Y positions or choosing an undersized explicit `meta.viewBox`. Before handoff, open the real HTML at 1440×900, 1600×1000, and 1920×1080; additionally check 2048×1320 whenever the composition is intended for a large desktop display. Require `document.documentElement.scrollWidth <= window.innerWidth` and `scrollHeight <= window.innerHeight` at every checked size, while visually checking that the diagram remains comfortably readable and vertically balanced at the largest checked viewport. Repair overflow by removing only genuinely redundant content or compacting spacing before shrinking nodes, labels, or the main panel. Never counterfeit a pass with `overflow: hidden`, clipped content, an internal diagram scroller, or smaller typography. Narrow/mobile layouts may scroll vertically when containment requires it.+- Treat the standalone desktop viewer as a first-screen artifact by default, not a shallow strip. Generate one responsive artifact for laptops and external displays—never device-specific HTML or alternate topology. The viewer may adapt only the outer reading width from the live viewport height; it must preserve the authored SVG/viewBox, proportions, semantic geometry, and normal document flow. On a wide or tall desktop, use enough authored vertical rhythm that the diagram panel and its necessary conclusion cards occupy the screen as a balanced whole; runtime scaling cannot repair an over-compressed Y layout or an undersized explicit `meta.viewBox`. Before handoff, open the real HTML at 1440×900, 1600×1000, and 1920×1080; additionally check 2048×1320 whenever the composition is intended for a large desktop display. Require `document.documentElement.scrollWidth <= window.innerWidth` and `scrollHeight <= window.innerHeight` at every checked size, while visually checking that the diagram remains comfortably readable and vertically balanced at the largest checked viewport. Repair overflow by removing only genuinely redundant content or compacting spacing before shrinking nodes, labels, or the main panel. If the largest viewport still has a conspicuous empty lower band at the viewer's width cap, redistribute authored Y positions and increase the viewBox height proportionally; do not add filler copy or decorative cards. Never counterfeit a pass with `overflow: hidden`, clipped content, an internal diagram scroller, stretched SVG height, or smaller typography. Narrow/mobile layouts may scroll vertically when containment requires it.- Omit `meta.legend` for the truthful `auto` default. When needed, use only `mode: auto|all|hidden` and renderer-supported `entries.<kind>.label|visible`; labels never change semantics.- Match every reader-facing authored string to the language of the user's request, or the conversation's dominant language when the request is language-neutral. Apply it consistently to titles/subtitles, node/edge/boundary/lane/group text, guided-view labels/notes, legend label overrides, and card titles/items; use another language or bilingual copy only when the user asks.- Preserve exact product names, code identifiers, commands, protocols, API paths, and environment names. They may remain English inside localized copy, but never justify leaving the surrounding explanatory prose in another language.diff --git a/archify/assets/template.html b/archify/assets/template.htmlindex 3619aa9d..bde15c35 100644--- a/archify/assets/template.html+++ b/archify/assets/template.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10361,6 +10359,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10377,9 +10526,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/archify/examples/dataflow-product-analytics.html b/archify/examples/dataflow-product-analytics.htmlindex debdeadd..e2a5497a 100644--- a/archify/examples/dataflow-product-analytics.html+++ b/archify/examples/dataflow-product-analytics.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10472,6 +10470,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10488,9 +10637,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/archify/examples/lifecycle-agent-run.html b/archify/examples/lifecycle-agent-run.htmlindex 92eb1c8c..db31c365 100644--- a/archify/examples/lifecycle-agent-run.html+++ b/archify/examples/lifecycle-agent-run.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10421,6 +10419,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10437,9 +10586,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/archify/examples/sequence-cache-miss-request.html b/archify/examples/sequence-cache-miss-request.htmlindex 4f0bfa5b..9f465698 100644--- a/archify/examples/sequence-cache-miss-request.html+++ b/archify/examples/sequence-cache-miss-request.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10487,6 +10485,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10503,9 +10652,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/archify/examples/web-app-rendered.html b/archify/examples/web-app-rendered.htmlindex 6ce3815b..89f5b557 100644--- a/archify/examples/web-app-rendered.html+++ b/archify/examples/web-app-rendered.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10427,6 +10425,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10443,9 +10592,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/archify/examples/workflow-agent-tool-call-rendered.html b/archify/examples/workflow-agent-tool-call-rendered.htmlindex 2f6e1663..7f1b978b 100644--- a/archify/examples/workflow-agent-tool-call-rendered.html+++ b/archify/examples/workflow-agent-tool-call-rendered.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10469,6 +10467,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10485,9 +10634,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/archify/test/adaptive-reader-layout.test.mjs b/archify/test/adaptive-reader-layout.test.mjsnew file mode 100644index 00000000..c672cd56--- /dev/null+++ b/archify/test/adaptive-reader-layout.test.mjs@@ -0,0 +1,47 @@+import { test } from 'node:test';+import assert from 'node:assert/strict';+import fs from 'node:fs';+import path from 'node:path';+import { fileURLToPath } from 'node:url';++const __dirname = path.dirname(fileURLToPath(import.meta.url));+const skillRoot = path.resolve(__dirname, '..');+const template = fs.readFileSync(path.join(skillRoot, 'assets', 'template.html'), 'utf8');+const skill = fs.readFileSync(path.join(skillRoot, 'SKILL.md'), 'utf8');+const reader = template.slice(+ template.indexOf('Adaptive Reader Shell'),+ template.indexOf('Archify.view = (function ()'),+);++test('wide desktop diagrams use one height-budgeted reader shell instead of breakpoint jumps', () => {+ assert.match(template, /max-width: var\(--archify-reader-width, 1440px\)/);+ assert.doesNotMatch(template, /@media \(min-width: 1680px\)[\s\S]{0,180}\.container/);+ assert.doesNotMatch(template, /@media \(min-width: 1920px\)[\s\S]{0,180}\.container/);+ assert.match(reader, /var WIDE_RATIO = 1\.55/);+ assert.match(reader, /var MAX_READER_WIDTH = 1920/);+ assert.match(reader, /var availableSvgHeight = Math\.max\(1, window\.innerHeight - fixedHeight\)/);+ assert.match(reader, /var desiredWidth = availableSvgHeight \* ratio \+ chrome\.diagramX/);+ assert.match(reader, /html\.style\.setProperty\('--archify-reader-width', rounded \+ 'px'\)/);+});++test('adaptive width preserves canonical SVG geometry and yields to specialized viewer modes', () => {+ assert.match(reader, /window\.innerWidth >= MIN_DESKTOP_WIDTH/);+ assert.match(reader, /html\.getAttribute\('data-embed'\) !== 'true'/);+ assert.match(reader, /html\.getAttribute\('data-present'\) !== 'true'/);+ assert.match(reader, /window\.matchMedia\('print'\)\.matches/);+ assert.doesNotMatch(reader, /svg\.setAttribute\(['"](?:viewBox|width|height)/);+ assert.doesNotMatch(reader, /svg\.style\.(?:width|height)/);+ assert.doesNotMatch(reader, /overflow\s*=\s*['"]hidden/);+});++test('reader remeasures real content and reduces width before allowing desktop page overflow', () => {+ assert.match(reader, /document\.fonts\.ready\.then\(schedule\)/);+ assert.match(reader, /new ResizeObserver\(schedule\)/);+ assert.match(reader, /new MutationObserver\(schedule\)/);+ assert.match(reader, /document\.documentElement\.scrollHeight/);+ assert.match(reader, /lastWidth - overflow \* ratio - 4/);+ assert.match(skill, /1440×900, 1600×1000, and 1920×1080/);+ assert.match(skill, /2048×1320/);+ assert.match(skill, /Generate one responsive artifact for laptops and external displays/);+ assert.match(skill, /preserve the authored SVG\/viewBox, proportions, semantic geometry/);+});diff --git a/archify/test/start-page.test.mjs b/archify/test/start-page.test.mjsindex 041ea3f2..58351607 100644--- a/archify/test/start-page.test.mjs+++ b/archify/test/start-page.test.mjs@@ -103,7 +103,8 @@ test('generated artifacts omit the promotional footer and shortcut manual', () =test('viewer gives wide screens a larger canvas without forcing a subtitle row', () => {const template = fs.readFileSync(path.join(skillRoot, 'assets', 'template.html'), 'utf8');- assert.match(template, /\.container \{ width: 100%; max-width: 1440px; margin: 0 auto; \}/);+ assert.match(template, /max-width: var\(--archify-reader-width, 1440px\)/);+ assert.match(template, /Archify\.readerLayout = \(function \(\)/);const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-title-hierarchy-'));try {diff --git a/docs/assets/archify-live-proof.gif b/docs/assets/archify-live-proof.gifindex a199d3fc..349b6300 100644Binary files a/docs/assets/archify-live-proof.gif and b/docs/assets/archify-live-proof.gif differdiff --git a/docs/assets/archify-live-proof.json b/docs/assets/archify-live-proof.jsonindex 170f5773..88d12292 100644--- a/docs/assets/archify-live-proof.json+++ b/docs/assets/archify-live-proof.json@@ -7,13 +7,13 @@"fps": 10,"frameCount": 54,"durationSeconds": 5.4,- "bytes": 1721977,- "sha256": "043004156ecb09e2c81ca0b25d3534ace9537d9672def131970b1b12cdc392a2",+ "bytes": 1732180,+ "sha256": "fe4c218d6722ee704220ce544cbe42715b02ca7c29d4b69a2ae6c9e625c38c7f","scenes": [{"id": "signal-flow","artifact": "docs/gallery/artifacts/agent-tool-call.workflow.html",- "artifactSha256": "40387f30acae30d9a3c65690dbe40c0b955b5b047ec212aecc564022084ce16e",+ "artifactSha256": "fb1ba25ea22c51dbae52465534ae6d85ee1d6a1b976039d728e85ae05f987b82","view": "happy-path","eyebrow": "WORKFLOW · SIGNAL FLOW","title": "Agent Tool Call",@@ -22,7 +22,7 @@{"id": "blueprint","artifact": "docs/gallery/artifacts/production-deployment.architecture.html",- "artifactSha256": "99c596fa7f140e8d237f4ea1503191e134f90ee05c099ce89f184f01f9fa751b",+ "artifactSha256": "81654c2dde2f9d85d9bae0e6180a5fc3c77126db4355dfd03a0a3894bb92c0af","view": "request-boundary","eyebrow": "ARCHITECTURE · BLUEPRINT","title": "Production Deployment",@@ -31,7 +31,7 @@{"id": "classic","artifact": "docs/gallery/artifacts/cache-miss.sequence.html",- "artifactSha256": "100d63cb87b6c5485362c927833b00a6676d6498d9ed80283c69ce2ffd2b3e63",+ "artifactSha256": "adaa8382b2fb2ca545b0acfee57226a1297001c41f96e612d776a6c276edbe55","view": "cache-fallback","eyebrow": "SEQUENCE · CLASSIC","title": "Cache Miss Request",diff --git a/docs/cases/mco-runtime.architecture.html b/docs/cases/mco-runtime.architecture.htmlindex 32aa342d..ef754d17 100644--- a/docs/cases/mco-runtime.architecture.html+++ b/docs/cases/mco-runtime.architecture.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10480,6 +10478,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10496,9 +10645,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/docs/gallery.html b/docs/gallery.htmlindex e6a97162..bc38341e 100644--- a/docs/gallery.html+++ b/docs/gallery.html@@ -339,7 +339,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">12N · 11E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="40387f30acae30d9a3c65690dbe40c0b955b5b047ec212aecc564022084ce16e">40387f30acae</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="fb1ba25ea22c51dbae52465534ae6d85ee1d6a1b976039d728e85ae05f987b82">fb1ba25ea22c</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/agent-tool-call.workflow.html?present=1&play=1#view=happy-path" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -369,7 +369,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">12N · 12E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="99c596fa7f140e8d237f4ea1503191e134f90ee05c099ce89f184f01f9fa751b">99c596fa7f14</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="81654c2dde2f9d85d9bae0e6180a5fc3c77126db4355dfd03a0a3894bb92c0af">81654c2dde2f</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/production-deployment.architecture.html?present=1&play=1#view=request-boundary" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -398,7 +398,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">7N · 12E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="100d63cb87b6c5485362c927833b00a6676d6498d9ed80283c69ce2ffd2b3e63">100d63cb87b6</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="adaa8382b2fb2ca545b0acfee57226a1297001c41f96e612d776a6c276edbe55">adaa8382b2fb</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/cache-miss.sequence.html?present=1&play=1#view=cache-fallback" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -427,7 +427,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 10E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="a9387db5540177373e3522abad94c053d6a8b08a0a31d26b279c3dbf10387c8c">a9387db55401</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="8c7370098928cc6c9393b82e6bab120f09b991ad5c6ae1e1646f960341792dcc">8c7370098928</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/release-delivery.workflow.html?present=1&play=1#view=approval-to-production" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -456,7 +456,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">11N · 10E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="414e2f37c0621be2f596799bd73974a98762030a96d8360b2d04658695359ff9">414e2f37c062</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="f6538acef6a7882edc3728e924fb54a6f6ce3f359564e22d889edcf817b16bb9">f6538acef6a7</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/incident-response.workflow.html?present=1&play=1#view=mitigate-and-verify" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -485,7 +485,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 10E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="372188a92279636eab3d64a0bf334a6e7e9ce14eaca75589daacd0c9c8e21a21">372188a92279</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="51b121ac7ef7ca8bfb1e4fe07afa63ffc1d4c14202e2bf3dfca6cb6d9b89c269">51b121ac7ef7</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/product-analytics.dataflow.html?present=1&play=1#view=consent-boundary" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -514,7 +514,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">7N · 14E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="956f04233f26e580a63790dd8b00c62c73c07d4f398847674ac5a23f0075a160">956f04233f26</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="6d2fc7e1e569e88dfcd2b80b5cb8a488b9998a6a44a3e9ed40c16e13402512d8">6d2fc7e1e569</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/async-job-roundtrip.sequence.html?present=1&play=1#view=work-and-retry" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -543,7 +543,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">12N · 12E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="43561d8efa7eb835a956b368ec1f2aad3b41511fd06d92dddf3ad2029cf6deba">43561d8efa7e</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="bd8b23c201dfae4ef62a89db0c0ebd6d480c5149306285b6fee02d7080b06bdd">bd8b23c201df</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/event-stream.dataflow.html?present=1&play=1#view=order-transit" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -572,7 +572,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 6E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="3e26ae5833e9f4c5b6ed3f43ab7b8ef025f6d75688c4cf3d764f919cd544663c">3e26ae5833e9</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="1ba792690744bfdb6e95a429a10ff46b20a6568ee9de1c5a2a3e222f0cad0d4a">1ba792690744</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/agent-run.lifecycle.html?present=1&play=1#view=main-lifecycle" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -601,7 +601,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">11N · 6E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="82452ebed088ec978f33c0fe4695b51ffa3dcfbe1a38acfc7288723a3e145375">82452ebed088</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="0f959d52d9442bed636dee9ccb15ef4edb655305f1a1adc9bb975b84d6f7d081">0f959d52d944</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/deployment-release.lifecycle.html?present=1&play=1#view=rollback-outcomes" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -630,7 +630,7 @@<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 9E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="553a29b1c6381080832d694df728d59cc214c6e71aad89d3f948b3b81d00d219">553a29b1c638</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="019d2fb5c9427209f1b836e857ce913c849c50adc0b701f1309140000ed74a64">019d2fb5c942</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/web-app.architecture.html?present=1&play=1#view=request-path" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -716,8 +716,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"engineeringProfile": null,"nodeCount": 12,"edgeCount": 11,- "artifactBytes": 632606,- "artifactSha256": "40387f30acae30d9a3c65690dbe40c0b955b5b047ec212aecc564022084ce16e",+ "artifactBytes": 639183,+ "artifactSha256": "fb1ba25ea22c51dbae52465534ae6d85ee1d6a1b976039d728e85ae05f987b82","sourceBytes": 6367,"sourceSha256": "9c94c8c0b2104478b77befb4cc5e343d381acba6e66645ab17616fde20b60e05","checks": [@@ -814,8 +814,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"engineeringProfile": "deployment-ownership","nodeCount": 12,"edgeCount": 12,- "artifactBytes": 635199,- "artifactSha256": "99c596fa7f140e8d237f4ea1503191e134f90ee05c099ce89f184f01f9fa751b",+ "artifactBytes": 641776,+ "artifactSha256": "81654c2dde2f9d85d9bae0e6180a5fc3c77126db4355dfd03a0a3894bb92c0af","sourceBytes": 5454,"sourceSha256": "738e9c7f22e4e6e88f5aafc087dc58409105927daa9a79aaf240c8393654494f","checks": [@@ -912,8 +912,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"engineeringProfile": null,"nodeCount": 7,"edgeCount": 12,- "artifactBytes": 629103,- "artifactSha256": "100d63cb87b6c5485362c927833b00a6676d6498d9ed80283c69ce2ffd2b3e63",+ "artifactBytes": 635680,+ "artifactSha256": "adaa8382b2fb2ca545b0acfee57226a1297001c41f96e612d776a6c276edbe55","sourceBytes": 4345,"sourceSha256": "4bbaa6ca3cd4036002fd5d0f3a332eb922cec69d09bac3d7925f95beb4308389","checks": [@@ -1010,8 +1010,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"engineeringProfile": null,"nodeCount": 10,"edgeCount": 10,- "artifactBytes": 631430,- "artifactSha256": "a9387db5540177373e3522abad94c053d6a8b08a0a31d26b279c3dbf10387c8c",+ "artifactBytes": 638007,+ "artifactSha256": "8c7370098928cc6c9393b82e6bab120f09b991ad5c6ae1e1646f960341792dcc","sourceBytes": 5164,"sourceSha256": "e5c880417eac1623923c3dd5461e0c78acd762e1621a28bd53fc14a84cad6a91","checks": [@@ -1108,8 +1108,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"engineeringProfile": null,"nodeCount": 11,"edgeCount": 10,- "artifactBytes": 628743,- "artifactSha256": "414e2f37c0621be2f596799bd73974a98762030a96d8360b2d04658695359ff9",+ "artifactBytes": 635320,+ "artifactSha256": "f6538acef6a7882edc3728e924fb54a6f6ce3f359564e22d889edcf817b16bb9","sourceBytes": 5375,"sourceSha256": "5c760c82eee545dfb7da38a4e628059d7891af4cfbfc13c8a7009ea64f69aa1b","checks": [@@ -1206,8 +1206,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"engineeringProfile": null,"nodeCount": 10,"edgeCount": 10,- "artifactBytes": 632688,- "artifactSha256": "372188a92279636eab3d64a0bf334a6e7e9ce14eaca75589daacd0c9c8e21a21",+ "artifactBytes": 639265,+ "artifactSha256": "51b121ac7ef7ca8bfb1e4fe07afa63ffc1d4c14202e2bf3dfca6cb6d9b89c269","sourceBytes": 5627,"sourceSha256": "6fa38a7ccedf96da592d60b392783b846188eaa3ec9136c6dc06ca020e43a110","checks": [@@ -1304,8 +1304,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"engineeringProfile": null,"nodeCount": 7,"edgeCount": 14,- "artifactBytes": 629513,- "artifactSha256": "956f04233f26e580a63790dd8b00c62c73c07d4f398847674ac5a23f0075a160",+ "artifactBytes": 636090,+ "artifactSha256": "6d2fc7e1e569e88dfcd2b80b5cb8a488b9998a6a44a3e9ed40c16e13402512d8","sourceBytes": 4370,"sourceSha256": "545f20920c89b69c2bb1f15508d5543fddbeb15cffba61e102206e04bd5a5cd9","checks": [@@ -1402,8 +1402,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"engineeringProfile": null,"nodeCount": 12,"edgeCount": 12,- "artifactBytes": 636607,- "artifactSha256": "43561d8efa7eb835a956b368ec1f2aad3b41511fd06d92dddf3ad2029cf6deba",+ "artifactBytes": 643184,+ "artifactSha256": "bd8b23c201dfae4ef62a89db0c0ebd6d480c5149306285b6fee02d7080b06bdd","sourceBytes": 5433,"sourceSha256": "a92d6597ddbe164f395da32a7d4b33cfae08edd7d9600a6fb45a2058e5bbb43e","checks": [@@ -1500,8 +1500,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"engineeringProfile": null,"nodeCount": 10,"edgeCount": 6,- "artifactBytes": 626323,- "artifactSha256": "3e26ae5833e9f4c5b6ed3f43ab7b8ef025f6d75688c4cf3d764f919cd544663c",+ "artifactBytes": 632900,+ "artifactSha256": "1ba792690744bfdb6e95a429a10ff46b20a6568ee9de1c5a2a3e222f0cad0d4a","sourceBytes": 4417,"sourceSha256": "af939579dcafc8b4c49f09594591577994398aee57a57369d4c791dfc0d85a42","checks": [@@ -1598,8 +1598,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"engineeringProfile": null,"nodeCount": 11,"edgeCount": 6,- "artifactBytes": 627293,- "artifactSha256": "82452ebed088ec978f33c0fe4695b51ffa3dcfbe1a38acfc7288723a3e145375",+ "artifactBytes": 633870,+ "artifactSha256": "0f959d52d9442bed636dee9ccb15ef4edb655305f1a1adc9bb975b84d6f7d081","sourceBytes": 4274,"sourceSha256": "735c2c5819266e6ea2a71775b6eefce98b53030ce90cb721dc8e1d022ce5be71","checks": [@@ -1696,8 +1696,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"engineeringProfile": null,"nodeCount": 10,"edgeCount": 9,- "artifactBytes": 626530,- "artifactSha256": "553a29b1c6381080832d694df728d59cc214c6e71aad89d3f948b3b81d00d219",+ "artifactBytes": 633107,+ "artifactSha256": "019d2fb5c9427209f1b836e857ce913c849c50adc0b701f1309140000ed74a64","sourceBytes": 3793,"sourceSha256": "483350f5297df682aba4e4a0fa491307ce3d3abd725ae4df07fab177490752cf","checks": [diff --git a/docs/gallery/artifacts/agent-run.lifecycle.html b/docs/gallery/artifacts/agent-run.lifecycle.htmlindex 92eb1c8c..db31c365 100644--- a/docs/gallery/artifacts/agent-run.lifecycle.html+++ b/docs/gallery/artifacts/agent-run.lifecycle.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10421,6 +10419,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10437,9 +10586,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/docs/gallery/artifacts/agent-tool-call.workflow.html b/docs/gallery/artifacts/agent-tool-call.workflow.htmlindex 2f6e1663..7f1b978b 100644--- a/docs/gallery/artifacts/agent-tool-call.workflow.html+++ b/docs/gallery/artifacts/agent-tool-call.workflow.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10469,6 +10467,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10485,9 +10634,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/docs/gallery/artifacts/async-job-roundtrip.sequence.html b/docs/gallery/artifacts/async-job-roundtrip.sequence.htmlindex 941bebe7..a6d9c672 100644--- a/docs/gallery/artifacts/async-job-roundtrip.sequence.html+++ b/docs/gallery/artifacts/async-job-roundtrip.sequence.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10499,6 +10497,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10515,9 +10664,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/docs/gallery/artifacts/cache-miss.sequence.html b/docs/gallery/artifacts/cache-miss.sequence.htmlindex 4f0bfa5b..9f465698 100644--- a/docs/gallery/artifacts/cache-miss.sequence.html+++ b/docs/gallery/artifacts/cache-miss.sequence.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10487,6 +10485,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10503,9 +10652,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/docs/gallery/artifacts/deployment-release.lifecycle.html b/docs/gallery/artifacts/deployment-release.lifecycle.htmlindex 87ccb583..0a63bd88 100644--- a/docs/gallery/artifacts/deployment-release.lifecycle.html+++ b/docs/gallery/artifacts/deployment-release.lifecycle.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10433,6 +10431,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10449,9 +10598,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/docs/gallery/artifacts/event-stream.dataflow.html b/docs/gallery/artifacts/event-stream.dataflow.htmlindex a0e8db2d..fccb8f39 100644--- a/docs/gallery/artifacts/event-stream.dataflow.html+++ b/docs/gallery/artifacts/event-stream.dataflow.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10511,6 +10509,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10527,9 +10676,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/docs/gallery/artifacts/incident-response.workflow.html b/docs/gallery/artifacts/incident-response.workflow.htmlindex 9bfef5c9..775f478f 100644--- a/docs/gallery/artifacts/incident-response.workflow.html+++ b/docs/gallery/artifacts/incident-response.workflow.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10438,6 +10436,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10454,9 +10603,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/docs/gallery/artifacts/product-analytics.dataflow.html b/docs/gallery/artifacts/product-analytics.dataflow.htmlindex debdeadd..e2a5497a 100644--- a/docs/gallery/artifacts/product-analytics.dataflow.html+++ b/docs/gallery/artifacts/product-analytics.dataflow.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10472,6 +10470,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10488,9 +10637,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/docs/gallery/artifacts/production-deployment.architecture.html b/docs/gallery/artifacts/production-deployment.architecture.htmlindex 17125225..0a687a4e 100644--- a/docs/gallery/artifacts/production-deployment.architecture.html+++ b/docs/gallery/artifacts/production-deployment.architecture.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10486,6 +10484,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10502,9 +10651,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/docs/gallery/artifacts/release-delivery.workflow.html b/docs/gallery/artifacts/release-delivery.workflow.htmlindex 3e12daf5..7de67289 100644--- a/docs/gallery/artifacts/release-delivery.workflow.html+++ b/docs/gallery/artifacts/release-delivery.workflow.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10464,6 +10462,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10480,9 +10629,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/docs/gallery/artifacts/web-app.architecture.html b/docs/gallery/artifacts/web-app.architecture.htmlindex 6ce3815b..89f5b557 100644--- a/docs/gallery/artifacts/web-app.architecture.html+++ b/docs/gallery/artifacts/web-app.architecture.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10427,6 +10425,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10443,9 +10592,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/docs/gallery/manifest.json b/docs/gallery/manifest.jsonindex 62164e55..486fd10e 100644--- a/docs/gallery/manifest.json+++ b/docs/gallery/manifest.json@@ -27,8 +27,8 @@"engineeringProfile": null,"nodeCount": 12,"edgeCount": 11,- "artifactBytes": 632606,- "artifactSha256": "40387f30acae30d9a3c65690dbe40c0b955b5b047ec212aecc564022084ce16e",+ "artifactBytes": 639183,+ "artifactSha256": "fb1ba25ea22c51dbae52465534ae6d85ee1d6a1b976039d728e85ae05f987b82","sourceBytes": 6367,"sourceSha256": "9c94c8c0b2104478b77befb4cc5e343d381acba6e66645ab17616fde20b60e05","checks": [@@ -125,8 +125,8 @@"engineeringProfile": "deployment-ownership","nodeCount": 12,"edgeCount": 12,- "artifactBytes": 635199,- "artifactSha256": "99c596fa7f140e8d237f4ea1503191e134f90ee05c099ce89f184f01f9fa751b",+ "artifactBytes": 641776,+ "artifactSha256": "81654c2dde2f9d85d9bae0e6180a5fc3c77126db4355dfd03a0a3894bb92c0af","sourceBytes": 5454,"sourceSha256": "738e9c7f22e4e6e88f5aafc087dc58409105927daa9a79aaf240c8393654494f","checks": [@@ -223,8 +223,8 @@"engineeringProfile": null,"nodeCount": 7,"edgeCount": 12,- "artifactBytes": 629103,- "artifactSha256": "100d63cb87b6c5485362c927833b00a6676d6498d9ed80283c69ce2ffd2b3e63",+ "artifactBytes": 635680,+ "artifactSha256": "adaa8382b2fb2ca545b0acfee57226a1297001c41f96e612d776a6c276edbe55","sourceBytes": 4345,"sourceSha256": "4bbaa6ca3cd4036002fd5d0f3a332eb922cec69d09bac3d7925f95beb4308389","checks": [@@ -321,8 +321,8 @@"engineeringProfile": null,"nodeCount": 10,"edgeCount": 10,- "artifactBytes": 631430,- "artifactSha256": "a9387db5540177373e3522abad94c053d6a8b08a0a31d26b279c3dbf10387c8c",+ "artifactBytes": 638007,+ "artifactSha256": "8c7370098928cc6c9393b82e6bab120f09b991ad5c6ae1e1646f960341792dcc","sourceBytes": 5164,"sourceSha256": "e5c880417eac1623923c3dd5461e0c78acd762e1621a28bd53fc14a84cad6a91","checks": [@@ -419,8 +419,8 @@"engineeringProfile": null,"nodeCount": 11,"edgeCount": 10,- "artifactBytes": 628743,- "artifactSha256": "414e2f37c0621be2f596799bd73974a98762030a96d8360b2d04658695359ff9",+ "artifactBytes": 635320,+ "artifactSha256": "f6538acef6a7882edc3728e924fb54a6f6ce3f359564e22d889edcf817b16bb9","sourceBytes": 5375,"sourceSha256": "5c760c82eee545dfb7da38a4e628059d7891af4cfbfc13c8a7009ea64f69aa1b","checks": [@@ -517,8 +517,8 @@"engineeringProfile": null,"nodeCount": 10,"edgeCount": 10,- "artifactBytes": 632688,- "artifactSha256": "372188a92279636eab3d64a0bf334a6e7e9ce14eaca75589daacd0c9c8e21a21",+ "artifactBytes": 639265,+ "artifactSha256": "51b121ac7ef7ca8bfb1e4fe07afa63ffc1d4c14202e2bf3dfca6cb6d9b89c269","sourceBytes": 5627,"sourceSha256": "6fa38a7ccedf96da592d60b392783b846188eaa3ec9136c6dc06ca020e43a110","checks": [@@ -615,8 +615,8 @@"engineeringProfile": null,"nodeCount": 7,"edgeCount": 14,- "artifactBytes": 629513,- "artifactSha256": "956f04233f26e580a63790dd8b00c62c73c07d4f398847674ac5a23f0075a160",+ "artifactBytes": 636090,+ "artifactSha256": "6d2fc7e1e569e88dfcd2b80b5cb8a488b9998a6a44a3e9ed40c16e13402512d8","sourceBytes": 4370,"sourceSha256": "545f20920c89b69c2bb1f15508d5543fddbeb15cffba61e102206e04bd5a5cd9","checks": [@@ -713,8 +713,8 @@"engineeringProfile": null,"nodeCount": 12,"edgeCount": 12,- "artifactBytes": 636607,- "artifactSha256": "43561d8efa7eb835a956b368ec1f2aad3b41511fd06d92dddf3ad2029cf6deba",+ "artifactBytes": 643184,+ "artifactSha256": "bd8b23c201dfae4ef62a89db0c0ebd6d480c5149306285b6fee02d7080b06bdd","sourceBytes": 5433,"sourceSha256": "a92d6597ddbe164f395da32a7d4b33cfae08edd7d9600a6fb45a2058e5bbb43e","checks": [@@ -811,8 +811,8 @@"engineeringProfile": null,"nodeCount": 10,"edgeCount": 6,- "artifactBytes": 626323,- "artifactSha256": "3e26ae5833e9f4c5b6ed3f43ab7b8ef025f6d75688c4cf3d764f919cd544663c",+ "artifactBytes": 632900,+ "artifactSha256": "1ba792690744bfdb6e95a429a10ff46b20a6568ee9de1c5a2a3e222f0cad0d4a","sourceBytes": 4417,"sourceSha256": "af939579dcafc8b4c49f09594591577994398aee57a57369d4c791dfc0d85a42","checks": [@@ -909,8 +909,8 @@"engineeringProfile": null,"nodeCount": 11,"edgeCount": 6,- "artifactBytes": 627293,- "artifactSha256": "82452ebed088ec978f33c0fe4695b51ffa3dcfbe1a38acfc7288723a3e145375",+ "artifactBytes": 633870,+ "artifactSha256": "0f959d52d9442bed636dee9ccb15ef4edb655305f1a1adc9bb975b84d6f7d081","sourceBytes": 4274,"sourceSha256": "735c2c5819266e6ea2a71775b6eefce98b53030ce90cb721dc8e1d022ce5be71","checks": [@@ -1007,8 +1007,8 @@"engineeringProfile": null,"nodeCount": 10,"edgeCount": 9,- "artifactBytes": 626530,- "artifactSha256": "553a29b1c6381080832d694df728d59cc214c6e71aad89d3f948b3b81d00d219",+ "artifactBytes": 633107,+ "artifactSha256": "019d2fb5c9427209f1b836e857ce913c849c50adc0b701f1309140000ed74a64","sourceBytes": 3793,"sourceSha256": "483350f5297df682aba4e4a0fa491307ce3d3abd725ae4df07fab177490752cf","checks": [diff --git a/examples/dataflow-product-analytics.html b/examples/dataflow-product-analytics.htmlindex debdeadd..e2a5497a 100644--- a/examples/dataflow-product-analytics.html+++ b/examples/dataflow-product-analytics.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10472,6 +10470,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10488,9 +10637,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/examples/lifecycle-agent-run.html b/examples/lifecycle-agent-run.htmlindex 92eb1c8c..db31c365 100644--- a/examples/lifecycle-agent-run.html+++ b/examples/lifecycle-agent-run.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10421,6 +10419,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10437,9 +10586,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/examples/sequence-cache-miss-request.html b/examples/sequence-cache-miss-request.htmlindex 4f0bfa5b..9f465698 100644--- a/examples/sequence-cache-miss-request.html+++ b/examples/sequence-cache-miss-request.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10487,6 +10485,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10503,9 +10652,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/examples/web-app-rendered.html b/examples/web-app-rendered.htmlindex 6ce3815b..89f5b557 100644--- a/examples/web-app-rendered.html+++ b/examples/web-app-rendered.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10427,6 +10425,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10443,9 +10592,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/examples/web-app.html b/examples/web-app.htmlindex 6ce3815b..89f5b557 100644--- a/examples/web-app.html+++ b/examples/web-app.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10427,6 +10425,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10443,9 +10592,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;diff --git a/examples/workflow-agent-tool-call-rendered.html b/examples/workflow-agent-tool-call-rendered.htmlindex 2f6e1663..7f1b978b 100644--- a/examples/workflow-agent-tool-call-rendered.html+++ b/examples/workflow-agent-tool-call-rendered.html@@ -598,16 +598,14 @@color: var(--frontend-stroke);}- .container { width: 100%; max-width: 1440px; margin: 0 auto; }-- /* A wide, tall desktop has room for the whole reading surface. Let the- panel grow with it instead of locking every architecture map to a- shallow 1440px strip; SVG geometry remains proportionate. */- @media (min-width: 1680px) and (min-height: 960px) {- .container { max-width: min(1680px, calc(100vw - 4rem)); }- }- @media (min-width: 1920px) and (min-height: 1120px) {- .container { max-width: min(1920px, calc(100vw - 4rem)); }+ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;}@media (min-width: 768px) and (max-height: 920px) {.header { margin-bottom: 1rem; }@@ -10469,6 +10467,157 @@};})();+ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();+Archify.view = (function () {var container = document.querySelector('.diagram-container');var svg = container.querySelector('svg');@@ -10485,9 +10634,6 @@var autoScrollUntil = 0;var viewBox = svg.viewBox && svg.viewBox.baseVal;- if (viewBox && viewBox.height > 0 && viewBox.width / viewBox.height >= 1.55) {- container.setAttribute('data-wide-diagram', 'true');- }function clamp() {var width = svg.clientWidth || 1;