Skip to content

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

feat: add direct visual style picker

tt-a1ieb847fa65afd
diff --git a/README.md b/README.md
index 4d82941a..5a42741e 100644
--- a/README.md
+++ b/README.md
@@ -234,7 +234,7 @@ Omit `animation` for a truly static diagram. `classic` remains default; `editori
| Open the live overview radar | <kbd>M</kbd> or `MAP` |
| Play a guided story / change chapter | <kbd>P</kbd> / <kbd>[</kbd> <kbd>]</kbd> |
| Enter Presentation Stage | <kbd>F</kbd> |
-| Cycle visual style / toggle theme / open Export | <kbd>S</kbd> / <kbd>T</kbd> / <kbd>E</kbd> |
+| Choose visual style (`S` cycles) / toggle theme / open Export | <kbd>S</kbd> / <kbd>T</kbd> / <kbd>E</kbd> |
| Zoom or reset | <kbd>+</kbd> / <kbd>-</kbd> / <kbd>0</kbd> |
Stable links can restore `#focus=<id>`, `#focus=<id>&reach=upstream|downstream`, `#relation=<id>`, `#route=<source>~<target>`, `#lens=<kind>~<kind>`, and `#view=<view-id>`. Reader-driven motion is finite, respects `prefers-reduced-motion`, and never enters canonical exports.
diff --git a/README_EN.md b/README_EN.md
index 4d82941a..5a42741e 100644
--- a/README_EN.md
+++ b/README_EN.md
@@ -234,7 +234,7 @@ Omit `animation` for a truly static diagram. `classic` remains default; `editori
| Open the live overview radar | <kbd>M</kbd> or `MAP` |
| Play a guided story / change chapter | <kbd>P</kbd> / <kbd>[</kbd> <kbd>]</kbd> |
| Enter Presentation Stage | <kbd>F</kbd> |
-| Cycle visual style / toggle theme / open Export | <kbd>S</kbd> / <kbd>T</kbd> / <kbd>E</kbd> |
+| Choose visual style (`S` cycles) / toggle theme / open Export | <kbd>S</kbd> / <kbd>T</kbd> / <kbd>E</kbd> |
| Zoom or reset | <kbd>+</kbd> / <kbd>-</kbd> / <kbd>0</kbd> |
Stable links can restore `#focus=<id>`, `#focus=<id>&reach=upstream|downstream`, `#relation=<id>`, `#route=<source>~<target>`, `#lens=<kind>~<kind>`, and `#view=<view-id>`. Reader-driven motion is finite, respects `prefers-reduced-motion`, and never enters canonical exports.
diff --git a/README_ZH.md b/README_ZH.md
index 90741281..a98624eb 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -229,7 +229,7 @@ node bin/archify.mjs deliver workflow examples/agent-tool-call.workflow.json /tm
| 打开实时全局雷达 | <kbd>M</kbd> 或 `MAP` |
| 播放故事 / 切换章节 | <kbd>P</kbd> / <kbd>[</kbd> <kbd>]</kbd> |
| 进入 Presentation Stage | <kbd>F</kbd> |
-| 切换视觉风格 / 主题 / 打开 Export | <kbd>S</kbd> / <kbd>T</kbd> / <kbd>E</kbd> |
+| 选择视觉风格(<kbd>S</kbd> 循环)/ 切换主题 / 打开 Export | <kbd>S</kbd> / <kbd>T</kbd> / <kbd>E</kbd> |
| 缩放或复位 | <kbd>+</kbd> / <kbd>-</kbd> / <kbd>0</kbd> |
稳定链接可以恢复 `#focus=<id>`、`#focus=<id>&reach=upstream|downstream`、`#relation=<id>`、`#route=<source>~<target>`、`#lens=<kind>~<kind>` 和 `#view=<view-id>`。读者触发的动态有限运行、遵守 `prefers-reduced-motion`,并且不会进入标准导出。
diff --git a/ROADMAP.md b/ROADMAP.md
index e2eb944b..ae090914 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -1,8 +1,10 @@
# 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, 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, four 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.
+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, four reader-switchable visual presets with a direct Style Picker, 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 visual-identity slice adds the opt-in `editorial` preset: warm paper and charcoal surfaces, deep ink, ruled structure, publication typography, and a restrained vermilion accent. It is available in all five typed renderers, both themes, session-only Style cycling, canonical SVG, raster, Share Card, Route Card, Reach Card, and finite trace motion. The preset changes only CSS variables and viewer styling; exact SVG geometry, semantic IDs, topology, author data, validation, default Classic output, storage, URLs, dependencies, and mobile product scope remain unchanged. This adapts the visible-style breadth that makes Fireworks Tech Graph and D2 easy to understand from their showcases while keeping Archify's stronger truth and interaction boundaries.
+The latest viewer slice turns the one-click Style cycle into a direct, accessible four-option Visual Style Picker. Each named option includes a compact material sample and audience cue; radio state, Arrow/Home/End navigation, Escape/Tab/outside-click dismissal, focus return, and mutual exclusion with Export follow the existing viewer contract. <kbd>S</kbd> still cycles for fast keyboard use. The picker is shared by all five renderers and keeps Classic as the default; it changes no geometry, topology, semantic identity, authored data, URL, storage, schema, dependency, export format, or passive-embed behavior.
+
+The previous visual-identity slice added the opt-in `editorial` preset: warm paper and charcoal surfaces, deep ink, ruled structure, publication typography, and a restrained vermilion accent. It is available in all five typed renderers, both themes, session-only Style selection, canonical SVG, raster, Share Card, Route Card, Reach Card, and finite trace motion. The preset changes only CSS variables and viewer styling; exact SVG geometry, semantic IDs, topology, author data, validation, default Classic output, storage, URLs, dependencies, and mobile product scope remain unchanged. This adapts the visible-style breadth that makes Fireworks Tech Graph and D2 easy to understand from their showcases while keeping Archify's stronger truth and interaction boundaries.
The latest Architecture Delta review slice adds an Exact-ID Review Navigator without expanding comparator truth. The proof still opens as a static Before / Delta / After overview and complete sidecar receipt; a reader may select any deterministic authored-change row or deliberately run one finite 1400ms-per-change pass. Components, relationships, and boundaries resolve only through exact generated identity, with generation-time and runtime state/classification checks that disable the navigator on missing, duplicate, or conflicting targets while preserving the static proof. Manual navigation, roving keyboard focus, Escape/Overview cleanup, reduced motion, hidden/print lifecycles, dark/light themes, and every bundled preset share the same bounded contract. No URL, history, storage, inferred impact, risk, mergeability, GitHub/CI integration, schema, dependency, hosted service, or mobile product surface was added.
diff --git a/archify.zip b/archify.zip
index 7ed9bd16..d1c2c889 100644
Binary files a/archify.zip and b/archify.zip differ
diff --git a/archify/SKILL.md b/archify/SKILL.md
index d80c7f57..ac97612b 100644
--- a/archify/SKILL.md
+++ b/archify/SKILL.md
@@ -148,7 +148,7 @@ Press <kbd>R</kbd> or use `PATH` to open Route Probe. If one node is already foc
After Route Probe resolves, expose Route Journey over the existing ordered `activeNodeIds` and exact `activeEdges`; do not build a second graph. Render every receipt stop as a native button with one roving Tab stop and add Previous, Next, Journey/Pause/Replay, and Overview controls. The full route stays visible. Position zero owns the source and no incoming edge; position `i > 0` owns exactly `activeEdges[i - 1]`, which alone may emit one finite 780ms marker-free signal. Manual activation pauses playback, while arrows/Home/End move focus and Enter/Space selects. Playback must start only from deliberate Play activation, run one finite pass, preserve the remaining dwell when paused, and reject stale timers with a generation token. Manual pan/zoom, path focus, Diagram Guide, Motion Still, dynamic reduced motion, page hiding, and print pause it without auto-resume. Use Semantic Camera to frame previous/current/next; manual inspection remains available without motion. Escape layers as pause → Overview → clear. Keep `#route=<source>~<target>` endpoint-only and restore to Overview without autoplay. Mobile controls need 44px targets; embed, print, canonical export, schema, IR, layout, dependencies, storage, and authored SVG geometry remain unchanged.
-Choose the authored `meta.visual_preset` with the user by audience, without changing diagram geometry: use `"signal-flow"` for a striking demo or motion-forward presentation; use `"blueprint"` for deployment maps, infrastructure handoffs, and drafting-style technical documentation; use `"editorial"` for warm publication-style design reviews, launch notes, and narrative documentation; omit it (or use `"classic"`) for the stable default visual language. If the user has no preference, keep Classic rather than guessing. In the generated artifact, the reader may press <kbd>S</kbd> or use `Style` to try Classic, Flow, Blueprint, and Editorial over the exact same topology; this session-only choice updates the canonical SVG and therefore deliberate exports, but never rewrites source JSON, persists a preference, changes the URL, or runs in a passive embed. Every preset supports both themes. WebM export appears only for trace-enabled diagrams and records six seconds directly in a supporting browser.
+Choose the authored `meta.visual_preset` with the user by audience, without changing diagram geometry: use `"signal-flow"` for a striking demo or motion-forward presentation; use `"blueprint"` for deployment maps, infrastructure handoffs, and drafting-style technical documentation; use `"editorial"` for warm publication-style design reviews, launch notes, and narrative documentation; omit it (or use `"classic"`) for the stable default visual language. If the user has no preference, keep Classic rather than guessing. In the generated artifact, `Style` opens a direct four-option picker for Classic, Flow, Blueprint, and Editorial over the exact same topology; <kbd>S</kbd> remains the fast cycle shortcut. This session-only choice updates the canonical SVG and therefore deliberate exports, but never rewrites source JSON, persists a preference, changes the URL, or runs in a passive embed. Every preset supports both themes. WebM export appears only for trace-enabled diagrams and records six seconds directly in a supporting browser.
For Architecture deployment reviews, choose `meta.engineering_profile: "deployment-ownership"` only after the user explicitly asks for a fail-closed deployment contract. Ordinary Architecture diagrams omit it. The profile requires every non-external component to name its owner in `tag` and belong to exactly one `region`; at least one `region` and one `security-group`; every `database` inside a security group; every security group contained within one shared region; and every connection that changes region/security-group membership to name its real boundary-crossing mechanism in `label`. It validates authored facts only. Never infer owners, regions, private placement, or crossing mechanisms, and never describe a passing profile as live-infrastructure or repository verification. `quality_profile` governs visual composition; `engineering_profile` governs this optional deployment contract.
diff --git a/archify/assets/template.html b/archify/assets/template.html
index 4aea7b37..9358eed3 100644
--- a/archify/assets/template.html
+++ b/archify/assets/template.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4773,6 +4958,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4791,16 +4980,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -5992,6 +6245,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12822,6 +13076,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12858,6 +13115,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/archify/examples/dataflow-product-analytics.html b/archify/examples/dataflow-product-analytics.html
index 00aae82f..73017361 100644
--- a/archify/examples/dataflow-product-analytics.html
+++ b/archify/examples/dataflow-product-analytics.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4871,6 +5056,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4889,16 +5078,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6090,6 +6343,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12920,6 +13174,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12956,6 +13213,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/archify/examples/lifecycle-agent-run.html b/archify/examples/lifecycle-agent-run.html
index d98084b3..2334d261 100644
--- a/archify/examples/lifecycle-agent-run.html
+++ b/archify/examples/lifecycle-agent-run.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4824,6 +5009,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4842,16 +5031,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6043,6 +6296,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12873,6 +13127,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12909,6 +13166,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/archify/examples/sequence-cache-miss-request.html b/archify/examples/sequence-cache-miss-request.html
index 3f727132..3574d859 100644
--- a/archify/examples/sequence-cache-miss-request.html
+++ b/archify/examples/sequence-cache-miss-request.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4875,6 +5060,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4893,16 +5082,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6094,6 +6347,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12924,6 +13178,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12960,6 +13217,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/archify/examples/web-app-rendered.html b/archify/examples/web-app-rendered.html
index c4c94f73..02ad0191 100644
--- a/archify/examples/web-app-rendered.html
+++ b/archify/examples/web-app-rendered.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4840,6 +5025,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4858,16 +5047,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6059,6 +6312,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12889,6 +13143,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12925,6 +13182,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/archify/examples/workflow-agent-tool-call-rendered.html b/archify/examples/workflow-agent-tool-call-rendered.html
index ec2ff0ce..d4c59fb5 100644
--- a/archify/examples/workflow-agent-tool-call-rendered.html
+++ b/archify/examples/workflow-agent-tool-call-rendered.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4904,6 +5089,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4922,16 +5111,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6123,6 +6376,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12953,6 +13207,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12989,6 +13246,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/archify/test/preset-tryon.test.mjs b/archify/test/preset-tryon.test.mjs
index 2e5a90eb..1a39c7ab 100644
--- a/archify/test/preset-tryon.test.mjs
+++ b/archify/test/preset-tryon.test.mjs
@@ -37,25 +37,49 @@ function presetRuntime(html) {
return html.match(/Archify\.preset = \(function \(\) \{[\s\S]*?\n \}\)\(\);/)?.[0] || '';
}
-test('all five renderers expose one reader-controlled visual style cycle', () => {
+test('all five renderers expose one reader-controlled visual style picker', () => {
for (const mode of Object.keys(CASES)) {
const html = render(mode);
- assert.match(html, /id="btn-preset"/, mode);
+ assert.match(html, /id="btn-preset"[^>]+aria-haspopup="menu"[^>]+aria-controls="preset-menu"/, mode);
assert.match(html, /id="preset-label"/, mode);
- assert.match(html, /title="Cycle visual style \(S\)"/, mode);
+ assert.match(html, /title="Choose visual style \(S cycles\)"/, mode);
+ assert.match(html, /id="preset-menu" role="menu" aria-label="Visual style"/, mode);
+ for (const preset of ['classic', 'signal-flow', 'blueprint', 'editorial']) {
+ assert.match(html, new RegExp(`data-preset-value="${preset}"[^>]+role="menuitemradio"`), `${mode}: ${preset}`);
+ }
assert.match(html, /Archify\.preset = \(function \(\)/, mode);
assert.match(html, /S -> cycle visual style/, mode);
}
});
-test('style cycle synchronizes page and canonical SVG without touching geometry', () => {
+test('style selection synchronizes page, picker, and canonical SVG without touching geometry', () => {
const html = render('architecture');
const runtime = presetRuntime(html);
assert.match(runtime, /\['classic', 'signal-flow', 'blueprint', 'editorial'\]/);
assert.match(runtime, /html\.setAttribute\('data-preset', preset\)/);
assert.match(runtime, /svg\.setAttribute\('data-preset', preset\)/);
assert.match(runtime, /data-preset-option/);
- assert.match(runtime, /return \{ cycle: cycle, apply: apply, current: current, authored: authored \}/);
+ assert.match(runtime, /option\.setAttribute\('aria-checked', String\(selected\)\)/);
+ assert.match(runtime, /return \{ cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen \}/);
+});
+
+test('style picker follows the accessible menu-button interaction contract', () => {
+ const html = render('architecture');
+ const runtime = presetRuntime(html);
+ assert.match(runtime, /function open\(focusLast\)/);
+ assert.match(runtime, /function close\(focusTrigger\)/);
+ assert.match(runtime, /e\.key === 'ArrowDown' \|\| e\.key === 'ArrowUp'/);
+ assert.match(runtime, /e\.key === 'Escape'/);
+ assert.match(runtime, /e\.key === 'Tab'/);
+ assert.match(runtime, /case 'Home':/);
+ assert.match(runtime, /case 'End':/);
+ assert.match(runtime, /document\.addEventListener\('click'/);
+ assert.match(html, /\.preset-option-swatch\.editorial/);
+ assert.match(
+ html,
+ /@media \(max-width: 720px\)[\s\S]*?\.toolbar \{[\s\S]*?position: relative;/,
+ 'the mobile toolbar must preserve its stacking context so the fixed preset menu stays above guided views',
+ );
});
test('style try-on is session-only and unavailable to passive embeds', () => {
diff --git a/docs/assets/archify-live-proof.gif b/docs/assets/archify-live-proof.gif
index d8568a50..2d26f9f8 100644
Binary files a/docs/assets/archify-live-proof.gif and b/docs/assets/archify-live-proof.gif differ
diff --git a/docs/assets/archify-live-proof.json b/docs/assets/archify-live-proof.json
index 7b83f14b..3380422a 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": 1673416,
- "sha256": "082b0fce9c008410ddff37c8d633a0c98ccd443ce639257849c6ced417ffe86a",
+ "bytes": 1599496,
+ "sha256": "d8742e92353f190b23b5eff45be8661ade3fe06a4dd19832853936b7b5e8edad",
"scenes": [
{
"id": "signal-flow",
"artifact": "docs/gallery/artifacts/agent-tool-call.workflow.html",
- "artifactSha256": "271ad748e5af753f1508f8006bbfc5506f59ce7f563a8cda426a28743cefab8c",
+ "artifactSha256": "5dcc43441ca3c5dac66f7d0ea2cd815596734ade9bba71f11f04501f19827cfc",
"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": "e8912695211d8342149355315c02c0f9019404385d14a1a215941a0c3f3ce53a",
+ "artifactSha256": "a9eadd97b44b97622c2c506ae54b1e98b8da4a4ac4b1142249a32865b8d5b1c3",
"view": "request-boundary",
"eyebrow": "ARCHITECTURE · BLUEPRINT",
"title": "Production Deployment",
@@ -31,7 +31,7 @@
{
"id": "classic",
"artifact": "docs/gallery/artifacts/cache-miss.sequence.html",
- "artifactSha256": "b03c06ce4052274ed6ab8269e20f376c1dc092435cbbc925af066c839b1f4b51",
+ "artifactSha256": "6acd3926a89a7ea1d53de6dd072552a63cfe858eae38505bf7b2ef0bca4342e8",
"view": "cache-fallback",
"eyebrow": "SEQUENCE · CLASSIC",
"title": "Cache Miss Request",
diff --git a/docs/cases/mco-runtime.architecture.html b/docs/cases/mco-runtime.architecture.html
index 16636eb9..4a57d061 100644
--- a/docs/cases/mco-runtime.architecture.html
+++ b/docs/cases/mco-runtime.architecture.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4892,6 +5077,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4910,16 +5099,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6111,6 +6364,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12941,6 +13195,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12977,6 +13234,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/docs/gallery.html b/docs/gallery.html
index dd9f36f0..e2836ba8 100644
--- a/docs/gallery.html
+++ b/docs/gallery.html
@@ -327,7 +327,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="271ad748e5af753f1508f8006bbfc5506f59ce7f563a8cda426a28743cefab8c">271ad748e5af</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="5dcc43441ca3c5dac66f7d0ea2cd815596734ade9bba71f11f04501f19827cfc">5dcc43441ca3</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/agent-tool-call.workflow.html?present=1&amp;play=1#view=happy-path" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -356,7 +356,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="e8912695211d8342149355315c02c0f9019404385d14a1a215941a0c3f3ce53a">e8912695211d</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="a9eadd97b44b97622c2c506ae54b1e98b8da4a4ac4b1142249a32865b8d5b1c3">a9eadd97b44b</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/production-deployment.architecture.html?present=1&amp;play=1#view=request-boundary" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -384,7 +384,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="b03c06ce4052274ed6ab8269e20f376c1dc092435cbbc925af066c839b1f4b51">b03c06ce4052</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="6acd3926a89a7ea1d53de6dd072552a63cfe858eae38505bf7b2ef0bca4342e8">6acd3926a89a</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/cache-miss.sequence.html?present=1&amp;play=1#view=cache-fallback" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -412,7 +412,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="29e8a9ea86175e1bb9b4147c63b5f54868727c2d902c039c2eff6cc528ce57af">29e8a9ea8617</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="2c78e3fe32c5fc4dcbee5a66b7883137f1c2f11355b20a68f62727437f81858b">2c78e3fe32c5</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/release-delivery.workflow.html?present=1&amp;play=1#view=approval-to-production" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -440,7 +440,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="fb42a4dcc8f6bc7063c59187f41cfb16b319105932f4ef626c4cd0383c25a559">fb42a4dcc8f6</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="29e3361a83566e4bb560bed2982e221751439bf43394337f5367d00202146999">29e3361a8356</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/incident-response.workflow.html?present=1&amp;play=1#view=mitigate-and-verify" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -468,7 +468,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="cdd52f1f9412ed5e6ef728811a358bc60f27e9fd58a525184dcfeb94416fddf5">cdd52f1f9412</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="f5367b1ffa3bbff4a8da232e73ca5d68d3b799c343dbfed0d5298ac86b76849a">f5367b1ffa3b</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/product-analytics.dataflow.html?present=1&amp;play=1#view=consent-boundary" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -496,7 +496,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="ec2fd4181f42bff695e83129b29835fc5c001aa0713950a756cbc17ab0321255">ec2fd4181f42</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="ab66af1e96145292a6c6ae0779fdcef8db05bdbd32060c14ca537cf82bfa8a79">ab66af1e9614</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/async-job-roundtrip.sequence.html?present=1&amp;play=1#view=work-and-retry" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -524,7 +524,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="c7083f49978c1d8e12065828eb8b482c933f3310450f7887bd7f8c9e024fe54d">c7083f49978c</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="af828c5d5bcb4f273b7237ff6326a8d5708008888501a799780ea169fb1aa8db">af828c5d5bcb</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/event-stream.dataflow.html?present=1&amp;play=1#view=order-transit" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -552,7 +552,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="7e33e8c6c598a13b0ed701b2e4c5f5c84e6dfd14445010aa9891264d4c8a6f85">7e33e8c6c598</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="c8249bca9a75fb086979737923883cca5f469ae5a1d22a69513aecc5a53a0354">c8249bca9a75</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/agent-run.lifecycle.html?present=1&amp;play=1#view=main-lifecycle" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -580,7 +580,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="f46c7e38b4ae9f6c0c09c97370f80be9011b6a7ab4a138be2145882e4c9e6ffe">f46c7e38b4ae</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="2d5d1b17ac04d29668f3249f1282b2ad531f87ae21884f12b78ca9f91ddd9b8c">2d5d1b17ac04</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/deployment-release.lifecycle.html?present=1&amp;play=1#view=rollback-outcomes" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -608,7 +608,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="3dc7e09c598fb1aaefa1664e06800782efadbbfbf92878ac76602c0a9194f3f5">3dc7e09c598f</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="352fa82e90ba4f470b43bcc1460631c882d83151d9b692bef63b3625b8ad67d6">352fa82e90ba</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/web-app.architecture.html?present=1&amp;play=1#view=request-path" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -686,8 +686,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 12,
"edgeCount": 11,
- "artifactBytes": 609259,
- "artifactSha256": "271ad748e5af753f1508f8006bbfc5506f59ce7f563a8cda426a28743cefab8c",
+ "artifactBytes": 619305,
+ "artifactSha256": "5dcc43441ca3c5dac66f7d0ea2cd815596734ade9bba71f11f04501f19827cfc",
"sourceBytes": 6470,
"sourceSha256": "a3afc6b30044eb256aa15c6195ddfbbcd1a14880d99967ed5605bc621ffb7e5f",
"checks": [
@@ -784,8 +784,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"engineeringProfile": "deployment-ownership",
"nodeCount": 12,
"edgeCount": 12,
- "artifactBytes": 609583,
- "artifactSha256": "e8912695211d8342149355315c02c0f9019404385d14a1a215941a0c3f3ce53a",
+ "artifactBytes": 619629,
+ "artifactSha256": "a9eadd97b44b97622c2c506ae54b1e98b8da4a4ac4b1142249a32865b8d5b1c3",
"sourceBytes": 5546,
"sourceSha256": "03e647d057eb20d99f7fb4ba4ddfdd5d58a7a813865338680e968038e6a90e0f",
"checks": [
@@ -882,8 +882,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 7,
"edgeCount": 12,
- "artifactBytes": 602906,
- "artifactSha256": "b03c06ce4052274ed6ab8269e20f376c1dc092435cbbc925af066c839b1f4b51",
+ "artifactBytes": 612952,
+ "artifactSha256": "6acd3926a89a7ea1d53de6dd072552a63cfe858eae38505bf7b2ef0bca4342e8",
"sourceBytes": 4442,
"sourceSha256": "30098d81006a18813bab447da698edf74604a1463770f01dc056b0af8cb314ef",
"checks": [
@@ -980,8 +980,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 10,
- "artifactBytes": 605525,
- "artifactSha256": "29e8a9ea86175e1bb9b4147c63b5f54868727c2d902c039c2eff6cc528ce57af",
+ "artifactBytes": 615571,
+ "artifactSha256": "2c78e3fe32c5fc4dcbee5a66b7883137f1c2f11355b20a68f62727437f81858b",
"sourceBytes": 5256,
"sourceSha256": "44aa56ac6ca807937dfe84a6404e8b07d6394a38ae2ac53248a1985337dfd671",
"checks": [
@@ -1078,8 +1078,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 11,
"edgeCount": 10,
- "artifactBytes": 605383,
- "artifactSha256": "fb42a4dcc8f6bc7063c59187f41cfb16b319105932f4ef626c4cd0383c25a559",
+ "artifactBytes": 615429,
+ "artifactSha256": "29e3361a83566e4bb560bed2982e221751439bf43394337f5367d00202146999",
"sourceBytes": 5471,
"sourceSha256": "9beb8698b275679a2fc92d4b51288cd5b5fc2115696d06b9168f3d7fef253a72",
"checks": [
@@ -1176,8 +1176,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 10,
- "artifactBytes": 606916,
- "artifactSha256": "cdd52f1f9412ed5e6ef728811a358bc60f27e9fd58a525184dcfeb94416fddf5",
+ "artifactBytes": 616962,
+ "artifactSha256": "f5367b1ffa3bbff4a8da232e73ca5d68d3b799c343dbfed0d5298ac86b76849a",
"sourceBytes": 5719,
"sourceSha256": "f71c89288f80255bdedcdc0057bcbc155d1d8b1b7476d024b35f4e27c730c974",
"checks": [
@@ -1274,8 +1274,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 7,
"edgeCount": 14,
- "artifactBytes": 603691,
- "artifactSha256": "ec2fd4181f42bff695e83129b29835fc5c001aa0713950a756cbc17ab0321255",
+ "artifactBytes": 613737,
+ "artifactSha256": "ab66af1e96145292a6c6ae0779fdcef8db05bdbd32060c14ca537cf82bfa8a79",
"sourceBytes": 4483,
"sourceSha256": "1b53d7c4ce7b2d8f6f40b8f33a394abe1d37fc991272b534c1ccd0255920ab52",
"checks": [
@@ -1372,8 +1372,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 12,
"edgeCount": 12,
- "artifactBytes": 610871,
- "artifactSha256": "c7083f49978c1d8e12065828eb8b482c933f3310450f7887bd7f8c9e024fe54d",
+ "artifactBytes": 620917,
+ "artifactSha256": "af828c5d5bcb4f273b7237ff6326a8d5708008888501a799780ea169fb1aa8db",
"sourceBytes": 5543,
"sourceSha256": "bbfedc2f1b73bf50932490f7f56d45d5f853e970d2fab26660a04947a783969c",
"checks": [
@@ -1470,8 +1470,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 5,
- "artifactBytes": 599861,
- "artifactSha256": "7e33e8c6c598a13b0ed701b2e4c5f5c84e6dfd14445010aa9891264d4c8a6f85",
+ "artifactBytes": 609907,
+ "artifactSha256": "c8249bca9a75fb086979737923883cca5f469ae5a1d22a69513aecc5a53a0354",
"sourceBytes": 4353,
"sourceSha256": "1d6b34282e014cb2730662b1993158ec67bc0ad2a40520cb441aaee1ad21e4c6",
"checks": [
@@ -1568,8 +1568,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 11,
"edgeCount": 6,
- "artifactBytes": 601238,
- "artifactSha256": "f46c7e38b4ae9f6c0c09c97370f80be9011b6a7ab4a138be2145882e4c9e6ffe",
+ "artifactBytes": 611284,
+ "artifactSha256": "2d5d1b17ac04d29668f3249f1282b2ad531f87ae21884f12b78ca9f91ddd9b8c",
"sourceBytes": 4394,
"sourceSha256": "aa614f0c9a82f210e301e382f362dfbd7f290bda4d5501de3c99a6cd81b4c0a4",
"checks": [
@@ -1666,8 +1666,8 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 9,
- "artifactBytes": 600870,
- "artifactSha256": "3dc7e09c598fb1aaefa1664e06800782efadbbfbf92878ac76602c0a9194f3f5",
+ "artifactBytes": 610916,
+ "artifactSha256": "352fa82e90ba4f470b43bcc1460631c882d83151d9b692bef63b3625b8ad67d6",
"sourceBytes": 3863,
"sourceSha256": "01567b5e49cad5139baa071533a028d22f0e80fedfb49095e0d9330aee7f87db",
"checks": [
diff --git a/docs/gallery/artifacts/agent-run.lifecycle.html b/docs/gallery/artifacts/agent-run.lifecycle.html
index d98084b3..2334d261 100644
--- a/docs/gallery/artifacts/agent-run.lifecycle.html
+++ b/docs/gallery/artifacts/agent-run.lifecycle.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4824,6 +5009,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4842,16 +5031,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6043,6 +6296,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12873,6 +13127,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12909,6 +13166,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/docs/gallery/artifacts/agent-tool-call.workflow.html b/docs/gallery/artifacts/agent-tool-call.workflow.html
index ec2ff0ce..d4c59fb5 100644
--- a/docs/gallery/artifacts/agent-tool-call.workflow.html
+++ b/docs/gallery/artifacts/agent-tool-call.workflow.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4904,6 +5089,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4922,16 +5111,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6123,6 +6376,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12953,6 +13207,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12989,6 +13246,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/docs/gallery/artifacts/async-job-roundtrip.sequence.html b/docs/gallery/artifacts/async-job-roundtrip.sequence.html
index 818c81b4..df361132 100644
--- a/docs/gallery/artifacts/async-job-roundtrip.sequence.html
+++ b/docs/gallery/artifacts/async-job-roundtrip.sequence.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4891,6 +5076,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4909,16 +5098,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6110,6 +6363,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12940,6 +13194,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12976,6 +13233,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/docs/gallery/artifacts/cache-miss.sequence.html b/docs/gallery/artifacts/cache-miss.sequence.html
index 3f727132..3574d859 100644
--- a/docs/gallery/artifacts/cache-miss.sequence.html
+++ b/docs/gallery/artifacts/cache-miss.sequence.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4875,6 +5060,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4893,16 +5082,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6094,6 +6347,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12924,6 +13178,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12960,6 +13217,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/docs/gallery/artifacts/deployment-release.lifecycle.html b/docs/gallery/artifacts/deployment-release.lifecycle.html
index c192aa96..2e39950d 100644
--- a/docs/gallery/artifacts/deployment-release.lifecycle.html
+++ b/docs/gallery/artifacts/deployment-release.lifecycle.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4838,6 +5023,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4856,16 +5045,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6057,6 +6310,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12887,6 +13141,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12923,6 +13180,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/docs/gallery/artifacts/event-stream.dataflow.html b/docs/gallery/artifacts/event-stream.dataflow.html
index eb4a0e60..8b8d83aa 100644
--- a/docs/gallery/artifacts/event-stream.dataflow.html
+++ b/docs/gallery/artifacts/event-stream.dataflow.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4910,6 +5095,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4928,16 +5117,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6129,6 +6382,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12959,6 +13213,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12995,6 +13252,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/docs/gallery/artifacts/incident-response.workflow.html b/docs/gallery/artifacts/incident-response.workflow.html
index 0028d9b1..20b9af43 100644
--- a/docs/gallery/artifacts/incident-response.workflow.html
+++ b/docs/gallery/artifacts/incident-response.workflow.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4873,6 +5058,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4891,16 +5080,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6092,6 +6345,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12922,6 +13176,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12958,6 +13215,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/docs/gallery/artifacts/product-analytics.dataflow.html b/docs/gallery/artifacts/product-analytics.dataflow.html
index 00aae82f..73017361 100644
--- a/docs/gallery/artifacts/product-analytics.dataflow.html
+++ b/docs/gallery/artifacts/product-analytics.dataflow.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4871,6 +5056,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4889,16 +5078,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6090,6 +6343,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12920,6 +13174,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12956,6 +13213,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/docs/gallery/artifacts/production-deployment.architecture.html b/docs/gallery/artifacts/production-deployment.architecture.html
index e0c0081e..17338376 100644
--- a/docs/gallery/artifacts/production-deployment.architecture.html
+++ b/docs/gallery/artifacts/production-deployment.architecture.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4899,6 +5084,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4917,16 +5106,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6118,6 +6371,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12948,6 +13202,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12984,6 +13241,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/docs/gallery/artifacts/release-delivery.workflow.html b/docs/gallery/artifacts/release-delivery.workflow.html
index 5cf82d35..491444ae 100644
--- a/docs/gallery/artifacts/release-delivery.workflow.html
+++ b/docs/gallery/artifacts/release-delivery.workflow.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4873,6 +5058,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4891,16 +5080,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6092,6 +6345,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12922,6 +13176,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12958,6 +13215,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/docs/gallery/artifacts/web-app.architecture.html b/docs/gallery/artifacts/web-app.architecture.html
index c4c94f73..02ad0191 100644
--- a/docs/gallery/artifacts/web-app.architecture.html
+++ b/docs/gallery/artifacts/web-app.architecture.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4840,6 +5025,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4858,16 +5047,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6059,6 +6312,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12889,6 +13143,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12925,6 +13182,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/docs/gallery/manifest.json b/docs/gallery/manifest.json
index 7a94bcb3..bc9195b3 100644
--- a/docs/gallery/manifest.json
+++ b/docs/gallery/manifest.json
@@ -27,8 +27,8 @@
"engineeringProfile": null,
"nodeCount": 12,
"edgeCount": 11,
- "artifactBytes": 609259,
- "artifactSha256": "271ad748e5af753f1508f8006bbfc5506f59ce7f563a8cda426a28743cefab8c",
+ "artifactBytes": 619305,
+ "artifactSha256": "5dcc43441ca3c5dac66f7d0ea2cd815596734ade9bba71f11f04501f19827cfc",
"sourceBytes": 6470,
"sourceSha256": "a3afc6b30044eb256aa15c6195ddfbbcd1a14880d99967ed5605bc621ffb7e5f",
"checks": [
@@ -125,8 +125,8 @@
"engineeringProfile": "deployment-ownership",
"nodeCount": 12,
"edgeCount": 12,
- "artifactBytes": 609583,
- "artifactSha256": "e8912695211d8342149355315c02c0f9019404385d14a1a215941a0c3f3ce53a",
+ "artifactBytes": 619629,
+ "artifactSha256": "a9eadd97b44b97622c2c506ae54b1e98b8da4a4ac4b1142249a32865b8d5b1c3",
"sourceBytes": 5546,
"sourceSha256": "03e647d057eb20d99f7fb4ba4ddfdd5d58a7a813865338680e968038e6a90e0f",
"checks": [
@@ -223,8 +223,8 @@
"engineeringProfile": null,
"nodeCount": 7,
"edgeCount": 12,
- "artifactBytes": 602906,
- "artifactSha256": "b03c06ce4052274ed6ab8269e20f376c1dc092435cbbc925af066c839b1f4b51",
+ "artifactBytes": 612952,
+ "artifactSha256": "6acd3926a89a7ea1d53de6dd072552a63cfe858eae38505bf7b2ef0bca4342e8",
"sourceBytes": 4442,
"sourceSha256": "30098d81006a18813bab447da698edf74604a1463770f01dc056b0af8cb314ef",
"checks": [
@@ -321,8 +321,8 @@
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 10,
- "artifactBytes": 605525,
- "artifactSha256": "29e8a9ea86175e1bb9b4147c63b5f54868727c2d902c039c2eff6cc528ce57af",
+ "artifactBytes": 615571,
+ "artifactSha256": "2c78e3fe32c5fc4dcbee5a66b7883137f1c2f11355b20a68f62727437f81858b",
"sourceBytes": 5256,
"sourceSha256": "44aa56ac6ca807937dfe84a6404e8b07d6394a38ae2ac53248a1985337dfd671",
"checks": [
@@ -419,8 +419,8 @@
"engineeringProfile": null,
"nodeCount": 11,
"edgeCount": 10,
- "artifactBytes": 605383,
- "artifactSha256": "fb42a4dcc8f6bc7063c59187f41cfb16b319105932f4ef626c4cd0383c25a559",
+ "artifactBytes": 615429,
+ "artifactSha256": "29e3361a83566e4bb560bed2982e221751439bf43394337f5367d00202146999",
"sourceBytes": 5471,
"sourceSha256": "9beb8698b275679a2fc92d4b51288cd5b5fc2115696d06b9168f3d7fef253a72",
"checks": [
@@ -517,8 +517,8 @@
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 10,
- "artifactBytes": 606916,
- "artifactSha256": "cdd52f1f9412ed5e6ef728811a358bc60f27e9fd58a525184dcfeb94416fddf5",
+ "artifactBytes": 616962,
+ "artifactSha256": "f5367b1ffa3bbff4a8da232e73ca5d68d3b799c343dbfed0d5298ac86b76849a",
"sourceBytes": 5719,
"sourceSha256": "f71c89288f80255bdedcdc0057bcbc155d1d8b1b7476d024b35f4e27c730c974",
"checks": [
@@ -615,8 +615,8 @@
"engineeringProfile": null,
"nodeCount": 7,
"edgeCount": 14,
- "artifactBytes": 603691,
- "artifactSha256": "ec2fd4181f42bff695e83129b29835fc5c001aa0713950a756cbc17ab0321255",
+ "artifactBytes": 613737,
+ "artifactSha256": "ab66af1e96145292a6c6ae0779fdcef8db05bdbd32060c14ca537cf82bfa8a79",
"sourceBytes": 4483,
"sourceSha256": "1b53d7c4ce7b2d8f6f40b8f33a394abe1d37fc991272b534c1ccd0255920ab52",
"checks": [
@@ -713,8 +713,8 @@
"engineeringProfile": null,
"nodeCount": 12,
"edgeCount": 12,
- "artifactBytes": 610871,
- "artifactSha256": "c7083f49978c1d8e12065828eb8b482c933f3310450f7887bd7f8c9e024fe54d",
+ "artifactBytes": 620917,
+ "artifactSha256": "af828c5d5bcb4f273b7237ff6326a8d5708008888501a799780ea169fb1aa8db",
"sourceBytes": 5543,
"sourceSha256": "bbfedc2f1b73bf50932490f7f56d45d5f853e970d2fab26660a04947a783969c",
"checks": [
@@ -811,8 +811,8 @@
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 5,
- "artifactBytes": 599861,
- "artifactSha256": "7e33e8c6c598a13b0ed701b2e4c5f5c84e6dfd14445010aa9891264d4c8a6f85",
+ "artifactBytes": 609907,
+ "artifactSha256": "c8249bca9a75fb086979737923883cca5f469ae5a1d22a69513aecc5a53a0354",
"sourceBytes": 4353,
"sourceSha256": "1d6b34282e014cb2730662b1993158ec67bc0ad2a40520cb441aaee1ad21e4c6",
"checks": [
@@ -909,8 +909,8 @@
"engineeringProfile": null,
"nodeCount": 11,
"edgeCount": 6,
- "artifactBytes": 601238,
- "artifactSha256": "f46c7e38b4ae9f6c0c09c97370f80be9011b6a7ab4a138be2145882e4c9e6ffe",
+ "artifactBytes": 611284,
+ "artifactSha256": "2d5d1b17ac04d29668f3249f1282b2ad531f87ae21884f12b78ca9f91ddd9b8c",
"sourceBytes": 4394,
"sourceSha256": "aa614f0c9a82f210e301e382f362dfbd7f290bda4d5501de3c99a6cd81b4c0a4",
"checks": [
@@ -1007,8 +1007,8 @@
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 9,
- "artifactBytes": 600870,
- "artifactSha256": "3dc7e09c598fb1aaefa1664e06800782efadbbfbf92878ac76602c0a9194f3f5",
+ "artifactBytes": 610916,
+ "artifactSha256": "352fa82e90ba4f470b43bcc1460631c882d83151d9b692bef63b3625b8ad67d6",
"sourceBytes": 3863,
"sourceSha256": "01567b5e49cad5139baa071533a028d22f0e80fedfb49095e0d9330aee7f87db",
"checks": [
diff --git a/docs/research-visual-style-picker-2026-07-23.md b/docs/research-visual-style-picker-2026-07-23.md
new file mode 100644
index 00000000..df09e2b7
--- /dev/null
+++ b/docs/research-visual-style-picker-2026-07-23.md
@@ -0,0 +1,68 @@
+# Visual Style Picker Research
+
+Date: 2026-07-23
+Status: implementation decision for `codex/visual-style-picker`
+
+## Decision
+
+Turn the existing Style cycle button into a direct, accessible picker for the
+four bundled visual presets. Keep <kbd>S</kbd> as the fast cycle shortcut.
+
+This is a discoverability improvement over one stable visual system, not a
+fifth preset, theme DSL, or graph-state feature.
+
+## Evidence
+
+- [Fireworks Tech Graph](https://github.com/yizhiyanhua-ai/fireworks-tech-graph)
+ puts named visual styles directly in its public showcase. The useful lesson
+ is visibility: readers can see that style is a deliberate product surface.
+- [D2 themes](https://d2lang.com/tour/themes/) are catalogued, named choices.
+ Special themes can change typography and material as well as color while the
+ diagram language remains the same.
+- [AntV G6 themes](https://g6.antv.antgroup.com/en/manual/theme/overview) can be
+ switched at runtime and coordinate canvas, node, edge, state, and animation
+ styling. Theme choice is explicit rather than hidden behind repeated clicks.
+
+Archify already has the stronger invariant for this use case: Classic, Flow,
+Blueprint, and Editorial render the exact same canonical SVG geometry and
+semantic identity. The missing piece is a visible choice surface.
+
+## Interaction contract
+
+1. The toolbar Style button opens a menu showing all four named presets.
+2. Each option has a small, preset-specific material sample, a name, and a
+ concise audience cue.
+3. The active option uses `menuitemradio` plus `aria-checked`; color is not the
+ only selected-state signal.
+4. Arrow keys, Home, End, Escape, Tab, outside click, and trigger focus follow
+ the existing Export menu-button conventions.
+5. Choosing an option updates the page and canonical SVG together, then closes
+ the menu and returns focus to the trigger.
+6. <kbd>S</kbd> continues to cycle without opening the menu.
+7. Opening Style closes Export; opening Export closes Style, so toolbar popups
+ never stack.
+
+## Stability boundaries
+
+- `classic` remains the renderer and schema default.
+- Authored `meta.visual_preset` remains the initial selection.
+- The reader choice remains session-only: no URL, history, local storage,
+ cookies, source rewrite, or preference persistence.
+- Passive embeds and print keep the picker unavailable.
+- SVG elements, coordinates, authored facts, topology, stable IDs, schema,
+ renderer layout, export formats, dependencies, and mobile product scope do
+ not change.
+- Ordinary SVG/raster/Share Card/Route Card/Reach Card/WebM exports continue to
+ consume the current canonical preset exactly as before.
+
+## Acceptance evidence
+
+- all five renderers expose the same four-option picker;
+- active state and button copy stay synchronized after authored, direct, and
+ shortcut-driven selection;
+- keyboard and dismissal behavior pass focused tests and real browser checks;
+- geometry equivalence across all four presets remains byte-identical after
+ normalizing only `data-preset`;
+- desktop dark/light and narrow containment show no clipping or popup overlap;
+- full tests, WebM visual matrices, Gallery freshness, and packaged ZIP smoke
+ remain green.
diff --git a/examples/archify-repo-grid.html b/examples/archify-repo-grid.html
index 6398becf..674ea223 100644
--- a/examples/archify-repo-grid.html
+++ b/examples/archify-repo-grid.html
@@ -271,6 +271,83 @@
--toolbar-menu-bg: #f9fdff;
}
+ /* ==========================================================
+ EDITORIAL — a warm, publication-minded preset for design
+ reviews, launch notes, and documentation. The diagram keeps
+ the same semantic palette and exact geometry, but trades
+ software chrome for paper, ink, ruled structure, and one
+ restrained vermilion accent.
+ ========================================================== */
+ [data-preset="editorial"][data-theme="dark"] {
+ --bg: #181611;
+ --grid: #39342a;
+ --panel: rgba(35, 31, 24, 0.96);
+ --panel-border: #625a4a;
+ --lane-fill: rgba(52, 46, 35, 0.46);
+ --lane-stroke: #726957;
+ --text: #f4eddf;
+ --text-muted: #b9ae9b;
+ --text-dim: #776e60;
+ --text-faint: #9d917e;
+ --mask: #231f18;
+ --frontend-fill: rgba(43, 133, 142, 0.16);
+ --frontend-stroke: #7fc6c7;
+ --backend-fill: rgba(63, 132, 92, 0.16);
+ --backend-stroke: #8fc29e;
+ --database-fill: rgba(117, 91, 141, 0.17);
+ --database-stroke: #c0a4d0;
+ --cloud-fill: rgba(170, 119, 49, 0.16);
+ --cloud-stroke: #d8ad68;
+ --security-fill: rgba(157, 69, 65, 0.17);
+ --security-stroke: #df9085;
+ --messagebus-fill: rgba(174, 79, 42, 0.16);
+ --messagebus-stroke: #df946f;
+ --external-fill: rgba(126, 115, 96, 0.18);
+ --external-stroke: #b8ad99;
+ --arrow: #948978;
+ --arrow-emphasis: #dd6b3d;
+ --toolbar-bg: rgba(35, 31, 24, 0.92);
+ --toolbar-border: #625a4a;
+ --toolbar-text: #eee5d5;
+ --toolbar-hover: #302a20;
+ --toolbar-menu-bg: #231f18;
+ }
+
+ [data-preset="editorial"][data-theme="light"] {
+ --bg: #f2eee5;
+ --grid: #d8d0c2;
+ --panel: rgba(251, 248, 241, 0.97);
+ --panel-border: #c4b9a6;
+ --lane-fill: rgba(229, 221, 207, 0.42);
+ --lane-stroke: #b8aa94;
+ --text: #242018;
+ --text-muted: #6f6658;
+ --text-dim: #a09788;
+ --text-faint: #817767;
+ --mask: #fbf8f1;
+ --frontend-fill: rgba(31, 117, 126, 0.09);
+ --frontend-stroke: #287e84;
+ --backend-fill: rgba(42, 119, 75, 0.09);
+ --backend-stroke: #397b53;
+ --database-fill: rgba(105, 75, 130, 0.09);
+ --database-stroke: #765d86;
+ --cloud-fill: rgba(157, 103, 31, 0.1);
+ --cloud-stroke: #9a671f;
+ --security-fill: rgba(153, 58, 52, 0.09);
+ --security-stroke: #9e463f;
+ --messagebus-fill: rgba(182, 70, 27, 0.09);
+ --messagebus-stroke: #ad4b25;
+ --external-fill: rgba(101, 91, 75, 0.09);
+ --external-stroke: #746b5e;
+ --arrow: #8a806f;
+ --arrow-emphasis: #bb4c23;
+ --toolbar-bg: rgba(251, 248, 241, 0.94);
+ --toolbar-border: #c4b9a6;
+ --toolbar-text: #40392f;
+ --toolbar-hover: #fffdf8;
+ --toolbar-menu-bg: #fbf8f1;
+ }
+
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
@@ -301,6 +378,12 @@
background-position: -1px -1px;
background-attachment: fixed;
}
+ html[data-preset="editorial"] body {
+ background-image:
+ linear-gradient(90deg, transparent 0, transparent 5.4rem, color-mix(in srgb, var(--security-stroke) 18%, transparent) 5.4rem, color-mix(in srgb, var(--security-stroke) 18%, transparent) calc(5.4rem + 1px), transparent calc(5.4rem + 1px)),
+ repeating-linear-gradient(0deg, transparent 0, transparent 31px, color-mix(in srgb, var(--grid) 36%, transparent) 31px, color-mix(in srgb, var(--grid) 36%, transparent) 32px);
+ background-attachment: fixed;
+ }
/* Gallery/embed mode keeps the generated artifact as the source of truth
while presenting only its diagram surface inside a proof card. */
@@ -369,6 +452,20 @@
box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
backdrop-filter: none;
}
+ html[data-preset="editorial"] .share-chapter-cue {
+ border-color: var(--panel-border);
+ background:
+ linear-gradient(90deg, color-mix(in srgb, var(--security-fill) 58%, transparent), transparent 42%),
+ var(--toolbar-menu-bg);
+ box-shadow: 0 10px 30px color-mix(in srgb, #000 18%, transparent);
+ backdrop-filter: none;
+ }
+ html[data-preset="editorial"] .share-chapter-state { color: var(--arrow-emphasis); }
+ html[data-preset="editorial"] .share-chapter-state::before {
+ border-radius: 0;
+ box-shadow: none;
+ transform: rotate(45deg) scale(0.8);
+ }
.share-chapter-index {
display: grid;
gap: 0.12rem;
@@ -508,7 +605,8 @@
.header { margin-bottom: 2rem; padding-right: 29.5rem; }
html[data-preset="signal-flow"] .header,
- html[data-preset="blueprint"] .header { padding-right: 29.5rem; }
+ html[data-preset="blueprint"] .header,
+ html[data-preset="editorial"] .header { padding-right: 29.5rem; }
.header-row {
display: flex;
@@ -581,6 +679,36 @@
white-space: nowrap;
}
+ html[data-preset="editorial"] h1,
+ html[data-preset="editorial"] .card h3 {
+ font-family: Georgia, 'Times New Roman', 'Songti SC', STSong, serif;
+ letter-spacing: -0.02em;
+ }
+ html[data-preset="editorial"] h1 { font-size: 1.72rem; font-weight: 600; }
+ html[data-preset="editorial"] .pulse-dot {
+ width: 9px;
+ height: 9px;
+ border: 1px solid var(--arrow-emphasis);
+ border-radius: 0;
+ background: var(--arrow-emphasis);
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
+ transform: rotate(45deg);
+ animation: none;
+ }
+ html[data-preset="editorial"] .header-row::after {
+ content: "EDITORIAL / FIELD NOTE";
+ margin-left: auto;
+ padding: 0.32rem 0 0.24rem;
+ border-bottom: 2px solid var(--arrow-emphasis);
+ color: var(--arrow-emphasis);
+ font-family: Georgia, 'Times New Roman', serif;
+ font-size: 0.625rem;
+ font-style: italic;
+ font-weight: 600;
+ letter-spacing: 0.08em;
+ white-space: nowrap;
+ }
+
.diagram-container {
background: var(--panel);
border-radius: 1rem;
@@ -625,6 +753,35 @@
linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right bottom / 1px 1.35rem no-repeat;
opacity: 0.58;
}
+ html[data-preset="editorial"] .diagram-container {
+ overflow: hidden;
+ border-color: var(--panel-border);
+ border-radius: 0.38rem;
+ background:
+ linear-gradient(90deg, color-mix(in srgb, var(--security-fill) 58%, transparent), transparent 12%),
+ var(--panel);
+ box-shadow:
+ 0 1px 0 color-mix(in srgb, var(--text) 6%, transparent),
+ 0 18px 48px color-mix(in srgb, #000 19%, transparent);
+ }
+ html[data-preset="editorial"] .diagram-container::after {
+ position: absolute;
+ z-index: 10;
+ top: 0.72rem;
+ right: 1.25rem;
+ padding: 0.2rem 0.52rem;
+ border: 1px solid var(--panel-border);
+ background: var(--panel);
+ color: var(--arrow-emphasis);
+ content: "ARCHIFY / PLATE 04";
+ font-family: Georgia, 'Times New Roman', serif;
+ font-size: 0.52rem;
+ font-style: italic;
+ font-weight: 600;
+ letter-spacing: 0.09em;
+ pointer-events: none;
+ }
+ html[data-embed="true"][data-preset="editorial"] .diagram-container::after { display: none; }
html[data-motion-capable="true"][data-preset="signal-flow"][data-ambient-motion="running"] .diagram-container::before {
content: "";
position: absolute;
@@ -1354,10 +1511,25 @@
.relationship-lens-actions {
display: flex;
flex-direction: column;
- align-items: stretch;
+ align-items: flex-end;
gap: 0.18rem;
}
.relationship-lens-actions button { white-space: nowrap; }
+ .relationship-lens-actions #btn-focus-clear {
+ display: grid;
+ width: 1.75rem;
+ height: 1.75rem;
+ padding: 0;
+ place-items: center;
+ color: var(--text-muted);
+ font-size: 1rem;
+ line-height: 1;
+ }
+ .relationship-lens-actions #btn-focus-clear:hover,
+ .relationship-lens-actions #btn-focus-clear:focus-visible {
+ background: var(--toolbar-hover);
+ color: var(--text);
+ }
.relationship-lens-actions #btn-focus-copy { color: var(--frontend-stroke); }
.relationship-lens-actions #btn-focus-relations { display: none; }
.relationship-lens-eyebrow {
@@ -1420,12 +1592,163 @@
.semantic-passport-meta [hidden] { display: none; }
html[data-preset="blueprint"] .semantic-passport-meta span,
html[data-preset="blueprint"] .semantic-passport-meta code { border-radius: 0.1rem; }
+ .semantic-passport-evidence {
+ margin-top: 0.52rem;
+ padding: 0.5rem;
+ border: 1px solid color-mix(in srgb, var(--backend-stroke) 32%, var(--toolbar-border));
+ border-radius: 0.55rem;
+ background: color-mix(in srgb, var(--backend-fill) 18%, var(--panel));
+ }
+ .semantic-passport-evidence[hidden] { display: none; }
+ html[data-preset="blueprint"] .semantic-passport-evidence { border-radius: 0.18rem; }
+ .semantic-passport-evidence-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 0.55rem;
+ margin-bottom: 0.35rem;
+ }
+ .semantic-passport-evidence-status {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.28rem;
+ color: var(--backend-stroke);
+ font-size: 0.5rem;
+ font-weight: 800;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ }
+ .semantic-passport-evidence-status::before {
+ content: '';
+ width: 0.38rem;
+ height: 0.38rem;
+ border-radius: 50%;
+ background: var(--backend-stroke);
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--backend-stroke) 14%, transparent);
+ }
+ .semantic-passport-repository {
+ min-width: 0;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.5rem;
+ text-decoration: none;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+ .semantic-passport-repository:hover,
+ .semantic-passport-repository:focus-visible { color: var(--backend-stroke); }
+ .semantic-passport-evidence-links { display: grid; gap: 0.22rem; }
+ .semantic-passport-source {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) auto;
+ gap: 0.15rem 0.45rem;
+ align-items: center;
+ padding: 0.34rem 0.4rem;
+ border: 1px solid transparent;
+ border-radius: 0.38rem;
+ color: var(--text-muted);
+ text-decoration: none;
+ }
+ .semantic-passport-source:hover,
+ .semantic-passport-source:focus-visible {
+ border-color: color-mix(in srgb, var(--backend-stroke) 42%, transparent);
+ background: color-mix(in srgb, var(--backend-fill) 32%, transparent);
+ color: var(--text);
+ }
+ .semantic-passport-source strong {
+ overflow: hidden;
+ font-size: 0.5625rem;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+ .semantic-passport-source code {
+ color: var(--backend-stroke);
+ font: inherit;
+ font-size: 0.5rem;
+ }
+ .semantic-passport-source small {
+ grid-column: 1 / -1;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.5rem;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
.relationship-lens-summary {
display: block;
margin-top: 0.12rem;
color: var(--text-faint);
font-size: 0.5625rem;
}
+ .semantic-passport-reach {
+ display: grid;
+ gap: 0.28rem;
+ margin-top: 0.52rem;
+ padding-top: 0.48rem;
+ border-top: 1px solid color-mix(in srgb, var(--toolbar-border) 76%, transparent);
+ }
+ .semantic-passport-reach[hidden] { display: none; }
+ .semantic-passport-reach-label {
+ color: var(--text-faint);
+ font-size: 0.5rem;
+ font-weight: 800;
+ letter-spacing: 0.1em;
+ text-transform: uppercase;
+ }
+ .semantic-passport-reach-actions {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 0.25rem;
+ }
+ .semantic-passport-reach-actions button {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 0.5rem;
+ min-width: 0;
+ min-height: 2rem;
+ padding: 0.32rem 0.42rem;
+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 86%, transparent);
+ background: color-mix(in srgb, var(--panel) 70%, transparent);
+ color: var(--text-muted);
+ text-align: left;
+ }
+ .semantic-passport-reach-actions button:hover:not(:disabled),
+ .semantic-passport-reach-actions button:focus-visible {
+ border-color: color-mix(in srgb, var(--frontend-stroke) 62%, var(--toolbar-border));
+ color: var(--text);
+ }
+ .semantic-passport-reach-actions button:focus-visible {
+ outline: 2px solid var(--frontend-stroke);
+ outline-offset: 1px;
+ }
+ .semantic-passport-reach-actions button:disabled {
+ cursor: default;
+ opacity: 0.5;
+ }
+ .semantic-passport-reach-actions button[aria-pressed="true"] {
+ border-color: color-mix(in srgb, var(--reach-color, var(--frontend-stroke)) 72%, var(--toolbar-border));
+ background: color-mix(in srgb, var(--reach-fill, var(--frontend-fill)) 48%, transparent);
+ color: var(--text);
+ }
+ #btn-reach-upstream {
+ --reach-color: var(--database-stroke);
+ --reach-fill: var(--database-fill);
+ }
+ #btn-reach-downstream {
+ --reach-color: var(--backend-stroke);
+ --reach-fill: var(--backend-fill);
+ }
+ .semantic-passport-reach-actions strong {
+ color: var(--reach-color, var(--frontend-stroke));
+ font-size: 0.625rem;
+ }
+ .semantic-passport-reach-status {
+ color: var(--text-faint);
+ font-size: 0.525rem;
+ line-height: 1.4;
+ }
+ .semantic-passport-reach-status[hidden] { display: none; }
.relationship-lens-list {
max-height: min(18rem, 46vh);
overflow: auto;
@@ -1698,13 +2021,16 @@
top: 1rem;
left: 1rem;
z-index: 24;
+ display: flex;
+ flex-direction: column;
width: min(22rem, calc(100% - 2rem));
+ max-height: calc(100% - 2rem);
overflow: hidden;
border: 1px solid var(--toolbar-border);
border-radius: 0.85rem;
background: var(--toolbar-menu-bg);
color: var(--toolbar-text);
- box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34);
+ box-shadow: 0 6px 8px rgba(0, 0, 0, 0.22);
backdrop-filter: blur(16px);
}
.node-finder[hidden] { display: none; }
@@ -1744,7 +2070,6 @@
.node-finder-close:hover,
.node-finder-close:focus-visible { background: var(--toolbar-hover); }
.node-finder-close:focus-visible,
- .node-finder-input:focus-visible,
.node-finder-result:focus-visible {
outline: 2px solid var(--frontend-stroke);
outline-offset: -2px;
@@ -1760,10 +2085,16 @@
border: 1px solid var(--toolbar-border);
border-radius: 0.55rem;
background: color-mix(in srgb, var(--panel) 78%, transparent);
+ transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
}
html[data-preset="blueprint"] .node-finder-search { border-radius: 0.18rem; }
.node-finder-search > span { color: var(--frontend-stroke); font-size: 0.875rem; }
+ .node-finder-search:focus-within {
+ border-color: var(--frontend-stroke);
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--frontend-stroke) 20%, transparent);
+ }
.node-finder-input {
+ appearance: none;
width: 100%;
min-width: 0;
border: 0;
@@ -1773,6 +2104,7 @@
font: inherit;
font-size: 0.75rem;
}
+ .node-finder-input:focus-visible { outline: none; }
.node-finder-input::placeholder { color: var(--text-faint); }
.node-finder kbd {
padding: 0.1rem 0.32rem;
@@ -1784,34 +2116,50 @@
}
.node-finder-results {
display: grid;
- gap: 0.18rem;
+ flex: 1 1 auto;
+ gap: 0;
+ min-height: 0;
max-height: min(18rem, 48vh);
- margin: 0;
- padding: 0 0.55rem 0.55rem;
+ margin: 0 0.55rem 0.45rem;
+ padding: 0;
overflow-y: auto;
overscroll-behavior: contain;
+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 78%, transparent);
+ border-radius: 0.55rem;
+ background: color-mix(in srgb, var(--panel) 54%, transparent);
+ scroll-padding-block: 0.25rem;
scrollbar-width: thin;
}
+ html[data-preset="blueprint"] .node-finder-results { border-radius: 0.18rem; }
.node-finder-result {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 0.2rem 0.75rem;
width: 100%;
- padding: 0.55rem 0.65rem;
+ min-height: 3.25rem;
+ padding: 0.58rem 0.65rem;
border: 0;
- border-radius: 0.45rem;
+ border-radius: 0;
background: transparent;
color: var(--text);
font: inherit;
text-align: left;
cursor: pointer;
+ transition: background-color 160ms ease-out;
+ }
+ .node-finder-result:not(:last-child) {
+ border-bottom: 1px solid color-mix(in srgb, var(--toolbar-border) 62%, transparent);
}
- html[data-preset="blueprint"] .node-finder-result { border-radius: 0.12rem; }
.node-finder-result:hover,
- .node-finder-result:focus-visible { background: var(--toolbar-hover); }
+ .node-finder-result:focus-visible {
+ position: relative;
+ z-index: 1;
+ background: color-mix(in srgb, var(--frontend-fill) 48%, var(--toolbar-hover));
+ }
.node-finder-result strong {
overflow: hidden;
font-size: 0.75rem;
+ line-height: 1.25;
text-overflow: ellipsis;
white-space: nowrap;
}
@@ -1820,7 +2168,7 @@
overflow: hidden;
color: var(--text-faint);
font-size: 0.5625rem;
- letter-spacing: 0.03em;
+ letter-spacing: 0.015em;
text-overflow: ellipsis;
white-space: nowrap;
}
@@ -1847,8 +2195,8 @@
text-align: center;
}
.node-finder-status {
- padding: 0.5rem 0.8rem;
- border-top: 1px solid var(--toolbar-border);
+ margin: 0;
+ padding: 0.1rem 0.8rem 0.65rem;
color: var(--text-faint);
font-size: 0.5625rem;
}
@@ -2364,6 +2712,22 @@
border-top: 2px solid var(--frontend-stroke);
}
+ html[data-preset="editorial"] .card {
+ position: relative;
+ border-radius: 0.28rem;
+ background: var(--panel);
+ box-shadow: 0 10px 28px color-mix(in srgb, #000 10%, transparent);
+ }
+ html[data-preset="editorial"] .card::before {
+ position: absolute;
+ top: -1px;
+ left: 1.25rem;
+ width: 3.25rem;
+ border-top: 3px solid var(--arrow-emphasis);
+ content: "";
+ }
+ html[data-preset="editorial"] .card-dot { border-radius: 0; transform: rotate(45deg) scale(0.78); }
+
.card-header {
display: flex;
align-items: center;
@@ -2491,6 +2855,8 @@
.story-carrier-overlay { display: none !important; }
.diagram-container svg[data-focus-active] [data-node-id],
.diagram-container svg[data-focus-active] [data-edge-from],
+ .diagram-container svg[data-reach-active] [data-node-id],
+ .diagram-container svg[data-reach-active] [data-edge-from],
.diagram-container svg[data-story-beat] [data-story-step],
.diagram-container svg[data-story-beat] [data-edge-from][data-story-beat-step],
.diagram-container svg[data-route-active] [data-node-id],
@@ -2541,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2561,6 +2928,172 @@
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);
transform: rotate(45deg) scale(0.84);
}
+ #btn-preset[data-preset-option="editorial"] .preset-control-mark {
+ border-color: var(--arrow-emphasis);
+ border-radius: 0;
+ background: var(--arrow-emphasis);
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
+ transform: rotate(45deg) scale(0.72);
+ }
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
+ html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
+ html[data-preset="editorial"] .export-menu,
+ html[data-preset="editorial"] .overview-map,
+ html[data-preset="editorial"] .semantic-lens,
+ html[data-preset="editorial"] .route-probe,
+ html[data-preset="editorial"] .focus-chip,
+ html[data-preset="editorial"] .diagram-guide,
+ html[data-preset="editorial"] .node-finder,
+ html[data-preset="editorial"] .guided-views,
+ html[data-preset="editorial"] .share-chapter-cue {
+ border-radius: 0.3rem;
+ }
.motion-control-dot {
width: 0.46rem;
height: 0.46rem;
@@ -2597,6 +3130,7 @@
text-align: left;
padding: 0.5rem 0.75rem;
}
+ .toolbar .export-menu button[hidden] { display: none; }
.toolbar .export-menu button:hover {
background: var(--toolbar-hover);
}
@@ -2637,20 +3171,29 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
.header { margin-bottom: 1.25rem; padding-right: 0; }
html[data-preset="signal-flow"] .header,
- html[data-preset="blueprint"] .header { padding-right: 0; }
+ html[data-preset="blueprint"] .header,
+ html[data-preset="editorial"] .header { padding-right: 0; }
.header-row {
gap: 0.75rem;
align-items: flex-start;
}
html[data-preset="signal-flow"] .header-row,
- html[data-preset="blueprint"] .header-row { flex-wrap: wrap; }
+ html[data-preset="blueprint"] .header-row,
+ html[data-preset="editorial"] .header-row { flex-wrap: wrap; }
html[data-preset="signal-flow"] .header-row::after {
margin-left: 0;
order: 3;
@@ -2659,6 +3202,10 @@
margin-left: 0;
order: 3;
}
+ html[data-preset="editorial"] .header-row::after {
+ margin-left: 0;
+ order: 3;
+ }
h1 {
font-size: 1.25rem;
line-height: 1.25;
@@ -3035,6 +3582,8 @@
the global zoom level. Reveal only their exact semantic matches. */
svg[data-focus-active] [data-focus-match][data-detail],
svg[data-focus-active] [data-focus-match] [data-detail],
+ svg[data-reach-active] [data-reach-match][data-detail],
+ svg[data-reach-active] [data-reach-match] [data-detail],
svg[data-lens-active] [data-lens-match][data-detail],
svg[data-lens-active] [data-lens-match] [data-detail],
svg[data-legend-preview-active] [data-legend-preview-match][data-detail],
@@ -3053,6 +3602,7 @@
pointer-events: auto;
}
svg[data-focus-active] [data-focus-match] [data-detail-anchor],
+ svg[data-reach-active] [data-reach-match] [data-detail-anchor],
svg[data-lens-active] [data-lens-match] [data-detail-anchor],
svg[data-legend-preview-active] [data-legend-preview-match] [data-detail-anchor],
svg[data-intent-trace-active] [data-intent-trace-match] [data-detail-anchor],
@@ -3084,6 +3634,41 @@
filter: drop-shadow(0 0 7px var(--frontend-stroke));
outline: none;
}
+ /* Verified Source Beacons are installed at runtime only for nodes whose
+ repository evidence passed the local revision/blob/line checks. They
+ live inside the owning node so every focus, route, story, and guided
+ view keeps one coherent opacity state. Export serialization removes
+ them before producing the canonical SVG or any derived visual. */
+ .source-evidence-beacon {
+ pointer-events: none;
+ opacity: 0.76;
+ transition: opacity 160ms ease, filter 160ms ease;
+ }
+ .source-evidence-beacon rect {
+ fill: color-mix(in srgb, var(--mask) 92%, var(--backend-stroke));
+ stroke: color-mix(in srgb, var(--backend-stroke) 82%, var(--panel-border));
+ stroke-width: 1;
+ vector-effect: non-scaling-stroke;
+ }
+ .source-evidence-beacon text {
+ fill: var(--backend-stroke);
+ font-size: 5.5px;
+ font-weight: 800;
+ letter-spacing: 0.06em;
+ text-anchor: middle;
+ text-transform: uppercase;
+ }
+ svg [data-node-id]:hover .source-evidence-beacon,
+ svg [data-node-id]:focus-visible .source-evidence-beacon,
+ svg [data-node-id][data-focus-selected] .source-evidence-beacon {
+ opacity: 1;
+ filter: drop-shadow(0 0 4px color-mix(in srgb, var(--backend-stroke) 72%, transparent));
+ }
+ svg[data-preset="signal-flow"] .source-evidence-beacon { opacity: 0.9; }
+ svg[data-preset="blueprint"] .source-evidence-beacon rect {
+ rx: 0.8px;
+ filter: none;
+ }
svg [data-legend-kind][role="button"] { cursor: pointer; }
svg [data-legend-kind]:focus { outline: none; }
svg [data-legend-hit] {
@@ -3199,6 +3784,30 @@
filter: drop-shadow(0 0 10px var(--frontend-stroke));
}
+ /* Authored Reachability is a bounded graph query over the relationships
+ already present in the artifact. Upstream walks incoming edges;
+ downstream walks outgoing edges. It never claims runtime causality and
+ changes only viewer emphasis, not canonical geometry or export bytes. */
+ svg[data-reach-active] [data-node-id],
+ svg[data-reach-active] [data-edge-from] { opacity: 0.09; }
+ svg[data-reach-active] [data-reach-match] { opacity: 1; }
+ svg[data-reach-active="upstream"] [data-reach-origin] {
+ filter: drop-shadow(0 0 11px var(--database-stroke));
+ }
+ svg[data-reach-active="downstream"] [data-reach-origin] {
+ filter: drop-shadow(0 0 11px var(--backend-stroke));
+ }
+ svg[data-reach-active="upstream"] [data-edge-from][data-reach-match] {
+ filter: drop-shadow(0 0 4px color-mix(in srgb, var(--database-stroke) 72%, transparent));
+ }
+ svg[data-reach-active="downstream"] [data-edge-from][data-reach-match] {
+ filter: drop-shadow(0 0 4px color-mix(in srgb, var(--backend-stroke) 72%, transparent));
+ }
+ svg[data-preset="blueprint"][data-reach-active] [data-reach-origin],
+ svg[data-preset="blueprint"][data-reach-active] [data-edge-from][data-reach-match] {
+ filter: none;
+ }
+
/* Direct Relationship Explorer makes authored paths a real input surface
without changing their visible stroke or canonical SVG. A transparent
runtime rail supplies forgiving pointer geometry; the exact authored
@@ -3294,6 +3903,11 @@
stroke-linecap: square;
filter: none;
}
+ svg[data-preset="editorial"] .relationship-flow-pulse {
+ stroke: var(--arrow-emphasis);
+ stroke-width: 2.75;
+ filter: none;
+ }
.semantic-flow-token {
color: var(--frontend-stroke);
opacity: 0;
@@ -3336,6 +3950,7 @@
filter: drop-shadow(0 0 5px currentColor);
}
svg[data-preset="blueprint"] .semantic-flow-token { filter: none; }
+ svg[data-preset="editorial"] .semantic-flow-token { filter: none; }
html[data-embed="true"] .relationship-pulse-overlay { display: none; }
/* Intent Trace is a temporary, pre-click exploration layer. Related
@@ -3376,6 +3991,8 @@
filter: none;
stroke-linecap: square;
}
+ svg[data-preset="editorial"] [data-intent-trace-selected],
+ svg[data-preset="editorial"] .intent-trace-flow { filter: none; }
.intent-trace-status {
position: absolute;
width: 1px;
@@ -3459,6 +4076,25 @@
filter: none;
stroke-linecap: square;
}
+ svg[data-preset="editorial"] [data-route-start],
+ svg[data-preset="editorial"] [data-route-end],
+ svg[data-preset="editorial"] [data-route-step],
+ svg[data-preset="editorial"] .route-probe-flow,
+ svg[data-preset="editorial"] .route-journey-flow { filter: none; }
+
+ svg[data-preset="editorial"] .c-grid {
+ stroke-dasharray: 1 4;
+ opacity: 0.48;
+ }
+ svg[data-preset="editorial"] .c-region {
+ fill: color-mix(in srgb, var(--cloud-fill) 48%, transparent);
+ stroke-dasharray: 9 4;
+ }
+ svg[data-preset="editorial"] [data-node-id]:hover,
+ svg[data-preset="editorial"] [data-node-id]:focus-visible,
+ svg[data-preset="editorial"][data-focus-active] [data-focus-selected] {
+ filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 18%, transparent));
+ }
svg[data-preset="blueprint"] .c-grid {
stroke-dasharray: 1 3;
@@ -3477,6 +4113,9 @@
svg[data-preset="blueprint"][data-focus-active] [data-focus-selected] {
filter: drop-shadow(0 0 3px var(--frontend-stroke));
}
+ svg[data-preset="blueprint"][data-focus-active][data-reach-active] [data-focus-selected][data-reach-origin] {
+ filter: none;
+ }
svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview],
svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview-source],
svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview-target] {
@@ -3541,6 +4180,10 @@
filter: none;
animation: none;
}
+ svg[data-preset="editorial"] .story-trail-flow { filter: none; }
+ svg[data-preset="editorial"][data-story-beat] [data-story-step][data-story-beat-state="active"] {
+ filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 16%, transparent));
+ }
/* Chapter Delta Preview is a static, pre-commit comparison between two
chapter focus sets. Symbols in the rail carry the meaning without color;
@@ -3602,6 +4245,14 @@
animation-name: archify-blueprint-node-pulse;
animation-duration: 3.8s;
}
+ svg[data-preset="editorial"][data-animation="trace"] [data-animate="edge"] {
+ filter: none;
+ animation-duration: 2.2s;
+ }
+ svg[data-preset="editorial"][data-animation="trace"] [data-animate="node"] {
+ animation-name: archify-editorial-node-pulse;
+ animation-duration: 3.5s;
+ }
/* Embedded proofs are static until a named Story Trail chapter is played.
This keeps proof grids calm and ensures ?play=1 stops all viewer motion
after one 3.2 second chapter instead of leaving ambient trace loops on. */
@@ -3627,6 +4278,10 @@
0%, 72%, 100% { opacity: 1; filter: none; }
18%, 36% { opacity: 0.72; filter: drop-shadow(0 0 2px var(--frontend-stroke)); }
}
+ @keyframes archify-editorial-node-pulse {
+ 0%, 72%, 100% { opacity: 1; filter: none; }
+ 18%, 36% { opacity: 0.78; filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 18%, transparent)); }
+ }
@keyframes archify-signal-scan {
0%, 18% { opacity: 1; transform: translateX(-70%); }
70% { opacity: 1; transform: translateX(70%); }
@@ -3742,6 +4397,7 @@
}
.relationship-pulse-overlay { display: none !important; }
.guided-view-chapter { transition: none !important; }
+ .source-evidence-beacon,
svg [data-node-id], svg [data-edge-from], svg [data-detail], svg [data-detail-anchor], svg [data-legend-hit], svg { transition: none !important; }
}
</style>
@@ -3758,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -3789,6 +4475,8 @@
</button>
<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&times;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&times;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&times;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>
@@ -3814,6 +4502,7 @@
</div>
<script id="archify-guided-views-data" type="application/json">[]</script>
+
<div class="guided-views no-print" id="guided-views" hidden aria-label="Guided diagram views">
<button id="guided-view-prev" type="button" aria-label="Previous guided view" title="Previous guided view ([)">&#8592;</button>
<div class="guided-view-copy">
@@ -4111,7 +4800,7 @@
</div>
<div class="node-finder-search">
<span aria-hidden="true">&#8981;</span>
- <input class="node-finder-input" id="node-finder-input" type="search" autocomplete="off" spellcheck="false" placeholder="Search labels or IDs" aria-describedby="node-finder-status">
+ <input class="node-finder-input" id="node-finder-input" type="search" autocomplete="off" spellcheck="false" placeholder="Search labels or IDs" aria-label="Search diagram nodes" aria-describedby="node-finder-status">
<kbd aria-hidden="true">/</kbd>
</div>
<div class="node-finder-results" id="node-finder-results" role="group" aria-label="Diagram nodes"></div>
@@ -4130,12 +4819,31 @@
<span id="focus-tag" data-passport="tag" hidden></span>
<code id="focus-id" data-passport="id"></code>
</div>
+ <div class="semantic-passport-evidence" id="focus-evidence" hidden aria-label="Verified source evidence">
+ <div class="semantic-passport-evidence-head">
+ <span class="semantic-passport-evidence-status">Verified source</span>
+ <a class="semantic-passport-repository" id="focus-repository" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer"></a>
+ </div>
+ <div class="semantic-passport-evidence-links" id="focus-evidence-links"></div>
+ </div>
<span class="relationship-lens-summary" id="focus-summary" aria-live="polite"></span>
+ <div class="semantic-passport-reach" id="focus-reach" hidden>
+ <span class="semantic-passport-reach-label">Authored reach</span>
+ <div class="semantic-passport-reach-actions" role="group" aria-label="Trace authored reachability">
+ <button id="btn-reach-upstream" type="button" aria-label="Trace upstream authored reachability" aria-pressed="false">
+ <span>Upstream</span><strong id="focus-reach-upstream-count">0</strong>
+ </button>
+ <button id="btn-reach-downstream" type="button" aria-label="Trace downstream authored reachability" aria-pressed="false">
+ <span>Downstream</span><strong id="focus-reach-downstream-count">0</strong>
+ </button>
+ </div>
+ <small class="semantic-passport-reach-status" id="focus-reach-status" hidden aria-live="polite"></small>
+ </div>
</div>
<div class="relationship-lens-actions">
+ <button id="btn-focus-clear" type="button" aria-label="Close semantic passport" title="Close">&#215;</button>
<button id="btn-focus-copy" type="button" aria-label="Copy link to focused node">Copy link</button>
<button id="btn-focus-relations" type="button" aria-label="Show connected relationships" aria-expanded="false" aria-controls="relationship-lens-list">Relations</button>
- <button id="btn-focus-clear" type="button" aria-label="Clear focused node">Clear</button>
</div>
</div>
<div class="relationship-lens-list" id="relationship-lens-list" aria-label="Connected relationships"></div>
@@ -4230,19 +4938,44 @@
<script>
var Archify = {};
+ function hasDrawableGeometry(element) {
+ if (!element) return false;
+ var geometries = /^(path|line|polyline)$/i.test(element.tagName)
+ ? [element]
+ : Array.prototype.slice.call(element.querySelectorAll('path, line, polyline'));
+ return geometries.some(function (geometry) {
+ var source = geometry.tagName.toLowerCase() === 'path'
+ ? geometry.getAttribute('d')
+ : geometry.tagName.toLowerCase() === 'polyline'
+ ? geometry.getAttribute('points')
+ : [geometry.getAttribute('x1'), geometry.getAttribute('y1'), geometry.getAttribute('x2'), geometry.getAttribute('y2')].join(' ');
+ if (!source || /(?:^|[^a-z])(?:nan|infinity)(?:[^a-z]|$)/i.test(source) || typeof geometry.getTotalLength !== 'function') return false;
+ try {
+ var length = Number(geometry.getTotalLength());
+ return Number.isFinite(length) && length > 0;
+ } catch (_) {
+ return false;
+ }
+ });
+ }
+
/* ============================================================
- Visual style try-on — one topology, three bundled presets.
+ Visual style try-on — one topology, four bundled presets.
The reader's choice is intentionally session-only: it updates the
live page and canonical SVG together, but never rewrites the source,
URL, or a later diagram's authored default.
============================================================ */
Archify.preset = (function () {
- var PRESETS = ['classic', 'signal-flow', 'blueprint'];
- var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };
+ var PRESETS = ['classic', 'signal-flow', 'blueprint', 'editorial'];
+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint', editorial: 'Editorial' };
var html = document.documentElement;
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4261,16 +4994,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -4389,6 +5186,168 @@
* self-themes when embedded in GitHub READMEs or other hosts that
* expose a color scheme. Used for "Download SVG".
*/
+ function applyRouteSnapshot(clone, snapshot) {
+ if (!snapshot || !Array.isArray(snapshot.nodeIds) || !Array.isArray(snapshot.edges) ||
+ snapshot.nodeIds.length < 2 || snapshot.edges.length !== snapshot.nodeIds.length - 1 ||
+ snapshot.hops !== snapshot.edges.length ||
+ !snapshot.source || !snapshot.target ||
+ snapshot.source.id !== snapshot.nodeIds[0] ||
+ snapshot.target.id !== snapshot.nodeIds[snapshot.nodeIds.length - 1]) 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 = [];
+
+ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {
+ var nodeId = snapshot.nodeIds[nodeIndex];
+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId]) return false;
+ var matchedNodes = cloneNodes.filter(function (candidate) {
+ return candidate.getAttribute('data-node-id') === nodeId;
+ });
+ if (matchedNodes.length !== 1) return false;
+ nodeIds[nodeId] = true;
+ nodeMatches.push(matchedNodes);
+ }
+
+ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {
+ var edge = snapshot.edges[edgeIndex];
+ var fromId = snapshot.nodeIds[edgeIndex];
+ var toId = snapshot.nodeIds[edgeIndex + 1];
+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||
+ edge.from !== fromId || edge.to !== toId) 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(matchedEdges);
+ }
+
+ clone.setAttribute('data-share-route', '');
+ nodeMatches.forEach(function (matches, step) {
+ matches.forEach(function (element) {
+ element.setAttribute('data-share-route-match', '');
+ element.setAttribute('data-share-route-step', String(step));
+ if (step === 0) element.setAttribute('data-share-route-start', '');
+ else if (step === snapshot.nodeIds.length - 1) element.setAttribute('data-share-route-end', '');
+ else element.setAttribute('data-share-route-middle', '');
+ });
+ });
+ edgeMatches.forEach(function (matches, step) {
+ matches.forEach(function (element) {
+ element.setAttribute('data-share-route-match', '');
+ element.setAttribute('data-share-route-step', String(step));
+ });
+ });
+
+ return clone.hasAttribute('data-share-route') &&
+ !clone.hasAttribute('data-animation') &&
+ !clone.hasAttribute('data-route-active') &&
+ !clone.hasAttribute('data-route-journey') &&
+ clone.querySelectorAll('[data-animate], [data-route-match], [data-route-step], [data-route-start], [data-route-end], [data-route-journey-state], [data-route-journey-current], [data-route-journey-overlay]').length === 0 &&
+ clone.querySelectorAll('[data-share-route-match]').length ===
+ nodeMatches.reduce(function (count, matches) { return count + matches.length; }, 0) +
+ 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.
@@ -4403,6 +5362,7 @@
clone.style.removeProperty('transform');
clone.removeAttribute('data-view-scale');
clone.removeAttribute('data-focus-active');
+ clone.removeAttribute('data-reach-active');
clone.removeAttribute('data-lens-active');
clone.removeAttribute('data-lens-flow-count');
clone.removeAttribute('data-lens-flow-density');
@@ -4414,6 +5374,8 @@
clone.removeAttribute('data-route-picking');
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');
@@ -4473,6 +5435,16 @@
Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-hit-overlay]'), function (el) {
el.remove();
});
+ Array.prototype.forEach.call(clone.querySelectorAll('[data-source-evidence-beacon]'), function (el) {
+ el.remove();
+ });
+ Array.prototype.forEach.call(clone.querySelectorAll('[data-source-evidence-count]'), function (el) {
+ var originalLabel = el.getAttribute('data-source-evidence-original-label');
+ if (originalLabel == null || originalLabel === '') el.removeAttribute('aria-label');
+ else el.setAttribute('aria-label', originalLabel);
+ el.removeAttribute('data-source-evidence-count');
+ el.removeAttribute('data-source-evidence-original-label');
+ });
Array.prototype.forEach.call(clone.querySelectorAll('[data-story-step], [data-story-beat-state], [data-story-beat-step]'), function (el) {
el.removeAttribute('data-story-step');
el.removeAttribute('data-story-beat-state');
@@ -4483,6 +5455,11 @@
el.removeAttribute('data-focus-match');
el.removeAttribute('data-focus-selected');
});
+ Array.prototype.forEach.call(clone.querySelectorAll('[data-reach-match], [data-reach-origin], [data-reach-depth]'), function (el) {
+ el.removeAttribute('data-reach-match');
+ el.removeAttribute('data-reach-origin');
+ el.removeAttribute('data-reach-depth');
+ });
Array.prototype.forEach.call(clone.querySelectorAll('[data-lens-match], [data-lens-selected], [data-lens-peer]'), function (el) {
el.removeAttribute('data-lens-match');
el.removeAttribute('data-lens-selected');
@@ -4513,6 +5490,18 @@
el.removeAttribute('data-route-journey-current');
el.style.removeProperty('--route-step');
});
+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle]'), function (el) {
+ el.removeAttribute('data-share-route-match');
+ el.removeAttribute('data-share-route-step');
+ el.removeAttribute('data-share-route-start');
+ 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');
@@ -4522,6 +5511,7 @@
});
var canonicalStateClean = !clone.hasAttribute('data-view-scale') &&
!clone.hasAttribute('data-focus-active') &&
+ !clone.hasAttribute('data-reach-active') &&
!clone.hasAttribute('data-lens-active') &&
!clone.hasAttribute('data-lens-flow-count') &&
!clone.hasAttribute('data-lens-flow-density') &&
@@ -4532,6 +5522,8 @@
!clone.hasAttribute('data-route-picking') &&
!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') &&
@@ -4541,9 +5533,17 @@
!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-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-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) &&
+ Number.isFinite(vb.width) && Number.isFinite(vb.height) && vb.width > 0 && vb.height > 0;
+ 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
@@ -4667,6 +5667,22 @@
bgRect.setAttribute('fill', computed.getPropertyValue('--bg').trim() || '#ffffff');
}
+ if (opts.routeSnapshot) {
+ style.textContent += "\nsvg[data-share-route] [data-node-id], svg[data-share-route] [data-edge-from] { opacity: 0.18; }\n" +
+ "svg[data-share-route] [data-share-route-match] { opacity: 1; }\n" +
+ "svg[data-share-route] [data-share-route-start] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3; stroke-dasharray: 5 3; }\n" +
+ "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);
@@ -4674,7 +5690,9 @@
svgString: new XMLSerializer().serializeToString(clone),
width: vb.width * scale,
height: vb.height * scale,
- canonicalStateClean: canonicalStateClean
+ canonicalStateClean: canonicalStateClean,
+ routeStateClean: routeStateClean,
+ reachStateClean: reachStateClean
};
}
@@ -4718,24 +5736,29 @@
return new Promise(function (resolve, reject) {
var img = new Image();
img.onload = function () {
- var canvas = document.createElement('canvas');
- canvas.width = data.width;
- canvas.height = data.height;
- var ctx = canvas.getContext('2d');
- if (format === 'jpeg') {
- ctx.fillStyle = currentBg();
- ctx.fillRect(0, 0, canvas.width, canvas.height);
+ try {
+ var canvas = document.createElement('canvas');
+ canvas.width = data.width;
+ canvas.height = data.height;
+ var ctx = canvas2dOrThrow(canvas, format);
+ if (format === 'jpeg') {
+ ctx.fillStyle = currentBg();
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+ }
+ // Draw at natural size — SVG was already rasterized at target res.
+ ctx.drawImage(img, 0, 0);
+ URL.revokeObjectURL(svgUrl);
+ var mime = format === 'jpeg' ? 'image/jpeg' :
+ format === 'webp' ? 'image/webp' : 'image/png';
+ var quality = format === 'png' ? undefined : 0.95;
+ canvas.toBlob(function (blob) {
+ if (!blob) reject(new Error('toBlob returned null for ' + format));
+ else resolve(blob);
+ }, mime, quality);
+ } catch (error) {
+ URL.revokeObjectURL(svgUrl);
+ reject(error);
}
- // Draw at natural size — SVG was already rasterized at target res.
- ctx.drawImage(img, 0, 0);
- URL.revokeObjectURL(svgUrl);
- var mime = format === 'jpeg' ? 'image/jpeg' :
- format === 'webp' ? 'image/webp' : 'image/png';
- var quality = format === 'png' ? undefined : 0.95;
- canvas.toBlob(function (blob) {
- if (!blob) reject(new Error('toBlob returned null for ' + format));
- else resolve(blob);
- }, mime, quality);
};
img.onerror = function (e) {
URL.revokeObjectURL(svgUrl);
@@ -4763,75 +5786,110 @@
return value + suffix;
}
- function rasterizeShareCard() {
+ function canvas2dOrThrow(canvas, label) {
+ if (!canvas || typeof canvas.getContext !== 'function') {
+ throw new Error('Canvas unavailable for ' + label);
+ }
+ var ctx = canvas.getContext('2d');
+ if (!ctx) throw new Error('2D canvas context unavailable for ' + label);
+ if (typeof canvas.toBlob !== 'function') throw new Error('canvas.toBlob unavailable for ' + label);
+ return ctx;
+ }
+
+ 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);
+ 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);
return new Promise(function (resolve, reject) {
var img = new Image();
img.onload = function () {
- var canvas = document.createElement('canvas');
- canvas.width = SHARE_CARD_WIDTH;
- canvas.height = SHARE_CARD_HEIGHT;
- var ctx = canvas.getContext('2d');
- var computed = getComputedStyle(document.documentElement);
- var bg = computed.getPropertyValue('--bg').trim() || currentBg();
- 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 titleNode = document.querySelector('.header h1');
- var subtitleNode = document.querySelector('.header .subtitle');
- var title = titleNode ? titleNode.textContent : document.title;
- var subtitle = 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();
-
- ctx.fillStyle = bg;
- ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);
-
- ctx.fillStyle = accent;
- ctx.fillRect(SHARE_CARD_PADDING, 27, 42, 3);
-
- ctx.textBaseline = 'alphabetic';
- ctx.fillStyle = text;
- var fittedTitle = fitCanvasText(ctx, title, SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2 - 330, 29, 18, '700');
- ctx.fillText(fittedTitle, SHARE_CARD_PADDING, 62);
-
- ctx.fillStyle = muted;
- var fittedSubtitle = fitCanvasText(ctx, subtitle, SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2 - 280, 13, 11, '500');
- ctx.fillText(fittedSubtitle, SHARE_CARD_PADDING, 87);
-
- ctx.font = "600 12px 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
- ctx.textAlign = 'right';
- ctx.fillStyle = accent;
- ctx.fillText('ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase(), SHARE_CARD_WIDTH - SHARE_CARD_PADDING, 50);
- ctx.textAlign = 'left';
-
- var availableWidth = SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2;
- var availableHeight = SHARE_CARD_HEIGHT - SHARE_CARD_HEADER - SHARE_CARD_PADDING;
- var fit = Math.min(availableWidth / data.width, availableHeight / data.height);
- var drawWidth = data.width * fit;
- var drawHeight = data.height * fit;
- var drawX = SHARE_CARD_PADDING + (availableWidth - drawWidth) / 2;
- var drawY = SHARE_CARD_HEADER + (availableHeight - drawHeight) / 2;
-
- ctx.strokeStyle = border;
- ctx.lineWidth = 1;
- ctx.strokeRect(drawX - 0.5, drawY - 0.5, drawWidth + 1, drawHeight + 1);
- ctx.drawImage(img, drawX, drawY, drawWidth, drawHeight);
- URL.revokeObjectURL(svgUrl);
-
- canvas.toBlob(function (blob) {
- if (!blob) reject(new Error('toBlob returned null for Share Card'));
- else resolve(blob);
- }, 'image/png');
+ try {
+ var canvas = document.createElement('canvas');
+ canvas.width = SHARE_CARD_WIDTH;
+ canvas.height = SHARE_CARD_HEIGHT;
+ var ctx = canvas2dOrThrow(canvas, 'Share Card');
+ var computed = getComputedStyle(document.documentElement);
+ var bg = computed.getPropertyValue('--bg').trim() || currentBg();
+ var text = computed.getPropertyValue('--text').trim() || '#ffffff';
+ var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';
+ var border = computed.getPropertyValue('--panel-border').trim() || '#334155';
+ 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'
+ : 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'
+ : reachSnapshot
+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'
+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();
+
+ ctx.fillStyle = bg;
+ ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);
+
+ ctx.fillStyle = accent;
+ ctx.fillRect(SHARE_CARD_PADDING, 27, 42, 3);
+
+ ctx.textBaseline = 'alphabetic';
+ ctx.fillStyle = text;
+ var fittedTitle = fitCanvasText(ctx, title, SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2 - 330, 29, 18, '700');
+ ctx.fillText(fittedTitle, SHARE_CARD_PADDING, 62);
+
+ ctx.fillStyle = muted;
+ var fittedSubtitle = fitCanvasText(ctx, subtitle, SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2 - 280, 13, 11, '500');
+ ctx.fillText(fittedSubtitle, SHARE_CARD_PADDING, 87);
+
+ ctx.font = "600 12px 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
+ ctx.textAlign = 'right';
+ ctx.fillStyle = accent;
+ ctx.fillText(cardLabel, SHARE_CARD_WIDTH - SHARE_CARD_PADDING, 50);
+ ctx.textAlign = 'left';
+
+ var availableWidth = SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2;
+ var availableHeight = SHARE_CARD_HEIGHT - SHARE_CARD_HEADER - SHARE_CARD_PADDING;
+ var fit = Math.min(availableWidth / data.width, availableHeight / data.height);
+ var drawWidth = data.width * fit;
+ var drawHeight = data.height * fit;
+ var drawX = SHARE_CARD_PADDING + (availableWidth - drawWidth) / 2;
+ var drawY = SHARE_CARD_HEADER + (availableHeight - drawHeight) / 2;
+
+ ctx.strokeStyle = border;
+ ctx.lineWidth = 1;
+ ctx.strokeRect(drawX - 0.5, drawY - 0.5, drawWidth + 1, drawHeight + 1);
+ ctx.drawImage(img, drawX, drawY, drawWidth, drawHeight);
+ URL.revokeObjectURL(svgUrl);
+
+ canvas.toBlob(function (blob) {
+ if (!blob) reject(new Error('toBlob returned null for Share Card'));
+ else resolve(blob);
+ }, 'image/png');
+ } catch (error) {
+ URL.revokeObjectURL(svgUrl);
+ reject(error);
+ }
};
img.onerror = function (e) {
URL.revokeObjectURL(svgUrl);
@@ -4841,6 +5899,24 @@
});
}
+ function rasterizeShareCard(options) {
+ options = options || {};
+ if (!options.variant) return renderShareCard();
+ 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() {
if (typeof MediaRecorder === 'undefined') return '';
var candidates = [
@@ -5103,10 +6179,30 @@
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"]'));
};
+ function syncRouteShareItem() {
+ var snapshot = Archify.routeProbe && typeof Archify.routeProbe.exportSnapshot === 'function'
+ ? Archify.routeProbe.exportSnapshot()
+ : null;
+ routeShareItem.hidden = !snapshot;
+ routeShareItem.disabled = !snapshot;
+ 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' &&
@@ -5163,11 +6259,14 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
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.disabled; });
+ var available = items().filter(function (i) { return !i.hidden && !i.disabled; });
var target = focusLast ? available[available.length - 1] : available[0];
if (target) target.focus();
}
@@ -5201,7 +6300,7 @@
if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
if (e.key === 'Tab') { close(false); return; }
- var available = items().filter(function (i) { return !i.disabled; });
+ var available = items().filter(function (i) { return !i.hidden && !i.disabled; });
var current = available.indexOf(document.activeElement);
switch (e.key) {
case 'ArrowDown':
@@ -5226,8 +6325,7 @@
function runExport(format) {
var base = diagramFilename();
close(true);
- document.documentElement.removeAttribute('data-last-export-error');
- document.documentElement.removeAttribute('data-last-export-error-format');
+ clearExportReceipt();
if (format === 'webm') toast('Recording 6 seconds of motion…');
return (format === 'share-card'
? rasterizeShareCard().then(function (blob) {
@@ -5271,13 +6369,72 @@
});
}
+ function runRouteShareCard() {
+ close(false);
+ clearExportReceipt();
+ var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();
+ var blobPromise = snapshot
+ ? renderShareCard({ routeSnapshot: snapshot })
+ : Promise.reject(new Error('Trace a route before exporting a Route Share Card'));
+ return blobPromise.then(function (blob) {
+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'route', true);
+ download(blob, diagramFilename() + '-route-share-card.png');
+ toast('Downloaded Route 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('Route Share Card export failed: ' + message);
+ });
+ }
+
+ 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) {
+ 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');
+ if (variant) {
+ document.documentElement.setAttribute('data-last-export-variant', variant);
+ } else {
+ document.documentElement.removeAttribute('data-last-export-variant');
+ }
+ if (routeStateClean === true) {
+ document.documentElement.setAttribute('data-last-export-route-state-clean', 'true');
+ } 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));
@@ -5293,6 +6450,9 @@
document.documentElement.removeAttribute('data-last-export-canonical');
document.documentElement.removeAttribute('data-last-export-width');
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');
}
@@ -5334,6 +6494,7 @@
function runCopy() {
close(true);
+ clearExportReceipt();
if (!canCopyImage()) {
alert('Clipboard image write not supported in this browser.');
return;
@@ -5348,6 +6509,12 @@
}
menu.addEventListener('click', function (e) {
+ 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; }
@@ -5359,7 +6526,18 @@
});
Archify.motion = { canRecord: canRecordMotion, recordWebm: recordWebm };
- Archify.exportMenu = { open: open, close: close, isOpen: isOpen, run: runExport, shareCard: rasterizeShareCard, copyShareCard: runCopyShareCard };
+ Archify.exportMenu = {
+ open: open,
+ close: close,
+ isOpen: isOpen,
+ run: runExport,
+ shareCard: rasterizeShareCard,
+ downloadRouteShareCard: runRouteShareCard,
+ downloadReachShareCard: runReachShareCard,
+ syncRouteShare: syncRouteShareItem,
+ syncReachShare: syncReachShareItem,
+ copyShareCard: runCopyShareCard
+ };
// Auto-open on page load for demo/screenshot purposes: ?openExport=1
// Wait for fonts (so the menu doesn't flash before typography lands)
@@ -5644,6 +6822,76 @@
};
})();
+ /* Verified repository evidence is emitted only after the renderer checks
+ the authored GitHub revision, source blobs, and optional line ranges
+ against the explicit --repo-root. It remains outside the SVG so every
+ canonical visual export stays free of repository paths. */
+ Archify.sourceEvidence = (function () {
+ var element = document.getElementById('archify-source-evidence-data');
+ var payload = null;
+ var svgNamespace = 'http://www.w3.org/2000/svg';
+ if (element) {
+ try {
+ var parsed = JSON.parse(element.textContent || 'null');
+ if (parsed && parsed.verified === true && parsed.repository && parsed.nodes) payload = parsed;
+ } catch (_) {}
+ }
+ function installBeacons() {
+ if (!payload) return 0;
+ var svg = document.querySelector('.diagram-container svg');
+ if (!svg) return 0;
+ var installed = 0;
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {
+ var id = node.getAttribute('data-node-id');
+ var sources = payload.nodes[id];
+ if (!Array.isArray(sources) || !sources.length || node.querySelector('[data-source-evidence-beacon]')) return;
+ var shape = node.querySelector('[data-animate="node"]') || node.querySelector('[class*="c-"]');
+ var box;
+ try { box = (shape || node).getBBox(); } catch (_) { return; }
+ if (!box || !Number.isFinite(box.x) || !Number.isFinite(box.y) || !Number.isFinite(box.width) || box.width < 36) return;
+
+ var count = sources.length;
+ var label = count + ' verified source' + (count === 1 ? '' : 's') + '; focus this node to inspect';
+ var beacon = document.createElementNS(svgNamespace, 'g');
+ beacon.classList.add('source-evidence-beacon');
+ beacon.setAttribute('data-source-evidence-beacon', '');
+ beacon.setAttribute('aria-hidden', 'true');
+ beacon.setAttribute('transform', 'translate(' + (box.x + box.width - 35) + ' ' + (box.y + 5) + ')');
+ var title = document.createElementNS(svgNamespace, 'title');
+ title.textContent = label;
+ var plate = document.createElementNS(svgNamespace, 'rect');
+ plate.setAttribute('width', '30');
+ plate.setAttribute('height', '12');
+ plate.setAttribute('rx', '6');
+ var text = document.createElementNS(svgNamespace, 'text');
+ text.setAttribute('x', '15');
+ text.setAttribute('y', '8.25');
+ text.textContent = 'SRC ' + count;
+ beacon.appendChild(title);
+ beacon.appendChild(plate);
+ beacon.appendChild(text);
+ node.appendChild(beacon);
+
+ var originalLabel = node.getAttribute('aria-label') || '';
+ node.setAttribute('data-source-evidence-count', String(count));
+ node.setAttribute('data-source-evidence-original-label', originalLabel);
+ node.setAttribute('aria-label', (originalLabel ? originalLabel + ', ' : '') + count + ' verified source reference' + (count === 1 ? '' : 's'));
+ installed += 1;
+ });
+ return installed;
+ }
+ return {
+ available: function () { return Boolean(payload); },
+ repository: function () { return payload ? payload.repository : null; },
+ node: function (id) {
+ var sources = payload && payload.nodes ? payload.nodes[id] : null;
+ return Array.isArray(sources) ? sources.slice() : [];
+ },
+ installBeacons: installBeacons
+ };
+ })();
+ Archify.sourceEvidence.installBeacons();
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -5660,7 +6908,16 @@
var context = document.getElementById('focus-context');
var tag = document.getElementById('focus-tag');
var semanticId = document.getElementById('focus-id');
+ var evidence = document.getElementById('focus-evidence');
+ var repositoryLink = document.getElementById('focus-repository');
+ var evidenceLinks = document.getElementById('focus-evidence-links');
var summary = document.getElementById('focus-summary');
+ var reachSection = document.getElementById('focus-reach');
+ var reachStatus = document.getElementById('focus-reach-status');
+ var upstreamBtn = document.getElementById('btn-reach-upstream');
+ var downstreamBtn = document.getElementById('btn-reach-downstream');
+ var upstreamCount = document.getElementById('focus-reach-upstream-count');
+ var downstreamCount = document.getElementById('focus-reach-downstream-count');
var relationshipList = document.getElementById('relationship-lens-list');
var copyBtn = document.getElementById('btn-focus-copy');
var relationsBtn = document.getElementById('btn-focus-relations');
@@ -5674,6 +6931,8 @@
var relationshipHitOverlay = null;
var relationshipHitTargets = [];
var directPreviewTimer = null;
+ var reachabilityMode = null;
+ var activeReachability = null;
var svgNamespace = 'http://www.w3.org/2000/svg';
var reducedMotionQuery = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;
var finePointerQuery = window.matchMedia ? window.matchMedia('(hover: hover) and (pointer: fine)') : null;
@@ -5687,11 +6946,318 @@
function nodeLabel(node, fallback) {
return node.getAttribute('data-node-label') || (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '');
}
+ function reachabilityRelationships() {
+ var seen = Object.create(null);
+ var relationships = [];
+ edges().forEach(function (edge) {
+ var from = edge.getAttribute('data-edge-from');
+ var to = edge.getAttribute('data-edge-to');
+ var key = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + (edge.getAttribute('data-edge-label') || ''));
+ if (!from || !to || seen[key]) return;
+ seen[key] = true;
+ relationships.push({ key: key, from: from, to: to });
+ });
+ return relationships;
+ }
+ function computeReachability(originId, direction, relationships) {
+ if (typeof originId !== 'string' || !originId ||
+ (direction !== 'upstream' && direction !== 'downstream') ||
+ !Array.isArray(relationships)) return null;
+ var records = [];
+ var seenKeys = Object.create(null);
+ relationships.forEach(function (relationship, index) {
+ if (!relationship || typeof relationship.from !== 'string' || !relationship.from ||
+ typeof relationship.to !== 'string' || !relationship.to) return;
+ var key = typeof relationship.key === 'string' && relationship.key
+ ? relationship.key : String(index);
+ if (seenKeys[key]) return;
+ seenKeys[key] = true;
+ records.push({ key: key, from: relationship.from, to: relationship.to });
+ });
+
+ var depths = Object.create(null);
+ var order = [];
+ var queue = [originId];
+ depths[originId] = 0;
+ for (var cursor = 0; cursor < queue.length; cursor += 1) {
+ var current = queue[cursor];
+ records.forEach(function (relationship) {
+ var next = null;
+ if (direction === 'downstream' && relationship.from === current) next = relationship.to;
+ else if (direction === 'upstream' && relationship.to === current) next = relationship.from;
+ if (next == null || Object.prototype.hasOwnProperty.call(depths, next)) return;
+ depths[next] = depths[current] + 1;
+ queue.push(next);
+ });
+ }
+ queue.forEach(function (id) { order.push(id); });
+
+ var edgeKeys = [];
+ records.forEach(function (relationship) {
+ if (Object.prototype.hasOwnProperty.call(depths, relationship.from) &&
+ Object.prototype.hasOwnProperty.call(depths, relationship.to)) edgeKeys.push(relationship.key);
+ });
+ var maxDepth = order.reduce(function (maximum, id) {
+ return Math.max(maximum, depths[id]);
+ }, 0);
+ return {
+ direction: direction,
+ originId: originId,
+ nodeIds: order,
+ edgeKeys: edgeKeys,
+ depths: depths,
+ maxDepth: maxDepth
+ };
+ }
+ function reachabilityFor(id, direction) {
+ return computeReachability(id, direction, reachabilityRelationships());
+ }
+ function resetReachabilityButtons() {
+ upstreamBtn.setAttribute('aria-pressed', 'false');
+ downstreamBtn.setAttribute('aria-pressed', 'false');
+ }
+ function clearReachability(options) {
+ options = options || {};
+ reachabilityMode = null;
+ activeReachability = null;
+ svg.removeAttribute('data-reach-active');
+ chip.removeAttribute('data-reach-mode');
+ nodes().forEach(function (node) {
+ node.removeAttribute('data-reach-match');
+ node.removeAttribute('data-reach-origin');
+ node.removeAttribute('data-reach-depth');
+ });
+ edges().forEach(function (edge) {
+ edge.removeAttribute('data-reach-match');
+ edge.removeAttribute('data-reach-depth');
+ });
+ 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]));
+ } catch (_) {}
+ }
+ }
+ function renderReachabilityControls(id) {
+ var upstream = reachabilityFor(id, 'upstream');
+ var downstream = reachabilityFor(id, 'downstream');
+ var upstreamReach = upstream ? Math.max(0, upstream.nodeIds.length - 1) : 0;
+ var downstreamReach = downstream ? Math.max(0, downstream.nodeIds.length - 1) : 0;
+ upstreamCount.textContent = String(upstreamReach);
+ downstreamCount.textContent = String(downstreamReach);
+ upstreamBtn.disabled = upstreamReach === 0;
+ downstreamBtn.disabled = downstreamReach === 0;
+ upstreamBtn.setAttribute('aria-label', upstreamReach
+ ? 'Trace ' + upstreamReach + ' upstream authored node' + (upstreamReach === 1 ? '' : 's')
+ : 'No upstream authored nodes');
+ downstreamBtn.setAttribute('aria-label', downstreamReach
+ ? 'Trace ' + downstreamReach + ' downstream authored node' + (downstreamReach === 1 ? '' : 's')
+ : 'No downstream authored nodes');
+ reachSection.hidden = false;
+ }
+ function applyReachability(direction, options) {
+ options = options || {};
+ if (activeIds.length !== 1 || (direction !== 'upstream' && direction !== 'downstream')) return false;
+ if (reachabilityMode === direction && options.toggle !== false) {
+ clearReachability({ updateUrl: options.updateUrl !== false });
+ return true;
+ }
+ var result = reachabilityFor(activeIds[0], direction);
+ if (!result || result.nodeIds.length <= 1) return false;
+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {
+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false, resetView: false });
+ }
+ clearRelationshipPreview({ clearPin: true });
+ clearReachability({ updateUrl: false });
+ reachabilityMode = direction;
+ activeReachability = result;
+ var edgeKeySet = Object.create(null);
+ result.edgeKeys.forEach(function (key) { edgeKeySet[key] = true; });
+ svg.setAttribute('data-reach-active', direction);
+ chip.setAttribute('data-reach-mode', direction);
+ nodes().forEach(function (node) {
+ var id = node.getAttribute('data-node-id');
+ if (!Object.prototype.hasOwnProperty.call(result.depths, id)) return;
+ node.setAttribute('data-reach-match', '');
+ node.setAttribute('data-reach-depth', String(result.depths[id]));
+ if (id === result.originId) node.setAttribute('data-reach-origin', '');
+ });
+ edges().forEach(function (edge) {
+ var key = edge.getAttribute('data-edge-key') || (
+ edge.getAttribute('data-edge-from') + '\u0000' +
+ edge.getAttribute('data-edge-to') + '\u0000' +
+ (edge.getAttribute('data-edge-label') || '')
+ );
+ if (!edgeKeySet[key]) return;
+ edge.setAttribute('data-reach-match', '');
+ var fromDepth = result.depths[edge.getAttribute('data-edge-from')];
+ var toDepth = result.depths[edge.getAttribute('data-edge-to')];
+ edge.setAttribute('data-reach-depth', String(Math.max(fromDepth || 0, toDepth || 0)));
+ });
+ resetReachabilityButtons();
+ var activeButton = direction === 'upstream' ? upstreamBtn : downstreamBtn;
+ activeButton.setAttribute('aria-pressed', 'true');
+ var reachableCount = result.nodeIds.length - 1;
+ var directionLabel = direction === 'upstream' ? 'Upstream' : 'Downstream';
+ reachStatus.textContent = directionLabel + ' · ' + reachableCount + ' node' +
+ (reachableCount === 1 ? '' : 's') + ' · ' + result.edgeKeys.length + ' link' +
+ (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=' +
+ encodeURIComponent(activeIds[0]) + '&reach=' + direction);
+ } catch (_) {}
+ }
+ if (options.reveal !== false && Archify.view && typeof Archify.view.reveal === 'function') {
+ Archify.view.reveal(result.nodeIds, { includeNeighbors: false, reason: 'reachability' });
+ }
+ 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;
element.hidden = !normalized;
}
+ function renderSourceEvidence(id) {
+ evidenceLinks.textContent = '';
+ repositoryLink.removeAttribute('href');
+ repositoryLink.textContent = '';
+ var sources = Archify.sourceEvidence.node(id);
+ var repository = Archify.sourceEvidence.repository();
+ if (!repository || !sources.length) {
+ evidence.hidden = true;
+ return;
+ }
+ var slug = repository.url.replace(/^https:\/\/github\.com\//, '').replace(/\/$/, '');
+ repositoryLink.href = repository.url + '/tree/' + repository.revision;
+ repositoryLink.textContent = slug + ' @ ' + repository.shortRevision;
+ repositoryLink.setAttribute('aria-label', 'Open verified repository revision ' + repository.revision);
+ sources.forEach(function (source) {
+ var link = document.createElement('a');
+ link.className = 'semantic-passport-source';
+ link.href = source.href;
+ link.target = '_blank';
+ link.rel = 'noopener noreferrer';
+ link.referrerPolicy = 'no-referrer';
+ link.setAttribute('aria-label', 'Open verified source ' + source.path + ' at revision ' + repository.shortRevision);
+ var name = document.createElement('strong');
+ name.textContent = source.label || source.path.split('/').pop() || source.path;
+ var location = document.createElement('code');
+ location.textContent = source.line
+ ? 'L' + source.line + (source.endLine && source.endLine !== source.line ? '–' + source.endLine : '') + ' ↗'
+ : 'Open ↗';
+ var sourcePath = document.createElement('small');
+ sourcePath.textContent = source.path;
+ link.appendChild(name);
+ link.appendChild(location);
+ link.appendChild(sourcePath);
+ evidenceLinks.appendChild(link);
+ });
+ evidence.hidden = false;
+ }
function renderPassport(id, node) {
setPassportValue(detail, node.getAttribute('data-node-sublabel'));
setPassportValue(kind, node.getAttribute('data-node-kind') || 'node');
@@ -5699,6 +7265,7 @@
setPassportValue(tag, node.getAttribute('data-node-tag'));
semanticId.textContent = id;
semanticId.hidden = false;
+ renderSourceEvidence(id);
}
function relationshipsFor(id, byId) {
var seen = {};
@@ -6256,6 +7823,7 @@
var counts = { out: 0, in: 0, loop: 0 };
relationships.forEach(function (relationship) { counts[relationship.direction] += 1; });
summary.textContent = counts.out + ' outgoing · ' + counts.in + ' incoming' + (counts.loop ? ' · ' + counts.loop + ' loop' : '');
+ renderReachabilityControls(id);
relationshipList.textContent = '';
if (!relationships.length) {
var empty = document.createElement('p');
@@ -6352,6 +7920,10 @@
}
function clear(options) {
options = options || {};
+ var restoreNode = options.restoreFocus === true && activeIds.length === 1
+ ? svg.querySelector('[data-node-id="' + activeIds[0] + '"]')
+ : null;
+ clearReachability({ updateUrl: false });
if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') {
Archify.intentTrace.clear({ announce: false });
}
@@ -6378,7 +7950,16 @@
tag.hidden = true;
semanticId.textContent = '';
semanticId.hidden = true;
+ evidence.hidden = true;
+ evidenceLinks.textContent = '';
+ repositoryLink.removeAttribute('href');
+ repositoryLink.textContent = '';
summary.textContent = '';
+ reachSection.hidden = true;
+ upstreamCount.textContent = '0';
+ downstreamCount.textContent = '0';
+ upstreamBtn.disabled = true;
+ downstreamBtn.disabled = true;
relationshipList.textContent = '';
copyBtn.textContent = 'Copy link';
copyBtn.setAttribute('aria-label', 'Copy link to focused node');
@@ -6393,6 +7974,10 @@
if (options.updateUrl !== false) {
try { history.replaceState(null, '', location.pathname + location.search); } catch (_) {}
}
+ if (restoreNode) {
+ try { restoreNode.focus({ preventScroll: true }); }
+ catch (_) { try { restoreNode.focus(); } catch (_) {} }
+ }
}
function setMany(ids, options) {
@@ -6488,7 +8073,7 @@
var relationId = record && record.id;
var value = location.href.replace(/#.*$/, '') + (relationId
? '#relation=' + encodeURIComponent(relationId)
- : '#focus=' + encodeURIComponent(activeIds[0]));
+ : '#focus=' + encodeURIComponent(activeIds[0]) + (reachabilityMode ? '&reach=' + reachabilityMode : ''));
var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'
? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })
: Promise.resolve(fallbackCopy(value));
@@ -6526,8 +8111,10 @@
Archify.view.reveal([id], { includeNeighbors: true, reason: 'focus' });
}
});
- clearBtn.addEventListener('click', function () { clear(); });
+ clearBtn.addEventListener('click', function () { clear({ restoreFocus: true }); });
copyBtn.addEventListener('click', copyFocusLink);
+ upstreamBtn.addEventListener('click', function () { applyReachability('upstream'); });
+ downstreamBtn.addEventListener('click', function () { applyReachability('downstream'); });
relationsBtn.addEventListener('click', function () {
var expanded = chip.getAttribute('data-relations-expanded') === 'true';
if (expanded) chip.removeAttribute('data-relations-expanded');
@@ -6591,6 +8178,13 @@
event.preventDefault();
buttons[index].focus();
});
+ document.addEventListener('click', function (event) {
+ var target = event.target;
+ if (chip.hidden || !target || typeof target.closest !== 'function' || chip.contains(target)) return;
+ if (container.getAttribute('data-just-panned') === 'true') return;
+ if (target.closest('[data-node-id], [data-relationship-hit-key]')) return;
+ clear();
+ }, true);
window.addEventListener('scroll', requestLensPlacement, { passive: true });
window.addEventListener('resize', requestLensPlacement);
container.addEventListener('scroll', requestLensPlacement, { passive: true });
@@ -6615,11 +8209,17 @@
var params = new URLSearchParams(location.hash.replace(/^#/, ''));
var relation = params.get('relation');
var initial = params.get('focus');
+ var reach = params.get('reach');
if (relation) {
if (html.getAttribute('data-embed') === 'true' ||
!inspectRelationshipById(relation, { updateUrl: false, toggle: false })) clear({ updateUrl: false });
}
- else if (initial) set(initial, { updateUrl: false, toggle: false });
+ else if (initial) {
+ if (set(initial, { updateUrl: false, toggle: false }) &&
+ (reach === 'upstream' || reach === 'downstream')) {
+ applyReachability(reach, { updateUrl: false, toggle: false, reveal: false });
+ }
+ }
else if (!params.get('view')) clear({ updateUrl: false });
} catch (_) {}
}
@@ -6632,6 +8232,9 @@
setMany: setMany,
clear: clear,
copyLink: copyFocusLink,
+ reach: applyReachability,
+ clearReach: clearReachability,
+ reachabilitySnapshot: reachabilitySnapshot,
inspectRelationship: inspectRelationship,
inspectRelationshipById: inspectRelationshipById,
reposition: requestLensPlacement,
@@ -6639,6 +8242,15 @@
var record = pinnedRelationshipRecord();
return record ? { id: record.id || null, key: record.key, from: record.from, to: record.to, label: record.label } : null;
},
+ reachability: function () {
+ return activeReachability ? {
+ direction: activeReachability.direction,
+ originId: activeReachability.originId,
+ nodeIds: activeReachability.nodeIds.slice(),
+ edgeKeys: activeReachability.edgeKeys.slice(),
+ maxDepth: activeReachability.maxDepth
+ } : null;
+ },
active: function () { return activeIds.length === 0 ? null : (activeIds.length === 1 ? activeIds[0] : activeIds.slice()); }
};
})();
@@ -9399,6 +11011,10 @@
var context = node.getAttribute('data-node-context') || '';
var tag = node.getAttribute('data-node-tag') || '';
var type = semanticType(node);
+ var sources = Archify.sourceEvidence.node(id);
+ var sourceSearch = sources.map(function (source) {
+ return [source.path, source.label, source.line, source.endLine].filter(Boolean).join(' ');
+ }).join(' ');
return {
id: id,
label: label,
@@ -9406,8 +11022,9 @@
sublabel: sublabel,
context: context,
tag: tag,
+ sources: sources,
links: connectionsFor(id),
- search: (id + ' ' + label + ' ' + type + ' ' + sublabel + ' ' + context + ' ' + tag + ' ' + text).toLowerCase(),
+ search: (id + ' ' + label + ' ' + type + ' ' + sublabel + ' ' + context + ' ' + tag + ' ' + sourceSearch + ' ' + text).toLowerCase(),
node: node
};
});
@@ -9476,7 +11093,11 @@
button.type = 'button';
button.className = 'node-finder-result';
button.setAttribute('data-node-id', item.id);
- var badge = context.badges && context.badges[item.id] ? context.badges[item.id] : String(item.links);
+ var badge = context.badges && context.badges[item.id]
+ ? context.badges[item.id]
+ : context.kind === 'focus'
+ ? item.links + (item.links === 1 ? ' link' : ' links')
+ : String(item.links);
var action = context.kind === 'route-source'
? 'Choose ' + item.label + ' as route start'
: context.kind === 'route-target'
@@ -9488,11 +11109,10 @@
name.textContent = item.label;
var links = document.createElement('em');
links.textContent = badge;
- links.title = context.kind === 'focus'
- ? item.links + ' related connection' + (item.links === 1 ? '' : 's')
- : action;
+ links.title = context.kind === 'focus' ? badge : action;
var meta = document.createElement('small');
- meta.textContent = [item.type, item.context, item.sublabel, item.tag, item.id].filter(Boolean).join(' \u00b7 ');
+ meta.textContent = [item.type, item.id, item.sublabel, item.tag].filter(Boolean).join(' \u00b7 ');
+ meta.title = [item.type, item.id, item.context, item.sublabel, item.tag].filter(Boolean).join(' \u00b7 ');
button.appendChild(name);
button.appendChild(links);
button.appendChild(meta);
@@ -9500,7 +11120,9 @@
results.appendChild(button);
});
empty.hidden = visibleItems.length !== 0;
- status.textContent = visibleItems.length + ' of ' + available.length + ' ' + context.availableNoun + (query ? ' match' : ' available');
+ status.textContent = query
+ ? visibleItems.length + ' of ' + available.length + ' ' + context.availableNoun
+ : available.length + ' ' + context.availableNoun;
}
function open(options) {
@@ -9633,7 +11255,7 @@
return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));
}
function nodesById() {
- var out = {};
+ var out = Object.create(null);
nodes().forEach(function (node) { out[node.getAttribute('data-node-id')] = node; });
return out;
}
@@ -9641,6 +11263,54 @@
return node.getAttribute('data-node-label') ||
(node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];
}
+ function exportSnapshot() {
+ if (mode !== 'result' || activeNodeIds.length < 2 || activeEdges.length !== activeNodeIds.length - 1) return null;
+ var allNodes = nodes();
+ var byId = nodesById();
+ var seenNodeIds = Object.create(null);
+ var seenEdgeKeys = Object.create(null);
+ if (startId !== activeNodeIds[0] || endId !== activeNodeIds[activeNodeIds.length - 1] ||
+ activeNodeIds.some(function (id) {
+ if (seenNodeIds[id] || allNodes.filter(function (node) {
+ return node.getAttribute('data-node-id') === id;
+ }).length !== 1) return true;
+ seenNodeIds[id] = true;
+ return !byId[id];
+ }) ||
+ activeEdges.some(function (edge, index) {
+ if (!edge || !svg.contains(edge)) return true;
+ var edgeKey = edge.getAttribute('data-edge-key');
+ var edgeId = edge.getAttribute('data-edge-id') || '';
+ if (!edgeKey || seenEdgeKeys[edgeKey]) return true;
+ seenEdgeKeys[edgeKey] = true;
+ var fragments = Array.prototype.slice.call(svg.querySelectorAll('[data-edge-key]')).filter(function (candidate) {
+ return candidate.getAttribute('data-edge-key') === edgeKey;
+ });
+ var drawableFragments = fragments.filter(hasDrawableGeometry);
+ return !fragments.length || !fragments.every(function (fragment) {
+ return fragment.getAttribute('data-edge-from') === activeNodeIds[index] &&
+ fragment.getAttribute('data-edge-to') === activeNodeIds[index + 1] &&
+ (fragment.getAttribute('data-edge-id') || '') === edgeId;
+ }) || drawableFragments.length !== 1 || drawableFragments[0] !== edge ||
+ edge.getAttribute('data-edge-from') !== activeNodeIds[index] ||
+ edge.getAttribute('data-edge-to') !== activeNodeIds[index + 1];
+ })) return null;
+ return {
+ source: { id: startId, label: nodeLabel(byId[startId], startId) },
+ target: { id: endId, label: nodeLabel(byId[endId], endId) },
+ nodeIds: activeNodeIds.slice(),
+ hops: activeEdges.length,
+ edges: activeEdges.map(function (edge) {
+ return {
+ key: edge.getAttribute('data-edge-key'),
+ id: edge.getAttribute('data-edge-id') || '',
+ from: edge.getAttribute('data-edge-from'),
+ to: edge.getAttribute('data-edge-to'),
+ label: edge.getAttribute('data-edge-label') || ''
+ };
+ })
+ };
+ }
function edgeShapes(edge) {
if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];
return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));
@@ -9789,6 +11459,7 @@
findBtn.setAttribute('aria-label', 'Find a route start');
copyBtn.hidden = true;
copyBtn.textContent = 'Copy link';
+ if (Archify.exportMenu && typeof Archify.exportMenu.syncRouteShare === 'function') Archify.exportMenu.syncRouteShare();
setTrigger(false);
if (wasActive && options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {
Archify.view.reset({ automatic: true });
@@ -10268,6 +11939,7 @@
findBtn.hidden = true;
copyBtn.hidden = false;
setTrigger(true);
+ if (Archify.exportMenu && typeof Archify.exportMenu.syncRouteShare === 'function') Archify.exportMenu.syncRouteShare();
if (options.updateUrl !== false) {
replaceRouteHash(encodeURIComponent(startId) + '~' + encodeURIComponent(endId));
}
@@ -10538,6 +12210,7 @@
finderOpening: finderOpening,
finderClosed: finderClosed,
openFinder: openFinder,
+ exportSnapshot: exportSnapshot,
active: function () { return mode === 'idle' ? null : mode; },
result: function () {
return mode === 'result'
@@ -11417,6 +13090,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -11453,6 +13129,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
@@ -11473,7 +13152,7 @@
Archify.intentTrace.clear();
} else if (e.key === 'Escape' && Archify.focus.active()) {
e.preventDefault();
- Archify.focus.clear();
+ Archify.focus.clear({ restoreFocus: true });
} else if (e.key === 'Escape' && Archify.presentation.active()) {
e.preventDefault();
Archify.presentation.exit();
diff --git a/examples/archify-repo.html b/examples/archify-repo.html
index 2639790f..04b40121 100644
--- a/examples/archify-repo.html
+++ b/examples/archify-repo.html
@@ -271,6 +271,83 @@
--toolbar-menu-bg: #f9fdff;
}
+ /* ==========================================================
+ EDITORIAL — a warm, publication-minded preset for design
+ reviews, launch notes, and documentation. The diagram keeps
+ the same semantic palette and exact geometry, but trades
+ software chrome for paper, ink, ruled structure, and one
+ restrained vermilion accent.
+ ========================================================== */
+ [data-preset="editorial"][data-theme="dark"] {
+ --bg: #181611;
+ --grid: #39342a;
+ --panel: rgba(35, 31, 24, 0.96);
+ --panel-border: #625a4a;
+ --lane-fill: rgba(52, 46, 35, 0.46);
+ --lane-stroke: #726957;
+ --text: #f4eddf;
+ --text-muted: #b9ae9b;
+ --text-dim: #776e60;
+ --text-faint: #9d917e;
+ --mask: #231f18;
+ --frontend-fill: rgba(43, 133, 142, 0.16);
+ --frontend-stroke: #7fc6c7;
+ --backend-fill: rgba(63, 132, 92, 0.16);
+ --backend-stroke: #8fc29e;
+ --database-fill: rgba(117, 91, 141, 0.17);
+ --database-stroke: #c0a4d0;
+ --cloud-fill: rgba(170, 119, 49, 0.16);
+ --cloud-stroke: #d8ad68;
+ --security-fill: rgba(157, 69, 65, 0.17);
+ --security-stroke: #df9085;
+ --messagebus-fill: rgba(174, 79, 42, 0.16);
+ --messagebus-stroke: #df946f;
+ --external-fill: rgba(126, 115, 96, 0.18);
+ --external-stroke: #b8ad99;
+ --arrow: #948978;
+ --arrow-emphasis: #dd6b3d;
+ --toolbar-bg: rgba(35, 31, 24, 0.92);
+ --toolbar-border: #625a4a;
+ --toolbar-text: #eee5d5;
+ --toolbar-hover: #302a20;
+ --toolbar-menu-bg: #231f18;
+ }
+
+ [data-preset="editorial"][data-theme="light"] {
+ --bg: #f2eee5;
+ --grid: #d8d0c2;
+ --panel: rgba(251, 248, 241, 0.97);
+ --panel-border: #c4b9a6;
+ --lane-fill: rgba(229, 221, 207, 0.42);
+ --lane-stroke: #b8aa94;
+ --text: #242018;
+ --text-muted: #6f6658;
+ --text-dim: #a09788;
+ --text-faint: #817767;
+ --mask: #fbf8f1;
+ --frontend-fill: rgba(31, 117, 126, 0.09);
+ --frontend-stroke: #287e84;
+ --backend-fill: rgba(42, 119, 75, 0.09);
+ --backend-stroke: #397b53;
+ --database-fill: rgba(105, 75, 130, 0.09);
+ --database-stroke: #765d86;
+ --cloud-fill: rgba(157, 103, 31, 0.1);
+ --cloud-stroke: #9a671f;
+ --security-fill: rgba(153, 58, 52, 0.09);
+ --security-stroke: #9e463f;
+ --messagebus-fill: rgba(182, 70, 27, 0.09);
+ --messagebus-stroke: #ad4b25;
+ --external-fill: rgba(101, 91, 75, 0.09);
+ --external-stroke: #746b5e;
+ --arrow: #8a806f;
+ --arrow-emphasis: #bb4c23;
+ --toolbar-bg: rgba(251, 248, 241, 0.94);
+ --toolbar-border: #c4b9a6;
+ --toolbar-text: #40392f;
+ --toolbar-hover: #fffdf8;
+ --toolbar-menu-bg: #fbf8f1;
+ }
+
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
@@ -301,6 +378,12 @@
background-position: -1px -1px;
background-attachment: fixed;
}
+ html[data-preset="editorial"] body {
+ background-image:
+ linear-gradient(90deg, transparent 0, transparent 5.4rem, color-mix(in srgb, var(--security-stroke) 18%, transparent) 5.4rem, color-mix(in srgb, var(--security-stroke) 18%, transparent) calc(5.4rem + 1px), transparent calc(5.4rem + 1px)),
+ repeating-linear-gradient(0deg, transparent 0, transparent 31px, color-mix(in srgb, var(--grid) 36%, transparent) 31px, color-mix(in srgb, var(--grid) 36%, transparent) 32px);
+ background-attachment: fixed;
+ }
/* Gallery/embed mode keeps the generated artifact as the source of truth
while presenting only its diagram surface inside a proof card. */
@@ -369,6 +452,20 @@
box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
backdrop-filter: none;
}
+ html[data-preset="editorial"] .share-chapter-cue {
+ border-color: var(--panel-border);
+ background:
+ linear-gradient(90deg, color-mix(in srgb, var(--security-fill) 58%, transparent), transparent 42%),
+ var(--toolbar-menu-bg);
+ box-shadow: 0 10px 30px color-mix(in srgb, #000 18%, transparent);
+ backdrop-filter: none;
+ }
+ html[data-preset="editorial"] .share-chapter-state { color: var(--arrow-emphasis); }
+ html[data-preset="editorial"] .share-chapter-state::before {
+ border-radius: 0;
+ box-shadow: none;
+ transform: rotate(45deg) scale(0.8);
+ }
.share-chapter-index {
display: grid;
gap: 0.12rem;
@@ -508,7 +605,8 @@
.header { margin-bottom: 2rem; padding-right: 29.5rem; }
html[data-preset="signal-flow"] .header,
- html[data-preset="blueprint"] .header { padding-right: 29.5rem; }
+ html[data-preset="blueprint"] .header,
+ html[data-preset="editorial"] .header { padding-right: 29.5rem; }
.header-row {
display: flex;
@@ -581,6 +679,36 @@
white-space: nowrap;
}
+ html[data-preset="editorial"] h1,
+ html[data-preset="editorial"] .card h3 {
+ font-family: Georgia, 'Times New Roman', 'Songti SC', STSong, serif;
+ letter-spacing: -0.02em;
+ }
+ html[data-preset="editorial"] h1 { font-size: 1.72rem; font-weight: 600; }
+ html[data-preset="editorial"] .pulse-dot {
+ width: 9px;
+ height: 9px;
+ border: 1px solid var(--arrow-emphasis);
+ border-radius: 0;
+ background: var(--arrow-emphasis);
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
+ transform: rotate(45deg);
+ animation: none;
+ }
+ html[data-preset="editorial"] .header-row::after {
+ content: "EDITORIAL / FIELD NOTE";
+ margin-left: auto;
+ padding: 0.32rem 0 0.24rem;
+ border-bottom: 2px solid var(--arrow-emphasis);
+ color: var(--arrow-emphasis);
+ font-family: Georgia, 'Times New Roman', serif;
+ font-size: 0.625rem;
+ font-style: italic;
+ font-weight: 600;
+ letter-spacing: 0.08em;
+ white-space: nowrap;
+ }
+
.diagram-container {
background: var(--panel);
border-radius: 1rem;
@@ -625,6 +753,35 @@
linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right bottom / 1px 1.35rem no-repeat;
opacity: 0.58;
}
+ html[data-preset="editorial"] .diagram-container {
+ overflow: hidden;
+ border-color: var(--panel-border);
+ border-radius: 0.38rem;
+ background:
+ linear-gradient(90deg, color-mix(in srgb, var(--security-fill) 58%, transparent), transparent 12%),
+ var(--panel);
+ box-shadow:
+ 0 1px 0 color-mix(in srgb, var(--text) 6%, transparent),
+ 0 18px 48px color-mix(in srgb, #000 19%, transparent);
+ }
+ html[data-preset="editorial"] .diagram-container::after {
+ position: absolute;
+ z-index: 10;
+ top: 0.72rem;
+ right: 1.25rem;
+ padding: 0.2rem 0.52rem;
+ border: 1px solid var(--panel-border);
+ background: var(--panel);
+ color: var(--arrow-emphasis);
+ content: "ARCHIFY / PLATE 04";
+ font-family: Georgia, 'Times New Roman', serif;
+ font-size: 0.52rem;
+ font-style: italic;
+ font-weight: 600;
+ letter-spacing: 0.09em;
+ pointer-events: none;
+ }
+ html[data-embed="true"][data-preset="editorial"] .diagram-container::after { display: none; }
html[data-motion-capable="true"][data-preset="signal-flow"][data-ambient-motion="running"] .diagram-container::before {
content: "";
position: absolute;
@@ -1354,10 +1511,25 @@
.relationship-lens-actions {
display: flex;
flex-direction: column;
- align-items: stretch;
+ align-items: flex-end;
gap: 0.18rem;
}
.relationship-lens-actions button { white-space: nowrap; }
+ .relationship-lens-actions #btn-focus-clear {
+ display: grid;
+ width: 1.75rem;
+ height: 1.75rem;
+ padding: 0;
+ place-items: center;
+ color: var(--text-muted);
+ font-size: 1rem;
+ line-height: 1;
+ }
+ .relationship-lens-actions #btn-focus-clear:hover,
+ .relationship-lens-actions #btn-focus-clear:focus-visible {
+ background: var(--toolbar-hover);
+ color: var(--text);
+ }
.relationship-lens-actions #btn-focus-copy { color: var(--frontend-stroke); }
.relationship-lens-actions #btn-focus-relations { display: none; }
.relationship-lens-eyebrow {
@@ -1420,12 +1592,163 @@
.semantic-passport-meta [hidden] { display: none; }
html[data-preset="blueprint"] .semantic-passport-meta span,
html[data-preset="blueprint"] .semantic-passport-meta code { border-radius: 0.1rem; }
+ .semantic-passport-evidence {
+ margin-top: 0.52rem;
+ padding: 0.5rem;
+ border: 1px solid color-mix(in srgb, var(--backend-stroke) 32%, var(--toolbar-border));
+ border-radius: 0.55rem;
+ background: color-mix(in srgb, var(--backend-fill) 18%, var(--panel));
+ }
+ .semantic-passport-evidence[hidden] { display: none; }
+ html[data-preset="blueprint"] .semantic-passport-evidence { border-radius: 0.18rem; }
+ .semantic-passport-evidence-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 0.55rem;
+ margin-bottom: 0.35rem;
+ }
+ .semantic-passport-evidence-status {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.28rem;
+ color: var(--backend-stroke);
+ font-size: 0.5rem;
+ font-weight: 800;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ }
+ .semantic-passport-evidence-status::before {
+ content: '';
+ width: 0.38rem;
+ height: 0.38rem;
+ border-radius: 50%;
+ background: var(--backend-stroke);
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--backend-stroke) 14%, transparent);
+ }
+ .semantic-passport-repository {
+ min-width: 0;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.5rem;
+ text-decoration: none;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+ .semantic-passport-repository:hover,
+ .semantic-passport-repository:focus-visible { color: var(--backend-stroke); }
+ .semantic-passport-evidence-links { display: grid; gap: 0.22rem; }
+ .semantic-passport-source {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) auto;
+ gap: 0.15rem 0.45rem;
+ align-items: center;
+ padding: 0.34rem 0.4rem;
+ border: 1px solid transparent;
+ border-radius: 0.38rem;
+ color: var(--text-muted);
+ text-decoration: none;
+ }
+ .semantic-passport-source:hover,
+ .semantic-passport-source:focus-visible {
+ border-color: color-mix(in srgb, var(--backend-stroke) 42%, transparent);
+ background: color-mix(in srgb, var(--backend-fill) 32%, transparent);
+ color: var(--text);
+ }
+ .semantic-passport-source strong {
+ overflow: hidden;
+ font-size: 0.5625rem;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+ .semantic-passport-source code {
+ color: var(--backend-stroke);
+ font: inherit;
+ font-size: 0.5rem;
+ }
+ .semantic-passport-source small {
+ grid-column: 1 / -1;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.5rem;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
.relationship-lens-summary {
display: block;
margin-top: 0.12rem;
color: var(--text-faint);
font-size: 0.5625rem;
}
+ .semantic-passport-reach {
+ display: grid;
+ gap: 0.28rem;
+ margin-top: 0.52rem;
+ padding-top: 0.48rem;
+ border-top: 1px solid color-mix(in srgb, var(--toolbar-border) 76%, transparent);
+ }
+ .semantic-passport-reach[hidden] { display: none; }
+ .semantic-passport-reach-label {
+ color: var(--text-faint);
+ font-size: 0.5rem;
+ font-weight: 800;
+ letter-spacing: 0.1em;
+ text-transform: uppercase;
+ }
+ .semantic-passport-reach-actions {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 0.25rem;
+ }
+ .semantic-passport-reach-actions button {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 0.5rem;
+ min-width: 0;
+ min-height: 2rem;
+ padding: 0.32rem 0.42rem;
+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 86%, transparent);
+ background: color-mix(in srgb, var(--panel) 70%, transparent);
+ color: var(--text-muted);
+ text-align: left;
+ }
+ .semantic-passport-reach-actions button:hover:not(:disabled),
+ .semantic-passport-reach-actions button:focus-visible {
+ border-color: color-mix(in srgb, var(--frontend-stroke) 62%, var(--toolbar-border));
+ color: var(--text);
+ }
+ .semantic-passport-reach-actions button:focus-visible {
+ outline: 2px solid var(--frontend-stroke);
+ outline-offset: 1px;
+ }
+ .semantic-passport-reach-actions button:disabled {
+ cursor: default;
+ opacity: 0.5;
+ }
+ .semantic-passport-reach-actions button[aria-pressed="true"] {
+ border-color: color-mix(in srgb, var(--reach-color, var(--frontend-stroke)) 72%, var(--toolbar-border));
+ background: color-mix(in srgb, var(--reach-fill, var(--frontend-fill)) 48%, transparent);
+ color: var(--text);
+ }
+ #btn-reach-upstream {
+ --reach-color: var(--database-stroke);
+ --reach-fill: var(--database-fill);
+ }
+ #btn-reach-downstream {
+ --reach-color: var(--backend-stroke);
+ --reach-fill: var(--backend-fill);
+ }
+ .semantic-passport-reach-actions strong {
+ color: var(--reach-color, var(--frontend-stroke));
+ font-size: 0.625rem;
+ }
+ .semantic-passport-reach-status {
+ color: var(--text-faint);
+ font-size: 0.525rem;
+ line-height: 1.4;
+ }
+ .semantic-passport-reach-status[hidden] { display: none; }
.relationship-lens-list {
max-height: min(18rem, 46vh);
overflow: auto;
@@ -1698,13 +2021,16 @@
top: 1rem;
left: 1rem;
z-index: 24;
+ display: flex;
+ flex-direction: column;
width: min(22rem, calc(100% - 2rem));
+ max-height: calc(100% - 2rem);
overflow: hidden;
border: 1px solid var(--toolbar-border);
border-radius: 0.85rem;
background: var(--toolbar-menu-bg);
color: var(--toolbar-text);
- box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34);
+ box-shadow: 0 6px 8px rgba(0, 0, 0, 0.22);
backdrop-filter: blur(16px);
}
.node-finder[hidden] { display: none; }
@@ -1744,7 +2070,6 @@
.node-finder-close:hover,
.node-finder-close:focus-visible { background: var(--toolbar-hover); }
.node-finder-close:focus-visible,
- .node-finder-input:focus-visible,
.node-finder-result:focus-visible {
outline: 2px solid var(--frontend-stroke);
outline-offset: -2px;
@@ -1760,10 +2085,16 @@
border: 1px solid var(--toolbar-border);
border-radius: 0.55rem;
background: color-mix(in srgb, var(--panel) 78%, transparent);
+ transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
}
html[data-preset="blueprint"] .node-finder-search { border-radius: 0.18rem; }
.node-finder-search > span { color: var(--frontend-stroke); font-size: 0.875rem; }
+ .node-finder-search:focus-within {
+ border-color: var(--frontend-stroke);
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--frontend-stroke) 20%, transparent);
+ }
.node-finder-input {
+ appearance: none;
width: 100%;
min-width: 0;
border: 0;
@@ -1773,6 +2104,7 @@
font: inherit;
font-size: 0.75rem;
}
+ .node-finder-input:focus-visible { outline: none; }
.node-finder-input::placeholder { color: var(--text-faint); }
.node-finder kbd {
padding: 0.1rem 0.32rem;
@@ -1784,34 +2116,50 @@
}
.node-finder-results {
display: grid;
- gap: 0.18rem;
+ flex: 1 1 auto;
+ gap: 0;
+ min-height: 0;
max-height: min(18rem, 48vh);
- margin: 0;
- padding: 0 0.55rem 0.55rem;
+ margin: 0 0.55rem 0.45rem;
+ padding: 0;
overflow-y: auto;
overscroll-behavior: contain;
+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 78%, transparent);
+ border-radius: 0.55rem;
+ background: color-mix(in srgb, var(--panel) 54%, transparent);
+ scroll-padding-block: 0.25rem;
scrollbar-width: thin;
}
+ html[data-preset="blueprint"] .node-finder-results { border-radius: 0.18rem; }
.node-finder-result {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 0.2rem 0.75rem;
width: 100%;
- padding: 0.55rem 0.65rem;
+ min-height: 3.25rem;
+ padding: 0.58rem 0.65rem;
border: 0;
- border-radius: 0.45rem;
+ border-radius: 0;
background: transparent;
color: var(--text);
font: inherit;
text-align: left;
cursor: pointer;
+ transition: background-color 160ms ease-out;
+ }
+ .node-finder-result:not(:last-child) {
+ border-bottom: 1px solid color-mix(in srgb, var(--toolbar-border) 62%, transparent);
}
- html[data-preset="blueprint"] .node-finder-result { border-radius: 0.12rem; }
.node-finder-result:hover,
- .node-finder-result:focus-visible { background: var(--toolbar-hover); }
+ .node-finder-result:focus-visible {
+ position: relative;
+ z-index: 1;
+ background: color-mix(in srgb, var(--frontend-fill) 48%, var(--toolbar-hover));
+ }
.node-finder-result strong {
overflow: hidden;
font-size: 0.75rem;
+ line-height: 1.25;
text-overflow: ellipsis;
white-space: nowrap;
}
@@ -1820,7 +2168,7 @@
overflow: hidden;
color: var(--text-faint);
font-size: 0.5625rem;
- letter-spacing: 0.03em;
+ letter-spacing: 0.015em;
text-overflow: ellipsis;
white-space: nowrap;
}
@@ -1847,8 +2195,8 @@
text-align: center;
}
.node-finder-status {
- padding: 0.5rem 0.8rem;
- border-top: 1px solid var(--toolbar-border);
+ margin: 0;
+ padding: 0.1rem 0.8rem 0.65rem;
color: var(--text-faint);
font-size: 0.5625rem;
}
@@ -2364,6 +2712,22 @@
border-top: 2px solid var(--frontend-stroke);
}
+ html[data-preset="editorial"] .card {
+ position: relative;
+ border-radius: 0.28rem;
+ background: var(--panel);
+ box-shadow: 0 10px 28px color-mix(in srgb, #000 10%, transparent);
+ }
+ html[data-preset="editorial"] .card::before {
+ position: absolute;
+ top: -1px;
+ left: 1.25rem;
+ width: 3.25rem;
+ border-top: 3px solid var(--arrow-emphasis);
+ content: "";
+ }
+ html[data-preset="editorial"] .card-dot { border-radius: 0; transform: rotate(45deg) scale(0.78); }
+
.card-header {
display: flex;
align-items: center;
@@ -2491,6 +2855,8 @@
.story-carrier-overlay { display: none !important; }
.diagram-container svg[data-focus-active] [data-node-id],
.diagram-container svg[data-focus-active] [data-edge-from],
+ .diagram-container svg[data-reach-active] [data-node-id],
+ .diagram-container svg[data-reach-active] [data-edge-from],
.diagram-container svg[data-story-beat] [data-story-step],
.diagram-container svg[data-story-beat] [data-edge-from][data-story-beat-step],
.diagram-container svg[data-route-active] [data-node-id],
@@ -2541,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2561,6 +2928,172 @@
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);
transform: rotate(45deg) scale(0.84);
}
+ #btn-preset[data-preset-option="editorial"] .preset-control-mark {
+ border-color: var(--arrow-emphasis);
+ border-radius: 0;
+ background: var(--arrow-emphasis);
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
+ transform: rotate(45deg) scale(0.72);
+ }
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
+ html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
+ html[data-preset="editorial"] .export-menu,
+ html[data-preset="editorial"] .overview-map,
+ html[data-preset="editorial"] .semantic-lens,
+ html[data-preset="editorial"] .route-probe,
+ html[data-preset="editorial"] .focus-chip,
+ html[data-preset="editorial"] .diagram-guide,
+ html[data-preset="editorial"] .node-finder,
+ html[data-preset="editorial"] .guided-views,
+ html[data-preset="editorial"] .share-chapter-cue {
+ border-radius: 0.3rem;
+ }
.motion-control-dot {
width: 0.46rem;
height: 0.46rem;
@@ -2597,6 +3130,7 @@
text-align: left;
padding: 0.5rem 0.75rem;
}
+ .toolbar .export-menu button[hidden] { display: none; }
.toolbar .export-menu button:hover {
background: var(--toolbar-hover);
}
@@ -2637,20 +3171,29 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
.header { margin-bottom: 1.25rem; padding-right: 0; }
html[data-preset="signal-flow"] .header,
- html[data-preset="blueprint"] .header { padding-right: 0; }
+ html[data-preset="blueprint"] .header,
+ html[data-preset="editorial"] .header { padding-right: 0; }
.header-row {
gap: 0.75rem;
align-items: flex-start;
}
html[data-preset="signal-flow"] .header-row,
- html[data-preset="blueprint"] .header-row { flex-wrap: wrap; }
+ html[data-preset="blueprint"] .header-row,
+ html[data-preset="editorial"] .header-row { flex-wrap: wrap; }
html[data-preset="signal-flow"] .header-row::after {
margin-left: 0;
order: 3;
@@ -2659,6 +3202,10 @@
margin-left: 0;
order: 3;
}
+ html[data-preset="editorial"] .header-row::after {
+ margin-left: 0;
+ order: 3;
+ }
h1 {
font-size: 1.25rem;
line-height: 1.25;
@@ -3035,6 +3582,8 @@
the global zoom level. Reveal only their exact semantic matches. */
svg[data-focus-active] [data-focus-match][data-detail],
svg[data-focus-active] [data-focus-match] [data-detail],
+ svg[data-reach-active] [data-reach-match][data-detail],
+ svg[data-reach-active] [data-reach-match] [data-detail],
svg[data-lens-active] [data-lens-match][data-detail],
svg[data-lens-active] [data-lens-match] [data-detail],
svg[data-legend-preview-active] [data-legend-preview-match][data-detail],
@@ -3053,6 +3602,7 @@
pointer-events: auto;
}
svg[data-focus-active] [data-focus-match] [data-detail-anchor],
+ svg[data-reach-active] [data-reach-match] [data-detail-anchor],
svg[data-lens-active] [data-lens-match] [data-detail-anchor],
svg[data-legend-preview-active] [data-legend-preview-match] [data-detail-anchor],
svg[data-intent-trace-active] [data-intent-trace-match] [data-detail-anchor],
@@ -3084,6 +3634,41 @@
filter: drop-shadow(0 0 7px var(--frontend-stroke));
outline: none;
}
+ /* Verified Source Beacons are installed at runtime only for nodes whose
+ repository evidence passed the local revision/blob/line checks. They
+ live inside the owning node so every focus, route, story, and guided
+ view keeps one coherent opacity state. Export serialization removes
+ them before producing the canonical SVG or any derived visual. */
+ .source-evidence-beacon {
+ pointer-events: none;
+ opacity: 0.76;
+ transition: opacity 160ms ease, filter 160ms ease;
+ }
+ .source-evidence-beacon rect {
+ fill: color-mix(in srgb, var(--mask) 92%, var(--backend-stroke));
+ stroke: color-mix(in srgb, var(--backend-stroke) 82%, var(--panel-border));
+ stroke-width: 1;
+ vector-effect: non-scaling-stroke;
+ }
+ .source-evidence-beacon text {
+ fill: var(--backend-stroke);
+ font-size: 5.5px;
+ font-weight: 800;
+ letter-spacing: 0.06em;
+ text-anchor: middle;
+ text-transform: uppercase;
+ }
+ svg [data-node-id]:hover .source-evidence-beacon,
+ svg [data-node-id]:focus-visible .source-evidence-beacon,
+ svg [data-node-id][data-focus-selected] .source-evidence-beacon {
+ opacity: 1;
+ filter: drop-shadow(0 0 4px color-mix(in srgb, var(--backend-stroke) 72%, transparent));
+ }
+ svg[data-preset="signal-flow"] .source-evidence-beacon { opacity: 0.9; }
+ svg[data-preset="blueprint"] .source-evidence-beacon rect {
+ rx: 0.8px;
+ filter: none;
+ }
svg [data-legend-kind][role="button"] { cursor: pointer; }
svg [data-legend-kind]:focus { outline: none; }
svg [data-legend-hit] {
@@ -3199,6 +3784,30 @@
filter: drop-shadow(0 0 10px var(--frontend-stroke));
}
+ /* Authored Reachability is a bounded graph query over the relationships
+ already present in the artifact. Upstream walks incoming edges;
+ downstream walks outgoing edges. It never claims runtime causality and
+ changes only viewer emphasis, not canonical geometry or export bytes. */
+ svg[data-reach-active] [data-node-id],
+ svg[data-reach-active] [data-edge-from] { opacity: 0.09; }
+ svg[data-reach-active] [data-reach-match] { opacity: 1; }
+ svg[data-reach-active="upstream"] [data-reach-origin] {
+ filter: drop-shadow(0 0 11px var(--database-stroke));
+ }
+ svg[data-reach-active="downstream"] [data-reach-origin] {
+ filter: drop-shadow(0 0 11px var(--backend-stroke));
+ }
+ svg[data-reach-active="upstream"] [data-edge-from][data-reach-match] {
+ filter: drop-shadow(0 0 4px color-mix(in srgb, var(--database-stroke) 72%, transparent));
+ }
+ svg[data-reach-active="downstream"] [data-edge-from][data-reach-match] {
+ filter: drop-shadow(0 0 4px color-mix(in srgb, var(--backend-stroke) 72%, transparent));
+ }
+ svg[data-preset="blueprint"][data-reach-active] [data-reach-origin],
+ svg[data-preset="blueprint"][data-reach-active] [data-edge-from][data-reach-match] {
+ filter: none;
+ }
+
/* Direct Relationship Explorer makes authored paths a real input surface
without changing their visible stroke or canonical SVG. A transparent
runtime rail supplies forgiving pointer geometry; the exact authored
@@ -3294,6 +3903,11 @@
stroke-linecap: square;
filter: none;
}
+ svg[data-preset="editorial"] .relationship-flow-pulse {
+ stroke: var(--arrow-emphasis);
+ stroke-width: 2.75;
+ filter: none;
+ }
.semantic-flow-token {
color: var(--frontend-stroke);
opacity: 0;
@@ -3336,6 +3950,7 @@
filter: drop-shadow(0 0 5px currentColor);
}
svg[data-preset="blueprint"] .semantic-flow-token { filter: none; }
+ svg[data-preset="editorial"] .semantic-flow-token { filter: none; }
html[data-embed="true"] .relationship-pulse-overlay { display: none; }
/* Intent Trace is a temporary, pre-click exploration layer. Related
@@ -3376,6 +3991,8 @@
filter: none;
stroke-linecap: square;
}
+ svg[data-preset="editorial"] [data-intent-trace-selected],
+ svg[data-preset="editorial"] .intent-trace-flow { filter: none; }
.intent-trace-status {
position: absolute;
width: 1px;
@@ -3459,6 +4076,25 @@
filter: none;
stroke-linecap: square;
}
+ svg[data-preset="editorial"] [data-route-start],
+ svg[data-preset="editorial"] [data-route-end],
+ svg[data-preset="editorial"] [data-route-step],
+ svg[data-preset="editorial"] .route-probe-flow,
+ svg[data-preset="editorial"] .route-journey-flow { filter: none; }
+
+ svg[data-preset="editorial"] .c-grid {
+ stroke-dasharray: 1 4;
+ opacity: 0.48;
+ }
+ svg[data-preset="editorial"] .c-region {
+ fill: color-mix(in srgb, var(--cloud-fill) 48%, transparent);
+ stroke-dasharray: 9 4;
+ }
+ svg[data-preset="editorial"] [data-node-id]:hover,
+ svg[data-preset="editorial"] [data-node-id]:focus-visible,
+ svg[data-preset="editorial"][data-focus-active] [data-focus-selected] {
+ filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 18%, transparent));
+ }
svg[data-preset="blueprint"] .c-grid {
stroke-dasharray: 1 3;
@@ -3477,6 +4113,9 @@
svg[data-preset="blueprint"][data-focus-active] [data-focus-selected] {
filter: drop-shadow(0 0 3px var(--frontend-stroke));
}
+ svg[data-preset="blueprint"][data-focus-active][data-reach-active] [data-focus-selected][data-reach-origin] {
+ filter: none;
+ }
svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview],
svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview-source],
svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview-target] {
@@ -3541,6 +4180,10 @@
filter: none;
animation: none;
}
+ svg[data-preset="editorial"] .story-trail-flow { filter: none; }
+ svg[data-preset="editorial"][data-story-beat] [data-story-step][data-story-beat-state="active"] {
+ filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 16%, transparent));
+ }
/* Chapter Delta Preview is a static, pre-commit comparison between two
chapter focus sets. Symbols in the rail carry the meaning without color;
@@ -3602,6 +4245,14 @@
animation-name: archify-blueprint-node-pulse;
animation-duration: 3.8s;
}
+ svg[data-preset="editorial"][data-animation="trace"] [data-animate="edge"] {
+ filter: none;
+ animation-duration: 2.2s;
+ }
+ svg[data-preset="editorial"][data-animation="trace"] [data-animate="node"] {
+ animation-name: archify-editorial-node-pulse;
+ animation-duration: 3.5s;
+ }
/* Embedded proofs are static until a named Story Trail chapter is played.
This keeps proof grids calm and ensures ?play=1 stops all viewer motion
after one 3.2 second chapter instead of leaving ambient trace loops on. */
@@ -3627,6 +4278,10 @@
0%, 72%, 100% { opacity: 1; filter: none; }
18%, 36% { opacity: 0.72; filter: drop-shadow(0 0 2px var(--frontend-stroke)); }
}
+ @keyframes archify-editorial-node-pulse {
+ 0%, 72%, 100% { opacity: 1; filter: none; }
+ 18%, 36% { opacity: 0.78; filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 18%, transparent)); }
+ }
@keyframes archify-signal-scan {
0%, 18% { opacity: 1; transform: translateX(-70%); }
70% { opacity: 1; transform: translateX(70%); }
@@ -3742,6 +4397,7 @@
}
.relationship-pulse-overlay { display: none !important; }
.guided-view-chapter { transition: none !important; }
+ .source-evidence-beacon,
svg [data-node-id], svg [data-edge-from], svg [data-detail], svg [data-detail-anchor], svg [data-legend-hit], svg { transition: none !important; }
}
</style>
@@ -3758,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -3789,6 +4475,8 @@
</button>
<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&times;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&times;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&times;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>
@@ -3814,6 +4502,7 @@
</div>
<script id="archify-guided-views-data" type="application/json">[]</script>
+
<div class="guided-views no-print" id="guided-views" hidden aria-label="Guided diagram views">
<button id="guided-view-prev" type="button" aria-label="Previous guided view" title="Previous guided view ([)">&#8592;</button>
<div class="guided-view-copy">
@@ -4149,7 +4838,7 @@
</div>
<div class="node-finder-search">
<span aria-hidden="true">&#8981;</span>
- <input class="node-finder-input" id="node-finder-input" type="search" autocomplete="off" spellcheck="false" placeholder="Search labels or IDs" aria-describedby="node-finder-status">
+ <input class="node-finder-input" id="node-finder-input" type="search" autocomplete="off" spellcheck="false" placeholder="Search labels or IDs" aria-label="Search diagram nodes" aria-describedby="node-finder-status">
<kbd aria-hidden="true">/</kbd>
</div>
<div class="node-finder-results" id="node-finder-results" role="group" aria-label="Diagram nodes"></div>
@@ -4168,12 +4857,31 @@
<span id="focus-tag" data-passport="tag" hidden></span>
<code id="focus-id" data-passport="id"></code>
</div>
+ <div class="semantic-passport-evidence" id="focus-evidence" hidden aria-label="Verified source evidence">
+ <div class="semantic-passport-evidence-head">
+ <span class="semantic-passport-evidence-status">Verified source</span>
+ <a class="semantic-passport-repository" id="focus-repository" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer"></a>
+ </div>
+ <div class="semantic-passport-evidence-links" id="focus-evidence-links"></div>
+ </div>
<span class="relationship-lens-summary" id="focus-summary" aria-live="polite"></span>
+ <div class="semantic-passport-reach" id="focus-reach" hidden>
+ <span class="semantic-passport-reach-label">Authored reach</span>
+ <div class="semantic-passport-reach-actions" role="group" aria-label="Trace authored reachability">
+ <button id="btn-reach-upstream" type="button" aria-label="Trace upstream authored reachability" aria-pressed="false">
+ <span>Upstream</span><strong id="focus-reach-upstream-count">0</strong>
+ </button>
+ <button id="btn-reach-downstream" type="button" aria-label="Trace downstream authored reachability" aria-pressed="false">
+ <span>Downstream</span><strong id="focus-reach-downstream-count">0</strong>
+ </button>
+ </div>
+ <small class="semantic-passport-reach-status" id="focus-reach-status" hidden aria-live="polite"></small>
+ </div>
</div>
<div class="relationship-lens-actions">
+ <button id="btn-focus-clear" type="button" aria-label="Close semantic passport" title="Close">&#215;</button>
<button id="btn-focus-copy" type="button" aria-label="Copy link to focused node">Copy link</button>
<button id="btn-focus-relations" type="button" aria-label="Show connected relationships" aria-expanded="false" aria-controls="relationship-lens-list">Relations</button>
- <button id="btn-focus-clear" type="button" aria-label="Clear focused node">Clear</button>
</div>
</div>
<div class="relationship-lens-list" id="relationship-lens-list" aria-label="Connected relationships"></div>
@@ -4292,19 +5000,44 @@
<script>
var Archify = {};
+ function hasDrawableGeometry(element) {
+ if (!element) return false;
+ var geometries = /^(path|line|polyline)$/i.test(element.tagName)
+ ? [element]
+ : Array.prototype.slice.call(element.querySelectorAll('path, line, polyline'));
+ return geometries.some(function (geometry) {
+ var source = geometry.tagName.toLowerCase() === 'path'
+ ? geometry.getAttribute('d')
+ : geometry.tagName.toLowerCase() === 'polyline'
+ ? geometry.getAttribute('points')
+ : [geometry.getAttribute('x1'), geometry.getAttribute('y1'), geometry.getAttribute('x2'), geometry.getAttribute('y2')].join(' ');
+ if (!source || /(?:^|[^a-z])(?:nan|infinity)(?:[^a-z]|$)/i.test(source) || typeof geometry.getTotalLength !== 'function') return false;
+ try {
+ var length = Number(geometry.getTotalLength());
+ return Number.isFinite(length) && length > 0;
+ } catch (_) {
+ return false;
+ }
+ });
+ }
+
/* ============================================================
- Visual style try-on — one topology, three bundled presets.
+ Visual style try-on — one topology, four bundled presets.
The reader's choice is intentionally session-only: it updates the
live page and canonical SVG together, but never rewrites the source,
URL, or a later diagram's authored default.
============================================================ */
Archify.preset = (function () {
- var PRESETS = ['classic', 'signal-flow', 'blueprint'];
- var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };
+ var PRESETS = ['classic', 'signal-flow', 'blueprint', 'editorial'];
+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint', editorial: 'Editorial' };
var html = document.documentElement;
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4323,16 +5056,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -4451,6 +5248,168 @@
* self-themes when embedded in GitHub READMEs or other hosts that
* expose a color scheme. Used for "Download SVG".
*/
+ function applyRouteSnapshot(clone, snapshot) {
+ if (!snapshot || !Array.isArray(snapshot.nodeIds) || !Array.isArray(snapshot.edges) ||
+ snapshot.nodeIds.length < 2 || snapshot.edges.length !== snapshot.nodeIds.length - 1 ||
+ snapshot.hops !== snapshot.edges.length ||
+ !snapshot.source || !snapshot.target ||
+ snapshot.source.id !== snapshot.nodeIds[0] ||
+ snapshot.target.id !== snapshot.nodeIds[snapshot.nodeIds.length - 1]) 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 = [];
+
+ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {
+ var nodeId = snapshot.nodeIds[nodeIndex];
+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId]) return false;
+ var matchedNodes = cloneNodes.filter(function (candidate) {
+ return candidate.getAttribute('data-node-id') === nodeId;
+ });
+ if (matchedNodes.length !== 1) return false;
+ nodeIds[nodeId] = true;
+ nodeMatches.push(matchedNodes);
+ }
+
+ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {
+ var edge = snapshot.edges[edgeIndex];
+ var fromId = snapshot.nodeIds[edgeIndex];
+ var toId = snapshot.nodeIds[edgeIndex + 1];
+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||
+ edge.from !== fromId || edge.to !== toId) 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(matchedEdges);
+ }
+
+ clone.setAttribute('data-share-route', '');
+ nodeMatches.forEach(function (matches, step) {
+ matches.forEach(function (element) {
+ element.setAttribute('data-share-route-match', '');
+ element.setAttribute('data-share-route-step', String(step));
+ if (step === 0) element.setAttribute('data-share-route-start', '');
+ else if (step === snapshot.nodeIds.length - 1) element.setAttribute('data-share-route-end', '');
+ else element.setAttribute('data-share-route-middle', '');
+ });
+ });
+ edgeMatches.forEach(function (matches, step) {
+ matches.forEach(function (element) {
+ element.setAttribute('data-share-route-match', '');
+ element.setAttribute('data-share-route-step', String(step));
+ });
+ });
+
+ return clone.hasAttribute('data-share-route') &&
+ !clone.hasAttribute('data-animation') &&
+ !clone.hasAttribute('data-route-active') &&
+ !clone.hasAttribute('data-route-journey') &&
+ clone.querySelectorAll('[data-animate], [data-route-match], [data-route-step], [data-route-start], [data-route-end], [data-route-journey-state], [data-route-journey-current], [data-route-journey-overlay]').length === 0 &&
+ clone.querySelectorAll('[data-share-route-match]').length ===
+ nodeMatches.reduce(function (count, matches) { return count + matches.length; }, 0) +
+ 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.
@@ -4465,6 +5424,7 @@
clone.style.removeProperty('transform');
clone.removeAttribute('data-view-scale');
clone.removeAttribute('data-focus-active');
+ clone.removeAttribute('data-reach-active');
clone.removeAttribute('data-lens-active');
clone.removeAttribute('data-lens-flow-count');
clone.removeAttribute('data-lens-flow-density');
@@ -4476,6 +5436,8 @@
clone.removeAttribute('data-route-picking');
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');
@@ -4535,6 +5497,16 @@
Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-hit-overlay]'), function (el) {
el.remove();
});
+ Array.prototype.forEach.call(clone.querySelectorAll('[data-source-evidence-beacon]'), function (el) {
+ el.remove();
+ });
+ Array.prototype.forEach.call(clone.querySelectorAll('[data-source-evidence-count]'), function (el) {
+ var originalLabel = el.getAttribute('data-source-evidence-original-label');
+ if (originalLabel == null || originalLabel === '') el.removeAttribute('aria-label');
+ else el.setAttribute('aria-label', originalLabel);
+ el.removeAttribute('data-source-evidence-count');
+ el.removeAttribute('data-source-evidence-original-label');
+ });
Array.prototype.forEach.call(clone.querySelectorAll('[data-story-step], [data-story-beat-state], [data-story-beat-step]'), function (el) {
el.removeAttribute('data-story-step');
el.removeAttribute('data-story-beat-state');
@@ -4545,6 +5517,11 @@
el.removeAttribute('data-focus-match');
el.removeAttribute('data-focus-selected');
});
+ Array.prototype.forEach.call(clone.querySelectorAll('[data-reach-match], [data-reach-origin], [data-reach-depth]'), function (el) {
+ el.removeAttribute('data-reach-match');
+ el.removeAttribute('data-reach-origin');
+ el.removeAttribute('data-reach-depth');
+ });
Array.prototype.forEach.call(clone.querySelectorAll('[data-lens-match], [data-lens-selected], [data-lens-peer]'), function (el) {
el.removeAttribute('data-lens-match');
el.removeAttribute('data-lens-selected');
@@ -4575,6 +5552,18 @@
el.removeAttribute('data-route-journey-current');
el.style.removeProperty('--route-step');
});
+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle]'), function (el) {
+ el.removeAttribute('data-share-route-match');
+ el.removeAttribute('data-share-route-step');
+ el.removeAttribute('data-share-route-start');
+ 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');
@@ -4584,6 +5573,7 @@
});
var canonicalStateClean = !clone.hasAttribute('data-view-scale') &&
!clone.hasAttribute('data-focus-active') &&
+ !clone.hasAttribute('data-reach-active') &&
!clone.hasAttribute('data-lens-active') &&
!clone.hasAttribute('data-lens-flow-count') &&
!clone.hasAttribute('data-lens-flow-density') &&
@@ -4594,6 +5584,8 @@
!clone.hasAttribute('data-route-picking') &&
!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') &&
@@ -4603,9 +5595,17 @@
!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-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-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) &&
+ Number.isFinite(vb.width) && Number.isFinite(vb.height) && vb.width > 0 && vb.height > 0;
+ 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
@@ -4729,6 +5729,22 @@
bgRect.setAttribute('fill', computed.getPropertyValue('--bg').trim() || '#ffffff');
}
+ if (opts.routeSnapshot) {
+ style.textContent += "\nsvg[data-share-route] [data-node-id], svg[data-share-route] [data-edge-from] { opacity: 0.18; }\n" +
+ "svg[data-share-route] [data-share-route-match] { opacity: 1; }\n" +
+ "svg[data-share-route] [data-share-route-start] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3; stroke-dasharray: 5 3; }\n" +
+ "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);
@@ -4736,7 +5752,9 @@
svgString: new XMLSerializer().serializeToString(clone),
width: vb.width * scale,
height: vb.height * scale,
- canonicalStateClean: canonicalStateClean
+ canonicalStateClean: canonicalStateClean,
+ routeStateClean: routeStateClean,
+ reachStateClean: reachStateClean
};
}
@@ -4780,24 +5798,29 @@
return new Promise(function (resolve, reject) {
var img = new Image();
img.onload = function () {
- var canvas = document.createElement('canvas');
- canvas.width = data.width;
- canvas.height = data.height;
- var ctx = canvas.getContext('2d');
- if (format === 'jpeg') {
- ctx.fillStyle = currentBg();
- ctx.fillRect(0, 0, canvas.width, canvas.height);
+ try {
+ var canvas = document.createElement('canvas');
+ canvas.width = data.width;
+ canvas.height = data.height;
+ var ctx = canvas2dOrThrow(canvas, format);
+ if (format === 'jpeg') {
+ ctx.fillStyle = currentBg();
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+ }
+ // Draw at natural size — SVG was already rasterized at target res.
+ ctx.drawImage(img, 0, 0);
+ URL.revokeObjectURL(svgUrl);
+ var mime = format === 'jpeg' ? 'image/jpeg' :
+ format === 'webp' ? 'image/webp' : 'image/png';
+ var quality = format === 'png' ? undefined : 0.95;
+ canvas.toBlob(function (blob) {
+ if (!blob) reject(new Error('toBlob returned null for ' + format));
+ else resolve(blob);
+ }, mime, quality);
+ } catch (error) {
+ URL.revokeObjectURL(svgUrl);
+ reject(error);
}
- // Draw at natural size — SVG was already rasterized at target res.
- ctx.drawImage(img, 0, 0);
- URL.revokeObjectURL(svgUrl);
- var mime = format === 'jpeg' ? 'image/jpeg' :
- format === 'webp' ? 'image/webp' : 'image/png';
- var quality = format === 'png' ? undefined : 0.95;
- canvas.toBlob(function (blob) {
- if (!blob) reject(new Error('toBlob returned null for ' + format));
- else resolve(blob);
- }, mime, quality);
};
img.onerror = function (e) {
URL.revokeObjectURL(svgUrl);
@@ -4825,75 +5848,110 @@
return value + suffix;
}
- function rasterizeShareCard() {
+ function canvas2dOrThrow(canvas, label) {
+ if (!canvas || typeof canvas.getContext !== 'function') {
+ throw new Error('Canvas unavailable for ' + label);
+ }
+ var ctx = canvas.getContext('2d');
+ if (!ctx) throw new Error('2D canvas context unavailable for ' + label);
+ if (typeof canvas.toBlob !== 'function') throw new Error('canvas.toBlob unavailable for ' + label);
+ return ctx;
+ }
+
+ 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);
+ 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);
return new Promise(function (resolve, reject) {
var img = new Image();
img.onload = function () {
- var canvas = document.createElement('canvas');
- canvas.width = SHARE_CARD_WIDTH;
- canvas.height = SHARE_CARD_HEIGHT;
- var ctx = canvas.getContext('2d');
- var computed = getComputedStyle(document.documentElement);
- var bg = computed.getPropertyValue('--bg').trim() || currentBg();
- 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 titleNode = document.querySelector('.header h1');
- var subtitleNode = document.querySelector('.header .subtitle');
- var title = titleNode ? titleNode.textContent : document.title;
- var subtitle = 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();
-
- ctx.fillStyle = bg;
- ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);
-
- ctx.fillStyle = accent;
- ctx.fillRect(SHARE_CARD_PADDING, 27, 42, 3);
-
- ctx.textBaseline = 'alphabetic';
- ctx.fillStyle = text;
- var fittedTitle = fitCanvasText(ctx, title, SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2 - 330, 29, 18, '700');
- ctx.fillText(fittedTitle, SHARE_CARD_PADDING, 62);
-
- ctx.fillStyle = muted;
- var fittedSubtitle = fitCanvasText(ctx, subtitle, SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2 - 280, 13, 11, '500');
- ctx.fillText(fittedSubtitle, SHARE_CARD_PADDING, 87);
-
- ctx.font = "600 12px 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
- ctx.textAlign = 'right';
- ctx.fillStyle = accent;
- ctx.fillText('ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase(), SHARE_CARD_WIDTH - SHARE_CARD_PADDING, 50);
- ctx.textAlign = 'left';
-
- var availableWidth = SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2;
- var availableHeight = SHARE_CARD_HEIGHT - SHARE_CARD_HEADER - SHARE_CARD_PADDING;
- var fit = Math.min(availableWidth / data.width, availableHeight / data.height);
- var drawWidth = data.width * fit;
- var drawHeight = data.height * fit;
- var drawX = SHARE_CARD_PADDING + (availableWidth - drawWidth) / 2;
- var drawY = SHARE_CARD_HEADER + (availableHeight - drawHeight) / 2;
-
- ctx.strokeStyle = border;
- ctx.lineWidth = 1;
- ctx.strokeRect(drawX - 0.5, drawY - 0.5, drawWidth + 1, drawHeight + 1);
- ctx.drawImage(img, drawX, drawY, drawWidth, drawHeight);
- URL.revokeObjectURL(svgUrl);
-
- canvas.toBlob(function (blob) {
- if (!blob) reject(new Error('toBlob returned null for Share Card'));
- else resolve(blob);
- }, 'image/png');
+ try {
+ var canvas = document.createElement('canvas');
+ canvas.width = SHARE_CARD_WIDTH;
+ canvas.height = SHARE_CARD_HEIGHT;
+ var ctx = canvas2dOrThrow(canvas, 'Share Card');
+ var computed = getComputedStyle(document.documentElement);
+ var bg = computed.getPropertyValue('--bg').trim() || currentBg();
+ var text = computed.getPropertyValue('--text').trim() || '#ffffff';
+ var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';
+ var border = computed.getPropertyValue('--panel-border').trim() || '#334155';
+ 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'
+ : 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'
+ : reachSnapshot
+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'
+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();
+
+ ctx.fillStyle = bg;
+ ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);
+
+ ctx.fillStyle = accent;
+ ctx.fillRect(SHARE_CARD_PADDING, 27, 42, 3);
+
+ ctx.textBaseline = 'alphabetic';
+ ctx.fillStyle = text;
+ var fittedTitle = fitCanvasText(ctx, title, SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2 - 330, 29, 18, '700');
+ ctx.fillText(fittedTitle, SHARE_CARD_PADDING, 62);
+
+ ctx.fillStyle = muted;
+ var fittedSubtitle = fitCanvasText(ctx, subtitle, SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2 - 280, 13, 11, '500');
+ ctx.fillText(fittedSubtitle, SHARE_CARD_PADDING, 87);
+
+ ctx.font = "600 12px 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
+ ctx.textAlign = 'right';
+ ctx.fillStyle = accent;
+ ctx.fillText(cardLabel, SHARE_CARD_WIDTH - SHARE_CARD_PADDING, 50);
+ ctx.textAlign = 'left';
+
+ var availableWidth = SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2;
+ var availableHeight = SHARE_CARD_HEIGHT - SHARE_CARD_HEADER - SHARE_CARD_PADDING;
+ var fit = Math.min(availableWidth / data.width, availableHeight / data.height);
+ var drawWidth = data.width * fit;
+ var drawHeight = data.height * fit;
+ var drawX = SHARE_CARD_PADDING + (availableWidth - drawWidth) / 2;
+ var drawY = SHARE_CARD_HEADER + (availableHeight - drawHeight) / 2;
+
+ ctx.strokeStyle = border;
+ ctx.lineWidth = 1;
+ ctx.strokeRect(drawX - 0.5, drawY - 0.5, drawWidth + 1, drawHeight + 1);
+ ctx.drawImage(img, drawX, drawY, drawWidth, drawHeight);
+ URL.revokeObjectURL(svgUrl);
+
+ canvas.toBlob(function (blob) {
+ if (!blob) reject(new Error('toBlob returned null for Share Card'));
+ else resolve(blob);
+ }, 'image/png');
+ } catch (error) {
+ URL.revokeObjectURL(svgUrl);
+ reject(error);
+ }
};
img.onerror = function (e) {
URL.revokeObjectURL(svgUrl);
@@ -4903,6 +5961,24 @@
});
}
+ function rasterizeShareCard(options) {
+ options = options || {};
+ if (!options.variant) return renderShareCard();
+ 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() {
if (typeof MediaRecorder === 'undefined') return '';
var candidates = [
@@ -5165,10 +6241,30 @@
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"]'));
};
+ function syncRouteShareItem() {
+ var snapshot = Archify.routeProbe && typeof Archify.routeProbe.exportSnapshot === 'function'
+ ? Archify.routeProbe.exportSnapshot()
+ : null;
+ routeShareItem.hidden = !snapshot;
+ routeShareItem.disabled = !snapshot;
+ 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' &&
@@ -5225,11 +6321,14 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
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.disabled; });
+ var available = items().filter(function (i) { return !i.hidden && !i.disabled; });
var target = focusLast ? available[available.length - 1] : available[0];
if (target) target.focus();
}
@@ -5263,7 +6362,7 @@
if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
if (e.key === 'Tab') { close(false); return; }
- var available = items().filter(function (i) { return !i.disabled; });
+ var available = items().filter(function (i) { return !i.hidden && !i.disabled; });
var current = available.indexOf(document.activeElement);
switch (e.key) {
case 'ArrowDown':
@@ -5288,8 +6387,7 @@
function runExport(format) {
var base = diagramFilename();
close(true);
- document.documentElement.removeAttribute('data-last-export-error');
- document.documentElement.removeAttribute('data-last-export-error-format');
+ clearExportReceipt();
if (format === 'webm') toast('Recording 6 seconds of motion…');
return (format === 'share-card'
? rasterizeShareCard().then(function (blob) {
@@ -5333,13 +6431,72 @@
});
}
+ function runRouteShareCard() {
+ close(false);
+ clearExportReceipt();
+ var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();
+ var blobPromise = snapshot
+ ? renderShareCard({ routeSnapshot: snapshot })
+ : Promise.reject(new Error('Trace a route before exporting a Route Share Card'));
+ return blobPromise.then(function (blob) {
+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'route', true);
+ download(blob, diagramFilename() + '-route-share-card.png');
+ toast('Downloaded Route 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('Route Share Card export failed: ' + message);
+ });
+ }
+
+ 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) {
+ 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');
+ if (variant) {
+ document.documentElement.setAttribute('data-last-export-variant', variant);
+ } else {
+ document.documentElement.removeAttribute('data-last-export-variant');
+ }
+ if (routeStateClean === true) {
+ document.documentElement.setAttribute('data-last-export-route-state-clean', 'true');
+ } 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));
@@ -5355,6 +6512,9 @@
document.documentElement.removeAttribute('data-last-export-canonical');
document.documentElement.removeAttribute('data-last-export-width');
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');
}
@@ -5396,6 +6556,7 @@
function runCopy() {
close(true);
+ clearExportReceipt();
if (!canCopyImage()) {
alert('Clipboard image write not supported in this browser.');
return;
@@ -5410,6 +6571,12 @@
}
menu.addEventListener('click', function (e) {
+ 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; }
@@ -5421,7 +6588,18 @@
});
Archify.motion = { canRecord: canRecordMotion, recordWebm: recordWebm };
- Archify.exportMenu = { open: open, close: close, isOpen: isOpen, run: runExport, shareCard: rasterizeShareCard, copyShareCard: runCopyShareCard };
+ Archify.exportMenu = {
+ open: open,
+ close: close,
+ isOpen: isOpen,
+ run: runExport,
+ shareCard: rasterizeShareCard,
+ downloadRouteShareCard: runRouteShareCard,
+ downloadReachShareCard: runReachShareCard,
+ syncRouteShare: syncRouteShareItem,
+ syncReachShare: syncReachShareItem,
+ copyShareCard: runCopyShareCard
+ };
// Auto-open on page load for demo/screenshot purposes: ?openExport=1
// Wait for fonts (so the menu doesn't flash before typography lands)
@@ -5706,6 +6884,76 @@
};
})();
+ /* Verified repository evidence is emitted only after the renderer checks
+ the authored GitHub revision, source blobs, and optional line ranges
+ against the explicit --repo-root. It remains outside the SVG so every
+ canonical visual export stays free of repository paths. */
+ Archify.sourceEvidence = (function () {
+ var element = document.getElementById('archify-source-evidence-data');
+ var payload = null;
+ var svgNamespace = 'http://www.w3.org/2000/svg';
+ if (element) {
+ try {
+ var parsed = JSON.parse(element.textContent || 'null');
+ if (parsed && parsed.verified === true && parsed.repository && parsed.nodes) payload = parsed;
+ } catch (_) {}
+ }
+ function installBeacons() {
+ if (!payload) return 0;
+ var svg = document.querySelector('.diagram-container svg');
+ if (!svg) return 0;
+ var installed = 0;
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {
+ var id = node.getAttribute('data-node-id');
+ var sources = payload.nodes[id];
+ if (!Array.isArray(sources) || !sources.length || node.querySelector('[data-source-evidence-beacon]')) return;
+ var shape = node.querySelector('[data-animate="node"]') || node.querySelector('[class*="c-"]');
+ var box;
+ try { box = (shape || node).getBBox(); } catch (_) { return; }
+ if (!box || !Number.isFinite(box.x) || !Number.isFinite(box.y) || !Number.isFinite(box.width) || box.width < 36) return;
+
+ var count = sources.length;
+ var label = count + ' verified source' + (count === 1 ? '' : 's') + '; focus this node to inspect';
+ var beacon = document.createElementNS(svgNamespace, 'g');
+ beacon.classList.add('source-evidence-beacon');
+ beacon.setAttribute('data-source-evidence-beacon', '');
+ beacon.setAttribute('aria-hidden', 'true');
+ beacon.setAttribute('transform', 'translate(' + (box.x + box.width - 35) + ' ' + (box.y + 5) + ')');
+ var title = document.createElementNS(svgNamespace, 'title');
+ title.textContent = label;
+ var plate = document.createElementNS(svgNamespace, 'rect');
+ plate.setAttribute('width', '30');
+ plate.setAttribute('height', '12');
+ plate.setAttribute('rx', '6');
+ var text = document.createElementNS(svgNamespace, 'text');
+ text.setAttribute('x', '15');
+ text.setAttribute('y', '8.25');
+ text.textContent = 'SRC ' + count;
+ beacon.appendChild(title);
+ beacon.appendChild(plate);
+ beacon.appendChild(text);
+ node.appendChild(beacon);
+
+ var originalLabel = node.getAttribute('aria-label') || '';
+ node.setAttribute('data-source-evidence-count', String(count));
+ node.setAttribute('data-source-evidence-original-label', originalLabel);
+ node.setAttribute('aria-label', (originalLabel ? originalLabel + ', ' : '') + count + ' verified source reference' + (count === 1 ? '' : 's'));
+ installed += 1;
+ });
+ return installed;
+ }
+ return {
+ available: function () { return Boolean(payload); },
+ repository: function () { return payload ? payload.repository : null; },
+ node: function (id) {
+ var sources = payload && payload.nodes ? payload.nodes[id] : null;
+ return Array.isArray(sources) ? sources.slice() : [];
+ },
+ installBeacons: installBeacons
+ };
+ })();
+ Archify.sourceEvidence.installBeacons();
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -5722,7 +6970,16 @@
var context = document.getElementById('focus-context');
var tag = document.getElementById('focus-tag');
var semanticId = document.getElementById('focus-id');
+ var evidence = document.getElementById('focus-evidence');
+ var repositoryLink = document.getElementById('focus-repository');
+ var evidenceLinks = document.getElementById('focus-evidence-links');
var summary = document.getElementById('focus-summary');
+ var reachSection = document.getElementById('focus-reach');
+ var reachStatus = document.getElementById('focus-reach-status');
+ var upstreamBtn = document.getElementById('btn-reach-upstream');
+ var downstreamBtn = document.getElementById('btn-reach-downstream');
+ var upstreamCount = document.getElementById('focus-reach-upstream-count');
+ var downstreamCount = document.getElementById('focus-reach-downstream-count');
var relationshipList = document.getElementById('relationship-lens-list');
var copyBtn = document.getElementById('btn-focus-copy');
var relationsBtn = document.getElementById('btn-focus-relations');
@@ -5736,6 +6993,8 @@
var relationshipHitOverlay = null;
var relationshipHitTargets = [];
var directPreviewTimer = null;
+ var reachabilityMode = null;
+ var activeReachability = null;
var svgNamespace = 'http://www.w3.org/2000/svg';
var reducedMotionQuery = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;
var finePointerQuery = window.matchMedia ? window.matchMedia('(hover: hover) and (pointer: fine)') : null;
@@ -5749,11 +7008,318 @@
function nodeLabel(node, fallback) {
return node.getAttribute('data-node-label') || (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '');
}
+ function reachabilityRelationships() {
+ var seen = Object.create(null);
+ var relationships = [];
+ edges().forEach(function (edge) {
+ var from = edge.getAttribute('data-edge-from');
+ var to = edge.getAttribute('data-edge-to');
+ var key = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + (edge.getAttribute('data-edge-label') || ''));
+ if (!from || !to || seen[key]) return;
+ seen[key] = true;
+ relationships.push({ key: key, from: from, to: to });
+ });
+ return relationships;
+ }
+ function computeReachability(originId, direction, relationships) {
+ if (typeof originId !== 'string' || !originId ||
+ (direction !== 'upstream' && direction !== 'downstream') ||
+ !Array.isArray(relationships)) return null;
+ var records = [];
+ var seenKeys = Object.create(null);
+ relationships.forEach(function (relationship, index) {
+ if (!relationship || typeof relationship.from !== 'string' || !relationship.from ||
+ typeof relationship.to !== 'string' || !relationship.to) return;
+ var key = typeof relationship.key === 'string' && relationship.key
+ ? relationship.key : String(index);
+ if (seenKeys[key]) return;
+ seenKeys[key] = true;
+ records.push({ key: key, from: relationship.from, to: relationship.to });
+ });
+
+ var depths = Object.create(null);
+ var order = [];
+ var queue = [originId];
+ depths[originId] = 0;
+ for (var cursor = 0; cursor < queue.length; cursor += 1) {
+ var current = queue[cursor];
+ records.forEach(function (relationship) {
+ var next = null;
+ if (direction === 'downstream' && relationship.from === current) next = relationship.to;
+ else if (direction === 'upstream' && relationship.to === current) next = relationship.from;
+ if (next == null || Object.prototype.hasOwnProperty.call(depths, next)) return;
+ depths[next] = depths[current] + 1;
+ queue.push(next);
+ });
+ }
+ queue.forEach(function (id) { order.push(id); });
+
+ var edgeKeys = [];
+ records.forEach(function (relationship) {
+ if (Object.prototype.hasOwnProperty.call(depths, relationship.from) &&
+ Object.prototype.hasOwnProperty.call(depths, relationship.to)) edgeKeys.push(relationship.key);
+ });
+ var maxDepth = order.reduce(function (maximum, id) {
+ return Math.max(maximum, depths[id]);
+ }, 0);
+ return {
+ direction: direction,
+ originId: originId,
+ nodeIds: order,
+ edgeKeys: edgeKeys,
+ depths: depths,
+ maxDepth: maxDepth
+ };
+ }
+ function reachabilityFor(id, direction) {
+ return computeReachability(id, direction, reachabilityRelationships());
+ }
+ function resetReachabilityButtons() {
+ upstreamBtn.setAttribute('aria-pressed', 'false');
+ downstreamBtn.setAttribute('aria-pressed', 'false');
+ }
+ function clearReachability(options) {
+ options = options || {};
+ reachabilityMode = null;
+ activeReachability = null;
+ svg.removeAttribute('data-reach-active');
+ chip.removeAttribute('data-reach-mode');
+ nodes().forEach(function (node) {
+ node.removeAttribute('data-reach-match');
+ node.removeAttribute('data-reach-origin');
+ node.removeAttribute('data-reach-depth');
+ });
+ edges().forEach(function (edge) {
+ edge.removeAttribute('data-reach-match');
+ edge.removeAttribute('data-reach-depth');
+ });
+ 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]));
+ } catch (_) {}
+ }
+ }
+ function renderReachabilityControls(id) {
+ var upstream = reachabilityFor(id, 'upstream');
+ var downstream = reachabilityFor(id, 'downstream');
+ var upstreamReach = upstream ? Math.max(0, upstream.nodeIds.length - 1) : 0;
+ var downstreamReach = downstream ? Math.max(0, downstream.nodeIds.length - 1) : 0;
+ upstreamCount.textContent = String(upstreamReach);
+ downstreamCount.textContent = String(downstreamReach);
+ upstreamBtn.disabled = upstreamReach === 0;
+ downstreamBtn.disabled = downstreamReach === 0;
+ upstreamBtn.setAttribute('aria-label', upstreamReach
+ ? 'Trace ' + upstreamReach + ' upstream authored node' + (upstreamReach === 1 ? '' : 's')
+ : 'No upstream authored nodes');
+ downstreamBtn.setAttribute('aria-label', downstreamReach
+ ? 'Trace ' + downstreamReach + ' downstream authored node' + (downstreamReach === 1 ? '' : 's')
+ : 'No downstream authored nodes');
+ reachSection.hidden = false;
+ }
+ function applyReachability(direction, options) {
+ options = options || {};
+ if (activeIds.length !== 1 || (direction !== 'upstream' && direction !== 'downstream')) return false;
+ if (reachabilityMode === direction && options.toggle !== false) {
+ clearReachability({ updateUrl: options.updateUrl !== false });
+ return true;
+ }
+ var result = reachabilityFor(activeIds[0], direction);
+ if (!result || result.nodeIds.length <= 1) return false;
+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {
+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false, resetView: false });
+ }
+ clearRelationshipPreview({ clearPin: true });
+ clearReachability({ updateUrl: false });
+ reachabilityMode = direction;
+ activeReachability = result;
+ var edgeKeySet = Object.create(null);
+ result.edgeKeys.forEach(function (key) { edgeKeySet[key] = true; });
+ svg.setAttribute('data-reach-active', direction);
+ chip.setAttribute('data-reach-mode', direction);
+ nodes().forEach(function (node) {
+ var id = node.getAttribute('data-node-id');
+ if (!Object.prototype.hasOwnProperty.call(result.depths, id)) return;
+ node.setAttribute('data-reach-match', '');
+ node.setAttribute('data-reach-depth', String(result.depths[id]));
+ if (id === result.originId) node.setAttribute('data-reach-origin', '');
+ });
+ edges().forEach(function (edge) {
+ var key = edge.getAttribute('data-edge-key') || (
+ edge.getAttribute('data-edge-from') + '\u0000' +
+ edge.getAttribute('data-edge-to') + '\u0000' +
+ (edge.getAttribute('data-edge-label') || '')
+ );
+ if (!edgeKeySet[key]) return;
+ edge.setAttribute('data-reach-match', '');
+ var fromDepth = result.depths[edge.getAttribute('data-edge-from')];
+ var toDepth = result.depths[edge.getAttribute('data-edge-to')];
+ edge.setAttribute('data-reach-depth', String(Math.max(fromDepth || 0, toDepth || 0)));
+ });
+ resetReachabilityButtons();
+ var activeButton = direction === 'upstream' ? upstreamBtn : downstreamBtn;
+ activeButton.setAttribute('aria-pressed', 'true');
+ var reachableCount = result.nodeIds.length - 1;
+ var directionLabel = direction === 'upstream' ? 'Upstream' : 'Downstream';
+ reachStatus.textContent = directionLabel + ' · ' + reachableCount + ' node' +
+ (reachableCount === 1 ? '' : 's') + ' · ' + result.edgeKeys.length + ' link' +
+ (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=' +
+ encodeURIComponent(activeIds[0]) + '&reach=' + direction);
+ } catch (_) {}
+ }
+ if (options.reveal !== false && Archify.view && typeof Archify.view.reveal === 'function') {
+ Archify.view.reveal(result.nodeIds, { includeNeighbors: false, reason: 'reachability' });
+ }
+ 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;
element.hidden = !normalized;
}
+ function renderSourceEvidence(id) {
+ evidenceLinks.textContent = '';
+ repositoryLink.removeAttribute('href');
+ repositoryLink.textContent = '';
+ var sources = Archify.sourceEvidence.node(id);
+ var repository = Archify.sourceEvidence.repository();
+ if (!repository || !sources.length) {
+ evidence.hidden = true;
+ return;
+ }
+ var slug = repository.url.replace(/^https:\/\/github\.com\//, '').replace(/\/$/, '');
+ repositoryLink.href = repository.url + '/tree/' + repository.revision;
+ repositoryLink.textContent = slug + ' @ ' + repository.shortRevision;
+ repositoryLink.setAttribute('aria-label', 'Open verified repository revision ' + repository.revision);
+ sources.forEach(function (source) {
+ var link = document.createElement('a');
+ link.className = 'semantic-passport-source';
+ link.href = source.href;
+ link.target = '_blank';
+ link.rel = 'noopener noreferrer';
+ link.referrerPolicy = 'no-referrer';
+ link.setAttribute('aria-label', 'Open verified source ' + source.path + ' at revision ' + repository.shortRevision);
+ var name = document.createElement('strong');
+ name.textContent = source.label || source.path.split('/').pop() || source.path;
+ var location = document.createElement('code');
+ location.textContent = source.line
+ ? 'L' + source.line + (source.endLine && source.endLine !== source.line ? '–' + source.endLine : '') + ' ↗'
+ : 'Open ↗';
+ var sourcePath = document.createElement('small');
+ sourcePath.textContent = source.path;
+ link.appendChild(name);
+ link.appendChild(location);
+ link.appendChild(sourcePath);
+ evidenceLinks.appendChild(link);
+ });
+ evidence.hidden = false;
+ }
function renderPassport(id, node) {
setPassportValue(detail, node.getAttribute('data-node-sublabel'));
setPassportValue(kind, node.getAttribute('data-node-kind') || 'node');
@@ -5761,6 +7327,7 @@
setPassportValue(tag, node.getAttribute('data-node-tag'));
semanticId.textContent = id;
semanticId.hidden = false;
+ renderSourceEvidence(id);
}
function relationshipsFor(id, byId) {
var seen = {};
@@ -6318,6 +7885,7 @@
var counts = { out: 0, in: 0, loop: 0 };
relationships.forEach(function (relationship) { counts[relationship.direction] += 1; });
summary.textContent = counts.out + ' outgoing · ' + counts.in + ' incoming' + (counts.loop ? ' · ' + counts.loop + ' loop' : '');
+ renderReachabilityControls(id);
relationshipList.textContent = '';
if (!relationships.length) {
var empty = document.createElement('p');
@@ -6414,6 +7982,10 @@
}
function clear(options) {
options = options || {};
+ var restoreNode = options.restoreFocus === true && activeIds.length === 1
+ ? svg.querySelector('[data-node-id="' + activeIds[0] + '"]')
+ : null;
+ clearReachability({ updateUrl: false });
if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') {
Archify.intentTrace.clear({ announce: false });
}
@@ -6440,7 +8012,16 @@
tag.hidden = true;
semanticId.textContent = '';
semanticId.hidden = true;
+ evidence.hidden = true;
+ evidenceLinks.textContent = '';
+ repositoryLink.removeAttribute('href');
+ repositoryLink.textContent = '';
summary.textContent = '';
+ reachSection.hidden = true;
+ upstreamCount.textContent = '0';
+ downstreamCount.textContent = '0';
+ upstreamBtn.disabled = true;
+ downstreamBtn.disabled = true;
relationshipList.textContent = '';
copyBtn.textContent = 'Copy link';
copyBtn.setAttribute('aria-label', 'Copy link to focused node');
@@ -6455,6 +8036,10 @@
if (options.updateUrl !== false) {
try { history.replaceState(null, '', location.pathname + location.search); } catch (_) {}
}
+ if (restoreNode) {
+ try { restoreNode.focus({ preventScroll: true }); }
+ catch (_) { try { restoreNode.focus(); } catch (_) {} }
+ }
}
function setMany(ids, options) {
@@ -6550,7 +8135,7 @@
var relationId = record && record.id;
var value = location.href.replace(/#.*$/, '') + (relationId
? '#relation=' + encodeURIComponent(relationId)
- : '#focus=' + encodeURIComponent(activeIds[0]));
+ : '#focus=' + encodeURIComponent(activeIds[0]) + (reachabilityMode ? '&reach=' + reachabilityMode : ''));
var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'
? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })
: Promise.resolve(fallbackCopy(value));
@@ -6588,8 +8173,10 @@
Archify.view.reveal([id], { includeNeighbors: true, reason: 'focus' });
}
});
- clearBtn.addEventListener('click', function () { clear(); });
+ clearBtn.addEventListener('click', function () { clear({ restoreFocus: true }); });
copyBtn.addEventListener('click', copyFocusLink);
+ upstreamBtn.addEventListener('click', function () { applyReachability('upstream'); });
+ downstreamBtn.addEventListener('click', function () { applyReachability('downstream'); });
relationsBtn.addEventListener('click', function () {
var expanded = chip.getAttribute('data-relations-expanded') === 'true';
if (expanded) chip.removeAttribute('data-relations-expanded');
@@ -6653,6 +8240,13 @@
event.preventDefault();
buttons[index].focus();
});
+ document.addEventListener('click', function (event) {
+ var target = event.target;
+ if (chip.hidden || !target || typeof target.closest !== 'function' || chip.contains(target)) return;
+ if (container.getAttribute('data-just-panned') === 'true') return;
+ if (target.closest('[data-node-id], [data-relationship-hit-key]')) return;
+ clear();
+ }, true);
window.addEventListener('scroll', requestLensPlacement, { passive: true });
window.addEventListener('resize', requestLensPlacement);
container.addEventListener('scroll', requestLensPlacement, { passive: true });
@@ -6677,11 +8271,17 @@
var params = new URLSearchParams(location.hash.replace(/^#/, ''));
var relation = params.get('relation');
var initial = params.get('focus');
+ var reach = params.get('reach');
if (relation) {
if (html.getAttribute('data-embed') === 'true' ||
!inspectRelationshipById(relation, { updateUrl: false, toggle: false })) clear({ updateUrl: false });
}
- else if (initial) set(initial, { updateUrl: false, toggle: false });
+ else if (initial) {
+ if (set(initial, { updateUrl: false, toggle: false }) &&
+ (reach === 'upstream' || reach === 'downstream')) {
+ applyReachability(reach, { updateUrl: false, toggle: false, reveal: false });
+ }
+ }
else if (!params.get('view')) clear({ updateUrl: false });
} catch (_) {}
}
@@ -6694,6 +8294,9 @@
setMany: setMany,
clear: clear,
copyLink: copyFocusLink,
+ reach: applyReachability,
+ clearReach: clearReachability,
+ reachabilitySnapshot: reachabilitySnapshot,
inspectRelationship: inspectRelationship,
inspectRelationshipById: inspectRelationshipById,
reposition: requestLensPlacement,
@@ -6701,6 +8304,15 @@
var record = pinnedRelationshipRecord();
return record ? { id: record.id || null, key: record.key, from: record.from, to: record.to, label: record.label } : null;
},
+ reachability: function () {
+ return activeReachability ? {
+ direction: activeReachability.direction,
+ originId: activeReachability.originId,
+ nodeIds: activeReachability.nodeIds.slice(),
+ edgeKeys: activeReachability.edgeKeys.slice(),
+ maxDepth: activeReachability.maxDepth
+ } : null;
+ },
active: function () { return activeIds.length === 0 ? null : (activeIds.length === 1 ? activeIds[0] : activeIds.slice()); }
};
})();
@@ -9461,6 +11073,10 @@
var context = node.getAttribute('data-node-context') || '';
var tag = node.getAttribute('data-node-tag') || '';
var type = semanticType(node);
+ var sources = Archify.sourceEvidence.node(id);
+ var sourceSearch = sources.map(function (source) {
+ return [source.path, source.label, source.line, source.endLine].filter(Boolean).join(' ');
+ }).join(' ');
return {
id: id,
label: label,
@@ -9468,8 +11084,9 @@
sublabel: sublabel,
context: context,
tag: tag,
+ sources: sources,
links: connectionsFor(id),
- search: (id + ' ' + label + ' ' + type + ' ' + sublabel + ' ' + context + ' ' + tag + ' ' + text).toLowerCase(),
+ search: (id + ' ' + label + ' ' + type + ' ' + sublabel + ' ' + context + ' ' + tag + ' ' + sourceSearch + ' ' + text).toLowerCase(),
node: node
};
});
@@ -9538,7 +11155,11 @@
button.type = 'button';
button.className = 'node-finder-result';
button.setAttribute('data-node-id', item.id);
- var badge = context.badges && context.badges[item.id] ? context.badges[item.id] : String(item.links);
+ var badge = context.badges && context.badges[item.id]
+ ? context.badges[item.id]
+ : context.kind === 'focus'
+ ? item.links + (item.links === 1 ? ' link' : ' links')
+ : String(item.links);
var action = context.kind === 'route-source'
? 'Choose ' + item.label + ' as route start'
: context.kind === 'route-target'
@@ -9550,11 +11171,10 @@
name.textContent = item.label;
var links = document.createElement('em');
links.textContent = badge;
- links.title = context.kind === 'focus'
- ? item.links + ' related connection' + (item.links === 1 ? '' : 's')
- : action;
+ links.title = context.kind === 'focus' ? badge : action;
var meta = document.createElement('small');
- meta.textContent = [item.type, item.context, item.sublabel, item.tag, item.id].filter(Boolean).join(' \u00b7 ');
+ meta.textContent = [item.type, item.id, item.sublabel, item.tag].filter(Boolean).join(' \u00b7 ');
+ meta.title = [item.type, item.id, item.context, item.sublabel, item.tag].filter(Boolean).join(' \u00b7 ');
button.appendChild(name);
button.appendChild(links);
button.appendChild(meta);
@@ -9562,7 +11182,9 @@
results.appendChild(button);
});
empty.hidden = visibleItems.length !== 0;
- status.textContent = visibleItems.length + ' of ' + available.length + ' ' + context.availableNoun + (query ? ' match' : ' available');
+ status.textContent = query
+ ? visibleItems.length + ' of ' + available.length + ' ' + context.availableNoun
+ : available.length + ' ' + context.availableNoun;
}
function open(options) {
@@ -9695,7 +11317,7 @@
return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));
}
function nodesById() {
- var out = {};
+ var out = Object.create(null);
nodes().forEach(function (node) { out[node.getAttribute('data-node-id')] = node; });
return out;
}
@@ -9703,6 +11325,54 @@
return node.getAttribute('data-node-label') ||
(node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];
}
+ function exportSnapshot() {
+ if (mode !== 'result' || activeNodeIds.length < 2 || activeEdges.length !== activeNodeIds.length - 1) return null;
+ var allNodes = nodes();
+ var byId = nodesById();
+ var seenNodeIds = Object.create(null);
+ var seenEdgeKeys = Object.create(null);
+ if (startId !== activeNodeIds[0] || endId !== activeNodeIds[activeNodeIds.length - 1] ||
+ activeNodeIds.some(function (id) {
+ if (seenNodeIds[id] || allNodes.filter(function (node) {
+ return node.getAttribute('data-node-id') === id;
+ }).length !== 1) return true;
+ seenNodeIds[id] = true;
+ return !byId[id];
+ }) ||
+ activeEdges.some(function (edge, index) {
+ if (!edge || !svg.contains(edge)) return true;
+ var edgeKey = edge.getAttribute('data-edge-key');
+ var edgeId = edge.getAttribute('data-edge-id') || '';
+ if (!edgeKey || seenEdgeKeys[edgeKey]) return true;
+ seenEdgeKeys[edgeKey] = true;
+ var fragments = Array.prototype.slice.call(svg.querySelectorAll('[data-edge-key]')).filter(function (candidate) {
+ return candidate.getAttribute('data-edge-key') === edgeKey;
+ });
+ var drawableFragments = fragments.filter(hasDrawableGeometry);
+ return !fragments.length || !fragments.every(function (fragment) {
+ return fragment.getAttribute('data-edge-from') === activeNodeIds[index] &&
+ fragment.getAttribute('data-edge-to') === activeNodeIds[index + 1] &&
+ (fragment.getAttribute('data-edge-id') || '') === edgeId;
+ }) || drawableFragments.length !== 1 || drawableFragments[0] !== edge ||
+ edge.getAttribute('data-edge-from') !== activeNodeIds[index] ||
+ edge.getAttribute('data-edge-to') !== activeNodeIds[index + 1];
+ })) return null;
+ return {
+ source: { id: startId, label: nodeLabel(byId[startId], startId) },
+ target: { id: endId, label: nodeLabel(byId[endId], endId) },
+ nodeIds: activeNodeIds.slice(),
+ hops: activeEdges.length,
+ edges: activeEdges.map(function (edge) {
+ return {
+ key: edge.getAttribute('data-edge-key'),
+ id: edge.getAttribute('data-edge-id') || '',
+ from: edge.getAttribute('data-edge-from'),
+ to: edge.getAttribute('data-edge-to'),
+ label: edge.getAttribute('data-edge-label') || ''
+ };
+ })
+ };
+ }
function edgeShapes(edge) {
if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];
return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));
@@ -9851,6 +11521,7 @@
findBtn.setAttribute('aria-label', 'Find a route start');
copyBtn.hidden = true;
copyBtn.textContent = 'Copy link';
+ if (Archify.exportMenu && typeof Archify.exportMenu.syncRouteShare === 'function') Archify.exportMenu.syncRouteShare();
setTrigger(false);
if (wasActive && options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {
Archify.view.reset({ automatic: true });
@@ -10330,6 +12001,7 @@
findBtn.hidden = true;
copyBtn.hidden = false;
setTrigger(true);
+ if (Archify.exportMenu && typeof Archify.exportMenu.syncRouteShare === 'function') Archify.exportMenu.syncRouteShare();
if (options.updateUrl !== false) {
replaceRouteHash(encodeURIComponent(startId) + '~' + encodeURIComponent(endId));
}
@@ -10600,6 +12272,7 @@
finderOpening: finderOpening,
finderClosed: finderClosed,
openFinder: openFinder,
+ exportSnapshot: exportSnapshot,
active: function () { return mode === 'idle' ? null : mode; },
result: function () {
return mode === 'result'
@@ -11479,6 +13152,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -11515,6 +13191,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
@@ -11535,7 +13214,7 @@
Archify.intentTrace.clear();
} else if (e.key === 'Escape' && Archify.focus.active()) {
e.preventDefault();
- Archify.focus.clear();
+ Archify.focus.clear({ restoreFocus: true });
} else if (e.key === 'Escape' && Archify.presentation.active()) {
e.preventDefault();
Archify.presentation.exit();
diff --git a/examples/dataflow-product-analytics.html b/examples/dataflow-product-analytics.html
index 00aae82f..73017361 100644
--- a/examples/dataflow-product-analytics.html
+++ b/examples/dataflow-product-analytics.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4871,6 +5056,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4889,16 +5078,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6090,6 +6343,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12920,6 +13174,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12956,6 +13213,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/examples/lifecycle-agent-run.html b/examples/lifecycle-agent-run.html
index d98084b3..2334d261 100644
--- a/examples/lifecycle-agent-run.html
+++ b/examples/lifecycle-agent-run.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4824,6 +5009,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4842,16 +5031,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6043,6 +6296,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12873,6 +13127,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12909,6 +13166,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/examples/maka-architecture.html b/examples/maka-architecture.html
index 9da74c37..7d98709d 100644
--- a/examples/maka-architecture.html
+++ b/examples/maka-architecture.html
@@ -271,6 +271,83 @@
--toolbar-menu-bg: #f9fdff;
}
+ /* ==========================================================
+ EDITORIAL — a warm, publication-minded preset for design
+ reviews, launch notes, and documentation. The diagram keeps
+ the same semantic palette and exact geometry, but trades
+ software chrome for paper, ink, ruled structure, and one
+ restrained vermilion accent.
+ ========================================================== */
+ [data-preset="editorial"][data-theme="dark"] {
+ --bg: #181611;
+ --grid: #39342a;
+ --panel: rgba(35, 31, 24, 0.96);
+ --panel-border: #625a4a;
+ --lane-fill: rgba(52, 46, 35, 0.46);
+ --lane-stroke: #726957;
+ --text: #f4eddf;
+ --text-muted: #b9ae9b;
+ --text-dim: #776e60;
+ --text-faint: #9d917e;
+ --mask: #231f18;
+ --frontend-fill: rgba(43, 133, 142, 0.16);
+ --frontend-stroke: #7fc6c7;
+ --backend-fill: rgba(63, 132, 92, 0.16);
+ --backend-stroke: #8fc29e;
+ --database-fill: rgba(117, 91, 141, 0.17);
+ --database-stroke: #c0a4d0;
+ --cloud-fill: rgba(170, 119, 49, 0.16);
+ --cloud-stroke: #d8ad68;
+ --security-fill: rgba(157, 69, 65, 0.17);
+ --security-stroke: #df9085;
+ --messagebus-fill: rgba(174, 79, 42, 0.16);
+ --messagebus-stroke: #df946f;
+ --external-fill: rgba(126, 115, 96, 0.18);
+ --external-stroke: #b8ad99;
+ --arrow: #948978;
+ --arrow-emphasis: #dd6b3d;
+ --toolbar-bg: rgba(35, 31, 24, 0.92);
+ --toolbar-border: #625a4a;
+ --toolbar-text: #eee5d5;
+ --toolbar-hover: #302a20;
+ --toolbar-menu-bg: #231f18;
+ }
+
+ [data-preset="editorial"][data-theme="light"] {
+ --bg: #f2eee5;
+ --grid: #d8d0c2;
+ --panel: rgba(251, 248, 241, 0.97);
+ --panel-border: #c4b9a6;
+ --lane-fill: rgba(229, 221, 207, 0.42);
+ --lane-stroke: #b8aa94;
+ --text: #242018;
+ --text-muted: #6f6658;
+ --text-dim: #a09788;
+ --text-faint: #817767;
+ --mask: #fbf8f1;
+ --frontend-fill: rgba(31, 117, 126, 0.09);
+ --frontend-stroke: #287e84;
+ --backend-fill: rgba(42, 119, 75, 0.09);
+ --backend-stroke: #397b53;
+ --database-fill: rgba(105, 75, 130, 0.09);
+ --database-stroke: #765d86;
+ --cloud-fill: rgba(157, 103, 31, 0.1);
+ --cloud-stroke: #9a671f;
+ --security-fill: rgba(153, 58, 52, 0.09);
+ --security-stroke: #9e463f;
+ --messagebus-fill: rgba(182, 70, 27, 0.09);
+ --messagebus-stroke: #ad4b25;
+ --external-fill: rgba(101, 91, 75, 0.09);
+ --external-stroke: #746b5e;
+ --arrow: #8a806f;
+ --arrow-emphasis: #bb4c23;
+ --toolbar-bg: rgba(251, 248, 241, 0.94);
+ --toolbar-border: #c4b9a6;
+ --toolbar-text: #40392f;
+ --toolbar-hover: #fffdf8;
+ --toolbar-menu-bg: #fbf8f1;
+ }
+
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
@@ -301,6 +378,12 @@
background-position: -1px -1px;
background-attachment: fixed;
}
+ html[data-preset="editorial"] body {
+ background-image:
+ linear-gradient(90deg, transparent 0, transparent 5.4rem, color-mix(in srgb, var(--security-stroke) 18%, transparent) 5.4rem, color-mix(in srgb, var(--security-stroke) 18%, transparent) calc(5.4rem + 1px), transparent calc(5.4rem + 1px)),
+ repeating-linear-gradient(0deg, transparent 0, transparent 31px, color-mix(in srgb, var(--grid) 36%, transparent) 31px, color-mix(in srgb, var(--grid) 36%, transparent) 32px);
+ background-attachment: fixed;
+ }
/* Gallery/embed mode keeps the generated artifact as the source of truth
while presenting only its diagram surface inside a proof card. */
@@ -369,6 +452,20 @@
box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
backdrop-filter: none;
}
+ html[data-preset="editorial"] .share-chapter-cue {
+ border-color: var(--panel-border);
+ background:
+ linear-gradient(90deg, color-mix(in srgb, var(--security-fill) 58%, transparent), transparent 42%),
+ var(--toolbar-menu-bg);
+ box-shadow: 0 10px 30px color-mix(in srgb, #000 18%, transparent);
+ backdrop-filter: none;
+ }
+ html[data-preset="editorial"] .share-chapter-state { color: var(--arrow-emphasis); }
+ html[data-preset="editorial"] .share-chapter-state::before {
+ border-radius: 0;
+ box-shadow: none;
+ transform: rotate(45deg) scale(0.8);
+ }
.share-chapter-index {
display: grid;
gap: 0.12rem;
@@ -508,7 +605,8 @@
.header { margin-bottom: 2rem; padding-right: 29.5rem; }
html[data-preset="signal-flow"] .header,
- html[data-preset="blueprint"] .header { padding-right: 29.5rem; }
+ html[data-preset="blueprint"] .header,
+ html[data-preset="editorial"] .header { padding-right: 29.5rem; }
.header-row {
display: flex;
@@ -581,6 +679,36 @@
white-space: nowrap;
}
+ html[data-preset="editorial"] h1,
+ html[data-preset="editorial"] .card h3 {
+ font-family: Georgia, 'Times New Roman', 'Songti SC', STSong, serif;
+ letter-spacing: -0.02em;
+ }
+ html[data-preset="editorial"] h1 { font-size: 1.72rem; font-weight: 600; }
+ html[data-preset="editorial"] .pulse-dot {
+ width: 9px;
+ height: 9px;
+ border: 1px solid var(--arrow-emphasis);
+ border-radius: 0;
+ background: var(--arrow-emphasis);
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
+ transform: rotate(45deg);
+ animation: none;
+ }
+ html[data-preset="editorial"] .header-row::after {
+ content: "EDITORIAL / FIELD NOTE";
+ margin-left: auto;
+ padding: 0.32rem 0 0.24rem;
+ border-bottom: 2px solid var(--arrow-emphasis);
+ color: var(--arrow-emphasis);
+ font-family: Georgia, 'Times New Roman', serif;
+ font-size: 0.625rem;
+ font-style: italic;
+ font-weight: 600;
+ letter-spacing: 0.08em;
+ white-space: nowrap;
+ }
+
.diagram-container {
background: var(--panel);
border-radius: 1rem;
@@ -625,6 +753,35 @@
linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right bottom / 1px 1.35rem no-repeat;
opacity: 0.58;
}
+ html[data-preset="editorial"] .diagram-container {
+ overflow: hidden;
+ border-color: var(--panel-border);
+ border-radius: 0.38rem;
+ background:
+ linear-gradient(90deg, color-mix(in srgb, var(--security-fill) 58%, transparent), transparent 12%),
+ var(--panel);
+ box-shadow:
+ 0 1px 0 color-mix(in srgb, var(--text) 6%, transparent),
+ 0 18px 48px color-mix(in srgb, #000 19%, transparent);
+ }
+ html[data-preset="editorial"] .diagram-container::after {
+ position: absolute;
+ z-index: 10;
+ top: 0.72rem;
+ right: 1.25rem;
+ padding: 0.2rem 0.52rem;
+ border: 1px solid var(--panel-border);
+ background: var(--panel);
+ color: var(--arrow-emphasis);
+ content: "ARCHIFY / PLATE 04";
+ font-family: Georgia, 'Times New Roman', serif;
+ font-size: 0.52rem;
+ font-style: italic;
+ font-weight: 600;
+ letter-spacing: 0.09em;
+ pointer-events: none;
+ }
+ html[data-embed="true"][data-preset="editorial"] .diagram-container::after { display: none; }
html[data-motion-capable="true"][data-preset="signal-flow"][data-ambient-motion="running"] .diagram-container::before {
content: "";
position: absolute;
@@ -1354,10 +1511,25 @@
.relationship-lens-actions {
display: flex;
flex-direction: column;
- align-items: stretch;
+ align-items: flex-end;
gap: 0.18rem;
}
.relationship-lens-actions button { white-space: nowrap; }
+ .relationship-lens-actions #btn-focus-clear {
+ display: grid;
+ width: 1.75rem;
+ height: 1.75rem;
+ padding: 0;
+ place-items: center;
+ color: var(--text-muted);
+ font-size: 1rem;
+ line-height: 1;
+ }
+ .relationship-lens-actions #btn-focus-clear:hover,
+ .relationship-lens-actions #btn-focus-clear:focus-visible {
+ background: var(--toolbar-hover);
+ color: var(--text);
+ }
.relationship-lens-actions #btn-focus-copy { color: var(--frontend-stroke); }
.relationship-lens-actions #btn-focus-relations { display: none; }
.relationship-lens-eyebrow {
@@ -1420,12 +1592,163 @@
.semantic-passport-meta [hidden] { display: none; }
html[data-preset="blueprint"] .semantic-passport-meta span,
html[data-preset="blueprint"] .semantic-passport-meta code { border-radius: 0.1rem; }
+ .semantic-passport-evidence {
+ margin-top: 0.52rem;
+ padding: 0.5rem;
+ border: 1px solid color-mix(in srgb, var(--backend-stroke) 32%, var(--toolbar-border));
+ border-radius: 0.55rem;
+ background: color-mix(in srgb, var(--backend-fill) 18%, var(--panel));
+ }
+ .semantic-passport-evidence[hidden] { display: none; }
+ html[data-preset="blueprint"] .semantic-passport-evidence { border-radius: 0.18rem; }
+ .semantic-passport-evidence-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 0.55rem;
+ margin-bottom: 0.35rem;
+ }
+ .semantic-passport-evidence-status {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.28rem;
+ color: var(--backend-stroke);
+ font-size: 0.5rem;
+ font-weight: 800;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ }
+ .semantic-passport-evidence-status::before {
+ content: '';
+ width: 0.38rem;
+ height: 0.38rem;
+ border-radius: 50%;
+ background: var(--backend-stroke);
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--backend-stroke) 14%, transparent);
+ }
+ .semantic-passport-repository {
+ min-width: 0;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.5rem;
+ text-decoration: none;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+ .semantic-passport-repository:hover,
+ .semantic-passport-repository:focus-visible { color: var(--backend-stroke); }
+ .semantic-passport-evidence-links { display: grid; gap: 0.22rem; }
+ .semantic-passport-source {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) auto;
+ gap: 0.15rem 0.45rem;
+ align-items: center;
+ padding: 0.34rem 0.4rem;
+ border: 1px solid transparent;
+ border-radius: 0.38rem;
+ color: var(--text-muted);
+ text-decoration: none;
+ }
+ .semantic-passport-source:hover,
+ .semantic-passport-source:focus-visible {
+ border-color: color-mix(in srgb, var(--backend-stroke) 42%, transparent);
+ background: color-mix(in srgb, var(--backend-fill) 32%, transparent);
+ color: var(--text);
+ }
+ .semantic-passport-source strong {
+ overflow: hidden;
+ font-size: 0.5625rem;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+ .semantic-passport-source code {
+ color: var(--backend-stroke);
+ font: inherit;
+ font-size: 0.5rem;
+ }
+ .semantic-passport-source small {
+ grid-column: 1 / -1;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.5rem;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
.relationship-lens-summary {
display: block;
margin-top: 0.12rem;
color: var(--text-faint);
font-size: 0.5625rem;
}
+ .semantic-passport-reach {
+ display: grid;
+ gap: 0.28rem;
+ margin-top: 0.52rem;
+ padding-top: 0.48rem;
+ border-top: 1px solid color-mix(in srgb, var(--toolbar-border) 76%, transparent);
+ }
+ .semantic-passport-reach[hidden] { display: none; }
+ .semantic-passport-reach-label {
+ color: var(--text-faint);
+ font-size: 0.5rem;
+ font-weight: 800;
+ letter-spacing: 0.1em;
+ text-transform: uppercase;
+ }
+ .semantic-passport-reach-actions {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 0.25rem;
+ }
+ .semantic-passport-reach-actions button {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 0.5rem;
+ min-width: 0;
+ min-height: 2rem;
+ padding: 0.32rem 0.42rem;
+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 86%, transparent);
+ background: color-mix(in srgb, var(--panel) 70%, transparent);
+ color: var(--text-muted);
+ text-align: left;
+ }
+ .semantic-passport-reach-actions button:hover:not(:disabled),
+ .semantic-passport-reach-actions button:focus-visible {
+ border-color: color-mix(in srgb, var(--frontend-stroke) 62%, var(--toolbar-border));
+ color: var(--text);
+ }
+ .semantic-passport-reach-actions button:focus-visible {
+ outline: 2px solid var(--frontend-stroke);
+ outline-offset: 1px;
+ }
+ .semantic-passport-reach-actions button:disabled {
+ cursor: default;
+ opacity: 0.5;
+ }
+ .semantic-passport-reach-actions button[aria-pressed="true"] {
+ border-color: color-mix(in srgb, var(--reach-color, var(--frontend-stroke)) 72%, var(--toolbar-border));
+ background: color-mix(in srgb, var(--reach-fill, var(--frontend-fill)) 48%, transparent);
+ color: var(--text);
+ }
+ #btn-reach-upstream {
+ --reach-color: var(--database-stroke);
+ --reach-fill: var(--database-fill);
+ }
+ #btn-reach-downstream {
+ --reach-color: var(--backend-stroke);
+ --reach-fill: var(--backend-fill);
+ }
+ .semantic-passport-reach-actions strong {
+ color: var(--reach-color, var(--frontend-stroke));
+ font-size: 0.625rem;
+ }
+ .semantic-passport-reach-status {
+ color: var(--text-faint);
+ font-size: 0.525rem;
+ line-height: 1.4;
+ }
+ .semantic-passport-reach-status[hidden] { display: none; }
.relationship-lens-list {
max-height: min(18rem, 46vh);
overflow: auto;
@@ -1698,13 +2021,16 @@
top: 1rem;
left: 1rem;
z-index: 24;
+ display: flex;
+ flex-direction: column;
width: min(22rem, calc(100% - 2rem));
+ max-height: calc(100% - 2rem);
overflow: hidden;
border: 1px solid var(--toolbar-border);
border-radius: 0.85rem;
background: var(--toolbar-menu-bg);
color: var(--toolbar-text);
- box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34);
+ box-shadow: 0 6px 8px rgba(0, 0, 0, 0.22);
backdrop-filter: blur(16px);
}
.node-finder[hidden] { display: none; }
@@ -1744,7 +2070,6 @@
.node-finder-close:hover,
.node-finder-close:focus-visible { background: var(--toolbar-hover); }
.node-finder-close:focus-visible,
- .node-finder-input:focus-visible,
.node-finder-result:focus-visible {
outline: 2px solid var(--frontend-stroke);
outline-offset: -2px;
@@ -1760,10 +2085,16 @@
border: 1px solid var(--toolbar-border);
border-radius: 0.55rem;
background: color-mix(in srgb, var(--panel) 78%, transparent);
+ transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
}
html[data-preset="blueprint"] .node-finder-search { border-radius: 0.18rem; }
.node-finder-search > span { color: var(--frontend-stroke); font-size: 0.875rem; }
+ .node-finder-search:focus-within {
+ border-color: var(--frontend-stroke);
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--frontend-stroke) 20%, transparent);
+ }
.node-finder-input {
+ appearance: none;
width: 100%;
min-width: 0;
border: 0;
@@ -1773,6 +2104,7 @@
font: inherit;
font-size: 0.75rem;
}
+ .node-finder-input:focus-visible { outline: none; }
.node-finder-input::placeholder { color: var(--text-faint); }
.node-finder kbd {
padding: 0.1rem 0.32rem;
@@ -1784,34 +2116,50 @@
}
.node-finder-results {
display: grid;
- gap: 0.18rem;
+ flex: 1 1 auto;
+ gap: 0;
+ min-height: 0;
max-height: min(18rem, 48vh);
- margin: 0;
- padding: 0 0.55rem 0.55rem;
+ margin: 0 0.55rem 0.45rem;
+ padding: 0;
overflow-y: auto;
overscroll-behavior: contain;
+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 78%, transparent);
+ border-radius: 0.55rem;
+ background: color-mix(in srgb, var(--panel) 54%, transparent);
+ scroll-padding-block: 0.25rem;
scrollbar-width: thin;
}
+ html[data-preset="blueprint"] .node-finder-results { border-radius: 0.18rem; }
.node-finder-result {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 0.2rem 0.75rem;
width: 100%;
- padding: 0.55rem 0.65rem;
+ min-height: 3.25rem;
+ padding: 0.58rem 0.65rem;
border: 0;
- border-radius: 0.45rem;
+ border-radius: 0;
background: transparent;
color: var(--text);
font: inherit;
text-align: left;
cursor: pointer;
+ transition: background-color 160ms ease-out;
+ }
+ .node-finder-result:not(:last-child) {
+ border-bottom: 1px solid color-mix(in srgb, var(--toolbar-border) 62%, transparent);
}
- html[data-preset="blueprint"] .node-finder-result { border-radius: 0.12rem; }
.node-finder-result:hover,
- .node-finder-result:focus-visible { background: var(--toolbar-hover); }
+ .node-finder-result:focus-visible {
+ position: relative;
+ z-index: 1;
+ background: color-mix(in srgb, var(--frontend-fill) 48%, var(--toolbar-hover));
+ }
.node-finder-result strong {
overflow: hidden;
font-size: 0.75rem;
+ line-height: 1.25;
text-overflow: ellipsis;
white-space: nowrap;
}
@@ -1820,7 +2168,7 @@
overflow: hidden;
color: var(--text-faint);
font-size: 0.5625rem;
- letter-spacing: 0.03em;
+ letter-spacing: 0.015em;
text-overflow: ellipsis;
white-space: nowrap;
}
@@ -1847,8 +2195,8 @@
text-align: center;
}
.node-finder-status {
- padding: 0.5rem 0.8rem;
- border-top: 1px solid var(--toolbar-border);
+ margin: 0;
+ padding: 0.1rem 0.8rem 0.65rem;
color: var(--text-faint);
font-size: 0.5625rem;
}
@@ -2364,6 +2712,22 @@
border-top: 2px solid var(--frontend-stroke);
}
+ html[data-preset="editorial"] .card {
+ position: relative;
+ border-radius: 0.28rem;
+ background: var(--panel);
+ box-shadow: 0 10px 28px color-mix(in srgb, #000 10%, transparent);
+ }
+ html[data-preset="editorial"] .card::before {
+ position: absolute;
+ top: -1px;
+ left: 1.25rem;
+ width: 3.25rem;
+ border-top: 3px solid var(--arrow-emphasis);
+ content: "";
+ }
+ html[data-preset="editorial"] .card-dot { border-radius: 0; transform: rotate(45deg) scale(0.78); }
+
.card-header {
display: flex;
align-items: center;
@@ -2491,6 +2855,8 @@
.story-carrier-overlay { display: none !important; }
.diagram-container svg[data-focus-active] [data-node-id],
.diagram-container svg[data-focus-active] [data-edge-from],
+ .diagram-container svg[data-reach-active] [data-node-id],
+ .diagram-container svg[data-reach-active] [data-edge-from],
.diagram-container svg[data-story-beat] [data-story-step],
.diagram-container svg[data-story-beat] [data-edge-from][data-story-beat-step],
.diagram-container svg[data-route-active] [data-node-id],
@@ -2541,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2561,6 +2928,172 @@
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);
transform: rotate(45deg) scale(0.84);
}
+ #btn-preset[data-preset-option="editorial"] .preset-control-mark {
+ border-color: var(--arrow-emphasis);
+ border-radius: 0;
+ background: var(--arrow-emphasis);
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
+ transform: rotate(45deg) scale(0.72);
+ }
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
+ html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
+ html[data-preset="editorial"] .export-menu,
+ html[data-preset="editorial"] .overview-map,
+ html[data-preset="editorial"] .semantic-lens,
+ html[data-preset="editorial"] .route-probe,
+ html[data-preset="editorial"] .focus-chip,
+ html[data-preset="editorial"] .diagram-guide,
+ html[data-preset="editorial"] .node-finder,
+ html[data-preset="editorial"] .guided-views,
+ html[data-preset="editorial"] .share-chapter-cue {
+ border-radius: 0.3rem;
+ }
.motion-control-dot {
width: 0.46rem;
height: 0.46rem;
@@ -2597,6 +3130,7 @@
text-align: left;
padding: 0.5rem 0.75rem;
}
+ .toolbar .export-menu button[hidden] { display: none; }
.toolbar .export-menu button:hover {
background: var(--toolbar-hover);
}
@@ -2637,20 +3171,29 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
.header { margin-bottom: 1.25rem; padding-right: 0; }
html[data-preset="signal-flow"] .header,
- html[data-preset="blueprint"] .header { padding-right: 0; }
+ html[data-preset="blueprint"] .header,
+ html[data-preset="editorial"] .header { padding-right: 0; }
.header-row {
gap: 0.75rem;
align-items: flex-start;
}
html[data-preset="signal-flow"] .header-row,
- html[data-preset="blueprint"] .header-row { flex-wrap: wrap; }
+ html[data-preset="blueprint"] .header-row,
+ html[data-preset="editorial"] .header-row { flex-wrap: wrap; }
html[data-preset="signal-flow"] .header-row::after {
margin-left: 0;
order: 3;
@@ -2659,6 +3202,10 @@
margin-left: 0;
order: 3;
}
+ html[data-preset="editorial"] .header-row::after {
+ margin-left: 0;
+ order: 3;
+ }
h1 {
font-size: 1.25rem;
line-height: 1.25;
@@ -3035,6 +3582,8 @@
the global zoom level. Reveal only their exact semantic matches. */
svg[data-focus-active] [data-focus-match][data-detail],
svg[data-focus-active] [data-focus-match] [data-detail],
+ svg[data-reach-active] [data-reach-match][data-detail],
+ svg[data-reach-active] [data-reach-match] [data-detail],
svg[data-lens-active] [data-lens-match][data-detail],
svg[data-lens-active] [data-lens-match] [data-detail],
svg[data-legend-preview-active] [data-legend-preview-match][data-detail],
@@ -3053,6 +3602,7 @@
pointer-events: auto;
}
svg[data-focus-active] [data-focus-match] [data-detail-anchor],
+ svg[data-reach-active] [data-reach-match] [data-detail-anchor],
svg[data-lens-active] [data-lens-match] [data-detail-anchor],
svg[data-legend-preview-active] [data-legend-preview-match] [data-detail-anchor],
svg[data-intent-trace-active] [data-intent-trace-match] [data-detail-anchor],
@@ -3084,6 +3634,41 @@
filter: drop-shadow(0 0 7px var(--frontend-stroke));
outline: none;
}
+ /* Verified Source Beacons are installed at runtime only for nodes whose
+ repository evidence passed the local revision/blob/line checks. They
+ live inside the owning node so every focus, route, story, and guided
+ view keeps one coherent opacity state. Export serialization removes
+ them before producing the canonical SVG or any derived visual. */
+ .source-evidence-beacon {
+ pointer-events: none;
+ opacity: 0.76;
+ transition: opacity 160ms ease, filter 160ms ease;
+ }
+ .source-evidence-beacon rect {
+ fill: color-mix(in srgb, var(--mask) 92%, var(--backend-stroke));
+ stroke: color-mix(in srgb, var(--backend-stroke) 82%, var(--panel-border));
+ stroke-width: 1;
+ vector-effect: non-scaling-stroke;
+ }
+ .source-evidence-beacon text {
+ fill: var(--backend-stroke);
+ font-size: 5.5px;
+ font-weight: 800;
+ letter-spacing: 0.06em;
+ text-anchor: middle;
+ text-transform: uppercase;
+ }
+ svg [data-node-id]:hover .source-evidence-beacon,
+ svg [data-node-id]:focus-visible .source-evidence-beacon,
+ svg [data-node-id][data-focus-selected] .source-evidence-beacon {
+ opacity: 1;
+ filter: drop-shadow(0 0 4px color-mix(in srgb, var(--backend-stroke) 72%, transparent));
+ }
+ svg[data-preset="signal-flow"] .source-evidence-beacon { opacity: 0.9; }
+ svg[data-preset="blueprint"] .source-evidence-beacon rect {
+ rx: 0.8px;
+ filter: none;
+ }
svg [data-legend-kind][role="button"] { cursor: pointer; }
svg [data-legend-kind]:focus { outline: none; }
svg [data-legend-hit] {
@@ -3199,6 +3784,30 @@
filter: drop-shadow(0 0 10px var(--frontend-stroke));
}
+ /* Authored Reachability is a bounded graph query over the relationships
+ already present in the artifact. Upstream walks incoming edges;
+ downstream walks outgoing edges. It never claims runtime causality and
+ changes only viewer emphasis, not canonical geometry or export bytes. */
+ svg[data-reach-active] [data-node-id],
+ svg[data-reach-active] [data-edge-from] { opacity: 0.09; }
+ svg[data-reach-active] [data-reach-match] { opacity: 1; }
+ svg[data-reach-active="upstream"] [data-reach-origin] {
+ filter: drop-shadow(0 0 11px var(--database-stroke));
+ }
+ svg[data-reach-active="downstream"] [data-reach-origin] {
+ filter: drop-shadow(0 0 11px var(--backend-stroke));
+ }
+ svg[data-reach-active="upstream"] [data-edge-from][data-reach-match] {
+ filter: drop-shadow(0 0 4px color-mix(in srgb, var(--database-stroke) 72%, transparent));
+ }
+ svg[data-reach-active="downstream"] [data-edge-from][data-reach-match] {
+ filter: drop-shadow(0 0 4px color-mix(in srgb, var(--backend-stroke) 72%, transparent));
+ }
+ svg[data-preset="blueprint"][data-reach-active] [data-reach-origin],
+ svg[data-preset="blueprint"][data-reach-active] [data-edge-from][data-reach-match] {
+ filter: none;
+ }
+
/* Direct Relationship Explorer makes authored paths a real input surface
without changing their visible stroke or canonical SVG. A transparent
runtime rail supplies forgiving pointer geometry; the exact authored
@@ -3294,6 +3903,11 @@
stroke-linecap: square;
filter: none;
}
+ svg[data-preset="editorial"] .relationship-flow-pulse {
+ stroke: var(--arrow-emphasis);
+ stroke-width: 2.75;
+ filter: none;
+ }
.semantic-flow-token {
color: var(--frontend-stroke);
opacity: 0;
@@ -3336,6 +3950,7 @@
filter: drop-shadow(0 0 5px currentColor);
}
svg[data-preset="blueprint"] .semantic-flow-token { filter: none; }
+ svg[data-preset="editorial"] .semantic-flow-token { filter: none; }
html[data-embed="true"] .relationship-pulse-overlay { display: none; }
/* Intent Trace is a temporary, pre-click exploration layer. Related
@@ -3376,6 +3991,8 @@
filter: none;
stroke-linecap: square;
}
+ svg[data-preset="editorial"] [data-intent-trace-selected],
+ svg[data-preset="editorial"] .intent-trace-flow { filter: none; }
.intent-trace-status {
position: absolute;
width: 1px;
@@ -3459,6 +4076,25 @@
filter: none;
stroke-linecap: square;
}
+ svg[data-preset="editorial"] [data-route-start],
+ svg[data-preset="editorial"] [data-route-end],
+ svg[data-preset="editorial"] [data-route-step],
+ svg[data-preset="editorial"] .route-probe-flow,
+ svg[data-preset="editorial"] .route-journey-flow { filter: none; }
+
+ svg[data-preset="editorial"] .c-grid {
+ stroke-dasharray: 1 4;
+ opacity: 0.48;
+ }
+ svg[data-preset="editorial"] .c-region {
+ fill: color-mix(in srgb, var(--cloud-fill) 48%, transparent);
+ stroke-dasharray: 9 4;
+ }
+ svg[data-preset="editorial"] [data-node-id]:hover,
+ svg[data-preset="editorial"] [data-node-id]:focus-visible,
+ svg[data-preset="editorial"][data-focus-active] [data-focus-selected] {
+ filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 18%, transparent));
+ }
svg[data-preset="blueprint"] .c-grid {
stroke-dasharray: 1 3;
@@ -3477,6 +4113,9 @@
svg[data-preset="blueprint"][data-focus-active] [data-focus-selected] {
filter: drop-shadow(0 0 3px var(--frontend-stroke));
}
+ svg[data-preset="blueprint"][data-focus-active][data-reach-active] [data-focus-selected][data-reach-origin] {
+ filter: none;
+ }
svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview],
svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview-source],
svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview-target] {
@@ -3541,6 +4180,10 @@
filter: none;
animation: none;
}
+ svg[data-preset="editorial"] .story-trail-flow { filter: none; }
+ svg[data-preset="editorial"][data-story-beat] [data-story-step][data-story-beat-state="active"] {
+ filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 16%, transparent));
+ }
/* Chapter Delta Preview is a static, pre-commit comparison between two
chapter focus sets. Symbols in the rail carry the meaning without color;
@@ -3602,6 +4245,14 @@
animation-name: archify-blueprint-node-pulse;
animation-duration: 3.8s;
}
+ svg[data-preset="editorial"][data-animation="trace"] [data-animate="edge"] {
+ filter: none;
+ animation-duration: 2.2s;
+ }
+ svg[data-preset="editorial"][data-animation="trace"] [data-animate="node"] {
+ animation-name: archify-editorial-node-pulse;
+ animation-duration: 3.5s;
+ }
/* Embedded proofs are static until a named Story Trail chapter is played.
This keeps proof grids calm and ensures ?play=1 stops all viewer motion
after one 3.2 second chapter instead of leaving ambient trace loops on. */
@@ -3627,6 +4278,10 @@
0%, 72%, 100% { opacity: 1; filter: none; }
18%, 36% { opacity: 0.72; filter: drop-shadow(0 0 2px var(--frontend-stroke)); }
}
+ @keyframes archify-editorial-node-pulse {
+ 0%, 72%, 100% { opacity: 1; filter: none; }
+ 18%, 36% { opacity: 0.78; filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 18%, transparent)); }
+ }
@keyframes archify-signal-scan {
0%, 18% { opacity: 1; transform: translateX(-70%); }
70% { opacity: 1; transform: translateX(70%); }
@@ -3742,6 +4397,7 @@
}
.relationship-pulse-overlay { display: none !important; }
.guided-view-chapter { transition: none !important; }
+ .source-evidence-beacon,
svg [data-node-id], svg [data-edge-from], svg [data-detail], svg [data-detail-anchor], svg [data-legend-hit], svg { transition: none !important; }
}
</style>
@@ -3758,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -3789,6 +4475,8 @@
</button>
<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&times;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&times;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&times;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>
@@ -3814,6 +4502,7 @@
</div>
<script id="archify-guided-views-data" type="application/json">[]</script>
+
<div class="guided-views no-print" id="guided-views" hidden aria-label="Guided diagram views">
<button id="guided-view-prev" type="button" aria-label="Previous guided view" title="Previous guided view ([)">&#8592;</button>
<div class="guided-view-copy">
@@ -4171,7 +4860,7 @@
</div>
<div class="node-finder-search">
<span aria-hidden="true">&#8981;</span>
- <input class="node-finder-input" id="node-finder-input" type="search" autocomplete="off" spellcheck="false" placeholder="Search labels or IDs" aria-describedby="node-finder-status">
+ <input class="node-finder-input" id="node-finder-input" type="search" autocomplete="off" spellcheck="false" placeholder="Search labels or IDs" aria-label="Search diagram nodes" aria-describedby="node-finder-status">
<kbd aria-hidden="true">/</kbd>
</div>
<div class="node-finder-results" id="node-finder-results" role="group" aria-label="Diagram nodes"></div>
@@ -4190,12 +4879,31 @@
<span id="focus-tag" data-passport="tag" hidden></span>
<code id="focus-id" data-passport="id"></code>
</div>
+ <div class="semantic-passport-evidence" id="focus-evidence" hidden aria-label="Verified source evidence">
+ <div class="semantic-passport-evidence-head">
+ <span class="semantic-passport-evidence-status">Verified source</span>
+ <a class="semantic-passport-repository" id="focus-repository" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer"></a>
+ </div>
+ <div class="semantic-passport-evidence-links" id="focus-evidence-links"></div>
+ </div>
<span class="relationship-lens-summary" id="focus-summary" aria-live="polite"></span>
+ <div class="semantic-passport-reach" id="focus-reach" hidden>
+ <span class="semantic-passport-reach-label">Authored reach</span>
+ <div class="semantic-passport-reach-actions" role="group" aria-label="Trace authored reachability">
+ <button id="btn-reach-upstream" type="button" aria-label="Trace upstream authored reachability" aria-pressed="false">
+ <span>Upstream</span><strong id="focus-reach-upstream-count">0</strong>
+ </button>
+ <button id="btn-reach-downstream" type="button" aria-label="Trace downstream authored reachability" aria-pressed="false">
+ <span>Downstream</span><strong id="focus-reach-downstream-count">0</strong>
+ </button>
+ </div>
+ <small class="semantic-passport-reach-status" id="focus-reach-status" hidden aria-live="polite"></small>
+ </div>
</div>
<div class="relationship-lens-actions">
+ <button id="btn-focus-clear" type="button" aria-label="Close semantic passport" title="Close">&#215;</button>
<button id="btn-focus-copy" type="button" aria-label="Copy link to focused node">Copy link</button>
<button id="btn-focus-relations" type="button" aria-label="Show connected relationships" aria-expanded="false" aria-controls="relationship-lens-list">Relations</button>
- <button id="btn-focus-clear" type="button" aria-label="Clear focused node">Clear</button>
</div>
</div>
<div class="relationship-lens-list" id="relationship-lens-list" aria-label="Connected relationships"></div>
@@ -4314,19 +5022,44 @@
<script>
var Archify = {};
+ function hasDrawableGeometry(element) {
+ if (!element) return false;
+ var geometries = /^(path|line|polyline)$/i.test(element.tagName)
+ ? [element]
+ : Array.prototype.slice.call(element.querySelectorAll('path, line, polyline'));
+ return geometries.some(function (geometry) {
+ var source = geometry.tagName.toLowerCase() === 'path'
+ ? geometry.getAttribute('d')
+ : geometry.tagName.toLowerCase() === 'polyline'
+ ? geometry.getAttribute('points')
+ : [geometry.getAttribute('x1'), geometry.getAttribute('y1'), geometry.getAttribute('x2'), geometry.getAttribute('y2')].join(' ');
+ if (!source || /(?:^|[^a-z])(?:nan|infinity)(?:[^a-z]|$)/i.test(source) || typeof geometry.getTotalLength !== 'function') return false;
+ try {
+ var length = Number(geometry.getTotalLength());
+ return Number.isFinite(length) && length > 0;
+ } catch (_) {
+ return false;
+ }
+ });
+ }
+
/* ============================================================
- Visual style try-on — one topology, three bundled presets.
+ Visual style try-on — one topology, four bundled presets.
The reader's choice is intentionally session-only: it updates the
live page and canonical SVG together, but never rewrites the source,
URL, or a later diagram's authored default.
============================================================ */
Archify.preset = (function () {
- var PRESETS = ['classic', 'signal-flow', 'blueprint'];
- var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };
+ var PRESETS = ['classic', 'signal-flow', 'blueprint', 'editorial'];
+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint', editorial: 'Editorial' };
var html = document.documentElement;
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4345,16 +5078,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -4473,6 +5270,168 @@
* self-themes when embedded in GitHub READMEs or other hosts that
* expose a color scheme. Used for "Download SVG".
*/
+ function applyRouteSnapshot(clone, snapshot) {
+ if (!snapshot || !Array.isArray(snapshot.nodeIds) || !Array.isArray(snapshot.edges) ||
+ snapshot.nodeIds.length < 2 || snapshot.edges.length !== snapshot.nodeIds.length - 1 ||
+ snapshot.hops !== snapshot.edges.length ||
+ !snapshot.source || !snapshot.target ||
+ snapshot.source.id !== snapshot.nodeIds[0] ||
+ snapshot.target.id !== snapshot.nodeIds[snapshot.nodeIds.length - 1]) 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 = [];
+
+ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {
+ var nodeId = snapshot.nodeIds[nodeIndex];
+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId]) return false;
+ var matchedNodes = cloneNodes.filter(function (candidate) {
+ return candidate.getAttribute('data-node-id') === nodeId;
+ });
+ if (matchedNodes.length !== 1) return false;
+ nodeIds[nodeId] = true;
+ nodeMatches.push(matchedNodes);
+ }
+
+ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {
+ var edge = snapshot.edges[edgeIndex];
+ var fromId = snapshot.nodeIds[edgeIndex];
+ var toId = snapshot.nodeIds[edgeIndex + 1];
+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||
+ edge.from !== fromId || edge.to !== toId) 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(matchedEdges);
+ }
+
+ clone.setAttribute('data-share-route', '');
+ nodeMatches.forEach(function (matches, step) {
+ matches.forEach(function (element) {
+ element.setAttribute('data-share-route-match', '');
+ element.setAttribute('data-share-route-step', String(step));
+ if (step === 0) element.setAttribute('data-share-route-start', '');
+ else if (step === snapshot.nodeIds.length - 1) element.setAttribute('data-share-route-end', '');
+ else element.setAttribute('data-share-route-middle', '');
+ });
+ });
+ edgeMatches.forEach(function (matches, step) {
+ matches.forEach(function (element) {
+ element.setAttribute('data-share-route-match', '');
+ element.setAttribute('data-share-route-step', String(step));
+ });
+ });
+
+ return clone.hasAttribute('data-share-route') &&
+ !clone.hasAttribute('data-animation') &&
+ !clone.hasAttribute('data-route-active') &&
+ !clone.hasAttribute('data-route-journey') &&
+ clone.querySelectorAll('[data-animate], [data-route-match], [data-route-step], [data-route-start], [data-route-end], [data-route-journey-state], [data-route-journey-current], [data-route-journey-overlay]').length === 0 &&
+ clone.querySelectorAll('[data-share-route-match]').length ===
+ nodeMatches.reduce(function (count, matches) { return count + matches.length; }, 0) +
+ 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.
@@ -4487,6 +5446,7 @@
clone.style.removeProperty('transform');
clone.removeAttribute('data-view-scale');
clone.removeAttribute('data-focus-active');
+ clone.removeAttribute('data-reach-active');
clone.removeAttribute('data-lens-active');
clone.removeAttribute('data-lens-flow-count');
clone.removeAttribute('data-lens-flow-density');
@@ -4498,6 +5458,8 @@
clone.removeAttribute('data-route-picking');
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');
@@ -4557,6 +5519,16 @@
Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-hit-overlay]'), function (el) {
el.remove();
});
+ Array.prototype.forEach.call(clone.querySelectorAll('[data-source-evidence-beacon]'), function (el) {
+ el.remove();
+ });
+ Array.prototype.forEach.call(clone.querySelectorAll('[data-source-evidence-count]'), function (el) {
+ var originalLabel = el.getAttribute('data-source-evidence-original-label');
+ if (originalLabel == null || originalLabel === '') el.removeAttribute('aria-label');
+ else el.setAttribute('aria-label', originalLabel);
+ el.removeAttribute('data-source-evidence-count');
+ el.removeAttribute('data-source-evidence-original-label');
+ });
Array.prototype.forEach.call(clone.querySelectorAll('[data-story-step], [data-story-beat-state], [data-story-beat-step]'), function (el) {
el.removeAttribute('data-story-step');
el.removeAttribute('data-story-beat-state');
@@ -4567,6 +5539,11 @@
el.removeAttribute('data-focus-match');
el.removeAttribute('data-focus-selected');
});
+ Array.prototype.forEach.call(clone.querySelectorAll('[data-reach-match], [data-reach-origin], [data-reach-depth]'), function (el) {
+ el.removeAttribute('data-reach-match');
+ el.removeAttribute('data-reach-origin');
+ el.removeAttribute('data-reach-depth');
+ });
Array.prototype.forEach.call(clone.querySelectorAll('[data-lens-match], [data-lens-selected], [data-lens-peer]'), function (el) {
el.removeAttribute('data-lens-match');
el.removeAttribute('data-lens-selected');
@@ -4597,6 +5574,18 @@
el.removeAttribute('data-route-journey-current');
el.style.removeProperty('--route-step');
});
+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle]'), function (el) {
+ el.removeAttribute('data-share-route-match');
+ el.removeAttribute('data-share-route-step');
+ el.removeAttribute('data-share-route-start');
+ 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');
@@ -4606,6 +5595,7 @@
});
var canonicalStateClean = !clone.hasAttribute('data-view-scale') &&
!clone.hasAttribute('data-focus-active') &&
+ !clone.hasAttribute('data-reach-active') &&
!clone.hasAttribute('data-lens-active') &&
!clone.hasAttribute('data-lens-flow-count') &&
!clone.hasAttribute('data-lens-flow-density') &&
@@ -4616,6 +5606,8 @@
!clone.hasAttribute('data-route-picking') &&
!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') &&
@@ -4625,9 +5617,17 @@
!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-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-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) &&
+ Number.isFinite(vb.width) && Number.isFinite(vb.height) && vb.width > 0 && vb.height > 0;
+ 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
@@ -4751,6 +5751,22 @@
bgRect.setAttribute('fill', computed.getPropertyValue('--bg').trim() || '#ffffff');
}
+ if (opts.routeSnapshot) {
+ style.textContent += "\nsvg[data-share-route] [data-node-id], svg[data-share-route] [data-edge-from] { opacity: 0.18; }\n" +
+ "svg[data-share-route] [data-share-route-match] { opacity: 1; }\n" +
+ "svg[data-share-route] [data-share-route-start] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3; stroke-dasharray: 5 3; }\n" +
+ "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);
@@ -4758,7 +5774,9 @@
svgString: new XMLSerializer().serializeToString(clone),
width: vb.width * scale,
height: vb.height * scale,
- canonicalStateClean: canonicalStateClean
+ canonicalStateClean: canonicalStateClean,
+ routeStateClean: routeStateClean,
+ reachStateClean: reachStateClean
};
}
@@ -4802,24 +5820,29 @@
return new Promise(function (resolve, reject) {
var img = new Image();
img.onload = function () {
- var canvas = document.createElement('canvas');
- canvas.width = data.width;
- canvas.height = data.height;
- var ctx = canvas.getContext('2d');
- if (format === 'jpeg') {
- ctx.fillStyle = currentBg();
- ctx.fillRect(0, 0, canvas.width, canvas.height);
+ try {
+ var canvas = document.createElement('canvas');
+ canvas.width = data.width;
+ canvas.height = data.height;
+ var ctx = canvas2dOrThrow(canvas, format);
+ if (format === 'jpeg') {
+ ctx.fillStyle = currentBg();
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+ }
+ // Draw at natural size — SVG was already rasterized at target res.
+ ctx.drawImage(img, 0, 0);
+ URL.revokeObjectURL(svgUrl);
+ var mime = format === 'jpeg' ? 'image/jpeg' :
+ format === 'webp' ? 'image/webp' : 'image/png';
+ var quality = format === 'png' ? undefined : 0.95;
+ canvas.toBlob(function (blob) {
+ if (!blob) reject(new Error('toBlob returned null for ' + format));
+ else resolve(blob);
+ }, mime, quality);
+ } catch (error) {
+ URL.revokeObjectURL(svgUrl);
+ reject(error);
}
- // Draw at natural size — SVG was already rasterized at target res.
- ctx.drawImage(img, 0, 0);
- URL.revokeObjectURL(svgUrl);
- var mime = format === 'jpeg' ? 'image/jpeg' :
- format === 'webp' ? 'image/webp' : 'image/png';
- var quality = format === 'png' ? undefined : 0.95;
- canvas.toBlob(function (blob) {
- if (!blob) reject(new Error('toBlob returned null for ' + format));
- else resolve(blob);
- }, mime, quality);
};
img.onerror = function (e) {
URL.revokeObjectURL(svgUrl);
@@ -4847,75 +5870,110 @@
return value + suffix;
}
- function rasterizeShareCard() {
+ function canvas2dOrThrow(canvas, label) {
+ if (!canvas || typeof canvas.getContext !== 'function') {
+ throw new Error('Canvas unavailable for ' + label);
+ }
+ var ctx = canvas.getContext('2d');
+ if (!ctx) throw new Error('2D canvas context unavailable for ' + label);
+ if (typeof canvas.toBlob !== 'function') throw new Error('canvas.toBlob unavailable for ' + label);
+ return ctx;
+ }
+
+ 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);
+ 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);
return new Promise(function (resolve, reject) {
var img = new Image();
img.onload = function () {
- var canvas = document.createElement('canvas');
- canvas.width = SHARE_CARD_WIDTH;
- canvas.height = SHARE_CARD_HEIGHT;
- var ctx = canvas.getContext('2d');
- var computed = getComputedStyle(document.documentElement);
- var bg = computed.getPropertyValue('--bg').trim() || currentBg();
- 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 titleNode = document.querySelector('.header h1');
- var subtitleNode = document.querySelector('.header .subtitle');
- var title = titleNode ? titleNode.textContent : document.title;
- var subtitle = 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();
-
- ctx.fillStyle = bg;
- ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);
-
- ctx.fillStyle = accent;
- ctx.fillRect(SHARE_CARD_PADDING, 27, 42, 3);
-
- ctx.textBaseline = 'alphabetic';
- ctx.fillStyle = text;
- var fittedTitle = fitCanvasText(ctx, title, SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2 - 330, 29, 18, '700');
- ctx.fillText(fittedTitle, SHARE_CARD_PADDING, 62);
-
- ctx.fillStyle = muted;
- var fittedSubtitle = fitCanvasText(ctx, subtitle, SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2 - 280, 13, 11, '500');
- ctx.fillText(fittedSubtitle, SHARE_CARD_PADDING, 87);
-
- ctx.font = "600 12px 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
- ctx.textAlign = 'right';
- ctx.fillStyle = accent;
- ctx.fillText('ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase(), SHARE_CARD_WIDTH - SHARE_CARD_PADDING, 50);
- ctx.textAlign = 'left';
-
- var availableWidth = SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2;
- var availableHeight = SHARE_CARD_HEIGHT - SHARE_CARD_HEADER - SHARE_CARD_PADDING;
- var fit = Math.min(availableWidth / data.width, availableHeight / data.height);
- var drawWidth = data.width * fit;
- var drawHeight = data.height * fit;
- var drawX = SHARE_CARD_PADDING + (availableWidth - drawWidth) / 2;
- var drawY = SHARE_CARD_HEADER + (availableHeight - drawHeight) / 2;
-
- ctx.strokeStyle = border;
- ctx.lineWidth = 1;
- ctx.strokeRect(drawX - 0.5, drawY - 0.5, drawWidth + 1, drawHeight + 1);
- ctx.drawImage(img, drawX, drawY, drawWidth, drawHeight);
- URL.revokeObjectURL(svgUrl);
-
- canvas.toBlob(function (blob) {
- if (!blob) reject(new Error('toBlob returned null for Share Card'));
- else resolve(blob);
- }, 'image/png');
+ try {
+ var canvas = document.createElement('canvas');
+ canvas.width = SHARE_CARD_WIDTH;
+ canvas.height = SHARE_CARD_HEIGHT;
+ var ctx = canvas2dOrThrow(canvas, 'Share Card');
+ var computed = getComputedStyle(document.documentElement);
+ var bg = computed.getPropertyValue('--bg').trim() || currentBg();
+ var text = computed.getPropertyValue('--text').trim() || '#ffffff';
+ var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';
+ var border = computed.getPropertyValue('--panel-border').trim() || '#334155';
+ 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'
+ : 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'
+ : reachSnapshot
+ ? 'ARCHIFY · ' + reachSnapshot.direction.toUpperCase() + ' REACH'
+ : 'ARCHIFY · ' + presetLabel + ' · ' + theme.toUpperCase();
+
+ ctx.fillStyle = bg;
+ ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);
+
+ ctx.fillStyle = accent;
+ ctx.fillRect(SHARE_CARD_PADDING, 27, 42, 3);
+
+ ctx.textBaseline = 'alphabetic';
+ ctx.fillStyle = text;
+ var fittedTitle = fitCanvasText(ctx, title, SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2 - 330, 29, 18, '700');
+ ctx.fillText(fittedTitle, SHARE_CARD_PADDING, 62);
+
+ ctx.fillStyle = muted;
+ var fittedSubtitle = fitCanvasText(ctx, subtitle, SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2 - 280, 13, 11, '500');
+ ctx.fillText(fittedSubtitle, SHARE_CARD_PADDING, 87);
+
+ ctx.font = "600 12px 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";
+ ctx.textAlign = 'right';
+ ctx.fillStyle = accent;
+ ctx.fillText(cardLabel, SHARE_CARD_WIDTH - SHARE_CARD_PADDING, 50);
+ ctx.textAlign = 'left';
+
+ var availableWidth = SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2;
+ var availableHeight = SHARE_CARD_HEIGHT - SHARE_CARD_HEADER - SHARE_CARD_PADDING;
+ var fit = Math.min(availableWidth / data.width, availableHeight / data.height);
+ var drawWidth = data.width * fit;
+ var drawHeight = data.height * fit;
+ var drawX = SHARE_CARD_PADDING + (availableWidth - drawWidth) / 2;
+ var drawY = SHARE_CARD_HEADER + (availableHeight - drawHeight) / 2;
+
+ ctx.strokeStyle = border;
+ ctx.lineWidth = 1;
+ ctx.strokeRect(drawX - 0.5, drawY - 0.5, drawWidth + 1, drawHeight + 1);
+ ctx.drawImage(img, drawX, drawY, drawWidth, drawHeight);
+ URL.revokeObjectURL(svgUrl);
+
+ canvas.toBlob(function (blob) {
+ if (!blob) reject(new Error('toBlob returned null for Share Card'));
+ else resolve(blob);
+ }, 'image/png');
+ } catch (error) {
+ URL.revokeObjectURL(svgUrl);
+ reject(error);
+ }
};
img.onerror = function (e) {
URL.revokeObjectURL(svgUrl);
@@ -4925,6 +5983,24 @@
});
}
+ function rasterizeShareCard(options) {
+ options = options || {};
+ if (!options.variant) return renderShareCard();
+ 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() {
if (typeof MediaRecorder === 'undefined') return '';
var candidates = [
@@ -5187,10 +6263,30 @@
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"]'));
};
+ function syncRouteShareItem() {
+ var snapshot = Archify.routeProbe && typeof Archify.routeProbe.exportSnapshot === 'function'
+ ? Archify.routeProbe.exportSnapshot()
+ : null;
+ routeShareItem.hidden = !snapshot;
+ routeShareItem.disabled = !snapshot;
+ 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' &&
@@ -5247,11 +6343,14 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
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.disabled; });
+ var available = items().filter(function (i) { return !i.hidden && !i.disabled; });
var target = focusLast ? available[available.length - 1] : available[0];
if (target) target.focus();
}
@@ -5285,7 +6384,7 @@
if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
if (e.key === 'Tab') { close(false); return; }
- var available = items().filter(function (i) { return !i.disabled; });
+ var available = items().filter(function (i) { return !i.hidden && !i.disabled; });
var current = available.indexOf(document.activeElement);
switch (e.key) {
case 'ArrowDown':
@@ -5310,8 +6409,7 @@
function runExport(format) {
var base = diagramFilename();
close(true);
- document.documentElement.removeAttribute('data-last-export-error');
- document.documentElement.removeAttribute('data-last-export-error-format');
+ clearExportReceipt();
if (format === 'webm') toast('Recording 6 seconds of motion…');
return (format === 'share-card'
? rasterizeShareCard().then(function (blob) {
@@ -5355,13 +6453,72 @@
});
}
+ function runRouteShareCard() {
+ close(false);
+ clearExportReceipt();
+ var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();
+ var blobPromise = snapshot
+ ? renderShareCard({ routeSnapshot: snapshot })
+ : Promise.reject(new Error('Trace a route before exporting a Route Share Card'));
+ return blobPromise.then(function (blob) {
+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'route', true);
+ download(blob, diagramFilename() + '-route-share-card.png');
+ toast('Downloaded Route 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('Route Share Card export failed: ' + message);
+ });
+ }
+
+ 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) {
+ 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');
+ if (variant) {
+ document.documentElement.setAttribute('data-last-export-variant', variant);
+ } else {
+ document.documentElement.removeAttribute('data-last-export-variant');
+ }
+ if (routeStateClean === true) {
+ document.documentElement.setAttribute('data-last-export-route-state-clean', 'true');
+ } 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));
@@ -5377,6 +6534,9 @@
document.documentElement.removeAttribute('data-last-export-canonical');
document.documentElement.removeAttribute('data-last-export-width');
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');
}
@@ -5418,6 +6578,7 @@
function runCopy() {
close(true);
+ clearExportReceipt();
if (!canCopyImage()) {
alert('Clipboard image write not supported in this browser.');
return;
@@ -5432,6 +6593,12 @@
}
menu.addEventListener('click', function (e) {
+ 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; }
@@ -5443,7 +6610,18 @@
});
Archify.motion = { canRecord: canRecordMotion, recordWebm: recordWebm };
- Archify.exportMenu = { open: open, close: close, isOpen: isOpen, run: runExport, shareCard: rasterizeShareCard, copyShareCard: runCopyShareCard };
+ Archify.exportMenu = {
+ open: open,
+ close: close,
+ isOpen: isOpen,
+ run: runExport,
+ shareCard: rasterizeShareCard,
+ downloadRouteShareCard: runRouteShareCard,
+ downloadReachShareCard: runReachShareCard,
+ syncRouteShare: syncRouteShareItem,
+ syncReachShare: syncReachShareItem,
+ copyShareCard: runCopyShareCard
+ };
// Auto-open on page load for demo/screenshot purposes: ?openExport=1
// Wait for fonts (so the menu doesn't flash before typography lands)
@@ -5728,6 +6906,76 @@
};
})();
+ /* Verified repository evidence is emitted only after the renderer checks
+ the authored GitHub revision, source blobs, and optional line ranges
+ against the explicit --repo-root. It remains outside the SVG so every
+ canonical visual export stays free of repository paths. */
+ Archify.sourceEvidence = (function () {
+ var element = document.getElementById('archify-source-evidence-data');
+ var payload = null;
+ var svgNamespace = 'http://www.w3.org/2000/svg';
+ if (element) {
+ try {
+ var parsed = JSON.parse(element.textContent || 'null');
+ if (parsed && parsed.verified === true && parsed.repository && parsed.nodes) payload = parsed;
+ } catch (_) {}
+ }
+ function installBeacons() {
+ if (!payload) return 0;
+ var svg = document.querySelector('.diagram-container svg');
+ if (!svg) return 0;
+ var installed = 0;
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {
+ var id = node.getAttribute('data-node-id');
+ var sources = payload.nodes[id];
+ if (!Array.isArray(sources) || !sources.length || node.querySelector('[data-source-evidence-beacon]')) return;
+ var shape = node.querySelector('[data-animate="node"]') || node.querySelector('[class*="c-"]');
+ var box;
+ try { box = (shape || node).getBBox(); } catch (_) { return; }
+ if (!box || !Number.isFinite(box.x) || !Number.isFinite(box.y) || !Number.isFinite(box.width) || box.width < 36) return;
+
+ var count = sources.length;
+ var label = count + ' verified source' + (count === 1 ? '' : 's') + '; focus this node to inspect';
+ var beacon = document.createElementNS(svgNamespace, 'g');
+ beacon.classList.add('source-evidence-beacon');
+ beacon.setAttribute('data-source-evidence-beacon', '');
+ beacon.setAttribute('aria-hidden', 'true');
+ beacon.setAttribute('transform', 'translate(' + (box.x + box.width - 35) + ' ' + (box.y + 5) + ')');
+ var title = document.createElementNS(svgNamespace, 'title');
+ title.textContent = label;
+ var plate = document.createElementNS(svgNamespace, 'rect');
+ plate.setAttribute('width', '30');
+ plate.setAttribute('height', '12');
+ plate.setAttribute('rx', '6');
+ var text = document.createElementNS(svgNamespace, 'text');
+ text.setAttribute('x', '15');
+ text.setAttribute('y', '8.25');
+ text.textContent = 'SRC ' + count;
+ beacon.appendChild(title);
+ beacon.appendChild(plate);
+ beacon.appendChild(text);
+ node.appendChild(beacon);
+
+ var originalLabel = node.getAttribute('aria-label') || '';
+ node.setAttribute('data-source-evidence-count', String(count));
+ node.setAttribute('data-source-evidence-original-label', originalLabel);
+ node.setAttribute('aria-label', (originalLabel ? originalLabel + ', ' : '') + count + ' verified source reference' + (count === 1 ? '' : 's'));
+ installed += 1;
+ });
+ return installed;
+ }
+ return {
+ available: function () { return Boolean(payload); },
+ repository: function () { return payload ? payload.repository : null; },
+ node: function (id) {
+ var sources = payload && payload.nodes ? payload.nodes[id] : null;
+ return Array.isArray(sources) ? sources.slice() : [];
+ },
+ installBeacons: installBeacons
+ };
+ })();
+ Archify.sourceEvidence.installBeacons();
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -5744,7 +6992,16 @@
var context = document.getElementById('focus-context');
var tag = document.getElementById('focus-tag');
var semanticId = document.getElementById('focus-id');
+ var evidence = document.getElementById('focus-evidence');
+ var repositoryLink = document.getElementById('focus-repository');
+ var evidenceLinks = document.getElementById('focus-evidence-links');
var summary = document.getElementById('focus-summary');
+ var reachSection = document.getElementById('focus-reach');
+ var reachStatus = document.getElementById('focus-reach-status');
+ var upstreamBtn = document.getElementById('btn-reach-upstream');
+ var downstreamBtn = document.getElementById('btn-reach-downstream');
+ var upstreamCount = document.getElementById('focus-reach-upstream-count');
+ var downstreamCount = document.getElementById('focus-reach-downstream-count');
var relationshipList = document.getElementById('relationship-lens-list');
var copyBtn = document.getElementById('btn-focus-copy');
var relationsBtn = document.getElementById('btn-focus-relations');
@@ -5758,6 +7015,8 @@
var relationshipHitOverlay = null;
var relationshipHitTargets = [];
var directPreviewTimer = null;
+ var reachabilityMode = null;
+ var activeReachability = null;
var svgNamespace = 'http://www.w3.org/2000/svg';
var reducedMotionQuery = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;
var finePointerQuery = window.matchMedia ? window.matchMedia('(hover: hover) and (pointer: fine)') : null;
@@ -5771,11 +7030,318 @@
function nodeLabel(node, fallback) {
return node.getAttribute('data-node-label') || (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '');
}
+ function reachabilityRelationships() {
+ var seen = Object.create(null);
+ var relationships = [];
+ edges().forEach(function (edge) {
+ var from = edge.getAttribute('data-edge-from');
+ var to = edge.getAttribute('data-edge-to');
+ var key = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + (edge.getAttribute('data-edge-label') || ''));
+ if (!from || !to || seen[key]) return;
+ seen[key] = true;
+ relationships.push({ key: key, from: from, to: to });
+ });
+ return relationships;
+ }
+ function computeReachability(originId, direction, relationships) {
+ if (typeof originId !== 'string' || !originId ||
+ (direction !== 'upstream' && direction !== 'downstream') ||
+ !Array.isArray(relationships)) return null;
+ var records = [];
+ var seenKeys = Object.create(null);
+ relationships.forEach(function (relationship, index) {
+ if (!relationship || typeof relationship.from !== 'string' || !relationship.from ||
+ typeof relationship.to !== 'string' || !relationship.to) return;
+ var key = typeof relationship.key === 'string' && relationship.key
+ ? relationship.key : String(index);
+ if (seenKeys[key]) return;
+ seenKeys[key] = true;
+ records.push({ key: key, from: relationship.from, to: relationship.to });
+ });
+
+ var depths = Object.create(null);
+ var order = [];
+ var queue = [originId];
+ depths[originId] = 0;
+ for (var cursor = 0; cursor < queue.length; cursor += 1) {
+ var current = queue[cursor];
+ records.forEach(function (relationship) {
+ var next = null;
+ if (direction === 'downstream' && relationship.from === current) next = relationship.to;
+ else if (direction === 'upstream' && relationship.to === current) next = relationship.from;
+ if (next == null || Object.prototype.hasOwnProperty.call(depths, next)) return;
+ depths[next] = depths[current] + 1;
+ queue.push(next);
+ });
+ }
+ queue.forEach(function (id) { order.push(id); });
+
+ var edgeKeys = [];
+ records.forEach(function (relationship) {
+ if (Object.prototype.hasOwnProperty.call(depths, relationship.from) &&
+ Object.prototype.hasOwnProperty.call(depths, relationship.to)) edgeKeys.push(relationship.key);
+ });
+ var maxDepth = order.reduce(function (maximum, id) {
+ return Math.max(maximum, depths[id]);
+ }, 0);
+ return {
+ direction: direction,
+ originId: originId,
+ nodeIds: order,
+ edgeKeys: edgeKeys,
+ depths: depths,
+ maxDepth: maxDepth
+ };
+ }
+ function reachabilityFor(id, direction) {
+ return computeReachability(id, direction, reachabilityRelationships());
+ }
+ function resetReachabilityButtons() {
+ upstreamBtn.setAttribute('aria-pressed', 'false');
+ downstreamBtn.setAttribute('aria-pressed', 'false');
+ }
+ function clearReachability(options) {
+ options = options || {};
+ reachabilityMode = null;
+ activeReachability = null;
+ svg.removeAttribute('data-reach-active');
+ chip.removeAttribute('data-reach-mode');
+ nodes().forEach(function (node) {
+ node.removeAttribute('data-reach-match');
+ node.removeAttribute('data-reach-origin');
+ node.removeAttribute('data-reach-depth');
+ });
+ edges().forEach(function (edge) {
+ edge.removeAttribute('data-reach-match');
+ edge.removeAttribute('data-reach-depth');
+ });
+ 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]));
+ } catch (_) {}
+ }
+ }
+ function renderReachabilityControls(id) {
+ var upstream = reachabilityFor(id, 'upstream');
+ var downstream = reachabilityFor(id, 'downstream');
+ var upstreamReach = upstream ? Math.max(0, upstream.nodeIds.length - 1) : 0;
+ var downstreamReach = downstream ? Math.max(0, downstream.nodeIds.length - 1) : 0;
+ upstreamCount.textContent = String(upstreamReach);
+ downstreamCount.textContent = String(downstreamReach);
+ upstreamBtn.disabled = upstreamReach === 0;
+ downstreamBtn.disabled = downstreamReach === 0;
+ upstreamBtn.setAttribute('aria-label', upstreamReach
+ ? 'Trace ' + upstreamReach + ' upstream authored node' + (upstreamReach === 1 ? '' : 's')
+ : 'No upstream authored nodes');
+ downstreamBtn.setAttribute('aria-label', downstreamReach
+ ? 'Trace ' + downstreamReach + ' downstream authored node' + (downstreamReach === 1 ? '' : 's')
+ : 'No downstream authored nodes');
+ reachSection.hidden = false;
+ }
+ function applyReachability(direction, options) {
+ options = options || {};
+ if (activeIds.length !== 1 || (direction !== 'upstream' && direction !== 'downstream')) return false;
+ if (reachabilityMode === direction && options.toggle !== false) {
+ clearReachability({ updateUrl: options.updateUrl !== false });
+ return true;
+ }
+ var result = reachabilityFor(activeIds[0], direction);
+ if (!result || result.nodeIds.length <= 1) return false;
+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {
+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false, resetView: false });
+ }
+ clearRelationshipPreview({ clearPin: true });
+ clearReachability({ updateUrl: false });
+ reachabilityMode = direction;
+ activeReachability = result;
+ var edgeKeySet = Object.create(null);
+ result.edgeKeys.forEach(function (key) { edgeKeySet[key] = true; });
+ svg.setAttribute('data-reach-active', direction);
+ chip.setAttribute('data-reach-mode', direction);
+ nodes().forEach(function (node) {
+ var id = node.getAttribute('data-node-id');
+ if (!Object.prototype.hasOwnProperty.call(result.depths, id)) return;
+ node.setAttribute('data-reach-match', '');
+ node.setAttribute('data-reach-depth', String(result.depths[id]));
+ if (id === result.originId) node.setAttribute('data-reach-origin', '');
+ });
+ edges().forEach(function (edge) {
+ var key = edge.getAttribute('data-edge-key') || (
+ edge.getAttribute('data-edge-from') + '\u0000' +
+ edge.getAttribute('data-edge-to') + '\u0000' +
+ (edge.getAttribute('data-edge-label') || '')
+ );
+ if (!edgeKeySet[key]) return;
+ edge.setAttribute('data-reach-match', '');
+ var fromDepth = result.depths[edge.getAttribute('data-edge-from')];
+ var toDepth = result.depths[edge.getAttribute('data-edge-to')];
+ edge.setAttribute('data-reach-depth', String(Math.max(fromDepth || 0, toDepth || 0)));
+ });
+ resetReachabilityButtons();
+ var activeButton = direction === 'upstream' ? upstreamBtn : downstreamBtn;
+ activeButton.setAttribute('aria-pressed', 'true');
+ var reachableCount = result.nodeIds.length - 1;
+ var directionLabel = direction === 'upstream' ? 'Upstream' : 'Downstream';
+ reachStatus.textContent = directionLabel + ' · ' + reachableCount + ' node' +
+ (reachableCount === 1 ? '' : 's') + ' · ' + result.edgeKeys.length + ' link' +
+ (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=' +
+ encodeURIComponent(activeIds[0]) + '&reach=' + direction);
+ } catch (_) {}
+ }
+ if (options.reveal !== false && Archify.view && typeof Archify.view.reveal === 'function') {
+ Archify.view.reveal(result.nodeIds, { includeNeighbors: false, reason: 'reachability' });
+ }
+ 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;
element.hidden = !normalized;
}
+ function renderSourceEvidence(id) {
+ evidenceLinks.textContent = '';
+ repositoryLink.removeAttribute('href');
+ repositoryLink.textContent = '';
+ var sources = Archify.sourceEvidence.node(id);
+ var repository = Archify.sourceEvidence.repository();
+ if (!repository || !sources.length) {
+ evidence.hidden = true;
+ return;
+ }
+ var slug = repository.url.replace(/^https:\/\/github\.com\//, '').replace(/\/$/, '');
+ repositoryLink.href = repository.url + '/tree/' + repository.revision;
+ repositoryLink.textContent = slug + ' @ ' + repository.shortRevision;
+ repositoryLink.setAttribute('aria-label', 'Open verified repository revision ' + repository.revision);
+ sources.forEach(function (source) {
+ var link = document.createElement('a');
+ link.className = 'semantic-passport-source';
+ link.href = source.href;
+ link.target = '_blank';
+ link.rel = 'noopener noreferrer';
+ link.referrerPolicy = 'no-referrer';
+ link.setAttribute('aria-label', 'Open verified source ' + source.path + ' at revision ' + repository.shortRevision);
+ var name = document.createElement('strong');
+ name.textContent = source.label || source.path.split('/').pop() || source.path;
+ var location = document.createElement('code');
+ location.textContent = source.line
+ ? 'L' + source.line + (source.endLine && source.endLine !== source.line ? '–' + source.endLine : '') + ' ↗'
+ : 'Open ↗';
+ var sourcePath = document.createElement('small');
+ sourcePath.textContent = source.path;
+ link.appendChild(name);
+ link.appendChild(location);
+ link.appendChild(sourcePath);
+ evidenceLinks.appendChild(link);
+ });
+ evidence.hidden = false;
+ }
function renderPassport(id, node) {
setPassportValue(detail, node.getAttribute('data-node-sublabel'));
setPassportValue(kind, node.getAttribute('data-node-kind') || 'node');
@@ -5783,6 +7349,7 @@
setPassportValue(tag, node.getAttribute('data-node-tag'));
semanticId.textContent = id;
semanticId.hidden = false;
+ renderSourceEvidence(id);
}
function relationshipsFor(id, byId) {
var seen = {};
@@ -6340,6 +7907,7 @@
var counts = { out: 0, in: 0, loop: 0 };
relationships.forEach(function (relationship) { counts[relationship.direction] += 1; });
summary.textContent = counts.out + ' outgoing · ' + counts.in + ' incoming' + (counts.loop ? ' · ' + counts.loop + ' loop' : '');
+ renderReachabilityControls(id);
relationshipList.textContent = '';
if (!relationships.length) {
var empty = document.createElement('p');
@@ -6436,6 +8004,10 @@
}
function clear(options) {
options = options || {};
+ var restoreNode = options.restoreFocus === true && activeIds.length === 1
+ ? svg.querySelector('[data-node-id="' + activeIds[0] + '"]')
+ : null;
+ clearReachability({ updateUrl: false });
if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') {
Archify.intentTrace.clear({ announce: false });
}
@@ -6462,7 +8034,16 @@
tag.hidden = true;
semanticId.textContent = '';
semanticId.hidden = true;
+ evidence.hidden = true;
+ evidenceLinks.textContent = '';
+ repositoryLink.removeAttribute('href');
+ repositoryLink.textContent = '';
summary.textContent = '';
+ reachSection.hidden = true;
+ upstreamCount.textContent = '0';
+ downstreamCount.textContent = '0';
+ upstreamBtn.disabled = true;
+ downstreamBtn.disabled = true;
relationshipList.textContent = '';
copyBtn.textContent = 'Copy link';
copyBtn.setAttribute('aria-label', 'Copy link to focused node');
@@ -6477,6 +8058,10 @@
if (options.updateUrl !== false) {
try { history.replaceState(null, '', location.pathname + location.search); } catch (_) {}
}
+ if (restoreNode) {
+ try { restoreNode.focus({ preventScroll: true }); }
+ catch (_) { try { restoreNode.focus(); } catch (_) {} }
+ }
}
function setMany(ids, options) {
@@ -6572,7 +8157,7 @@
var relationId = record && record.id;
var value = location.href.replace(/#.*$/, '') + (relationId
? '#relation=' + encodeURIComponent(relationId)
- : '#focus=' + encodeURIComponent(activeIds[0]));
+ : '#focus=' + encodeURIComponent(activeIds[0]) + (reachabilityMode ? '&reach=' + reachabilityMode : ''));
var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'
? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })
: Promise.resolve(fallbackCopy(value));
@@ -6610,8 +8195,10 @@
Archify.view.reveal([id], { includeNeighbors: true, reason: 'focus' });
}
});
- clearBtn.addEventListener('click', function () { clear(); });
+ clearBtn.addEventListener('click', function () { clear({ restoreFocus: true }); });
copyBtn.addEventListener('click', copyFocusLink);
+ upstreamBtn.addEventListener('click', function () { applyReachability('upstream'); });
+ downstreamBtn.addEventListener('click', function () { applyReachability('downstream'); });
relationsBtn.addEventListener('click', function () {
var expanded = chip.getAttribute('data-relations-expanded') === 'true';
if (expanded) chip.removeAttribute('data-relations-expanded');
@@ -6675,6 +8262,13 @@
event.preventDefault();
buttons[index].focus();
});
+ document.addEventListener('click', function (event) {
+ var target = event.target;
+ if (chip.hidden || !target || typeof target.closest !== 'function' || chip.contains(target)) return;
+ if (container.getAttribute('data-just-panned') === 'true') return;
+ if (target.closest('[data-node-id], [data-relationship-hit-key]')) return;
+ clear();
+ }, true);
window.addEventListener('scroll', requestLensPlacement, { passive: true });
window.addEventListener('resize', requestLensPlacement);
container.addEventListener('scroll', requestLensPlacement, { passive: true });
@@ -6699,11 +8293,17 @@
var params = new URLSearchParams(location.hash.replace(/^#/, ''));
var relation = params.get('relation');
var initial = params.get('focus');
+ var reach = params.get('reach');
if (relation) {
if (html.getAttribute('data-embed') === 'true' ||
!inspectRelationshipById(relation, { updateUrl: false, toggle: false })) clear({ updateUrl: false });
}
- else if (initial) set(initial, { updateUrl: false, toggle: false });
+ else if (initial) {
+ if (set(initial, { updateUrl: false, toggle: false }) &&
+ (reach === 'upstream' || reach === 'downstream')) {
+ applyReachability(reach, { updateUrl: false, toggle: false, reveal: false });
+ }
+ }
else if (!params.get('view')) clear({ updateUrl: false });
} catch (_) {}
}
@@ -6716,6 +8316,9 @@
setMany: setMany,
clear: clear,
copyLink: copyFocusLink,
+ reach: applyReachability,
+ clearReach: clearReachability,
+ reachabilitySnapshot: reachabilitySnapshot,
inspectRelationship: inspectRelationship,
inspectRelationshipById: inspectRelationshipById,
reposition: requestLensPlacement,
@@ -6723,6 +8326,15 @@
var record = pinnedRelationshipRecord();
return record ? { id: record.id || null, key: record.key, from: record.from, to: record.to, label: record.label } : null;
},
+ reachability: function () {
+ return activeReachability ? {
+ direction: activeReachability.direction,
+ originId: activeReachability.originId,
+ nodeIds: activeReachability.nodeIds.slice(),
+ edgeKeys: activeReachability.edgeKeys.slice(),
+ maxDepth: activeReachability.maxDepth
+ } : null;
+ },
active: function () { return activeIds.length === 0 ? null : (activeIds.length === 1 ? activeIds[0] : activeIds.slice()); }
};
})();
@@ -9483,6 +11095,10 @@
var context = node.getAttribute('data-node-context') || '';
var tag = node.getAttribute('data-node-tag') || '';
var type = semanticType(node);
+ var sources = Archify.sourceEvidence.node(id);
+ var sourceSearch = sources.map(function (source) {
+ return [source.path, source.label, source.line, source.endLine].filter(Boolean).join(' ');
+ }).join(' ');
return {
id: id,
label: label,
@@ -9490,8 +11106,9 @@
sublabel: sublabel,
context: context,
tag: tag,
+ sources: sources,
links: connectionsFor(id),
- search: (id + ' ' + label + ' ' + type + ' ' + sublabel + ' ' + context + ' ' + tag + ' ' + text).toLowerCase(),
+ search: (id + ' ' + label + ' ' + type + ' ' + sublabel + ' ' + context + ' ' + tag + ' ' + sourceSearch + ' ' + text).toLowerCase(),
node: node
};
});
@@ -9560,7 +11177,11 @@
button.type = 'button';
button.className = 'node-finder-result';
button.setAttribute('data-node-id', item.id);
- var badge = context.badges && context.badges[item.id] ? context.badges[item.id] : String(item.links);
+ var badge = context.badges && context.badges[item.id]
+ ? context.badges[item.id]
+ : context.kind === 'focus'
+ ? item.links + (item.links === 1 ? ' link' : ' links')
+ : String(item.links);
var action = context.kind === 'route-source'
? 'Choose ' + item.label + ' as route start'
: context.kind === 'route-target'
@@ -9572,11 +11193,10 @@
name.textContent = item.label;
var links = document.createElement('em');
links.textContent = badge;
- links.title = context.kind === 'focus'
- ? item.links + ' related connection' + (item.links === 1 ? '' : 's')
- : action;
+ links.title = context.kind === 'focus' ? badge : action;
var meta = document.createElement('small');
- meta.textContent = [item.type, item.context, item.sublabel, item.tag, item.id].filter(Boolean).join(' \u00b7 ');
+ meta.textContent = [item.type, item.id, item.sublabel, item.tag].filter(Boolean).join(' \u00b7 ');
+ meta.title = [item.type, item.id, item.context, item.sublabel, item.tag].filter(Boolean).join(' \u00b7 ');
button.appendChild(name);
button.appendChild(links);
button.appendChild(meta);
@@ -9584,7 +11204,9 @@
results.appendChild(button);
});
empty.hidden = visibleItems.length !== 0;
- status.textContent = visibleItems.length + ' of ' + available.length + ' ' + context.availableNoun + (query ? ' match' : ' available');
+ status.textContent = query
+ ? visibleItems.length + ' of ' + available.length + ' ' + context.availableNoun
+ : available.length + ' ' + context.availableNoun;
}
function open(options) {
@@ -9717,7 +11339,7 @@
return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));
}
function nodesById() {
- var out = {};
+ var out = Object.create(null);
nodes().forEach(function (node) { out[node.getAttribute('data-node-id')] = node; });
return out;
}
@@ -9725,6 +11347,54 @@
return node.getAttribute('data-node-label') ||
(node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];
}
+ function exportSnapshot() {
+ if (mode !== 'result' || activeNodeIds.length < 2 || activeEdges.length !== activeNodeIds.length - 1) return null;
+ var allNodes = nodes();
+ var byId = nodesById();
+ var seenNodeIds = Object.create(null);
+ var seenEdgeKeys = Object.create(null);
+ if (startId !== activeNodeIds[0] || endId !== activeNodeIds[activeNodeIds.length - 1] ||
+ activeNodeIds.some(function (id) {
+ if (seenNodeIds[id] || allNodes.filter(function (node) {
+ return node.getAttribute('data-node-id') === id;
+ }).length !== 1) return true;
+ seenNodeIds[id] = true;
+ return !byId[id];
+ }) ||
+ activeEdges.some(function (edge, index) {
+ if (!edge || !svg.contains(edge)) return true;
+ var edgeKey = edge.getAttribute('data-edge-key');
+ var edgeId = edge.getAttribute('data-edge-id') || '';
+ if (!edgeKey || seenEdgeKeys[edgeKey]) return true;
+ seenEdgeKeys[edgeKey] = true;
+ var fragments = Array.prototype.slice.call(svg.querySelectorAll('[data-edge-key]')).filter(function (candidate) {
+ return candidate.getAttribute('data-edge-key') === edgeKey;
+ });
+ var drawableFragments = fragments.filter(hasDrawableGeometry);
+ return !fragments.length || !fragments.every(function (fragment) {
+ return fragment.getAttribute('data-edge-from') === activeNodeIds[index] &&
+ fragment.getAttribute('data-edge-to') === activeNodeIds[index + 1] &&
+ (fragment.getAttribute('data-edge-id') || '') === edgeId;
+ }) || drawableFragments.length !== 1 || drawableFragments[0] !== edge ||
+ edge.getAttribute('data-edge-from') !== activeNodeIds[index] ||
+ edge.getAttribute('data-edge-to') !== activeNodeIds[index + 1];
+ })) return null;
+ return {
+ source: { id: startId, label: nodeLabel(byId[startId], startId) },
+ target: { id: endId, label: nodeLabel(byId[endId], endId) },
+ nodeIds: activeNodeIds.slice(),
+ hops: activeEdges.length,
+ edges: activeEdges.map(function (edge) {
+ return {
+ key: edge.getAttribute('data-edge-key'),
+ id: edge.getAttribute('data-edge-id') || '',
+ from: edge.getAttribute('data-edge-from'),
+ to: edge.getAttribute('data-edge-to'),
+ label: edge.getAttribute('data-edge-label') || ''
+ };
+ })
+ };
+ }
function edgeShapes(edge) {
if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];
return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));
@@ -9873,6 +11543,7 @@
findBtn.setAttribute('aria-label', 'Find a route start');
copyBtn.hidden = true;
copyBtn.textContent = 'Copy link';
+ if (Archify.exportMenu && typeof Archify.exportMenu.syncRouteShare === 'function') Archify.exportMenu.syncRouteShare();
setTrigger(false);
if (wasActive && options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {
Archify.view.reset({ automatic: true });
@@ -10352,6 +12023,7 @@
findBtn.hidden = true;
copyBtn.hidden = false;
setTrigger(true);
+ if (Archify.exportMenu && typeof Archify.exportMenu.syncRouteShare === 'function') Archify.exportMenu.syncRouteShare();
if (options.updateUrl !== false) {
replaceRouteHash(encodeURIComponent(startId) + '~' + encodeURIComponent(endId));
}
@@ -10622,6 +12294,7 @@
finderOpening: finderOpening,
finderClosed: finderClosed,
openFinder: openFinder,
+ exportSnapshot: exportSnapshot,
active: function () { return mode === 'idle' ? null : mode; },
result: function () {
return mode === 'result'
@@ -11501,6 +13174,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -11537,6 +13213,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
@@ -11557,7 +13236,7 @@
Archify.intentTrace.clear();
} else if (e.key === 'Escape' && Archify.focus.active()) {
e.preventDefault();
- Archify.focus.clear();
+ Archify.focus.clear({ restoreFocus: true });
} else if (e.key === 'Escape' && Archify.presentation.active()) {
e.preventDefault();
Archify.presentation.exit();
diff --git a/examples/sequence-cache-miss-request.html b/examples/sequence-cache-miss-request.html
index 3f727132..3574d859 100644
--- a/examples/sequence-cache-miss-request.html
+++ b/examples/sequence-cache-miss-request.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4875,6 +5060,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4893,16 +5082,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6094,6 +6347,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12924,6 +13178,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12960,6 +13217,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/examples/web-app-rendered.html b/examples/web-app-rendered.html
index c4c94f73..02ad0191 100644
--- a/examples/web-app-rendered.html
+++ b/examples/web-app-rendered.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4840,6 +5025,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4858,16 +5047,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6059,6 +6312,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12889,6 +13143,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12925,6 +13182,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/examples/web-app.html b/examples/web-app.html
index c4c94f73..02ad0191 100644
--- a/examples/web-app.html
+++ b/examples/web-app.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4840,6 +5025,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4858,16 +5047,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6059,6 +6312,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12889,6 +13143,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12925,6 +13182,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/examples/workflow-agent-tool-call-rendered.html b/examples/workflow-agent-tool-call-rendered.html
index ec2ff0ce..d4c59fb5 100644
--- a/examples/workflow-agent-tool-call-rendered.html
+++ b/examples/workflow-agent-tool-call-rendered.html
@@ -2907,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2934,7 +2935,154 @@
box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
transform: rotate(45deg) scale(0.72);
}
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
html[data-preset="editorial"] .export-menu,
html[data-preset="editorial"] .overview-map,
html[data-preset="editorial"] .semantic-lens,
@@ -3023,8 +3171,15 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
@@ -4259,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4904,6 +5089,10 @@
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4922,16 +5111,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -6123,6 +6376,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -12953,6 +13207,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12989,6 +13246,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
diff --git a/experiments/mco-showcase/mco-runtime.html b/experiments/mco-showcase/mco-runtime.html
index fb11eade..97fa8d77 100644
--- a/experiments/mco-showcase/mco-runtime.html
+++ b/experiments/mco-showcase/mco-runtime.html
@@ -271,6 +271,83 @@
--toolbar-menu-bg: #f9fdff;
}
+ /* ==========================================================
+ EDITORIAL — a warm, publication-minded preset for design
+ reviews, launch notes, and documentation. The diagram keeps
+ the same semantic palette and exact geometry, but trades
+ software chrome for paper, ink, ruled structure, and one
+ restrained vermilion accent.
+ ========================================================== */
+ [data-preset="editorial"][data-theme="dark"] {
+ --bg: #181611;
+ --grid: #39342a;
+ --panel: rgba(35, 31, 24, 0.96);
+ --panel-border: #625a4a;
+ --lane-fill: rgba(52, 46, 35, 0.46);
+ --lane-stroke: #726957;
+ --text: #f4eddf;
+ --text-muted: #b9ae9b;
+ --text-dim: #776e60;
+ --text-faint: #9d917e;
+ --mask: #231f18;
+ --frontend-fill: rgba(43, 133, 142, 0.16);
+ --frontend-stroke: #7fc6c7;
+ --backend-fill: rgba(63, 132, 92, 0.16);
+ --backend-stroke: #8fc29e;
+ --database-fill: rgba(117, 91, 141, 0.17);
+ --database-stroke: #c0a4d0;
+ --cloud-fill: rgba(170, 119, 49, 0.16);
+ --cloud-stroke: #d8ad68;
+ --security-fill: rgba(157, 69, 65, 0.17);
+ --security-stroke: #df9085;
+ --messagebus-fill: rgba(174, 79, 42, 0.16);
+ --messagebus-stroke: #df946f;
+ --external-fill: rgba(126, 115, 96, 0.18);
+ --external-stroke: #b8ad99;
+ --arrow: #948978;
+ --arrow-emphasis: #dd6b3d;
+ --toolbar-bg: rgba(35, 31, 24, 0.92);
+ --toolbar-border: #625a4a;
+ --toolbar-text: #eee5d5;
+ --toolbar-hover: #302a20;
+ --toolbar-menu-bg: #231f18;
+ }
+
+ [data-preset="editorial"][data-theme="light"] {
+ --bg: #f2eee5;
+ --grid: #d8d0c2;
+ --panel: rgba(251, 248, 241, 0.97);
+ --panel-border: #c4b9a6;
+ --lane-fill: rgba(229, 221, 207, 0.42);
+ --lane-stroke: #b8aa94;
+ --text: #242018;
+ --text-muted: #6f6658;
+ --text-dim: #a09788;
+ --text-faint: #817767;
+ --mask: #fbf8f1;
+ --frontend-fill: rgba(31, 117, 126, 0.09);
+ --frontend-stroke: #287e84;
+ --backend-fill: rgba(42, 119, 75, 0.09);
+ --backend-stroke: #397b53;
+ --database-fill: rgba(105, 75, 130, 0.09);
+ --database-stroke: #765d86;
+ --cloud-fill: rgba(157, 103, 31, 0.1);
+ --cloud-stroke: #9a671f;
+ --security-fill: rgba(153, 58, 52, 0.09);
+ --security-stroke: #9e463f;
+ --messagebus-fill: rgba(182, 70, 27, 0.09);
+ --messagebus-stroke: #ad4b25;
+ --external-fill: rgba(101, 91, 75, 0.09);
+ --external-stroke: #746b5e;
+ --arrow: #8a806f;
+ --arrow-emphasis: #bb4c23;
+ --toolbar-bg: rgba(251, 248, 241, 0.94);
+ --toolbar-border: #c4b9a6;
+ --toolbar-text: #40392f;
+ --toolbar-hover: #fffdf8;
+ --toolbar-menu-bg: #fbf8f1;
+ }
+
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
@@ -301,6 +378,12 @@
background-position: -1px -1px;
background-attachment: fixed;
}
+ html[data-preset="editorial"] body {
+ background-image:
+ linear-gradient(90deg, transparent 0, transparent 5.4rem, color-mix(in srgb, var(--security-stroke) 18%, transparent) 5.4rem, color-mix(in srgb, var(--security-stroke) 18%, transparent) calc(5.4rem + 1px), transparent calc(5.4rem + 1px)),
+ repeating-linear-gradient(0deg, transparent 0, transparent 31px, color-mix(in srgb, var(--grid) 36%, transparent) 31px, color-mix(in srgb, var(--grid) 36%, transparent) 32px);
+ background-attachment: fixed;
+ }
/* Gallery/embed mode keeps the generated artifact as the source of truth
while presenting only its diagram surface inside a proof card. */
@@ -369,6 +452,20 @@
box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
backdrop-filter: none;
}
+ html[data-preset="editorial"] .share-chapter-cue {
+ border-color: var(--panel-border);
+ background:
+ linear-gradient(90deg, color-mix(in srgb, var(--security-fill) 58%, transparent), transparent 42%),
+ var(--toolbar-menu-bg);
+ box-shadow: 0 10px 30px color-mix(in srgb, #000 18%, transparent);
+ backdrop-filter: none;
+ }
+ html[data-preset="editorial"] .share-chapter-state { color: var(--arrow-emphasis); }
+ html[data-preset="editorial"] .share-chapter-state::before {
+ border-radius: 0;
+ box-shadow: none;
+ transform: rotate(45deg) scale(0.8);
+ }
.share-chapter-index {
display: grid;
gap: 0.12rem;
@@ -508,7 +605,8 @@
.header { margin-bottom: 2rem; padding-right: 29.5rem; }
html[data-preset="signal-flow"] .header,
- html[data-preset="blueprint"] .header { padding-right: 29.5rem; }
+ html[data-preset="blueprint"] .header,
+ html[data-preset="editorial"] .header { padding-right: 29.5rem; }
.header-row {
display: flex;
@@ -581,6 +679,36 @@
white-space: nowrap;
}
+ html[data-preset="editorial"] h1,
+ html[data-preset="editorial"] .card h3 {
+ font-family: Georgia, 'Times New Roman', 'Songti SC', STSong, serif;
+ letter-spacing: -0.02em;
+ }
+ html[data-preset="editorial"] h1 { font-size: 1.72rem; font-weight: 600; }
+ html[data-preset="editorial"] .pulse-dot {
+ width: 9px;
+ height: 9px;
+ border: 1px solid var(--arrow-emphasis);
+ border-radius: 0;
+ background: var(--arrow-emphasis);
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
+ transform: rotate(45deg);
+ animation: none;
+ }
+ html[data-preset="editorial"] .header-row::after {
+ content: "EDITORIAL / FIELD NOTE";
+ margin-left: auto;
+ padding: 0.32rem 0 0.24rem;
+ border-bottom: 2px solid var(--arrow-emphasis);
+ color: var(--arrow-emphasis);
+ font-family: Georgia, 'Times New Roman', serif;
+ font-size: 0.625rem;
+ font-style: italic;
+ font-weight: 600;
+ letter-spacing: 0.08em;
+ white-space: nowrap;
+ }
+
.diagram-container {
background: var(--panel);
border-radius: 1rem;
@@ -625,6 +753,35 @@
linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right bottom / 1px 1.35rem no-repeat;
opacity: 0.58;
}
+ html[data-preset="editorial"] .diagram-container {
+ overflow: hidden;
+ border-color: var(--panel-border);
+ border-radius: 0.38rem;
+ background:
+ linear-gradient(90deg, color-mix(in srgb, var(--security-fill) 58%, transparent), transparent 12%),
+ var(--panel);
+ box-shadow:
+ 0 1px 0 color-mix(in srgb, var(--text) 6%, transparent),
+ 0 18px 48px color-mix(in srgb, #000 19%, transparent);
+ }
+ html[data-preset="editorial"] .diagram-container::after {
+ position: absolute;
+ z-index: 10;
+ top: 0.72rem;
+ right: 1.25rem;
+ padding: 0.2rem 0.52rem;
+ border: 1px solid var(--panel-border);
+ background: var(--panel);
+ color: var(--arrow-emphasis);
+ content: "ARCHIFY / PLATE 04";
+ font-family: Georgia, 'Times New Roman', serif;
+ font-size: 0.52rem;
+ font-style: italic;
+ font-weight: 600;
+ letter-spacing: 0.09em;
+ pointer-events: none;
+ }
+ html[data-embed="true"][data-preset="editorial"] .diagram-container::after { display: none; }
html[data-motion-capable="true"][data-preset="signal-flow"][data-ambient-motion="running"] .diagram-container::before {
content: "";
position: absolute;
@@ -1354,10 +1511,25 @@
.relationship-lens-actions {
display: flex;
flex-direction: column;
- align-items: stretch;
+ align-items: flex-end;
gap: 0.18rem;
}
.relationship-lens-actions button { white-space: nowrap; }
+ .relationship-lens-actions #btn-focus-clear {
+ display: grid;
+ width: 1.75rem;
+ height: 1.75rem;
+ padding: 0;
+ place-items: center;
+ color: var(--text-muted);
+ font-size: 1rem;
+ line-height: 1;
+ }
+ .relationship-lens-actions #btn-focus-clear:hover,
+ .relationship-lens-actions #btn-focus-clear:focus-visible {
+ background: var(--toolbar-hover);
+ color: var(--text);
+ }
.relationship-lens-actions #btn-focus-copy { color: var(--frontend-stroke); }
.relationship-lens-actions #btn-focus-relations { display: none; }
.relationship-lens-eyebrow {
@@ -2540,6 +2712,22 @@
border-top: 2px solid var(--frontend-stroke);
}
+ html[data-preset="editorial"] .card {
+ position: relative;
+ border-radius: 0.28rem;
+ background: var(--panel);
+ box-shadow: 0 10px 28px color-mix(in srgb, #000 10%, transparent);
+ }
+ html[data-preset="editorial"] .card::before {
+ position: absolute;
+ top: -1px;
+ left: 1.25rem;
+ width: 3.25rem;
+ border-top: 3px solid var(--arrow-emphasis);
+ content: "";
+ }
+ html[data-preset="editorial"] .card-dot { border-radius: 0; transform: rotate(45deg) scale(0.78); }
+
.card-header {
display: flex;
align-items: center;
@@ -2719,6 +2907,7 @@
.toolbar #btn-motion[hidden] { display: none !important; }
.toolbar #btn-motion { min-width: 4.4rem; }
.toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }
+ .toolbar .preset-wrap { position: relative; }
.toolbar #btn-preset { min-width: 5.4rem; }
.preset-control-mark {
width: 0.58rem;
@@ -2739,6 +2928,172 @@
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);
transform: rotate(45deg) scale(0.84);
}
+ #btn-preset[data-preset-option="editorial"] .preset-control-mark {
+ border-color: var(--arrow-emphasis);
+ border-radius: 0;
+ background: var(--arrow-emphasis);
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);
+ transform: rotate(45deg) scale(0.72);
+ }
+ .toolbar .preset-menu {
+ position: absolute;
+ top: calc(100% + 0.375rem);
+ right: 0;
+ display: none;
+ width: 16.5rem;
+ padding: 0.4rem;
+ border: 1px solid var(--toolbar-border);
+ border-radius: 0.5rem;
+ background: var(--toolbar-menu-bg);
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
+ }
+ .toolbar .preset-menu.open { display: block; }
+ .preset-menu-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 0.42rem 0.6rem 0.55rem;
+ color: var(--text-faint);
+ font-size: 0.56rem;
+ letter-spacing: 0.13em;
+ text-transform: uppercase;
+ }
+ .preset-menu-heading span:last-child {
+ font-size: 0.52rem;
+ letter-spacing: 0.04em;
+ text-transform: none;
+ }
+ .toolbar .preset-option {
+ display: grid;
+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;
+ align-items: center;
+ gap: 0.68rem;
+ width: 100%;
+ min-height: 3.35rem;
+ padding: 0.5rem 0.62rem;
+ border: 0;
+ border-radius: 0.34rem;
+ background: transparent;
+ text-align: left;
+ }
+ .toolbar .preset-option:hover,
+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }
+ .preset-option-swatch {
+ position: relative;
+ width: 2rem;
+ height: 1.55rem;
+ overflow: hidden;
+ border: 1px solid #64748b;
+ border-radius: 0.24rem;
+ background: #0f172a;
+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
+ }
+ .preset-option-swatch::before,
+ .preset-option-swatch::after { position: absolute; content: ""; }
+ .preset-option-swatch.classic::before {
+ top: 0.42rem;
+ right: 0.35rem;
+ bottom: 0.42rem;
+ left: 0.35rem;
+ border: 1px solid #22d3ee;
+ border-radius: 0.16rem;
+ background: rgba(34, 211, 238, 0.14);
+ }
+ .preset-option-swatch.signal-flow {
+ border-color: #29415f;
+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);
+ }
+ .preset-option-swatch.signal-flow::before {
+ top: 50%;
+ right: 0.2rem;
+ left: 0.2rem;
+ height: 1px;
+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);
+ box-shadow: 0 0 8px #67e8f9;
+ }
+ .preset-option-swatch.signal-flow::after {
+ top: calc(50% - 0.13rem);
+ right: 0.28rem;
+ width: 0.26rem;
+ height: 0.26rem;
+ border-radius: 50%;
+ background: #67e8f9;
+ box-shadow: 0 0 7px #67e8f9;
+ }
+ .preset-option-swatch.blueprint {
+ border-color: #34799a;
+ border-radius: 0.08rem;
+ background-color: #0a2031;
+ background-image:
+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),
+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);
+ background-size: 0.42rem 0.42rem;
+ }
+ .preset-option-swatch.blueprint::before {
+ top: 0.34rem;
+ right: 0.38rem;
+ bottom: 0.34rem;
+ left: 0.38rem;
+ border: 1px solid #66d9ef;
+ }
+ .preset-option-swatch.editorial {
+ border-color: #b8aa94;
+ border-radius: 0.08rem;
+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);
+ }
+ .preset-option-swatch.editorial::before {
+ top: 0;
+ bottom: 0;
+ left: 0.42rem;
+ width: 1px;
+ background: #c9502d;
+ opacity: 0.72;
+ }
+ .preset-option-swatch.editorial::after {
+ top: 0.52rem;
+ right: 0.45rem;
+ width: 0.38rem;
+ height: 0.38rem;
+ background: #c9502d;
+ transform: rotate(45deg);
+ }
+ .preset-option-copy { min-width: 0; }
+ .preset-option-copy strong,
+ .preset-option-copy small { display: block; }
+ .preset-option-copy strong {
+ color: var(--toolbar-text);
+ font-size: 0.72rem;
+ font-weight: 600;
+ }
+ .preset-option-copy small {
+ margin-top: 0.16rem;
+ overflow: hidden;
+ color: var(--text-faint);
+ font-size: 0.57rem;
+ font-weight: 400;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ }
+ .preset-option-check {
+ color: var(--frontend-stroke);
+ font-size: 0.78rem;
+ opacity: 0;
+ }
+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }
+ html[data-preset="editorial"] .toolbar button,
+ html[data-preset="editorial"] .preset-menu,
+ html[data-preset="editorial"] .export-menu,
+ html[data-preset="editorial"] .overview-map,
+ html[data-preset="editorial"] .semantic-lens,
+ html[data-preset="editorial"] .route-probe,
+ html[data-preset="editorial"] .focus-chip,
+ html[data-preset="editorial"] .diagram-guide,
+ html[data-preset="editorial"] .node-finder,
+ html[data-preset="editorial"] .guided-views,
+ html[data-preset="editorial"] .share-chapter-cue {
+ border-radius: 0.3rem;
+ }
.motion-control-dot {
width: 0.46rem;
height: 0.46rem;
@@ -2816,20 +3171,29 @@
@media (max-width: 720px) {
body { padding: 1rem; }
+ .toolbar .preset-menu {
+ position: fixed;
+ top: 4.5rem;
+ right: 1rem;
+ left: 1rem;
+ width: auto;
+ }
.toolbar {
- position: static;
+ position: relative;
justify-content: flex-end;
margin-bottom: 1rem;
}
.header { margin-bottom: 1.25rem; padding-right: 0; }
html[data-preset="signal-flow"] .header,
- html[data-preset="blueprint"] .header { padding-right: 0; }
+ html[data-preset="blueprint"] .header,
+ html[data-preset="editorial"] .header { padding-right: 0; }
.header-row {
gap: 0.75rem;
align-items: flex-start;
}
html[data-preset="signal-flow"] .header-row,
- html[data-preset="blueprint"] .header-row { flex-wrap: wrap; }
+ html[data-preset="blueprint"] .header-row,
+ html[data-preset="editorial"] .header-row { flex-wrap: wrap; }
html[data-preset="signal-flow"] .header-row::after {
margin-left: 0;
order: 3;
@@ -2838,6 +3202,10 @@
margin-left: 0;
order: 3;
}
+ html[data-preset="editorial"] .header-row::after {
+ margin-left: 0;
+ order: 3;
+ }
h1 {
font-size: 1.25rem;
line-height: 1.25;
@@ -3535,6 +3903,11 @@
stroke-linecap: square;
filter: none;
}
+ svg[data-preset="editorial"] .relationship-flow-pulse {
+ stroke: var(--arrow-emphasis);
+ stroke-width: 2.75;
+ filter: none;
+ }
.semantic-flow-token {
color: var(--frontend-stroke);
opacity: 0;
@@ -3577,6 +3950,7 @@
filter: drop-shadow(0 0 5px currentColor);
}
svg[data-preset="blueprint"] .semantic-flow-token { filter: none; }
+ svg[data-preset="editorial"] .semantic-flow-token { filter: none; }
html[data-embed="true"] .relationship-pulse-overlay { display: none; }
/* Intent Trace is a temporary, pre-click exploration layer. Related
@@ -3617,6 +3991,8 @@
filter: none;
stroke-linecap: square;
}
+ svg[data-preset="editorial"] [data-intent-trace-selected],
+ svg[data-preset="editorial"] .intent-trace-flow { filter: none; }
.intent-trace-status {
position: absolute;
width: 1px;
@@ -3700,6 +4076,25 @@
filter: none;
stroke-linecap: square;
}
+ svg[data-preset="editorial"] [data-route-start],
+ svg[data-preset="editorial"] [data-route-end],
+ svg[data-preset="editorial"] [data-route-step],
+ svg[data-preset="editorial"] .route-probe-flow,
+ svg[data-preset="editorial"] .route-journey-flow { filter: none; }
+
+ svg[data-preset="editorial"] .c-grid {
+ stroke-dasharray: 1 4;
+ opacity: 0.48;
+ }
+ svg[data-preset="editorial"] .c-region {
+ fill: color-mix(in srgb, var(--cloud-fill) 48%, transparent);
+ stroke-dasharray: 9 4;
+ }
+ svg[data-preset="editorial"] [data-node-id]:hover,
+ svg[data-preset="editorial"] [data-node-id]:focus-visible,
+ svg[data-preset="editorial"][data-focus-active] [data-focus-selected] {
+ filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 18%, transparent));
+ }
svg[data-preset="blueprint"] .c-grid {
stroke-dasharray: 1 3;
@@ -3785,6 +4180,10 @@
filter: none;
animation: none;
}
+ svg[data-preset="editorial"] .story-trail-flow { filter: none; }
+ svg[data-preset="editorial"][data-story-beat] [data-story-step][data-story-beat-state="active"] {
+ filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 16%, transparent));
+ }
/* Chapter Delta Preview is a static, pre-commit comparison between two
chapter focus sets. Symbols in the rail carry the meaning without color;
@@ -3846,6 +4245,14 @@
animation-name: archify-blueprint-node-pulse;
animation-duration: 3.8s;
}
+ svg[data-preset="editorial"][data-animation="trace"] [data-animate="edge"] {
+ filter: none;
+ animation-duration: 2.2s;
+ }
+ svg[data-preset="editorial"][data-animation="trace"] [data-animate="node"] {
+ animation-name: archify-editorial-node-pulse;
+ animation-duration: 3.5s;
+ }
/* Embedded proofs are static until a named Story Trail chapter is played.
This keeps proof grids calm and ensures ?play=1 stops all viewer motion
after one 3.2 second chapter instead of leaving ambient trace loops on. */
@@ -3871,6 +4278,10 @@
0%, 72%, 100% { opacity: 1; filter: none; }
18%, 36% { opacity: 0.72; filter: drop-shadow(0 0 2px var(--frontend-stroke)); }
}
+ @keyframes archify-editorial-node-pulse {
+ 0%, 72%, 100% { opacity: 1; filter: none; }
+ 18%, 36% { opacity: 0.78; filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 18%, transparent)); }
+ }
@keyframes archify-signal-scan {
0%, 18% { opacity: 1; transform: translateX(-70%); }
70% { opacity: 1; transform: translateX(70%); }
@@ -4003,12 +4414,42 @@
<span id="theme-icon" aria-hidden="true">&#9790;</span>
<span id="theme-label">Dark</span>
</button>
- <button id="btn-preset" type="button"
- title="Cycle visual style (S)"
- aria-label="Cycle visual style">
- <span class="preset-control-mark" aria-hidden="true"></span>
- <span id="preset-label">Style</span>
- </button>
+ <div class="preset-wrap">
+ <button id="btn-preset" type="button"
+ title="Choose visual style (S cycles)"
+ aria-label="Choose visual style"
+ aria-haspopup="menu"
+ aria-expanded="false"
+ aria-controls="preset-menu"
+ aria-keyshortcuts="S">
+ <span class="preset-control-mark" aria-hidden="true"></span>
+ <span id="preset-label">Style</span>
+ <span aria-hidden="true">&#9662;</span>
+ </button>
+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="Visual style">
+ <div class="preset-menu-heading" role="presentation"><span>Visual identity</span><span>S cycles</span></div>
+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch classic" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Classic</strong><small>Stable technical default</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Signal Flow</strong><small>Motion-forward presentation</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Blueprint</strong><small>Engineering review</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">
+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>
+ <span class="preset-option-copy"><strong>Editorial</strong><small>Publication and launch notes</small></span>
+ <span class="preset-option-check" aria-hidden="true">&#10003;</span>
+ </button>
+ </div>
+ </div>
<button id="btn-motion" type="button" hidden
title="Pause motion"
aria-label="Pause motion"
@@ -4477,9 +4918,9 @@
</div>
</div>
<div class="relationship-lens-actions">
+ <button id="btn-focus-clear" type="button" aria-label="Close semantic passport" title="Close">&#215;</button>
<button id="btn-focus-copy" type="button" aria-label="Copy link to focused node">Copy link</button>
<button id="btn-focus-relations" type="button" aria-label="Show connected relationships" aria-expanded="false" aria-controls="relationship-lens-list">Relations</button>
- <button id="btn-focus-clear" type="button" aria-label="Clear focused node">Clear</button>
</div>
</div>
<div class="relationship-lens-list" id="relationship-lens-list" aria-label="Connected relationships"></div>
@@ -4620,18 +5061,22 @@
}
/* ============================================================
- Visual style try-on — one topology, three bundled presets.
+ Visual style try-on — one topology, four bundled presets.
The reader's choice is intentionally session-only: it updates the
live page and canonical SVG together, but never rewrites the source,
URL, or a later diagram's authored default.
============================================================ */
Archify.preset = (function () {
- var PRESETS = ['classic', 'signal-flow', 'blueprint'];
- var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint' };
+ var PRESETS = ['classic', 'signal-flow', 'blueprint', 'editorial'];
+ var LABELS = { classic: 'Classic', 'signal-flow': 'Flow', blueprint: 'Blueprint', editorial: 'Editorial' };
var html = document.documentElement;
var svg = document.querySelector('.diagram-container svg');
var btn = document.getElementById('btn-preset');
var label = document.getElementById('preset-label');
+ var menu = document.getElementById('preset-menu');
+ var options = function () {
+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));
+ };
var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0
? html.getAttribute('data-preset')
: 'classic';
@@ -4650,16 +5095,80 @@
svg.setAttribute('data-preset', preset);
btn.setAttribute('data-preset-option', preset);
label.textContent = LABELS[preset];
- var next = nextAfter(preset);
- btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Activate for ' + LABELS[next]);
- btn.title = 'Cycle visual style (S)';
+ btn.setAttribute('aria-label', 'Visual style: ' + LABELS[preset] + '. Choose visual style');
+ btn.title = 'Choose visual style (S cycles)';
+ options().forEach(function (option) {
+ var selected = option.getAttribute('data-preset-value') === preset;
+ option.setAttribute('aria-checked', String(selected));
+ });
return true;
}
function cycle() { return apply(nextAfter(current())); }
+ function isOpen() { return menu.classList.contains('open'); }
+ function open(focusLast) {
+ if (html.getAttribute('data-embed') === 'true') return false;
+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);
+ menu.classList.add('open');
+ btn.setAttribute('aria-expanded', 'true');
+ var available = options();
+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });
+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);
+ if (target) target.focus();
+ return true;
+ }
+ function close(focusTrigger) {
+ menu.classList.remove('open');
+ btn.setAttribute('aria-expanded', 'false');
+ if (focusTrigger) btn.focus();
+ return false;
+ }
+
apply(authored);
- btn.addEventListener('click', cycle);
- return { cycle: cycle, apply: apply, current: current, authored: authored };
+ btn.addEventListener('click', function (e) {
+ e.stopPropagation();
+ if (isOpen()) close(false);
+ else open(false);
+ });
+ btn.addEventListener('keydown', function (e) {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (!isOpen()) open(e.key === 'ArrowUp');
+ }
+ });
+ document.addEventListener('click', function (e) {
+ if (!menu.contains(e.target) && e.target !== btn) close(false);
+ });
+ menu.addEventListener('click', function (e) {
+ var option = e.target.closest('[data-preset-value]');
+ if (!option || !menu.contains(option)) return;
+ if (apply(option.getAttribute('data-preset-value'))) close(true);
+ });
+ menu.addEventListener('keydown', function (e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }
+ if (e.key === 'Tab') { close(false); return; }
+ var available = options();
+ var active = available.indexOf(document.activeElement);
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ if (available.length) available[(active + 1 + available.length) % available.length].focus();
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ if (available.length) available[(active - 1 + available.length) % available.length].focus();
+ break;
+ case 'Home':
+ e.preventDefault();
+ if (available[0]) available[0].focus();
+ break;
+ case 'End':
+ e.preventDefault();
+ if (available.length) available[available.length - 1].focus();
+ break;
+ }
+ });
+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };
})();
/* ============================================================
@@ -5851,6 +6360,7 @@
}
function open(focusLast) {
+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);
if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();
if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });
syncRouteShareItem();
@@ -7511,6 +8021,9 @@
}
function clear(options) {
options = options || {};
+ var restoreNode = options.restoreFocus === true && activeIds.length === 1
+ ? svg.querySelector('[data-node-id="' + activeIds[0] + '"]')
+ : null;
clearReachability({ updateUrl: false });
if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') {
Archify.intentTrace.clear({ announce: false });
@@ -7562,6 +8075,10 @@
if (options.updateUrl !== false) {
try { history.replaceState(null, '', location.pathname + location.search); } catch (_) {}
}
+ if (restoreNode) {
+ try { restoreNode.focus({ preventScroll: true }); }
+ catch (_) { try { restoreNode.focus(); } catch (_) {} }
+ }
}
function setMany(ids, options) {
@@ -7695,7 +8212,7 @@
Archify.view.reveal([id], { includeNeighbors: true, reason: 'focus' });
}
});
- clearBtn.addEventListener('click', function () { clear(); });
+ clearBtn.addEventListener('click', function () { clear({ restoreFocus: true }); });
copyBtn.addEventListener('click', copyFocusLink);
upstreamBtn.addEventListener('click', function () { applyReachability('upstream'); });
downstreamBtn.addEventListener('click', function () { applyReachability('downstream'); });
@@ -7762,6 +8279,13 @@
event.preventDefault();
buttons[index].focus();
});
+ document.addEventListener('click', function (event) {
+ var target = event.target;
+ if (chip.hidden || !target || typeof target.closest !== 'function' || chip.contains(target)) return;
+ if (container.getAttribute('data-just-panned') === 'true') return;
+ if (target.closest('[data-node-id], [data-relationship-hit-key]')) return;
+ clear();
+ }, true);
window.addEventListener('scroll', requestLensPlacement, { passive: true });
window.addEventListener('resize', requestLensPlacement);
container.addEventListener('scroll', requestLensPlacement, { passive: true });
@@ -12667,6 +13191,9 @@
if (e.defaultPrevented) return;
var t = e.target;
if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {
+ Archify.preset.close(false);
+ }
if (e.key === '?') {
e.preventDefault();
Archify.guide.toggle();
@@ -12703,6 +13230,9 @@
} else if (e.key === '0') {
e.preventDefault();
Archify.view.reset();
+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {
+ e.preventDefault();
+ Archify.preset.close(true);
} else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {
e.preventDefault();
Archify.semanticLens.close({ restoreFocus: true });
@@ -12723,7 +13253,7 @@
Archify.intentTrace.clear();
} else if (e.key === 'Escape' && Archify.focus.active()) {
e.preventDefault();
- Archify.focus.clear();
+ Archify.focus.clear({ restoreFocus: true });
} else if (e.key === 'Escape' && Archify.presentation.active()) {
e.preventDefault();
Archify.presentation.exit();