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
feat: add authored reach share cards
tt-a1i13d58c406dc4
diff --git a/.impeccable/design.json b/.impeccable/design.jsonindex 49c05e90..3a0309f7 100644--- a/.impeccable/design.json+++ b/.impeccable/design.json@@ -78,6 +78,14 @@"html": "<div class=\"ds-reach\"><button aria-pressed=\"false\">Upstream <b>3</b></button><button aria-pressed=\"true\">Downstream <b>9</b></button><small>9 nodes · 9 links · max 6 hops</small></div>","css": ".ds-reach { display: grid; grid-template-columns: 1fr 1fr; gap: 0.38rem; width: 18rem; font-family: 'JetBrains Mono', ui-monospace, monospace; } .ds-reach button { min-height: 2rem; border: 1px solid #334155; border-radius: 0.45rem; background: #0f172a; color: #cbd5e1; font: 700 0.65rem/1 'JetBrains Mono', ui-monospace, monospace; } .ds-reach button[aria-pressed=\"true\"] { border-color: #22d3ee; color: #22d3ee; background: rgba(34,211,238,0.08); } .ds-reach b { color: inherit; } .ds-reach small { grid-column: 1 / -1; color: #94a3b8; font-size: 0.6rem; } .ds-reach button:focus-visible { outline: 2px solid #22d3ee; outline-offset: 2px; }"},+ {+ "name": "Reach Share Card",+ "kind": "custom",+ "refersTo": "reach-share-card",+ "description": "An explicit 1200 by 630 authored upstream or downstream reading that preserves full-graph context without claiming runtime impact.",+ "html": "<article class=\"ds-reach-card\" data-direction=\"downstream\"><span>ARCHIFY · DOWNSTREAM REACH</span><strong>Authored downstream from Command Router</strong><small>9 nodes · 9 links · max 6 hops</small><i aria-hidden=\"true\"></i></article>",+ "css": ".ds-reach-card { display: grid; gap: 0.55rem; width: 24rem; padding: 1rem 1.1rem; border: 1px solid #334155; border-left: 3px solid #34d399; border-radius: 0.65rem; background: #020617; color: #fff; font-family: 'JetBrains Mono', ui-monospace, monospace; } .ds-reach-card span { color: #34d399; font-size: 0.52rem; font-weight: 800; letter-spacing: 0.13em; } .ds-reach-card strong { font-size: 0.85rem; } .ds-reach-card small { color: #94a3b8; } .ds-reach-card i { height: 2px; background: linear-gradient(90deg, #34d399 0 58%, #1e293b 58%); } .ds-reach-card[data-direction=\"upstream\"] { border-left-color: #a78bfa; } .ds-reach-card[data-direction=\"upstream\"] span { color: #a78bfa; }"+ },{"name": "Verified Source Beacon","kind": "chip",@@ -96,6 +104,7 @@"Mono-forward typography, small labels, and deliberate density for engineering review.","Viewer state stays outside canonical exports; proof remains portable and deterministic.","Authored reachability is explicit, finite, shareable, and never presented as runtime impact.",+ "Scoped share variants name their authored state, direction, origin, counts, and clean-state proof.","State transitions are 140–200ms; authored story motion may be longer but finite and reader-controlled."],"rules": [@@ -110,6 +119,7 @@"Do make the primary path legible before adding secondary relationships or detail.","Do derive every focus, route, story, source link, receipt, and count from authored or locally verified evidence.","Do label upstream and downstream exploration as authored reachability, deduplicate relationship fragments, terminate cycles, and preserve deterministic DOM order.",+ "Do name the authored scope, direction, origin, node count, link count, and maximum hops on every Reach Share Card.","Do keep ordinary artifacts source-free and make repository evidence explicitly opt-in.","Do use 140–200ms transitions for control state and honor prefers-reduced-motion.","Do preserve keyboard access, visible focus, semantic labels, dark/light parity, and non-color state cues.",@@ -120,6 +130,7 @@"Don't turn Archify into WYSIWYG drawing suites whose editing chrome becomes the product.","Don't ship motion-first graph demos that imply relationships or activity not present in the authored source.","Don't call authored graph reachability blast radius, breakage, dependency impact, or runtime causality.",+ "Don't present a Reach Share Card as proof of impact, failure propagation, breakage, or runtime causality.","Don't use dense dashboard shells, endless identical card grids, decorative glass, gradient text, and other AI-generated interface clichés.","Don't add vendor-icon catalogues or product-name matching that weaken Archify's portable semantic vocabulary.","Don't create another permanent panel when the Semantic Passport, Node Finder, or existing canvas can carry the capability.",diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 09aaba3c..86d47a18 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,7 @@ All notable changes are documented here. Format loosely follows [Keep a Changelo## [Unreleased]### Added+- **Reach Share Card.** An active Upstream or Downstream Authored Reachability result now reveals one contextual **Export → Reach Share Card** item. It copies the already resolved origin, direction, stable node/edge identity, minimum depths, and maximum hops without rerunning traversal, then applies only static `data-share-reach-*` decoration to a finite canonical clone before producing a 1200×630 PNG. The full diagram remains as dimmed context; the header names `Authored upstream/downstream`, origin, nodes, links, and hops; upstream uses repository violet, downstream uses proof green, and Blueprint stays filter-free. Missing, empty, stale, duplicate, conflicting, or tampered state fails closed. The truthful receipt uses `format=share-card`, `variant=reach`, `canonical=false`, and a dedicated reach-state-clean proof. Ordinary exports remain canonical. This is download-only and adds no schema, parser, traversal, format, panel, toolbar control, dependency, network, storage, hosted service, geometry change, or mobile product surface.- **Authored Reachability.** A focused node's existing Semantic Passport now offers compact `Upstream` and `Downstream` actions that reveal the deterministic transitive closure of authored relationships, report matched nodes, links, and maximum hops, and round-trip through `#focus=<id>&reach=upstream|downstream` plus Copy link. The viewer deduplicates parallel SVG fragments by stable edge key, terminates cycles, preserves authored DOM order, supports keyboard and browser-history navigation, and remains legible across Classic, Signal Flow, Blueprint, dark, and light. SVG, raster, Share Card, WebM backgrounds, and print strip the temporary state. This is explicitly authored reachability—not blast radius, breakage, repository impact, or runtime causality—and adds no parser, crawler, schema, panel, permanent toolbar action, dependency, hosted runtime, storage, geometry change, or mobile product surface.- **Verified Source Beacons.** Evidence-backed Architecture nodes now show one quiet viewer-only `SRC n` marker derived exclusively from the already verified repository payload. The node remains the single focus target and opens the existing Semantic Passport; screen-reader labels disclose the count, focus/routes/stories/guided views keep one coherent node state, and Classic, Signal Flow, Blueprint, dark, and light reuse the same proof-green vocabulary. Ordinary artifacts remain unchanged, while SVG, raster, Share Card, and WebM backgrounds strip the marker and restore the canonical node label. No parser, crawler, inferred relationship, panel, toolbar control, schema expansion, dependency, hosted runtime, or mobile product surface was added.- **Revision-verified Repository Evidence Passport.** Architecture diagrams can opt into public GitHub source links by declaring a repository URL, a full commit SHA, and one to three repo-relative sources per component, then passing `--repo-root` to `render`, `deliver`, `preview`, or `validate`. Archify verifies the local origin, commit, blobs, and optional line ranges before publishing; verified links appear in Semantic Passport and Node Finder while staying outside the canonical SVG and every visual export. Plain diagrams remain the default, other diagram modes reject the option, and private or unpinned evidence is deliberately out of scope.diff --git a/DESIGN.md b/DESIGN.mdindex 768f0993..fe313854 100644--- a/DESIGN.md+++ b/DESIGN.md@@ -208,6 +208,10 @@ An evidence-backed node receives one viewer-only `SRC n` capsule in its upper-riSemantic Passport offers two native, count-bearing actions: `Upstream` follows authored incoming relationships and `Downstream` follows authored outgoing relationships. The canvas keeps the focused origin plus the complete reachable subgraph strong while unrelated topology recedes. Upstream uses Repository Violet, downstream uses Proof Green, and Blueprint removes glow. The receipt says nodes, links, and maximum hops; it never says blast radius or breakage.+### Reach Share Card++An active reach query may expose one contextual **Export → Reach Share Card** item. The 1200×630 card keeps the full diagram as quiet context, preserves the selected origin and every matched authored node and link, and writes direction, origin, node count, link count, and maximum hops into the card header. Upstream retains Repository Violet; downstream retains Proof Green; Blueprint stays filter-free. The card is an explicit non-canonical reading variant, not runtime impact, causality, or breakage evidence. No animated state, live focus glow, camera transform, or unrelated viewer chrome enters the clone.+## Do's and Don'ts### Do:@@ -218,6 +222,7 @@ Semantic Passport offers two native, count-bearing actions: `Upstream` follows a- **Do** use 140–200ms transitions for control state and honor `prefers-reduced-motion`.- **Do** preserve keyboard access, visible focus, semantic labels, dark/light parity, and non-color state cues.- **Do** keep runtime exploration outside canonical SVG, raster, Share Card, and WebM backgrounds.+- **Do** name an intentionally scoped Route or Reach Share Card in its header and machine-readable receipt.### Don't:diff --git a/PRODUCT.md b/PRODUCT.mdindex 73296649..aa92f426 100644--- a/PRODUCT.md+++ b/PRODUCT.md@@ -10,7 +10,7 @@ Software engineers, architects, technical leads, reviewers, and AI coding agents## Product Purpose-Archify turns repository evidence or a bounded system description into a polished, interactive technical map directly in an agent conversation. Success means a reader can understand the primary story quickly, inspect exact authored relationships and evidence when needed, and carry one self-contained validated artifact into review, documentation, or presentation.+Archify turns repository evidence or a bounded system description into a polished, interactive technical map directly in an agent conversation. Success means a reader can understand the primary story quickly, inspect exact authored relationships and evidence when needed, and carry either the complete artifact or one explicitly scoped Route / Reach Share Card into review, documentation, or presentation.## Brand Personality@@ -30,7 +30,7 @@ Precise, composed, vivid. Archify should feel like a confident technical instrum2. One spatial narrative first: make the primary path legible before revealing secondary relationships and detail.3. Progressive disclosure over permanent chrome: keep the canvas dominant and reuse focused tools instead of adding panels.4. Motion has one bounded owner: static meaning must remain complete, motion must be finite and reader-controlled, and exports stay clean.-5. Portable proof: the default result is a self-contained artifact with deterministic validation and no required hosted runtime.+5. Portable proof: the default result is a self-contained artifact with deterministic validation and no required hosted runtime; intentional Route and Reach Share Card variants name their scope instead of pretending to be canonical.## Accessibility & Inclusiondiff --git a/README.md b/README.mdindex 5cb0dfab..72a63e04 100644--- a/README.md+++ b/README.md@@ -71,6 +71,10 @@ After tracing a route, open **Export → Route Share Card** to download the exac+After tracing `Upstream` or `Downstream` authored reach, choose **Export → Reach Share Card** to turn that exact reading into a 1200×630 PNG. The card keeps the complete topology as context and names its direction, origin, nodes, links, and maximum hops—it does not claim runtime impact.+++Open [`examples/web-app.html`](examples/web-app.html) locally to try the complete viewer.## Quick startdiff --git a/README_EN.md b/README_EN.mdindex 5cb0dfab..72a63e04 100644--- a/README_EN.md+++ b/README_EN.md@@ -71,6 +71,10 @@ After tracing a route, open **Export → Route Share Card** to download the exac+After tracing `Upstream` or `Downstream` authored reach, choose **Export → Reach Share Card** to turn that exact reading into a 1200×630 PNG. The card keeps the complete topology as context and names its direction, origin, nodes, links, and maximum hops—it does not claim runtime impact.+++Open [`examples/web-app.html`](examples/web-app.html) locally to try the complete viewer.## Quick startdiff --git a/README_ZH.md b/README_ZH.mdindex d5d27a63..0fc77463 100644--- a/README_ZH.md+++ b/README_ZH.md@@ -67,6 +67,10 @@ Export 菜单支持复制 PNG,并下载静态或动态格式:+完成 `Upstream` 或 `Downstream` authored reach 后,选择 **Export → Reach Share Card**,即可把这次阅读结果变成 1200×630 PNG。卡片保留完整拓扑作为上下文,并写明方向、起点、节点数、关系数与最大跳数;它不会冒充运行时影响分析。+++在本地打开 [`examples/web-app.html`](examples/web-app.html),即可体验完整 Viewer。## 快速开始diff --git a/ROADMAP.md b/ROADMAP.mdindex 5d92f051..e399d5f0 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -1,11 +1,13 @@# Archify Roadmap-As of v2.12.0, the coordinate-stability work has shipped as JSON IR plus typed renderers for architecture, workflow, sequence, data-flow, and lifecycle diagrams. Workflow diagrams now also have phase/group/exception-lane structure, happy-path linting, trace animation, and route-crossing guards. The shared viewer adds deterministic semantic node IDs, optional author-controlled relationship IDs with durable `#relation=` links, a pre-click Intent Trace for exact one-hop traffic, a two-endpoint Route Probe with an inspectable Route Journey over deterministic shortest authored paths, searchable Node Finder navigation, read-only one-hop focus with a renderer-owned Semantic Passport and copyable focus link, a runtime-built Semantic Radar for desktop viewport navigation, bounded typed guided views with a visible Named Chapter Rail, pre-commit Chapter Delta Preview, Shared Anchor Handoff, and path-aware Semantic Story Beats, a reader-controlled Live/Still Motion Governor, share-ready one-shot chapters with a title/route/step/state/progress cue, a viewport-filling Presentation Stage, Semantic Camera framing, pan/zoom, three reader-switchable visual presets, a contain-only 1200×630 Share Card, a route-focused 1200×630 Route Share Card variant, and browser-native WebM export. A generated Proof Lab publishes 11 live scenario artifacts with their exact sources, three named reader views, 99 artifact checks, and named composition receipts; its preview grid stays static while deliberate proof links play one named chapter once. The landing-page Live Proof Stage promotes three of those generated artifacts into the first bounded motion proof, and the README motion reel carries the same proof-first story onto GitHub without claiming SVG animation support. A question-first scenario guide maps concrete user needs to those 11 bounded recipes across the five modes, with one shared source for CLI and GitHub Pages and direct proof navigation. A unified CLI (`bin/archify.mjs`) wraps guide, render, preview, deliver, validate, check, and examples, with optional last-good desktop preview and verified post-commit open handoffs. This file records the design decisions that led there, plus the ideas that were explicitly declined. The original v2.4 / v2.5 backlog (export-scale URL param, color-blind palette, gzip+base64 share links) was considered and dropped — see [Not planned](#not-planned) for the rationale on each.+As of v2.12.0, the coordinate-stability work has shipped as JSON IR plus typed renderers for architecture, workflow, sequence, data-flow, and lifecycle diagrams. Workflow diagrams now also have phase/group/exception-lane structure, happy-path linting, trace animation, and route-crossing guards. The shared viewer adds deterministic semantic node IDs, optional author-controlled relationship IDs with durable `#relation=` links, a pre-click Intent Trace for exact one-hop traffic, a two-endpoint Route Probe with an inspectable Route Journey over deterministic shortest authored paths, searchable Node Finder navigation, read-only one-hop focus with a renderer-owned Semantic Passport and copyable focus link, upstream/downstream Authored Reachability, a runtime-built Semantic Radar for desktop viewport navigation, bounded typed guided views with a visible Named Chapter Rail, pre-commit Chapter Delta Preview, Shared Anchor Handoff, and path-aware Semantic Story Beats, a reader-controlled Live/Still Motion Governor, share-ready one-shot chapters with a title/route/step/state/progress cue, a viewport-filling Presentation Stage, Semantic Camera framing, pan/zoom, three reader-switchable visual presets, a contain-only 1200×630 Share Card, route-focused Route Share Card and authored-reach Reach Share Card variants, and browser-native WebM export. A generated Proof Lab publishes 11 live scenario artifacts with their exact sources, three named reader views, 99 artifact checks, and named composition receipts; its preview grid stays static while deliberate proof links play one named chapter once. The landing-page Live Proof Stage promotes three of those generated artifacts into the first bounded motion proof, and the README motion reel carries the same proof-first story onto GitHub without claiming SVG animation support. A question-first scenario guide maps concrete user needs to those 11 bounded recipes across the five modes, with one shared source for CLI and GitHub Pages and direct proof navigation. A unified CLI (`bin/archify.mjs`) wraps guide, render, preview, deliver, validate, check, and examples, with optional last-good desktop preview and verified post-commit open handoffs. This file records the design decisions that led there, plus the ideas that were explicitly declined. The original v2.4 / v2.5 backlog (export-scale URL param, color-blind palette, gzip+base64 share links) was considered and dropped — see [Not planned](#not-planned) for the rationale on each.The latest authoring slice adds Last-Good Live Preview. `archify preview <type> <input.json> [output.html]` binds one random IPv4 loopback port, opens one desktop status shell, and combines content-digest polling with directory watching so editor rename bursts and missed native notifications converge on the same source bytes. Every generation snapshots those exact bytes, then runs the existing atomic `deliver` pipeline into a private same-directory staging area; immediately before rename, preview rereads the named source digest, so only the latest passing SHA-256 receipt may replace the output and advance the iframe revision. Invalid, missing, half-written, failed, or superseded candidates update an exact stage diagnostic while the last verified artifact stays visible and byte-stable. Identical sources do not rebuild, identical artifacts do not reload, canonical future-path checks reject input/output aliases, external hosts and write requests are rejected, shutdown gives an active delivery a bounded graceful drain before terminating a stuck process and removing the server and staging directory, and installed ZIP skills keep the zero-dependency contract across all five modes. Preview is explicit, desktop-only, and local: no server state, port, path, error, or reload token enters HTML, SVG, raster, WebM, Share Card, schema, renderer, layout, storage, hosted network, or mobile scope.The latest sharing slice adds a contextual Route Share Card Export item to a completed Route Probe. It consumes the exact ordered node and stable-edge snapshot already resolved by the viewer, then applies only static `data-share-route-*` decoration to a finite canonical clone before reusing the existing 1200×630 Share Card canvas. The complete diagram remains as dimmed context; Journey position, animation overlays, camera, Focus, Lens, and Story never enter the asset. Clear, unreachable, stale, duplicate, or conflicting state fails closed. Browser smoke now covers all five renderer modes, a parallel authored edge, non-empty PNG pixels, immutable live SVG, and identical route-source fingerprints across Journey positions. The receipt remains `format=share-card`, uses `variant=route`, reports scoped route cleanup rather than claiming canonical output, and is cleared by the next ordinary export. The first slice is download-only and adds no new format, schema, layout, dependency, URL, storage, or mobile surface.+The latest reach-sharing slice adds a contextual Reach Share Card item to a non-empty Authored Reachability result. It consumes the existing origin, direction, stable node/edge identity, minimum depths, and maximum hop receipt without rerunning traversal, then decorates one canonical clone with static `data-share-reach-*` state. The complete topology remains as dimmed context, the header says `Authored upstream/downstream`, and Repository Violet / Proof Green keep direction visible while Blueprint remains glow-free. Missing, empty, stale, duplicate, conflicting, or tampered state fails closed. Its receipt is `format=share-card`, `variant=reach`, `canonical=false`, plus a dedicated reach-state-clean proof; ordinary exports clear the variant. It is download-only and adds no new format, schema, parser, layout, dependency, URL, storage, hosted service, or mobile product surface.+The latest stability slice adds Clean Label Gate across all five typed renderers and the final artifact checker. Actual rendered label masks must remain at least 4px from every other relationship route in `showcase`; `standard` records sub-2px clearance as a warning. Diagnostics preserve both relationship identities, exact segment geometry, the label rectangle, measured distance, threshold, and renderer-supported repair controls. The label's own path fragments are exempt, but shared endpoints do not hide another route. One real Event Stream label moved to a clear authored position, Proof Lab reaches 99/99 checks, and no auto-layout, route rewrite, schema, viewer, export, dependency, or mobile surface was added.The previous sharing slice added Copy Share Card. The existing canonical 1200×630 PNG can now move directly to an image clipboard from the Export menu, reusing one rasterization promise and retaining current theme, preset, contain-only geometry, and temporary-state cleanup. Only a successful clipboard write records exact dimensions, bytes, and canonical state. Missing image clipboard support disables this one action while download and full-diagram Copy PNG remain available. Real Chrome smoke reads back the copied PNG signature and dimensions without adding a toolbar control, second renderer, dependency, server, storage, schema, layout, or mobile surface.diff --git a/archify.zip b/archify.zipindex 137464ba..d1f35406 100644Binary files a/archify.zip and b/archify.zip differdiff --git a/archify/SKILL.md b/archify/SKILL.mdindex 513cd9e7..6309528a 100644--- a/archify/SKILL.md+++ b/archify/SKILL.md@@ -18,6 +18,8 @@ Offer the optional 1200×630 Share Card PNG when the user asks for a README, relRoute Share Card is a reader-invoked optional export, never a default generation or delivery mode. When the user wants to share an incident path, request chain, dependency route, or PR explanation, offer the choice to resolve a Route Probe and use **Export → Route Share Card**; otherwise keep ordinary Share Card and canonical exports unchanged. The contextual Export item appears only after a real directed route resolves, reuses that exact ordered node and stable-edge snapshot without re-running pathfinding, preserves the full diagram as dimmed context, and downloads one 1200×630 PNG named `<diagram-base>-route-share-card.png`. It remains the shared Share Card seam (`Archify.exportMenu.shareCard({ variant: "route" })`) with `format=share-card` and `variant=route`; clear, unreachable, stale, or conflicting routes must fail closed. The isolated clone may use only static `data-share-route-*` decoration and must not include Journey position, animation overlays, camera, Focus, Lens, or Story state. Do not claim the route variant is canonical. This slice is download-only: do not promise Copy Route Share Card, a new format, schema, layout, dependency, URL, or storage surface.+Reach Share Card is the corresponding reader-invoked export for an active **authored reachability** query. When the user wants to explain what authored relationships lead into a component or continue from it, focus that node, choose `Upstream` or `Downstream`, then offer **Export → Reach Share Card**. The item must remain hidden unless a non-empty reach result is active. It consumes the already resolved node IDs, stable edge keys, minimum depths, origin, direction, and maximum hops without running BFS again; stale, duplicate, conflicting, empty, or tampered DOM state fails closed. The shared 1200×630 seam is `Archify.exportMenu.shareCard({ variant: "reach" })`, with `format=share-card`, `variant=reach`, `canonical=false`, and an independent reach-state-clean receipt. The clone may use only static `data-share-reach-*` decoration, keeps the complete diagram as dimmed context, labels the header `Authored upstream/downstream`, and downloads `<diagram-base>-<direction>-reach-share-card.png`. Never call the asset impact, blast radius, breakage, or runtime causality. This is download-only and adds no copy action, format, schema, parser, layout, dependency, URL, storage, hosted service, or mobile product surface.+Reading Depth progressively reveals renderer-owned context and fine detail as the reader zooms, while semantic interactions reveal the exact local facts they need at any scale.Direct Relationship Pin makes every unique compiled relationship directly operable without changing the authored line. Give important `connections`, `edges`, `messages`, `flows`, and `transitions` an optional author-controlled `id` using the normal identifier pattern; IDs must be unique within their relationship collection. The renderer keeps its numeric `data-edge-key` for runtime de-duplication and emits the author identity separately as `data-edge-id`. At runtime, reject conflicting source/target/label/ID metadata and clone only path/line/polyline geometry into one viewer-owned overlay below nodes. Use a transparent 24px non-scaling stroke for hit testing plus a separate dashed focus rail; keep exactly one relationship button at `tabindex="0"` and move roving focus with all Arrow keys, Home, and End. Fine-pointer hover and keyboard focus reuse exact Relationship Preview transiently. Click, tap, Enter, or Space opens the source Semantic Passport and pins the exact existing Lens row. When the relationship has an authored ID, the pin writes `#relation=<id>`, changes the action to `Copy relation`, and restores the same source, target, label, path, and bounded camera after reordering; stale IDs fail closed. An ID-less legacy relationship remains an in-page pin, keeps `Copy node`, and never exposes its numeric key. The same relationship, a true background activation, Clear, or Escape clears it. `aria-pressed` conveys the pin while the source/target/label name stays stable. Touch never waits for hover, nodes win near endpoints, panning never activates a relation, and stronger Focus, Story, Route, Semantic Lens, Chapter, and embed states take priority. Do not add another panel, toolbar action, dependency, storage, or authored geometry. Remove all hit, pin, preview, and pulse state from embed, print, and canonical export; preserve the authored `data-edge-id` as semantic SVG identity.diff --git a/archify/assets/template.html b/archify/assets/template.htmlindex bfae4118..08242af6 100644--- a/archify/assets/template.html+++ b/archify/assets/template.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4740,6 +4741,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4767,6 +4852,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -4888,6 +4974,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -4909,6 +5000,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -4918,7 +5010,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -4926,6 +5018,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5056,6 +5151,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5065,7 +5168,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5172,12 +5276,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5194,19 +5301,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5263,10 +5379,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5532,6 +5657,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5545,6 +5671,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5604,6 +5739,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5730,10 +5866,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5747,6 +5906,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5764,6 +5928,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5823,6 +5988,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5841,7 +6009,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6340,6 +6510,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6412,6 +6585,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6424,6 +6600,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7428,6 +7696,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/archify/test/reach-share-card.test.mjs b/archify/test/reach-share-card.test.mjsnew file mode 100644index 00000000..99f2df51--- /dev/null+++ b/archify/test/reach-share-card.test.mjs@@ -0,0 +1,147 @@+import { test } from 'node:test';+import assert from 'node:assert/strict';+import { execFileSync } from 'node:child_process';+import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { fileURLToPath } from 'node:url';++const __dirname = path.dirname(fileURLToPath(import.meta.url));+const skillRoot = path.resolve(__dirname, '..');+const repoRoot = path.resolve(skillRoot, '..');+const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-reach-share-card-'));++const CASES = {+ architecture: 'web-app.architecture.json',+ workflow: 'agent-tool-call.workflow.json',+ sequence: 'cache-miss-request.sequence.json',+ dataflow: 'product-analytics.dataflow.json',+ lifecycle: 'agent-run.lifecycle.json',+};++function render(mode, example) {+ const output = path.join(tmp, `${mode}.html`);+ execFileSync(process.execPath, [+ path.join(skillRoot, `renderers/${mode}/render-${mode}.mjs`),+ path.join(skillRoot, 'examples', example),+ output,+ ]);+ return fs.readFileSync(output, 'utf8');+}++function canonicalSvg(html) {+ return html.match(/<svg\b[\s\S]*?<\/svg>/)?.[0] || '';+}++test('all five renderers inherit one active-reach-only Reach Share Card item', () => {+ for (const [mode, example] of Object.entries(CASES)) {+ const html = render(mode, example);+ assert.match(html, /data-action="reach-share-card"[^>]*hidden disabled[^>]*>Reach Share Card[\s\S]*?1200(?:×|×)630 PNG/, mode);+ assert.match(html, /function syncReachShareItem\(\)/, mode);+ assert.match(html, /reachShareItem\.hidden = !snapshot;/, mode);+ assert.match(html, /reachShareItem\.disabled = !snapshot;/, mode);+ assert.match(html, /function open\(focusLast\)[\s\S]*?syncReachShareItem\(\);/, mode);+ assert.doesNotMatch(html, /id="reach-share-card"|class="reach-share-card"/, mode);+ assert.doesNotMatch(canonicalSvg(html), /data-share-reach(?:-|=)/, mode);+ }+});++test('Reach Share Card snapshots copy the active authored closure without rerunning traversal', () => {+ const html = render('architecture', CASES.architecture);+ const start = html.indexOf('function reachabilitySnapshot() {');+ const end = html.indexOf('\n function setPassportValue', start);+ const snapshotBlock = start >= 0 && end > start ? html.slice(start, end) : '';++ assert.match(snapshotBlock, /activeReachability\.nodeIds\.slice\(\)/);+ assert.match(snapshotBlock, /activeReachability\.edgeKeys\.slice\(\)/);+ assert.match(snapshotBlock, /activeReachability\.depths/);+ assert.match(snapshotBlock, /direction: reachabilityMode/);+ assert.match(snapshotBlock, /origin: \{ id: originId, label:/);+ assert.match(snapshotBlock, /maxDepth: activeReachability\.maxDepth/);+ assert.match(snapshotBlock, /seenNodeIds = Object\.create\(null\)/);+ assert.match(snapshotBlock, /seenEdgeKeys = Object\.create\(null\)/);+ assert.match(snapshotBlock, /drawableFragments = fragments\.filter\(hasDrawableGeometry\)/);+ assert.match(snapshotBlock, /drawableFragments\.length !== 1/);+ assert.match(snapshotBlock, /return null/);+ assert.doesNotMatch(snapshotBlock, /computeReachability|reachabilityFor|queue\s*=|shortestDirectedPath/);+ assert.match(html, /reachabilitySnapshot: reachabilitySnapshot/);+});++test('Reach variant decorates only a finite canonical clone with static authored identity', () => {+ const html = render('workflow', CASES.workflow);+ const start = html.indexOf('function applyReachSnapshot(clone, snapshot) {');+ const end = html.indexOf('\n function serializeSvg', start);+ const applyBlock = start >= 0 && end > start ? html.slice(start, end) : '';++ assert.match(applyBlock, /snapshot\.direction !== 'upstream'/);+ assert.match(applyBlock, /snapshot\.direction !== 'downstream'/);+ assert.match(applyBlock, /snapshot\.nodeIds\.length < 2/);+ assert.match(applyBlock, /snapshot\.origin\.label\.trim\(\)/);+ assert.match(applyBlock, /nodeId === snapshot\.origin\.id \? depth !== 0 : depth < 1/);+ assert.match(applyBlock, /edge\.depth !== Math\.max\(snapshot\.depths\[edge\.from\], snapshot\.depths\[edge\.to\]\)/);+ assert.match(applyBlock, /matchedNodes\.length !== 1/);+ assert.match(applyBlock, /drawableMatches\.length !== 1/);+ assert.match(applyBlock, /data-share-reach-match/);+ assert.match(applyBlock, /data-share-reach-origin/);+ assert.match(applyBlock, /data-share-reach-depth/);+ assert.match(applyBlock, /clone\.setAttribute\('data-share-reach', snapshot\.direction\)/);+ assert.doesNotMatch(applyBlock, /setAttribute\('data-reach-(?:active|match|origin|depth)/);+ assert.doesNotMatch(applyBlock, /animation:|setTimeout|requestAnimationFrame/);+ assert.match(html, /canonicalStateClean && finiteSvgDimensions && !opts\.routeSnapshot && applyReachSnapshot\(clone, opts\.reachSnapshot\)/);+ assert.ok(html.indexOf('var canonicalStateClean =') < html.indexOf('applyReachSnapshot(clone, opts.reachSnapshot)'), 'canonical cleanup must precede reach decoration');+});++test('Reach styling preserves context, direction, and Blueprint restraint without motion', () => {+ const html = render('dataflow', CASES.dataflow);+ assert.match(html, /svg\[data-share-reach\] \[data-node-id\], svg\[data-share-reach\] \[data-edge-from\] \{ opacity: 0\.14; \}/);+ assert.match(html, /svg\[data-share-reach\] \[data-share-reach-match\] \{ opacity: 1; \}/);+ assert.match(html, /data-share-reach=\\?"upstream\\?"[\s\S]*?--database-stroke/);+ assert.match(html, /data-share-reach=\\?"downstream\\?"[\s\S]*?--backend-stroke/);+ assert.match(html, /data-preset=\\?"blueprint\\?"\]\[data-share-reach\][\s\S]*?filter: none/);+ const reachStyleBlock = html.match(/if \(opts\.reachSnapshot\) \{[\s\S]*?\n \}/)?.[0] || '';+ assert.doesNotMatch(reachStyleBlock, /animation:|display:\s*none|transform:/);+});++test('Reach Share Card reuses the 1200x630 seam and publishes a truthful scoped receipt', () => {+ const html = render('architecture', CASES.architecture);+ assert.match(html, /options\.variant !== 'route' && options\.variant !== 'reach'/);+ assert.match(html, /Archify\.focus\.reachabilitySnapshot\(\)/);+ assert.match(html, /renderShareCard\(\{ reachSnapshot: snapshot \}\)/);+ assert.doesNotMatch(html, /function rasterizeReachShareCard|reachShareCard:/);+ assert.match(html, /'Authored ' \+ reachSnapshot\.direction \+ ' from ' \+ reachSnapshot\.origin\.label/);+ assert.match(html, /reachSnapshot\.nodeIds\.length - 1/);+ assert.match(html, /reachSnapshot\.edges\.length/);+ assert.match(html, /reachSnapshot\.maxDepth/);+ assert.match(html, /recordExportReceipt\('share-card', blob, false, \{ width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT \}, 'reach', false, true\)/);+ assert.match(html, /'-' \+ snapshot\.direction \+ '-reach-share-card\.png'/);+ assert.match(html, /data-last-export-reach-state-clean/);+ assert.match(html, /Trace authored reach before exporting a Reach Share Card/);+ assert.match(html, /downloadReachShareCard: runReachShareCard/);+});++test('Skill, product docs, and READMEs keep the optional truthful boundary explicit', () => {+ const skill = fs.readFileSync(path.join(skillRoot, 'SKILL.md'), 'utf8');+ assert.match(skill, /Export → Reach Share Card/);+ assert.match(skill, /variant=reach/);+ assert.match(skill, /data-share-reach-\*/);+ assert.match(skill, /authored reachability/i);+ assert.match(skill, /download-only/i);++ for (const readme of ['README.md', 'README_EN.md', 'README_ZH.md']) {+ const text = fs.readFileSync(path.join(repoRoot, readme), 'utf8');+ assert.match(text, /Reach Share Card/, readme);+ assert.match(text, /docs\/assets\/mco-runtime-reach-share-card\.png/, readme);+ }+ const png = fs.readFileSync(path.join(repoRoot, 'docs/assets/mco-runtime-reach-share-card.png'));+ assert.equal(png.subarray(0, 8).toString('hex'), '89504e470d0a1a0a');+ assert.equal(png.readUInt32BE(16), 1200);+ assert.equal(png.readUInt32BE(20), 630);++ const product = fs.readFileSync(path.join(repoRoot, 'PRODUCT.md'), 'utf8');+ const design = fs.readFileSync(path.join(repoRoot, 'DESIGN.md'), 'utf8');+ assert.match(product, /Reach Share Card/);+ assert.match(design, /Reach Share Card/);+ assert.match(design, /not (?:runtime )?(?:impact|causality|breakage)/i);+});++process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/archify/test/share-card-export.test.mjs b/archify/test/share-card-export.test.mjsindex c717177e..df3d00e1 100644--- a/archify/test/share-card-export.test.mjs+++ b/archify/test/share-card-export.test.mjs@@ -56,7 +56,7 @@ test('Share Card uses contain-only canonical geometry with fixed safe areas', ()assert.match(html, /canvas\.toBlob unavailable for/);assert.match(html, /img\.onload = function \(\) \{\s*try \{/);assert.match(html, /function rasterizeShareCard\(options\)[\s\S]*?if \(!options\.variant\) return renderShareCard\(\);/);- assert.match(html, /function renderShareCard\(options\)[\s\S]*?serializeSvg\(sourceScale, \{ routeSnapshot: routeSnapshot \}\)/);+ assert.match(html, /function renderShareCard\(options\)[\s\S]*?serializeSvg\(sourceScale, \{ routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot \}\)/);assert.match(html, /fitCanvasText\(ctx, title, [^)]+\)/);assert.match(html, /ARCHIFY ·/);assert.doesNotMatch(svgBlock(html), /share-card|Share Card|ARCHIFY ·/);@@ -108,7 +108,7 @@ test('Share Card stays viewer-only and reuses export cleanup instead of source sassert.match(html, /html\[data-embed="true"\] \.toolbar/);assert.match(html, /@media print[\s\S]*?\.toolbar/);assert.match(html, /function rasterizeShareCard\(options\)[\s\S]*?if \(!options\.variant\) return renderShareCard\(\);/);- assert.match(html, /function renderShareCard\(options\)[\s\S]*?serializeSvg\(sourceScale, \{ routeSnapshot: routeSnapshot \}\)/);+ assert.match(html, /function renderShareCard\(options\)[\s\S]*?serializeSvg\(sourceScale, \{ routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot \}\)/);assert.match(html, /if \(!data\.canonicalStateClean\) return Promise\.reject\(new Error\('Share Card export could not remove temporary viewer state'\)\);/);assert.match(html, /canonicalStateClean/);assert.doesNotMatch(svgBlock(html), /data-last-export-|data-format="share-card"/);diff --git a/archify/test/webm-artifact.smoke.mjs b/archify/test/webm-artifact.smoke.mjsindex a0380421..86a1c1e5 100644--- a/archify/test/webm-artifact.smoke.mjs+++ b/archify/test/webm-artifact.smoke.mjs@@ -10,6 +10,13 @@ import { pathToFileURL, fileURLToPath } from 'node:url';const __dirname = path.dirname(fileURLToPath(import.meta.url));const skillRoot = path.resolve(__dirname, '..');const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-webm-artifact-'));+const externalReachSource = process.env.ARCHIFY_REACH_CARD_SOURCE+ ? path.resolve(process.env.ARCHIFY_REACH_CARD_SOURCE)+ : '';+const externalReachOutput = process.env.ARCHIFY_REACH_CARD_OUTPUT+ ? path.resolve(process.env.ARCHIFY_REACH_CARD_OUTPUT)+ : '';+assert.equal(Boolean(externalReachSource), Boolean(externalReachOutput), 'ARCHIFY_REACH_CARD_SOURCE and ARCHIFY_REACH_CARD_OUTPUT must be set together');function executable(candidates) {for (const candidate of candidates) {@@ -908,6 +915,270 @@ try {console.log(`ok ${label} Route visual matrix: Classic/Flow/Blueprint x dark/light`);}+ async function captureReachShareCard(file, label, originId, direction, options = {}) {+ await navigateReady(file, '!!(window.Archify && Archify.focus && Archify.focus.reachabilitySnapshot && Archify.exportMenu && Archify.exportMenu.downloadReachShareCard)', label);+ const reachPayload = await withTimeout(evaluate(cdp, sessionId, String.raw`(async function () {+ try {+ window.alert = function (message) { window.__archifyReachAlert = String(message); };+ if (!Archify.focus.set(${JSON.stringify(originId)}, { toggle: false, updateUrl: false })) {+ throw new Error('focus origin did not resolve');+ }+ if (!Archify.focus.reach(${JSON.stringify(direction)}, { toggle: false, updateUrl: false, reveal: false })) {+ throw new Error('authored reach did not resolve');+ }+ var snapshot = Archify.focus.reachabilitySnapshot();+ if (!snapshot) throw new Error('active authored reach exposed no export snapshot');+ Archify.exportMenu.syncReachShare();+ var reachMenuItem = document.querySelector('[data-action="reach-share-card"]');+ var menuResolved = !!reachMenuItem && !reachMenuItem.hidden && !reachMenuItem.disabled &&+ getComputedStyle(reachMenuItem).display !== 'none';+ var svg = document.querySelector('.diagram-container svg');++ var firstEdge = snapshot.edges[0];+ var primaryCarrier = Array.from(svg.querySelectorAll('[data-edge-key]')).find(function (element) {+ return element.getAttribute('data-edge-key') === firstEdge.key && hasDrawableGeometry(element);+ });+ if (!primaryCarrier) throw new Error('reach exposed no primary geometry carrier');+ var duplicateCarrier = primaryCarrier.cloneNode(true);+ var duplicateGeometry = /^(path|line|polyline)$/i.test(duplicateCarrier.tagName)+ ? duplicateCarrier+ : duplicateCarrier.querySelector('path, line, polyline');+ if (duplicateGeometry.tagName.toLowerCase() === 'path') {+ duplicateGeometry.setAttribute('d', duplicateGeometry.getAttribute('d') + ' M 0 0 L 1 1');+ }+ svg.appendChild(duplicateCarrier);+ var duplicateGeometryRejected = Archify.focus.reachabilitySnapshot() === null;+ var duplicateExportError = '';+ try { await Archify.exportMenu.shareCard({ variant: 'reach' }); }+ catch (error) { duplicateExportError = String(error && error.message || error); }+ duplicateCarrier.remove();+ snapshot = Archify.focus.reachabilitySnapshot();+ if (!snapshot) throw new Error('reach snapshot did not recover after geometry restoration');++ function stableLiveSnapshot() {+ var clone = svg.cloneNode(true);+ clone.style.removeProperty('transform');+ clone.removeAttribute('data-view-scale');+ Array.from(clone.querySelectorAll('[data-legend-bridge-runtime]')).forEach(function (element) { element.remove(); });+ return clone.outerHTML;+ }+ function fingerprintBytes(bytes) {+ var hash = 2166136261;+ for (var index = 0; index < bytes.length; index++) {+ hash ^= bytes[index];+ hash = Math.imul(hash, 16777619);+ }+ return (hash >>> 0).toString(16);+ }+ var liveBefore = stableLiveSnapshot();+ var captured = [];+ var downloads = [];+ var originalCreateObjectURL = URL.createObjectURL.bind(URL);+ var originalAnchorClick = HTMLAnchorElement.prototype.click;+ URL.createObjectURL = function (blob) {+ if (blob && blob.type && blob.type.indexOf('image/svg+xml') === 0) captured.push(blob.text());+ return originalCreateObjectURL(blob);+ };+ HTMLAnchorElement.prototype.click = function () { downloads.push(this.download); };++ try {+ var blob = await Archify.exportMenu.shareCard({ variant: 'reach' });+ var reachSvgText = captured[0] ? await captured[0] : '';+ var downloadedBlob = await Archify.exportMenu.downloadReachShareCard();+ var reachReceipt = {+ format: document.documentElement.getAttribute('data-last-export-format'),+ variant: document.documentElement.getAttribute('data-last-export-variant'),+ width: document.documentElement.getAttribute('data-last-export-width'),+ height: document.documentElement.getAttribute('data-last-export-height'),+ canonical: document.documentElement.getAttribute('data-last-export-canonical'),+ routeStateClean: document.documentElement.getAttribute('data-last-export-route-state-clean'),+ reachStateClean: document.documentElement.getAttribute('data-last-export-reach-state-clean'),+ error: document.documentElement.getAttribute('data-last-export-error')+ };++ var parser = new DOMParser();+ var reachSvg = parser.parseFromString(reachSvgText, 'image/svg+xml').documentElement;+ var matchedNodeIds = Array.from(reachSvg.querySelectorAll('[data-node-id][data-share-reach-match]')).map(function (node) {+ return node.getAttribute('data-node-id');+ });+ var matchedEdgeKeys = Array.from(new Set(Array.from(reachSvg.querySelectorAll('[data-edge-key][data-share-reach-match]')).map(function (edge) {+ return edge.getAttribute('data-edge-key');+ })));+ var reachNodeIds = Array.from(reachSvg.querySelectorAll('[data-node-id]')).map(function (node) {+ return node.getAttribute('data-node-id');+ }).sort();+ var liveNodeIds = Array.from(svg.querySelectorAll('[data-node-id]')).map(function (node) {+ return node.getAttribute('data-node-id');+ }).sort();+ var reachEdgeKeys = Array.from(new Set(Array.from(reachSvg.querySelectorAll('[data-edge-key]')).map(function (edge) {+ return edge.getAttribute('data-edge-key');+ }))).sort();+ var liveEdgeKeys = Array.from(new Set(Array.from(svg.querySelectorAll('[data-edge-key]')).map(function (edge) {+ return edge.getAttribute('data-edge-key');+ }))).sort();+ var reachStyles = Array.from(reachSvg.querySelectorAll('style')).map(function (style) { return style.textContent; }).join('\n');++ await new Promise(function (resolve) {+ requestAnimationFrame(function () { requestAnimationFrame(resolve); });+ });+ var liveAfter = stableLiveSnapshot();++ var matrix = [];+ if (${JSON.stringify(options.matrix === true)}) {+ var identity = JSON.stringify(snapshot);+ for (var preset of ['classic', 'signal-flow', 'blueprint']) {+ if (!Archify.preset.apply(preset)) throw new Error('could not apply preset ' + preset);+ for (var theme of ['dark', 'light']) {+ document.documentElement.setAttribute('data-theme', theme);+ var matrixBlob = await Archify.exportMenu.shareCard({ variant: 'reach' });+ var matrixBytes = new Uint8Array(await matrixBlob.arrayBuffer());+ var matrixView = new DataView(matrixBytes.buffer, matrixBytes.byteOffset, matrixBytes.byteLength);+ matrix.push({+ preset: preset,+ theme: theme,+ type: matrixBlob.type,+ size: matrixBlob.size,+ width: matrixView.getUint32(16),+ height: matrixView.getUint32(20),+ hash: fingerprintBytes(matrixBytes),+ identity: JSON.stringify(Archify.focus.reachabilitySnapshot())+ });+ }+ }+ if (matrix.some(function (entry) { return entry.identity !== identity; })) {+ throw new Error('visual matrix changed authored reach identity');+ }+ }++ Archify.focus.clearReach({ updateUrl: false });+ Archify.exportMenu.syncReachShare();+ var hiddenAfterClear = reachMenuItem.hidden && reachMenuItem.disabled &&+ getComputedStyle(reachMenuItem).display === 'none';+ var staleError = '';+ try { await Archify.exportMenu.shareCard({ variant: 'reach' }); }+ catch (error) { staleError = String(error && error.message || error); }+ await Archify.exportMenu.downloadReachShareCard();+ var failedReceipt = {+ format: document.documentElement.getAttribute('data-last-export-format'),+ variant: document.documentElement.getAttribute('data-last-export-variant'),+ errorFormat: document.documentElement.getAttribute('data-last-export-error-format'),+ error: document.documentElement.getAttribute('data-last-export-error')+ };+ var canonicalIndex = captured.length;+ var canonicalBlob = await Archify.exportMenu.shareCard();+ var canonicalSvgText = captured[canonicalIndex] ? await captured[canonicalIndex] : '';+ var canonicalSvg = parser.parseFromString(canonicalSvgText, 'image/svg+xml').documentElement;+ var canonicalReachResidue = canonicalSvg.hasAttribute('data-share-reach') ||+ canonicalSvg.hasAttribute('data-reach-active') ||+ canonicalSvg.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-reach-match], [data-reach-origin], [data-reach-depth]').length > 0;++ var bytes = new Uint8Array(await blob.arrayBuffer());+ var binary = '';+ for (var offset = 0; offset < bytes.length; offset += 32768) {+ binary += String.fromCharCode.apply(null, bytes.subarray(offset, offset + 32768));+ }+ return {+ ok: true,+ type: blob.type,+ size: blob.size,+ base64: btoa(binary),+ snapshot: snapshot,+ matchedNodeIds: matchedNodeIds,+ matchedEdgeKeys: matchedEdgeKeys,+ expectedEdgeKeys: snapshot.edges.map(function (edge) { return edge.key; }),+ reachDirection: reachSvg.getAttribute('data-share-reach'),+ originCount: reachSvg.querySelectorAll('[data-node-id][data-share-reach-origin]').length,+ reachLiveResidue: reachSvg.hasAttribute('data-reach-active') || reachSvg.querySelectorAll('[data-reach-match], [data-reach-origin], [data-reach-depth]').length > 0,+ routeResidue: reachSvg.hasAttribute('data-share-route') || reachSvg.querySelectorAll('[data-share-route-match], [data-share-route-step], [data-route-match], [data-route-step]').length > 0,+ motionResidue: reachSvg.hasAttribute('data-animation') || reachSvg.querySelectorAll('[data-animate]').length > 0,+ blueprintStaticRule: /data-preset=\"blueprint\"\]\[data-share-reach\][^}]*filter:\s*none/.test(reachStyles),+ reachNodeIds: reachNodeIds,+ liveNodeIds: liveNodeIds,+ reachEdgeKeys: reachEdgeKeys,+ liveEdgeKeys: liveEdgeKeys,+ liveUnchanged: liveBefore === liveAfter,+ menuResolved: menuResolved,+ duplicateGeometryRejected: duplicateGeometryRejected,+ duplicateExportError: duplicateExportError,+ downloadStable: downloadedBlob && downloadedBlob.type === 'image/png',+ downloads: downloads,+ reachReceipt: reachReceipt,+ hiddenAfterClear: hiddenAfterClear,+ staleSnapshot: Archify.focus.reachabilitySnapshot(),+ staleError: staleError,+ failedReceipt: failedReceipt,+ canonicalSize: canonicalBlob.size,+ canonicalReachResidue: canonicalReachResidue,+ matrix: matrix+ };+ } finally {+ URL.createObjectURL = originalCreateObjectURL;+ HTMLAnchorElement.prototype.click = originalAnchorClick;+ }+ } catch (error) {+ return { ok: false, error: String(error && error.message || error) };+ }+ })()`, true), options.matrix ? 35_000 : 15_000, `${label} Reach Card export`);++ assert.equal(reachPayload?.ok, true, reachPayload?.error || `${label} Reach Card export failed`);+ assert.equal(reachPayload.type, 'image/png');+ assert.ok(reachPayload.size > 20_000, `${label} Reach Card is unexpectedly small (${reachPayload.size} bytes)`);+ const png = Buffer.from(reachPayload.base64, 'base64');+ assert.equal(png.subarray(0, 8).toString('hex'), '89504e470d0a1a0a', `${label} Reach Card is not a PNG`);+ assert.equal(png.readUInt32BE(16), 1200, `${label} Reach Card width`);+ assert.equal(png.readUInt32BE(20), 630, `${label} Reach Card height`);+ if (options.outputPath) {+ fs.mkdirSync(path.dirname(options.outputPath), { recursive: true });+ fs.writeFileSync(options.outputPath, png);+ }+ assert.equal(reachPayload.reachDirection, direction);+ assert.deepEqual(reachPayload.matchedNodeIds.slice().sort(), reachPayload.snapshot.nodeIds.slice().sort());+ assert.deepEqual(reachPayload.matchedEdgeKeys.slice().sort(), reachPayload.expectedEdgeKeys.slice().sort());+ assert.equal(reachPayload.originCount, 1);+ assert.equal(reachPayload.reachLiveResidue, false);+ assert.equal(reachPayload.routeResidue, false);+ assert.equal(reachPayload.motionResidue, false);+ assert.equal(reachPayload.blueprintStaticRule, true);+ assert.deepEqual(reachPayload.reachNodeIds, reachPayload.liveNodeIds);+ assert.deepEqual(reachPayload.reachEdgeKeys, reachPayload.liveEdgeKeys);+ assert.equal(reachPayload.liveUnchanged, true);+ assert.equal(reachPayload.menuResolved, true);+ assert.equal(reachPayload.duplicateGeometryRejected, true);+ assert.match(reachPayload.duplicateExportError, /Trace authored reach before exporting a Reach Share Card/);+ assert.equal(reachPayload.downloadStable, true);+ assert.match(reachPayload.downloads[0], new RegExp(`-${direction}-reach-share-card\\.png$`));+ assert.deepEqual(reachPayload.reachReceipt, {+ format: 'share-card',+ variant: 'reach',+ width: '1200',+ height: '630',+ canonical: 'false',+ routeStateClean: null,+ reachStateClean: 'true',+ error: null,+ });+ assert.equal(reachPayload.hiddenAfterClear, true);+ assert.equal(reachPayload.staleSnapshot, null);+ assert.match(reachPayload.staleError, /Trace authored reach before exporting a Reach Share Card/);+ assert.equal(reachPayload.failedReceipt.format, null);+ assert.equal(reachPayload.failedReceipt.variant, null);+ assert.equal(reachPayload.failedReceipt.errorFormat, 'share-card');+ assert.match(reachPayload.failedReceipt.error, /Trace authored reach before exporting a Reach Share Card/);+ assert.ok(reachPayload.canonicalSize > 20_000);+ assert.equal(reachPayload.canonicalReachResidue, false);+ if (options.matrix) {+ assert.equal(reachPayload.matrix.length, 6);+ assert.equal(new Set(reachPayload.matrix.map((entry) => entry.hash)).size, 6, `${label} Reach presets/themes should produce six distinct PNGs`);+ for (const entry of reachPayload.matrix) {+ assert.equal(entry.type, 'image/png');+ assert.equal(entry.width, 1200);+ assert.equal(entry.height, 630);+ assert.ok(entry.size > 20_000);+ }+ }+ console.log(`ok ${label} Reach Card: ${reachPayload.size} bytes, ${reachPayload.snapshot.nodeIds.length} nodes, ${reachPayload.snapshot.edges.length} authored links`);+ }+await captureShareCard(output, 'architecture-wide');await captureShareCard(sequenceOutput, 'sequence-tall');await captureCopiedShareCard(output, 'architecture-wide');@@ -924,6 +1195,22 @@ try {});await captureRouteVisualMatrix(routeOutputs.architecture, 'architecture-route', 'users', 'api');await captureRouteVisualMatrix(routeOutputs.sequence, 'sequence-route', 'web', 'db');+ await captureReachShareCard(routeOutputs.architecture, 'architecture-reach', 'users', 'downstream', { matrix: true });+ await captureReachShareCard(routeOutputs.workflow, 'workflow-reach', 'user', 'downstream');+ await captureReachShareCard(routeOutputs.sequence, 'sequence-reach', 'web', 'downstream');+ await captureReachShareCard(routeOutputs.dataflow, 'dataflow-reach', 'web', 'downstream');+ await captureReachShareCard(routeOutputs.lifecycle, 'lifecycle-reach', 'executing', 'downstream');+ if (externalReachSource) {+ assert.ok(fs.existsSync(externalReachSource), `external Reach Card source does not exist: ${externalReachSource}`);+ await captureReachShareCard(+ externalReachSource,+ 'external-reach',+ process.env.ARCHIFY_REACH_CARD_ORIGIN || 'router',+ process.env.ARCHIFY_REACH_CARD_DIRECTION || 'downstream',+ { outputPath: externalReachOutput },+ );+ console.log(`ok external Reach Card artifact: ${externalReachOutput}`);+ }await verifyDynamicReducedMotionRoute(routeOutputs.architecture, 'architecture-route reduced motion', 'users', 'api');await navigateReady(output, '!!(window.Archify && Archify.motion && Archify.motion.canRecord())', 'motion artifact');diff --git a/docs/assets/archify-live-proof.gif b/docs/assets/archify-live-proof.gifindex 874fed83..d11d3835 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 ff942c9e..5a0dcd3b 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": 1561913,- "sha256": "1eeb1ed82050b46900c5745b2c4b65a1d807c90702bc12b7d9577f57dc95c607",+ "bytes": 1651715,+ "sha256": "b85ea07c2de063904c64c23dc0912b3994ebeed3cb516339c1d681d5152fa58f","scenes": [{"id": "signal-flow","artifact": "docs/gallery/artifacts/agent-tool-call.workflow.html",- "artifactSha256": "28dfc2548c4deb616a6ca294118970848a238725eb523e5823553ab838322568",+ "artifactSha256": "541402cac74cad242e40efb982b3a817a4cbc00537a7eb72244aa3291b81b3af","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": "5fddc4add98c66570dbe078632f45bdd8f3845b0413567696fe0ec55966bba03",+ "artifactSha256": "023e6d18181fddc2a8408af23b0770669f053557784407b293a819b8d7782718","view": "request-boundary","eyebrow": "ARCHITECTURE · BLUEPRINT","title": "Production Deployment",@@ -31,7 +31,7 @@{"id": "classic","artifact": "docs/gallery/artifacts/cache-miss.sequence.html",- "artifactSha256": "866273ba5df085d700a0fb60eca46d2f2bdef6baabbe40881934c1cd738084b2",+ "artifactSha256": "89a81e1c53f374896dec38fc514719fc836a91d6ed06bde014ddb60b8bb7b6f2","view": "cache-fallback","eyebrow": "SEQUENCE · CLASSIC","title": "Cache Miss Request",diff --git a/docs/assets/mco-runtime-reach-share-card.png b/docs/assets/mco-runtime-reach-share-card.pngnew file mode 100644index 00000000..39130ee0Binary files /dev/null and b/docs/assets/mco-runtime-reach-share-card.png differdiff --git a/docs/cases/mco-runtime.architecture.html b/docs/cases/mco-runtime.architecture.htmlindex 65800f37..ee11e21e 100644--- a/docs/cases/mco-runtime.architecture.html+++ b/docs/cases/mco-runtime.architecture.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4859,6 +4860,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4886,6 +4971,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -5007,6 +5093,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -5028,6 +5119,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -5037,7 +5129,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -5045,6 +5137,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5175,6 +5270,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5184,7 +5287,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5291,12 +5395,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5313,19 +5420,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5382,10 +5498,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5651,6 +5776,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5664,6 +5790,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5723,6 +5858,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5849,10 +5985,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5866,6 +6025,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5883,6 +6047,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5942,6 +6107,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5960,7 +6128,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6459,6 +6629,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6531,6 +6704,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6543,6 +6719,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7547,6 +7815,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/docs/gallery.html b/docs/gallery.htmlindex 338f8b90..2df675ec 100644--- a/docs/gallery.html+++ b/docs/gallery.html@@ -324,7 +324,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="28dfc2548c4deb616a6ca294118970848a238725eb523e5823553ab838322568">28dfc2548c4d</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="541402cac74cad242e40efb982b3a817a4cbc00537a7eb72244aa3291b81b3af">541402cac74c</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>@@ -352,7 +352,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="5fddc4add98c66570dbe078632f45bdd8f3845b0413567696fe0ec55966bba03">5fddc4add98c</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="023e6d18181fddc2a8408af23b0770669f053557784407b293a819b8d7782718">023e6d18181f</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>@@ -380,7 +380,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="866273ba5df085d700a0fb60eca46d2f2bdef6baabbe40881934c1cd738084b2">866273ba5df0</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="89a81e1c53f374896dec38fc514719fc836a91d6ed06bde014ddb60b8bb7b6f2">89a81e1c53f3</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>@@ -408,7 +408,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="82953127f8e08578f0c7ea95fdacc35b02724d7654c929ec497d5d04a16440aa">82953127f8e0</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="299191550368a8321aadd4fd8456c8dd20beb4a8542bfcd602a1830d8cea4e2c">299191550368</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>@@ -436,7 +436,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="ed9e9ee06749fd6db186c8ba50fe15af8d44513a8d075a3a176dba1ab7943e5f">ed9e9ee06749</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="53e3f088286e37edd904323bc91cc706ac7303e8abf3528f63c5f7ac32e3917f">53e3f088286e</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>@@ -464,7 +464,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="3980da8686d93c82ef3b1e4e5182c8bdec69dfafea2fd6ed50ddb4597f14013e">3980da8686d9</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="75c1f57bcf2791e5839893559d47faa9fdf2369882b137204ac5895367b3e7df">75c1f57bcf27</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>@@ -492,7 +492,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="39af2a4cf178dd720b85b10d36f7346b66a7071d14fd433e23b5a442c180f547">39af2a4cf178</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="2c6a5da1a2c0ca24451843a183734030e8fd25819ebedc3292034d7905983f70">2c6a5da1a2c0</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>@@ -520,7 +520,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="e992bd9969c629c76c3fc4ab52927d7e5fc52f550701daad3e3027a83e935121">e992bd9969c6</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="392e31bcfa3897af68da48debc3f2cf347aa594022f24fc08327c6488c5ba975">392e31bcfa38</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>@@ -548,7 +548,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 · 5E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="59cc573056710b27b5502882cd8ff8fd0805c69481d74031dd090411275c52bd">59cc57305671</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="af5632d9d34bce1f5c74eb61c4077b24441f1d88d02ea4498dfcc8e48855571d">af5632d9d34b</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>@@ -576,7 +576,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="544b85f7604643e37ec2b1722b471060bab7a7ad7a49c1b70e5f5f5f95492e5c">544b85f76046</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="29eb7cdde5ff9d1bb1cb749afeba91a72fa242cc2717d4ece9ca16d2b3676ab9">29eb7cdde5ff</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>@@ -604,7 +604,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="d076d42b4ce4f9d3ef60fecef030c9227c188fc084d0c510f0542d7a0a2ff423">d076d42b4ce4</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="55200146c277dadc2507b14b92df67cfaf35329f48e01912c30e369b241b352d">55200146c277</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>@@ -681,8 +681,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 12,"edgeCount": 11,- "artifactBytes": 583130,- "artifactSha256": "28dfc2548c4deb616a6ca294118970848a238725eb523e5823553ab838322568",+ "artifactBytes": 598332,+ "artifactSha256": "541402cac74cad242e40efb982b3a817a4cbc00537a7eb72244aa3291b81b3af","sourceBytes": 6470,"sourceSha256": "a3afc6b30044eb256aa15c6195ddfbbcd1a14880d99967ed5605bc621ffb7e5f","checks": [@@ -778,8 +778,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 12,"edgeCount": 12,- "artifactBytes": 582286,- "artifactSha256": "5fddc4add98c66570dbe078632f45bdd8f3845b0413567696fe0ec55966bba03",+ "artifactBytes": 597488,+ "artifactSha256": "023e6d18181fddc2a8408af23b0770669f053557784407b293a819b8d7782718","sourceBytes": 5308,"sourceSha256": "c3c4ddc8fd8910d8d2bcf2ba97434017d6fa347eb4ee436d2fb519dd0f27c814","checks": [@@ -875,8 +875,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 7,"edgeCount": 12,- "artifactBytes": 576777,- "artifactSha256": "866273ba5df085d700a0fb60eca46d2f2bdef6baabbe40881934c1cd738084b2",+ "artifactBytes": 591979,+ "artifactSha256": "89a81e1c53f374896dec38fc514719fc836a91d6ed06bde014ddb60b8bb7b6f2","sourceBytes": 4442,"sourceSha256": "30098d81006a18813bab447da698edf74604a1463770f01dc056b0af8cb314ef","checks": [@@ -972,8 +972,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 10,"edgeCount": 10,- "artifactBytes": 579396,- "artifactSha256": "82953127f8e08578f0c7ea95fdacc35b02724d7654c929ec497d5d04a16440aa",+ "artifactBytes": 594598,+ "artifactSha256": "299191550368a8321aadd4fd8456c8dd20beb4a8542bfcd602a1830d8cea4e2c","sourceBytes": 5256,"sourceSha256": "44aa56ac6ca807937dfe84a6404e8b07d6394a38ae2ac53248a1985337dfd671","checks": [@@ -1069,8 +1069,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 11,"edgeCount": 10,- "artifactBytes": 579254,- "artifactSha256": "ed9e9ee06749fd6db186c8ba50fe15af8d44513a8d075a3a176dba1ab7943e5f",+ "artifactBytes": 594456,+ "artifactSha256": "53e3f088286e37edd904323bc91cc706ac7303e8abf3528f63c5f7ac32e3917f","sourceBytes": 5471,"sourceSha256": "9beb8698b275679a2fc92d4b51288cd5b5fc2115696d06b9168f3d7fef253a72","checks": [@@ -1166,8 +1166,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 10,"edgeCount": 10,- "artifactBytes": 580787,- "artifactSha256": "3980da8686d93c82ef3b1e4e5182c8bdec69dfafea2fd6ed50ddb4597f14013e",+ "artifactBytes": 595989,+ "artifactSha256": "75c1f57bcf2791e5839893559d47faa9fdf2369882b137204ac5895367b3e7df","sourceBytes": 5719,"sourceSha256": "f71c89288f80255bdedcdc0057bcbc155d1d8b1b7476d024b35f4e27c730c974","checks": [@@ -1263,8 +1263,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 7,"edgeCount": 14,- "artifactBytes": 577562,- "artifactSha256": "39af2a4cf178dd720b85b10d36f7346b66a7071d14fd433e23b5a442c180f547",+ "artifactBytes": 592764,+ "artifactSha256": "2c6a5da1a2c0ca24451843a183734030e8fd25819ebedc3292034d7905983f70","sourceBytes": 4483,"sourceSha256": "1b53d7c4ce7b2d8f6f40b8f33a394abe1d37fc991272b534c1ccd0255920ab52","checks": [@@ -1360,8 +1360,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 12,"edgeCount": 12,- "artifactBytes": 584742,- "artifactSha256": "e992bd9969c629c76c3fc4ab52927d7e5fc52f550701daad3e3027a83e935121",+ "artifactBytes": 599944,+ "artifactSha256": "392e31bcfa3897af68da48debc3f2cf347aa594022f24fc08327c6488c5ba975","sourceBytes": 5543,"sourceSha256": "bbfedc2f1b73bf50932490f7f56d45d5f853e970d2fab26660a04947a783969c","checks": [@@ -1457,8 +1457,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 10,"edgeCount": 5,- "artifactBytes": 573732,- "artifactSha256": "59cc573056710b27b5502882cd8ff8fd0805c69481d74031dd090411275c52bd",+ "artifactBytes": 588934,+ "artifactSha256": "af5632d9d34bce1f5c74eb61c4077b24441f1d88d02ea4498dfcc8e48855571d","sourceBytes": 4353,"sourceSha256": "1d6b34282e014cb2730662b1993158ec67bc0ad2a40520cb441aaee1ad21e4c6","checks": [@@ -1554,8 +1554,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"animation": "trace","nodeCount": 11,"edgeCount": 6,- "artifactBytes": 575109,- "artifactSha256": "544b85f7604643e37ec2b1722b471060bab7a7ad7a49c1b70e5f5f5f95492e5c",+ "artifactBytes": 590311,+ "artifactSha256": "29eb7cdde5ff9d1bb1cb749afeba91a72fa242cc2717d4ece9ca16d2b3676ab9","sourceBytes": 4394,"sourceSha256": "aa614f0c9a82f210e301e382f362dfbd7f290bda4d5501de3c99a6cd81b4c0a4","checks": [@@ -1651,8 +1651,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"animation": "static","nodeCount": 10,"edgeCount": 9,- "artifactBytes": 574741,- "artifactSha256": "d076d42b4ce4f9d3ef60fecef030c9227c188fc084d0c510f0542d7a0a2ff423",+ "artifactBytes": 589943,+ "artifactSha256": "55200146c277dadc2507b14b92df67cfaf35329f48e01912c30e369b241b352d","sourceBytes": 3863,"sourceSha256": "01567b5e49cad5139baa071533a028d22f0e80fedfb49095e0d9330aee7f87db","checks": [diff --git a/docs/gallery/artifacts/agent-run.lifecycle.html b/docs/gallery/artifacts/agent-run.lifecycle.htmlindex ed786452..dddd6769 100644--- a/docs/gallery/artifacts/agent-run.lifecycle.html+++ b/docs/gallery/artifacts/agent-run.lifecycle.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4791,6 +4792,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4818,6 +4903,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -4939,6 +5025,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -4960,6 +5051,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -4969,7 +5061,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -4977,6 +5069,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5107,6 +5202,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5116,7 +5219,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5223,12 +5327,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5245,19 +5352,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5314,10 +5430,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5583,6 +5708,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5596,6 +5722,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5655,6 +5790,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5781,10 +5917,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5798,6 +5957,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5815,6 +5979,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5874,6 +6039,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5892,7 +6060,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6391,6 +6561,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6463,6 +6636,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6475,6 +6651,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7479,6 +7747,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/docs/gallery/artifacts/agent-tool-call.workflow.html b/docs/gallery/artifacts/agent-tool-call.workflow.htmlindex 6ba6f683..d6e039b4 100644--- a/docs/gallery/artifacts/agent-tool-call.workflow.html+++ b/docs/gallery/artifacts/agent-tool-call.workflow.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4871,6 +4872,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4898,6 +4983,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -5019,6 +5105,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -5040,6 +5131,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -5049,7 +5141,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -5057,6 +5149,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5187,6 +5282,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5196,7 +5299,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5303,12 +5407,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5325,19 +5432,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5394,10 +5510,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5663,6 +5788,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5676,6 +5802,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5735,6 +5870,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5861,10 +5997,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5878,6 +6037,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5895,6 +6059,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5954,6 +6119,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5972,7 +6140,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6471,6 +6641,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6543,6 +6716,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6555,6 +6731,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7559,6 +7827,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/docs/gallery/artifacts/async-job-roundtrip.sequence.html b/docs/gallery/artifacts/async-job-roundtrip.sequence.htmlindex 8683fe12..87eefe7c 100644--- a/docs/gallery/artifacts/async-job-roundtrip.sequence.html+++ b/docs/gallery/artifacts/async-job-roundtrip.sequence.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4858,6 +4859,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4885,6 +4970,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -5006,6 +5092,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -5027,6 +5118,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -5036,7 +5128,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -5044,6 +5136,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5174,6 +5269,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5183,7 +5286,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5290,12 +5394,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5312,19 +5419,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5381,10 +5497,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5650,6 +5775,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5663,6 +5789,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5722,6 +5857,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5848,10 +5984,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5865,6 +6024,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5882,6 +6046,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5941,6 +6106,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5959,7 +6127,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6458,6 +6628,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6530,6 +6703,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6542,6 +6718,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7546,6 +7814,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/docs/gallery/artifacts/cache-miss.sequence.html b/docs/gallery/artifacts/cache-miss.sequence.htmlindex 5923172b..54a90414 100644--- a/docs/gallery/artifacts/cache-miss.sequence.html+++ b/docs/gallery/artifacts/cache-miss.sequence.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4842,6 +4843,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4869,6 +4954,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -4990,6 +5076,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -5011,6 +5102,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -5020,7 +5112,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -5028,6 +5120,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5158,6 +5253,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5167,7 +5270,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5274,12 +5378,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5296,19 +5403,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5365,10 +5481,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5634,6 +5759,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5647,6 +5773,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5706,6 +5841,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5832,10 +5968,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5849,6 +6008,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5866,6 +6030,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5925,6 +6090,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5943,7 +6111,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6442,6 +6612,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6514,6 +6687,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6526,6 +6702,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7530,6 +7798,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/docs/gallery/artifacts/deployment-release.lifecycle.html b/docs/gallery/artifacts/deployment-release.lifecycle.htmlindex c47424c6..94267e2d 100644--- a/docs/gallery/artifacts/deployment-release.lifecycle.html+++ b/docs/gallery/artifacts/deployment-release.lifecycle.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4805,6 +4806,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4832,6 +4917,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -4953,6 +5039,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -4974,6 +5065,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -4983,7 +5075,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -4991,6 +5083,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5121,6 +5216,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5130,7 +5233,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5237,12 +5341,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5259,19 +5366,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5328,10 +5444,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5597,6 +5722,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5610,6 +5736,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5669,6 +5804,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5795,10 +5931,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5812,6 +5971,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5829,6 +5993,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5888,6 +6053,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5906,7 +6074,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6405,6 +6575,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6477,6 +6650,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6489,6 +6665,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7493,6 +7761,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/docs/gallery/artifacts/event-stream.dataflow.html b/docs/gallery/artifacts/event-stream.dataflow.htmlindex ae964140..3a0a9f5c 100644--- a/docs/gallery/artifacts/event-stream.dataflow.html+++ b/docs/gallery/artifacts/event-stream.dataflow.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4877,6 +4878,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4904,6 +4989,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -5025,6 +5111,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -5046,6 +5137,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -5055,7 +5147,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -5063,6 +5155,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5193,6 +5288,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5202,7 +5305,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5309,12 +5413,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5331,19 +5438,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5400,10 +5516,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5669,6 +5794,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5682,6 +5808,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5741,6 +5876,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5867,10 +6003,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5884,6 +6043,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5901,6 +6065,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5960,6 +6125,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5978,7 +6146,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6477,6 +6647,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6549,6 +6722,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6561,6 +6737,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7565,6 +7833,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/docs/gallery/artifacts/incident-response.workflow.html b/docs/gallery/artifacts/incident-response.workflow.htmlindex f57119c8..d61af1d8 100644--- a/docs/gallery/artifacts/incident-response.workflow.html+++ b/docs/gallery/artifacts/incident-response.workflow.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4840,6 +4841,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4867,6 +4952,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -4988,6 +5074,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -5009,6 +5100,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -5018,7 +5110,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -5026,6 +5118,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5156,6 +5251,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5165,7 +5268,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5272,12 +5376,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5294,19 +5401,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5363,10 +5479,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5632,6 +5757,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5645,6 +5771,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5704,6 +5839,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5830,10 +5966,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5847,6 +6006,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5864,6 +6028,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5923,6 +6088,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5941,7 +6109,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6440,6 +6610,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6512,6 +6685,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6524,6 +6700,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7528,6 +7796,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/docs/gallery/artifacts/product-analytics.dataflow.html b/docs/gallery/artifacts/product-analytics.dataflow.htmlindex c0623dc6..06d771a1 100644--- a/docs/gallery/artifacts/product-analytics.dataflow.html+++ b/docs/gallery/artifacts/product-analytics.dataflow.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4838,6 +4839,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4865,6 +4950,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -4986,6 +5072,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -5007,6 +5098,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -5016,7 +5108,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -5024,6 +5116,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5154,6 +5249,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5163,7 +5266,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5270,12 +5374,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5292,19 +5399,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5361,10 +5477,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5630,6 +5755,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5643,6 +5769,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5702,6 +5837,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5828,10 +5964,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5845,6 +6004,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5862,6 +6026,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5921,6 +6086,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5939,7 +6107,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6438,6 +6608,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6510,6 +6683,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6522,6 +6698,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7526,6 +7794,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/docs/gallery/artifacts/production-deployment.architecture.html b/docs/gallery/artifacts/production-deployment.architecture.htmlindex 6f09fcd8..2672737e 100644--- a/docs/gallery/artifacts/production-deployment.architecture.html+++ b/docs/gallery/artifacts/production-deployment.architecture.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4857,6 +4858,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4884,6 +4969,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -5005,6 +5091,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -5026,6 +5117,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -5035,7 +5127,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -5043,6 +5135,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5173,6 +5268,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5182,7 +5285,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5289,12 +5393,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5311,19 +5418,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5380,10 +5496,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5649,6 +5774,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5662,6 +5788,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5721,6 +5856,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5847,10 +5983,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5864,6 +6023,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5881,6 +6045,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5940,6 +6105,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5958,7 +6126,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6457,6 +6627,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6529,6 +6702,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6541,6 +6717,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7545,6 +7813,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/docs/gallery/artifacts/release-delivery.workflow.html b/docs/gallery/artifacts/release-delivery.workflow.htmlindex 961e031e..07132d99 100644--- a/docs/gallery/artifacts/release-delivery.workflow.html+++ b/docs/gallery/artifacts/release-delivery.workflow.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4840,6 +4841,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4867,6 +4952,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -4988,6 +5074,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -5009,6 +5100,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -5018,7 +5110,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -5026,6 +5118,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5156,6 +5251,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5165,7 +5268,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5272,12 +5376,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5294,19 +5401,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5363,10 +5479,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5632,6 +5757,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5645,6 +5771,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5704,6 +5839,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5830,10 +5966,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5847,6 +6006,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5864,6 +6028,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5923,6 +6088,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5941,7 +6109,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6440,6 +6610,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6512,6 +6685,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6524,6 +6700,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7528,6 +7796,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/docs/gallery/artifacts/web-app.architecture.html b/docs/gallery/artifacts/web-app.architecture.htmlindex 586fea28..b7ff6aea 100644--- a/docs/gallery/artifacts/web-app.architecture.html+++ b/docs/gallery/artifacts/web-app.architecture.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4807,6 +4808,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4834,6 +4919,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -4955,6 +5041,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -4976,6 +5067,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -4985,7 +5077,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -4993,6 +5085,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5123,6 +5218,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5132,7 +5235,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5239,12 +5343,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5261,19 +5368,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5330,10 +5446,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5599,6 +5724,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5612,6 +5738,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5671,6 +5806,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5797,10 +5933,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5814,6 +5973,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5831,6 +5995,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5890,6 +6055,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5908,7 +6076,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6407,6 +6577,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6479,6 +6652,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6491,6 +6667,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7495,6 +7763,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/docs/gallery/manifest.json b/docs/gallery/manifest.jsonindex d853e0e6..bc271fa3 100644--- a/docs/gallery/manifest.json+++ b/docs/gallery/manifest.json@@ -26,8 +26,8 @@"animation": "trace","nodeCount": 12,"edgeCount": 11,- "artifactBytes": 583130,- "artifactSha256": "28dfc2548c4deb616a6ca294118970848a238725eb523e5823553ab838322568",+ "artifactBytes": 598332,+ "artifactSha256": "541402cac74cad242e40efb982b3a817a4cbc00537a7eb72244aa3291b81b3af","sourceBytes": 6470,"sourceSha256": "a3afc6b30044eb256aa15c6195ddfbbcd1a14880d99967ed5605bc621ffb7e5f","checks": [@@ -123,8 +123,8 @@"animation": "trace","nodeCount": 12,"edgeCount": 12,- "artifactBytes": 582286,- "artifactSha256": "5fddc4add98c66570dbe078632f45bdd8f3845b0413567696fe0ec55966bba03",+ "artifactBytes": 597488,+ "artifactSha256": "023e6d18181fddc2a8408af23b0770669f053557784407b293a819b8d7782718","sourceBytes": 5308,"sourceSha256": "c3c4ddc8fd8910d8d2bcf2ba97434017d6fa347eb4ee436d2fb519dd0f27c814","checks": [@@ -220,8 +220,8 @@"animation": "trace","nodeCount": 7,"edgeCount": 12,- "artifactBytes": 576777,- "artifactSha256": "866273ba5df085d700a0fb60eca46d2f2bdef6baabbe40881934c1cd738084b2",+ "artifactBytes": 591979,+ "artifactSha256": "89a81e1c53f374896dec38fc514719fc836a91d6ed06bde014ddb60b8bb7b6f2","sourceBytes": 4442,"sourceSha256": "30098d81006a18813bab447da698edf74604a1463770f01dc056b0af8cb314ef","checks": [@@ -317,8 +317,8 @@"animation": "trace","nodeCount": 10,"edgeCount": 10,- "artifactBytes": 579396,- "artifactSha256": "82953127f8e08578f0c7ea95fdacc35b02724d7654c929ec497d5d04a16440aa",+ "artifactBytes": 594598,+ "artifactSha256": "299191550368a8321aadd4fd8456c8dd20beb4a8542bfcd602a1830d8cea4e2c","sourceBytes": 5256,"sourceSha256": "44aa56ac6ca807937dfe84a6404e8b07d6394a38ae2ac53248a1985337dfd671","checks": [@@ -414,8 +414,8 @@"animation": "trace","nodeCount": 11,"edgeCount": 10,- "artifactBytes": 579254,- "artifactSha256": "ed9e9ee06749fd6db186c8ba50fe15af8d44513a8d075a3a176dba1ab7943e5f",+ "artifactBytes": 594456,+ "artifactSha256": "53e3f088286e37edd904323bc91cc706ac7303e8abf3528f63c5f7ac32e3917f","sourceBytes": 5471,"sourceSha256": "9beb8698b275679a2fc92d4b51288cd5b5fc2115696d06b9168f3d7fef253a72","checks": [@@ -511,8 +511,8 @@"animation": "trace","nodeCount": 10,"edgeCount": 10,- "artifactBytes": 580787,- "artifactSha256": "3980da8686d93c82ef3b1e4e5182c8bdec69dfafea2fd6ed50ddb4597f14013e",+ "artifactBytes": 595989,+ "artifactSha256": "75c1f57bcf2791e5839893559d47faa9fdf2369882b137204ac5895367b3e7df","sourceBytes": 5719,"sourceSha256": "f71c89288f80255bdedcdc0057bcbc155d1d8b1b7476d024b35f4e27c730c974","checks": [@@ -608,8 +608,8 @@"animation": "trace","nodeCount": 7,"edgeCount": 14,- "artifactBytes": 577562,- "artifactSha256": "39af2a4cf178dd720b85b10d36f7346b66a7071d14fd433e23b5a442c180f547",+ "artifactBytes": 592764,+ "artifactSha256": "2c6a5da1a2c0ca24451843a183734030e8fd25819ebedc3292034d7905983f70","sourceBytes": 4483,"sourceSha256": "1b53d7c4ce7b2d8f6f40b8f33a394abe1d37fc991272b534c1ccd0255920ab52","checks": [@@ -705,8 +705,8 @@"animation": "trace","nodeCount": 12,"edgeCount": 12,- "artifactBytes": 584742,- "artifactSha256": "e992bd9969c629c76c3fc4ab52927d7e5fc52f550701daad3e3027a83e935121",+ "artifactBytes": 599944,+ "artifactSha256": "392e31bcfa3897af68da48debc3f2cf347aa594022f24fc08327c6488c5ba975","sourceBytes": 5543,"sourceSha256": "bbfedc2f1b73bf50932490f7f56d45d5f853e970d2fab26660a04947a783969c","checks": [@@ -802,8 +802,8 @@"animation": "trace","nodeCount": 10,"edgeCount": 5,- "artifactBytes": 573732,- "artifactSha256": "59cc573056710b27b5502882cd8ff8fd0805c69481d74031dd090411275c52bd",+ "artifactBytes": 588934,+ "artifactSha256": "af5632d9d34bce1f5c74eb61c4077b24441f1d88d02ea4498dfcc8e48855571d","sourceBytes": 4353,"sourceSha256": "1d6b34282e014cb2730662b1993158ec67bc0ad2a40520cb441aaee1ad21e4c6","checks": [@@ -899,8 +899,8 @@"animation": "trace","nodeCount": 11,"edgeCount": 6,- "artifactBytes": 575109,- "artifactSha256": "544b85f7604643e37ec2b1722b471060bab7a7ad7a49c1b70e5f5f5f95492e5c",+ "artifactBytes": 590311,+ "artifactSha256": "29eb7cdde5ff9d1bb1cb749afeba91a72fa242cc2717d4ece9ca16d2b3676ab9","sourceBytes": 4394,"sourceSha256": "aa614f0c9a82f210e301e382f362dfbd7f290bda4d5501de3c99a6cd81b4c0a4","checks": [@@ -996,8 +996,8 @@"animation": "static","nodeCount": 10,"edgeCount": 9,- "artifactBytes": 574741,- "artifactSha256": "d076d42b4ce4f9d3ef60fecef030c9227c188fc084d0c510f0542d7a0a2ff423",+ "artifactBytes": 589943,+ "artifactSha256": "55200146c277dadc2507b14b92df67cfaf35329f48e01912c30e369b241b352d","sourceBytes": 3863,"sourceSha256": "01567b5e49cad5139baa071533a028d22f0e80fedfb49095e0d9330aee7f87db","checks": [diff --git a/docs/research-reach-share-card-2026-07-23.md b/docs/research-reach-share-card-2026-07-23.mdnew file mode 100644index 00000000..6f4726fa--- /dev/null+++ b/docs/research-reach-share-card-2026-07-23.md@@ -0,0 +1,50 @@+# Reach Share Card — competitor learning and bounded export contract++Date: 2026-07-23++## Evidence++- [GitNexus architecture at current `main`](https://github.com/abhigyanpatwari/GitNexus/blob/main/ARCHITECTURE.md#L265-L285) treats upstream/downstream impact and shortest directed traces as first-class graph questions, and now extends them across repository contract boundaries.+- [SocratiCode README](https://github.com/giancarloerra/SocratiCode#readme) presents blast-radius and call-flow overlays as core code-intelligence outputs, but those claims are backed by its AST/dependency index rather than by presentation geometry.+- [SwarmVault README lines 670–676](https://github.com/swarmclawai/swarmvault/blob/main/README.md#L670-L676) pairs deterministic graph health/traversal outputs with a post-ready 1200×630 card and share bundle. The useful growth lesson is that a graph answer becomes more valuable when it is easy to carry into a post, issue, or review.++Archify should combine the interaction and sharing patterns without copying their causal claims. Its graph is the relationship set authored into one diagram, not a complete code index.++## Product decision++Add **Reach Share Card** as an explicit, contextual export variant:++- It appears only after a non-empty `Upstream` or `Downstream` authored reach query.+- It copies the already resolved origin, direction, stable node IDs, stable edge keys, minimum depths, and maximum hops. It never invokes BFS during export.+- The complete diagram remains as dimmed context; the resolved closure remains fully readable.+- The card header says `Authored upstream/downstream`, origin label, reachable nodes, links, and maximum hops.+- Upstream uses Repository Violet; downstream uses Proof Green; Blueprint has no filter or glow.+- The download is named `<diagram-base>-<direction>-reach-share-card.png`.+- The receipt is `format=share-card`, `variant=reach`, `canonical=false`, `reach-state-clean=true`, width 1200, and height 630.++## Fail-closed rules++Reject the variant when any of these is true:++- no active reach result, an empty closure, or invalid direction;+- active origin, URL/viewer direction, or reach state disagree;+- duplicate or missing node IDs / edge keys;+- a node or relationship no longer maps to exactly one valid authored identity;+- relationship fragments disagree on source, target, or author ID;+- drawable geometry is missing or duplicated;+- stored depth or maximum-hop evidence is invalid;+- canonical cleanup fails before the scoped decoration is applied.++## Explicit boundaries++- Do not call the card impact, blast radius, breakage, confidence, or runtime causality.+- Do not add code parsing, repository traversal, schema fields, a new format, a new panel, a permanent toolbar control, motion, copy-to-clipboard, storage, hosted sharing, or a mobile product surface.+- Ordinary Share Card, SVG, raster, WebM, and print remain canonical and strip both live reach state and share-variant attributes.+- The Reach Card owns only static `data-share-reach-*` decoration on an isolated clone.++## Acceptance++- All five renderers expose the same contextual menu contract.+- Browser smoke proves real 1200×630 PNG pixels, exact identity, live-SVG immutability, stale-state rejection, canonical follow-up exports, and Classic / Flow / Blueprint × dark / light parity.+- The MCO public proof exports Command Router downstream reach and is shown below the unchanged README Hero.+- Full Node regression, WebM/share-card smoke, Proof Lab, ZIP freshness, dependency-free package smoke, composition check, and in-app browser inspection pass.diff --git a/examples/dataflow-product-analytics.html b/examples/dataflow-product-analytics.htmlindex c0623dc6..06d771a1 100644--- a/examples/dataflow-product-analytics.html+++ b/examples/dataflow-product-analytics.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4838,6 +4839,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4865,6 +4950,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -4986,6 +5072,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -5007,6 +5098,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -5016,7 +5108,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -5024,6 +5116,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5154,6 +5249,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5163,7 +5266,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5270,12 +5374,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5292,19 +5399,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5361,10 +5477,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5630,6 +5755,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5643,6 +5769,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5702,6 +5837,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5828,10 +5964,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5845,6 +6004,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5862,6 +6026,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5921,6 +6086,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5939,7 +6107,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6438,6 +6608,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6510,6 +6683,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6522,6 +6698,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7526,6 +7794,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/examples/lifecycle-agent-run.html b/examples/lifecycle-agent-run.htmlindex ed786452..dddd6769 100644--- a/examples/lifecycle-agent-run.html+++ b/examples/lifecycle-agent-run.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4791,6 +4792,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4818,6 +4903,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -4939,6 +5025,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -4960,6 +5051,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -4969,7 +5061,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -4977,6 +5069,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5107,6 +5202,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5116,7 +5219,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5223,12 +5327,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5245,19 +5352,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5314,10 +5430,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5583,6 +5708,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5596,6 +5722,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5655,6 +5790,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5781,10 +5917,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5798,6 +5957,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5815,6 +5979,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5874,6 +6039,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5892,7 +6060,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6391,6 +6561,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6463,6 +6636,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6475,6 +6651,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7479,6 +7747,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/examples/sequence-cache-miss-request.html b/examples/sequence-cache-miss-request.htmlindex 5923172b..54a90414 100644--- a/examples/sequence-cache-miss-request.html+++ b/examples/sequence-cache-miss-request.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4842,6 +4843,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4869,6 +4954,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -4990,6 +5076,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -5011,6 +5102,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -5020,7 +5112,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -5028,6 +5120,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5158,6 +5253,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5167,7 +5270,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5274,12 +5378,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5296,19 +5403,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5365,10 +5481,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5634,6 +5759,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5647,6 +5773,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5706,6 +5841,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5832,10 +5968,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5849,6 +6008,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5866,6 +6030,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5925,6 +6090,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5943,7 +6111,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6442,6 +6612,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6514,6 +6687,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6526,6 +6702,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7530,6 +7798,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/examples/web-app-rendered.html b/examples/web-app-rendered.htmlindex 586fea28..b7ff6aea 100644--- a/examples/web-app-rendered.html+++ b/examples/web-app-rendered.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4807,6 +4808,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4834,6 +4919,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -4955,6 +5041,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -4976,6 +5067,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -4985,7 +5077,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -4993,6 +5085,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5123,6 +5218,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5132,7 +5235,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5239,12 +5343,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5261,19 +5368,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5330,10 +5446,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5599,6 +5724,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5612,6 +5738,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5671,6 +5806,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5797,10 +5933,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5814,6 +5973,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5831,6 +5995,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5890,6 +6055,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5908,7 +6076,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6407,6 +6577,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6479,6 +6652,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6491,6 +6667,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7495,6 +7763,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/examples/web-app.html b/examples/web-app.htmlindex 586fea28..b7ff6aea 100644--- a/examples/web-app.html+++ b/examples/web-app.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4807,6 +4808,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4834,6 +4919,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -4955,6 +5041,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -4976,6 +5067,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -4985,7 +5077,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -4993,6 +5085,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5123,6 +5218,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5132,7 +5235,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5239,12 +5343,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5261,19 +5368,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5330,10 +5446,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5599,6 +5724,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5612,6 +5738,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5671,6 +5806,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5797,10 +5933,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5814,6 +5973,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5831,6 +5995,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5890,6 +6055,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5908,7 +6076,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6407,6 +6577,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6479,6 +6652,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6491,6 +6667,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7495,6 +7763,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/examples/workflow-agent-tool-call-rendered.html b/examples/workflow-agent-tool-call-rendered.htmlindex 6ba6f683..d6e039b4 100644--- a/examples/workflow-agent-tool-call-rendered.html+++ b/examples/workflow-agent-tool-call-rendered.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4871,6 +4872,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4898,6 +4983,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -5019,6 +5105,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -5040,6 +5131,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -5049,7 +5141,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -5057,6 +5149,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5187,6 +5282,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5196,7 +5299,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5303,12 +5407,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5325,19 +5432,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5394,10 +5510,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5663,6 +5788,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5676,6 +5802,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5735,6 +5870,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5861,10 +5997,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5878,6 +6037,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5895,6 +6059,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5954,6 +6119,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5972,7 +6140,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6471,6 +6641,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6543,6 +6716,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6555,6 +6731,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7559,6 +7827,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,diff --git a/experiments/mco-showcase/mco-runtime.html b/experiments/mco-showcase/mco-runtime.htmlindex 5da79ea7..fb11eade 100644--- a/experiments/mco-showcase/mco-runtime.html+++ b/experiments/mco-showcase/mco-runtime.html@@ -4035,6 +4035,7 @@<div class="export-menu" id="export-menu" role="menu" aria-label="Export"><button data-format="share-card" type="button" role="menuitem" tabindex="-1">Share Card <span class="hint">1200×630 PNG</span></button><button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Route Share Card <span class="hint">1200×630 PNG</span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled>Reach Share Card <span class="hint">1200×630 PNG</span></button><button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1">Copy Share Card <span class="hint">PNG</span></button><hr role="separator"><button data-action="copy" type="button" role="menuitem" tabindex="-1">Copy to clipboard <span class="hint">PNG</span></button>@@ -4855,6 +4856,90 @@edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);}+ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }+function serializeSvg(scale, opts) {// scale: integer multiplier for intrinsic SVG pixel dimensions used by// the raster path. Defaults to 1 (natural size) for SVG download.@@ -4882,6 +4967,7 @@clone.removeAttribute('data-route-active');clone.removeAttribute('data-route-journey');clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');clone.removeAttribute('data-story-active');clone.removeAttribute('data-story-playing');clone.removeAttribute('data-story-beat');@@ -5003,6 +5089,11 @@el.removeAttribute('data-share-route-end');el.removeAttribute('data-share-route-middle');});+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {el.removeAttribute('data-detail');el.removeAttribute('data-detail-anchor');@@ -5024,6 +5115,7 @@!clone.hasAttribute('data-route-active') &&!clone.hasAttribute('data-route-journey') &&!clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&!clone.hasAttribute('data-story-active') &&!clone.hasAttribute('data-story-playing') &&!clone.hasAttribute('data-story-beat') &&@@ -5033,7 +5125,7 @@!clone.hasAttribute('data-chapter-anchor') &&!clone.hasAttribute('data-chapter-preview') &&!clone.style.getPropertyValue('transform') &&- clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;var vb = svg.viewBox.baseVal;var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&@@ -5041,6 +5133,9 @@var routeStateClean = opts.routeSnapshot? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot): null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;// Scale width/height so the browser rasterizes the vectors at target// resolution directly. viewBox stays unchanged so coordinates don't// shift. This is the key to sharp rasters — do NOT scale later via@@ -5171,6 +5266,14 @@"svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" +"svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";}+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }clone.insertBefore(style, clone.firstChild);clone.insertBefore(bgRect, style.nextSibling);@@ -5180,7 +5283,8 @@width: vb.width * scale,height: vb.height * scale,canonicalStateClean: canonicalStateClean,- routeStateClean: routeStateClean+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean};}@@ -5287,12 +5391,15 @@function renderShareCard(options) {options = options || {};var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(new Error('Share Card variants cannot be combined'));var svg = document.querySelector('.diagram-container svg');var vb = svg.viewBox.baseVal;var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));- var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot });+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });if (!data.canonicalStateClean) return Promise.reject(new Error('Share Card export could not remove temporary viewer state'));if (routeSnapshot && !data.routeStateClean) return Promise.reject(new Error('Route Card export could not preserve the resolved route safely'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(new Error('Reach Card export could not preserve authored reach safely'));var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });var svgUrl = URL.createObjectURL(svgBlob);@@ -5309,19 +5416,28 @@var text = computed.getPropertyValue('--text').trim() || '#ffffff';var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';var border = computed.getPropertyValue('--panel-border').trim() || '#334155';- var accent = computed.getPropertyValue('--frontend-stroke').trim() || '#22d3ee';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';var titleNode = document.querySelector('.header h1');var subtitleNode = document.querySelector('.header .subtitle');var title = titleNode ? titleNode.textContent : document.title;var subtitle = routeSnapshot? 'Route: ' + routeSnapshot.source.label + ' → ' + routeSnapshot.target.label + ' · ' + routeSnapshot.hops + ' directed hops'- : subtitleNode ? subtitleNode.textContent : '';+ : reachSnapshot+ ? 'Authored ' + reachSnapshot.direction + ' from ' + reachSnapshot.origin.label + ' · ' ++ (reachSnapshot.nodeIds.length - 1) + ' nodes · ' + reachSnapshot.edges.length ++ ' links · max ' + reachSnapshot.maxDepth + ' hops'+ : subtitleNode ? subtitleNode.textContent : '';var preset = document.documentElement.getAttribute('data-preset') || 'classic';var theme = document.documentElement.getAttribute('data-theme') || 'dark';var presetLabel = preset === 'signal-flow' ? 'FLOW' : preset.toUpperCase();var cardLabel = routeSnapshot? 'ARCHIFY · ROUTE · ' + routeSnapshot.hops + ' HOPS'- : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();+ : reachSnapshot+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();ctx.fillStyle = bg;ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);@@ -5378,10 +5494,19 @@function rasterizeShareCard(options) {options = options || {};if (!options.variant) return renderShareCard();- if (options.variant !== 'route') return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));- var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();- if (!snapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));- return renderShareCard({ routeSnapshot: snapshot });+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(new Error('Unknown Share Card variant: ' + options.variant));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(new Error('Trace a route before exporting a Route Share Card'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return renderShareCard({ reachSnapshot: snapshot });}function motionMimeType() {@@ -5647,6 +5772,7 @@var menu = document.getElementById('export-menu');var btn = document.getElementById('btn-export');var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');var items = function () {return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));};@@ -5660,6 +5786,15 @@return snapshot;}+ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }+// ---- Clipboard support ----------------------------------------------function canCopyImage() {return typeof ClipboardItem !== 'undefined' &&@@ -5719,6 +5854,7 @@if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });syncRouteShareItem();+ syncReachShareItem();menu.classList.add('open');btn.setAttribute('aria-expanded', 'true');var available = items().filter(function (i) { return !i.hidden && !i.disabled; });@@ -5845,10 +5981,33 @@});}+ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(new Error('Trace authored reach before exporting a Reach Share Card'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast('Downloaded Reach Share Card');+ return blob;+ }).catch(function (err) {+ console.error(err);+ var message = err && err.message ? err.message : 'share-card';+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', message);+ alert('Reach Share Card export failed: ' + message);+ });+ }+// A compact, machine-readable receipt for local QA and generated proof// galleries. It exposes no diagram contents, only the completed format,// byte count, and whether temporary viewer state was excluded.- function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean) {+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {document.documentElement.setAttribute('data-last-export-format', format);document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');@@ -5862,6 +6021,11 @@} else {document.documentElement.removeAttribute('data-last-export-route-state-clean');}+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }if (dimensions) {document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));@@ -5879,6 +6043,7 @@document.documentElement.removeAttribute('data-last-export-height');document.documentElement.removeAttribute('data-last-export-variant');document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');document.documentElement.removeAttribute('data-last-export-error-format');document.documentElement.removeAttribute('data-last-export-error');}@@ -5938,6 +6103,9 @@var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }+ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }+var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }@@ -5956,7 +6124,9 @@run: runExport,shareCard: rasterizeShareCard,downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,copyShareCard: runCopyShareCard};@@ -6455,6 +6625,9 @@resetReachabilityButtons();reachStatus.textContent = '';reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl === true && activeIds.length === 1) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));@@ -6527,6 +6700,9 @@(result.edgeKeys.length === 1 ? '' : 's') + ' · max ' + result.maxDepth + ' hop' +(result.maxDepth === 1 ? '' : 's');reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }if (options.updateUrl !== false) {try {history.replaceState(null, '', location.pathname + location.search + '#focus=' +@@ -6539,6 +6715,98 @@requestLensPlacement();return true;}+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }function setPassportValue(element, value) {var normalized = value == null ? '' : String(value).trim();element.textContent = normalized;@@ -7543,6 +7811,7 @@copyLink: copyFocusLink,reach: applyReachability,clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,inspectRelationship: inspectRelationship,inspectRelationshipById: inspectRelationshipById,reposition: requestLensPlacement,