Skip to content

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

fix: resolve new diagram review and integration defects

tt-a1i06c7ad86510c
diff --git a/archify.zip b/archify.zip
index 7da28b60..a97b44ac 100644
Binary files a/archify.zip and b/archify.zip differ
diff --git a/archify/assets/template.html b/archify/assets/template.html
index 6dd56b5d..07a511d4 100644
--- a/archify/assets/template.html
+++ b/archify/assets/template.html
@@ -6586,13 +6586,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7484,6 +7489,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8009,6 +8145,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8053,7 +8191,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8814,6 +8952,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9163,6 +9306,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9310,6 +9455,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11760,145 +11906,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12236,6 +12243,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12336,6 +12345,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12932,6 +12943,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13168,6 +13180,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13605,6 +13619,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/class-payment-processors-rendered.html b/archify/examples/class-payment-processors-rendered.html
index d9352f23..abcfdd71 100644
--- a/archify/examples/class-payment-processors-rendered.html
+++ b/archify/examples/class-payment-processors-rendered.html
@@ -5064,11 +5064,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<path data-edge-from="checkout_orchestrator" data-edge-to="order" data-edge-label="updates" data-edge-key="2" data-edge-id="orchestrator_order" data-class-relationship="dependency" data-composition-points="182,274;182,378" d="M 182 274 L 182 378" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-end="url(#cl-open)"/>
<path data-edge-from="order" data-edge-to="line_item" data-edge-label="owns lines" data-edge-key="3" data-edge-id="order_lines" data-class-relationship="composition" data-composition-points="182,612;182,721" d="M 182 612 L 182 721" class="a-default cl-relationship" stroke-width="1.5" marker-start="url(#cl-diamond-filled)"/>
<path data-edge-from="order" data-edge-to="payment_status" data-edge-key="4" data-edge-id="order_status" data-class-relationship="association" data-composition-points="332,495;517,495" d="M 332 495 L 517 495" class="a-default cl-relationship" stroke-width="1.5" marker-end="url(#cl-open)"/>
- <path data-edge-from="retrying_processor" data-edge-to="payment_processor" data-edge-key="5" data-edge-id="retrying_implements" data-class-relationship="realization" data-class-bus="payment_processor" data-composition-points="1038,383;1038,339;1252,339;1252,294" d="M 1252 294 L 1252 331 Q 1252 339 1244 339 L 1046 339 Q 1038 339 1038 347 L 1038 383" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
- <path data-edge-from="bank_transfer" data-edge-to="payment_processor" data-edge-key="6" data-edge-id="bank_implements" data-class-relationship="realization" data-class-bus="payment_processor" data-composition-points="1466,413;1466,339;1252,339;1252,294" d="M 1252 294 L 1252 331 Q 1252 339 1260 339 L 1458 339 Q 1466 339 1466 347 L 1466 413" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
- <path data-edge-from="stripe_card" data-edge-to="retrying_processor" data-edge-key="7" data-edge-id="stripe_extends" data-class-relationship="inheritance" data-class-bus="retrying_processor" data-composition-points="610,726;610,652;1038,652;1038,607" d="M 1038 607 L 1038 644 Q 1038 652 1030 652 L 618 652 Q 610 652 610 660 L 610 726" class="a-default cl-relationship" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
- <path data-edge-from="adyen_card" data-edge-to="retrying_processor" data-edge-key="8" data-edge-id="adyen_extends" data-class-relationship="inheritance" data-class-bus="retrying_processor" data-composition-points="1038,726;1038,607" d="M 1038 607 L 1038 726" class="a-default cl-relationship" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
- <path data-edge-from="paypal_wallet" data-edge-to="retrying_processor" data-edge-key="9" data-edge-id="paypal_extends" data-class-relationship="inheritance" data-class-bus="retrying_processor" data-composition-points="1466,696;1466,652;1038,652;1038,607" d="M 1038 607 L 1038 644 Q 1038 652 1046 652 L 1458 652 Q 1466 652 1466 660 L 1466 696" class="a-default cl-relationship" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
+ <path data-edge-from="retrying_processor" data-edge-to="payment_processor" data-edge-key="5" data-edge-id="retrying_implements" data-class-relationship="realization" data-class-bus="payment_processor" data-motion-path="M 1038 383 L 1038 347 Q 1038 339 1046 339 L 1244 339 Q 1252 339 1252 331 L 1252 294" data-composition-points="1038,383;1038,339;1252,339;1252,294" d="M 1252 294 L 1252 331 Q 1252 339 1244 339 L 1046 339 Q 1038 339 1038 347 L 1038 383" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
+ <path data-edge-from="bank_transfer" data-edge-to="payment_processor" data-edge-key="6" data-edge-id="bank_implements" data-class-relationship="realization" data-class-bus="payment_processor" data-motion-path="M 1466 413 L 1466 347 Q 1466 339 1458 339 L 1260 339 Q 1252 339 1252 331 L 1252 294" data-composition-points="1466,413;1466,339;1252,339;1252,294" d="M 1252 294 L 1252 331 Q 1252 339 1260 339 L 1458 339 Q 1466 339 1466 347 L 1466 413" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
+ <path data-edge-from="stripe_card" data-edge-to="retrying_processor" data-edge-key="7" data-edge-id="stripe_extends" data-class-relationship="inheritance" data-class-bus="retrying_processor" data-motion-path="M 610 726 L 610 660 Q 610 652 618 652 L 1030 652 Q 1038 652 1038 644 L 1038 607" data-composition-points="610,726;610,652;1038,652;1038,607" d="M 1038 607 L 1038 644 Q 1038 652 1030 652 L 618 652 Q 610 652 610 660 L 610 726" class="a-default cl-relationship" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
+ <path data-edge-from="adyen_card" data-edge-to="retrying_processor" data-edge-key="8" data-edge-id="adyen_extends" data-class-relationship="inheritance" data-class-bus="retrying_processor" data-motion-path="M 1038 726 L 1038 607" data-composition-points="1038,726;1038,607" d="M 1038 607 L 1038 726" class="a-default cl-relationship" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
+ <path data-edge-from="paypal_wallet" data-edge-to="retrying_processor" data-edge-key="9" data-edge-id="paypal_extends" data-class-relationship="inheritance" data-class-bus="retrying_processor" data-motion-path="M 1466 696 L 1466 660 Q 1466 652 1458 652 L 1046 652 Q 1038 652 1038 644 L 1038 607" data-composition-points="1466,696;1466,652;1038,652;1038,607" d="M 1038 607 L 1038 644 Q 1038 652 1046 652 L 1458 652 Q 1466 652 1466 660 L 1466 696" class="a-default cl-relationship" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
<!-- Types -->
<g id="node-checkout_orchestrator" data-node-id="checkout_orchestrator" data-node-label="CheckoutOrchestrator" tabindex="0" role="button" aria-label="Focus CheckoutOrchestrator, Runs one checkout from order to receipt, Class" aria-pressed="false" data-node-kind="class" data-node-sublabel="Runs one checkout from order to receipt" data-node-context="Class" data-class-kind="class">
@@ -6777,13 +6777,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7675,6 +7680,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8200,6 +8336,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8244,7 +8382,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -9005,6 +9143,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9354,6 +9497,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9501,6 +9646,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11951,145 +12097,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12427,6 +12434,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12527,6 +12536,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13123,6 +13134,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13359,6 +13371,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13796,6 +13810,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/class-payments-rendered.html b/archify/examples/class-payments-rendered.html
index d102dab5..9f622bb3 100644
--- a/archify/examples/class-payments-rendered.html
+++ b/archify/examples/class-payments-rendered.html
@@ -5055,8 +5055,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<!-- Relationships (before types for correct z-order) -->
<path data-edge-from="order_service" data-edge-to="payment_gateway" data-edge-label="pays through" data-edge-key="0" data-edge-id="uses_gateway" data-class-relationship="dependency" data-composition-points="274,97;570.5,97" d="M 274 97 L 570.5 97" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-end="url(#cl-open)"/>
<path data-edge-from="order_service" data-edge-to="order" data-edge-label="creates" data-edge-key="1" data-edge-id="creates_order" data-class-relationship="dependency" data-composition-points="153,154;153,238" d="M 153 154 L 153 238" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-end="url(#cl-open)"/>
- <path data-edge-from="card_gateway" data-edge-to="payment_gateway" data-edge-key="2" data-edge-id="card_implements" data-class-relationship="realization" data-class-bus="payment_gateway" data-composition-points="506.5,273;506.5,204;675,204;675,134" d="M 675 134 L 675 196 Q 675 204 667 204 L 514.5 204 Q 506.5 204 506.5 212 L 506.5 273" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
- <path data-edge-from="wallet_gateway" data-edge-to="payment_gateway" data-edge-key="3" data-edge-id="wallet_implements" data-class-relationship="realization" data-class-bus="payment_gateway" data-composition-points="843.5,273;843.5,204;675,204;675,134" d="M 675 134 L 675 196 Q 675 204 683 204 L 835.5 204 Q 843.5 204 843.5 212 L 843.5 273" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
+ <path data-edge-from="card_gateway" data-edge-to="payment_gateway" data-edge-key="2" data-edge-id="card_implements" data-class-relationship="realization" data-class-bus="payment_gateway" data-motion-path="M 506.5 273 L 506.5 212 Q 506.5 204 514.5 204 L 667 204 Q 675 204 675 196 L 675 134" data-composition-points="506.5,273;506.5,204;675,204;675,134" d="M 675 134 L 675 196 Q 675 204 667 204 L 514.5 204 Q 506.5 204 506.5 212 L 506.5 273" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
+ <path data-edge-from="wallet_gateway" data-edge-to="payment_gateway" data-edge-key="3" data-edge-id="wallet_implements" data-class-relationship="realization" data-class-bus="payment_gateway" data-motion-path="M 843.5 273 L 843.5 212 Q 843.5 204 835.5 204 L 683 204 Q 675 204 675 196 L 675 134" data-composition-points="843.5,273;843.5,204;675,204;675,134" d="M 675 134 L 675 196 Q 675 204 683 204 L 835.5 204 Q 843.5 204 843.5 212 L 843.5 273" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
<!-- Types -->
<g id="node-order_service" data-node-id="order_service" data-node-label="OrderService" tabindex="0" role="button" aria-label="Focus OrderService, Creates orders and starts payment, Class" aria-pressed="false" data-node-kind="class" data-node-sublabel="Creates orders and starts payment" data-node-context="Class" data-class-kind="class">
@@ -6583,13 +6583,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7481,6 +7486,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8006,6 +8142,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8050,7 +8188,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8811,6 +8949,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9160,6 +9303,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9307,6 +9452,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11757,145 +11903,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12233,6 +12240,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12333,6 +12342,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12929,6 +12940,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13165,6 +13177,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13602,6 +13616,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/dataflow-product-analytics.html b/archify/examples/dataflow-product-analytics.html
index 44577180..a8cf286a 100644
--- a/archify/examples/dataflow-product-analytics.html
+++ b/archify/examples/dataflow-product-analytics.html
@@ -6697,13 +6697,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7595,6 +7600,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8120,6 +8256,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8164,7 +8302,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8925,6 +9063,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9274,6 +9417,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9421,6 +9566,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11871,145 +12017,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12347,6 +12354,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12447,6 +12456,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13043,6 +13054,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13279,6 +13291,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13716,6 +13730,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/erd-orders-rendered.html b/archify/examples/erd-orders-rendered.html
index 6dcc3fbd..4e1a96ad 100644
--- a/archify/examples/erd-orders-rendered.html
+++ b/archify/examples/erd-orders-rendered.html
@@ -6865,13 +6865,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7763,6 +7768,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8288,6 +8424,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8332,7 +8470,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -9093,6 +9231,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9442,6 +9585,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9589,6 +9734,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -12039,145 +12185,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12515,6 +12522,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12615,6 +12624,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13211,6 +13222,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13447,6 +13459,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13884,6 +13898,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/lifecycle-agent-run.html b/archify/examples/lifecycle-agent-run.html
index ffb094a4..ab54a458 100644
--- a/archify/examples/lifecycle-agent-run.html
+++ b/archify/examples/lifecycle-agent-run.html
@@ -6642,13 +6642,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7540,6 +7545,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8065,6 +8201,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8109,7 +8247,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8870,6 +9008,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9219,6 +9362,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9366,6 +9511,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11816,145 +11962,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12292,6 +12299,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12392,6 +12401,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12988,6 +12999,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13224,6 +13236,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13661,6 +13675,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/locales/de.json b/archify/examples/locales/de.json
index 9fd47a59..568cf380 100644
--- a/archify/examples/locales/de.json
+++ b/archify/examples/locales/de.json
@@ -421,5 +421,46 @@
"viewer.common.copyFailed": "Kopieren fehlgeschlagen",
"viewer.common.copyLink": "Link kopieren",
"viewer.common.clear": "Löschen",
- "viewer.common.close": "Schließen"
+ "viewer.common.close": "Schließen",
+ "diagram.description.tree": "Ein von Archify erstelltes Hierarchiediagramm.",
+ "node.context.tree.root": "Wurzel",
+ "node.context.tree.branch": "Zweig",
+ "node.context.tree.leaf": "Blatt",
+ "tree.toggle.collapse": "{label} einklappen ({count} untergeordnete Knoten)",
+ "tree.toggle.expand": "{label} ausklappen ({count} verborgen)",
+ "tree.expandAll": "Alle ausklappen",
+ "diagram.description.class": "Ein von Archify erstelltes Klassen- und Schnittstellendiagramm.",
+ "node.context.class.class": "Klasse",
+ "node.context.class.abstract": "Abstrakte Klasse",
+ "node.context.class.interface": "Schnittstelle",
+ "node.context.class.enum": "Aufzählung",
+ "node.context.class.record": "Datensatz",
+ "legend.class.dependency": "Abhängig von",
+ "legend.class.association": "Assoziation",
+ "legend.class.inheritance": "Erbt von",
+ "legend.class.realization": "Implementiert",
+ "legend.class.composition": "Komposition",
+ "legend.class.aggregation": "Aggregation",
+ "diagram.description.timeline": "Eine von Archify erstellte Ereigniszeitleiste.",
+ "timeline.axis": "Zeit",
+ "timeline.break": "Achsenunterbrechung: {duration} ohne Ereignisse ausgelassen",
+ "timeline.compressed": "{count} ruhige Zeiträume komprimiert (≈)",
+ "timeline.evidence.observed": "Beobachtete Ereignisse",
+ "timeline.evidence.illustrative": "Beispieldaten",
+ "legend.timeline.default": "Ereignis",
+ "legend.timeline.change": "Änderung",
+ "legend.timeline.alert": "Warnung",
+ "legend.timeline.action": "Reaktion",
+ "legend.timeline.recovery": "Wiederherstellung",
+ "diagram.description.waterfall": "Ein von Archify erstelltes Wasserfalldiagramm der Ausführung.",
+ "waterfall.evidence.measured": "Gemessene Zeiten",
+ "waterfall.evidence.illustrative": "Beispielzeiten",
+ "waterfall.wall": "Gesamtdauer {duration}",
+ "waterfall.share": "{percent} der Gesamtdauer {total}",
+ "waterfall.incomplete": "unvollständig, ≥ {duration}",
+ "waterfall.operation": "Vorgang",
+ "legend.waterfall.ok": "Abgeschlossen",
+ "legend.waterfall.error": "Fehler",
+ "legend.waterfall.cancelled": "Abgebrochen",
+ "legend.waterfall.incomplete": "Unvollständig (kein Ende aufgezeichnet)"
}
diff --git a/archify/examples/locales/fr.json b/archify/examples/locales/fr.json
index d9b1e8d9..af7f539c 100644
--- a/archify/examples/locales/fr.json
+++ b/archify/examples/locales/fr.json
@@ -421,5 +421,46 @@
"viewer.common.copyFailed": "Échec de la copie",
"viewer.common.copyLink": "Copier le lien",
"viewer.common.clear": "Effacer",
- "viewer.common.close": "Fermer"
+ "viewer.common.close": "Fermer",
+ "diagram.description.tree": "Un diagramme hiérarchique généré par Archify.",
+ "node.context.tree.root": "Racine",
+ "node.context.tree.branch": "Branche",
+ "node.context.tree.leaf": "Feuille",
+ "tree.toggle.collapse": "Replier {label} ({count} descendants)",
+ "tree.toggle.expand": "Déplier {label} ({count} masqués)",
+ "tree.expandAll": "Tout déplier",
+ "diagram.description.class": "Un diagramme de classes et d’interfaces généré par Archify.",
+ "node.context.class.class": "Classe",
+ "node.context.class.abstract": "Classe abstraite",
+ "node.context.class.interface": "Interface",
+ "node.context.class.enum": "Énumération",
+ "node.context.class.record": "Enregistrement",
+ "legend.class.dependency": "Dépend de",
+ "legend.class.association": "Association",
+ "legend.class.inheritance": "Hérite de",
+ "legend.class.realization": "Implémente",
+ "legend.class.composition": "Composition",
+ "legend.class.aggregation": "Agrégation",
+ "diagram.description.timeline": "Une chronologie d’événements générée par Archify.",
+ "timeline.axis": "Temps",
+ "timeline.break": "Rupture d’axe : {duration} sans événements omises",
+ "timeline.compressed": "{count} période(s) calme(s) comprimée(s) (≈)",
+ "timeline.evidence.observed": "Événements observés",
+ "timeline.evidence.illustrative": "Données illustratives",
+ "legend.timeline.default": "Événement",
+ "legend.timeline.change": "Changement",
+ "legend.timeline.alert": "Alerte",
+ "legend.timeline.action": "Intervention",
+ "legend.timeline.recovery": "Rétablissement",
+ "diagram.description.waterfall": "Un diagramme en cascade d’exécution généré par Archify.",
+ "waterfall.evidence.measured": "Durées mesurées",
+ "waterfall.evidence.illustrative": "Durées illustratives",
+ "waterfall.wall": "Durée totale {duration}",
+ "waterfall.share": "{percent} de la durée totale {total}",
+ "waterfall.incomplete": "incomplet, ≥ {duration}",
+ "waterfall.operation": "Opération",
+ "legend.waterfall.ok": "Terminé",
+ "legend.waterfall.error": "Erreur",
+ "legend.waterfall.cancelled": "Annulé",
+ "legend.waterfall.incomplete": "Incomplet (fin non enregistrée)"
}
diff --git a/archify/examples/locales/it.json b/archify/examples/locales/it.json
index 37fe4d11..362a061c 100644
--- a/archify/examples/locales/it.json
+++ b/archify/examples/locales/it.json
@@ -421,5 +421,46 @@
"viewer.common.copyFailed": "Copia non riuscita",
"viewer.common.copyLink": "Copia link",
"viewer.common.clear": "Cancella",
- "viewer.common.close": "Chiudi"
+ "viewer.common.close": "Chiudi",
+ "diagram.description.tree": "Un diagramma gerarchico generato da Archify.",
+ "node.context.tree.root": "Radice",
+ "node.context.tree.branch": "Ramo",
+ "node.context.tree.leaf": "Foglia",
+ "tree.toggle.collapse": "Comprimi {label} ({count} discendenti)",
+ "tree.toggle.expand": "Espandi {label} ({count} nascosti)",
+ "tree.expandAll": "Espandi tutto",
+ "diagram.description.class": "Un diagramma di classi e interfacce generato da Archify.",
+ "node.context.class.class": "Classe",
+ "node.context.class.abstract": "Classe astratta",
+ "node.context.class.interface": "Interfaccia",
+ "node.context.class.enum": "Enumerazione",
+ "node.context.class.record": "Record",
+ "legend.class.dependency": "Dipende da",
+ "legend.class.association": "Associazione",
+ "legend.class.inheritance": "Eredita da",
+ "legend.class.realization": "Implementa",
+ "legend.class.composition": "Composizione",
+ "legend.class.aggregation": "Aggregazione",
+ "diagram.description.timeline": "Una cronologia di eventi generata da Archify.",
+ "timeline.axis": "Tempo",
+ "timeline.break": "Interruzione dell’asse: omesso intervallo di {duration} senza eventi",
+ "timeline.compressed": "{count} periodi di inattività compressi (≈)",
+ "timeline.evidence.observed": "Eventi osservati",
+ "timeline.evidence.illustrative": "Dati illustrativi",
+ "legend.timeline.default": "Evento",
+ "legend.timeline.change": "Modifica",
+ "legend.timeline.alert": "Avviso",
+ "legend.timeline.action": "Risposta",
+ "legend.timeline.recovery": "Ripristino",
+ "diagram.description.waterfall": "Un diagramma a cascata dell’esecuzione generato da Archify.",
+ "waterfall.evidence.measured": "Tempi misurati",
+ "waterfall.evidence.illustrative": "Tempi illustrativi",
+ "waterfall.wall": "Tempo totale {duration}",
+ "waterfall.share": "{percent} del tempo totale {total}",
+ "waterfall.incomplete": "incompleto, ≥ {duration}",
+ "waterfall.operation": "Operazione",
+ "legend.waterfall.ok": "Completato",
+ "legend.waterfall.error": "Errore",
+ "legend.waterfall.cancelled": "Annullato",
+ "legend.waterfall.incomplete": "Incompleto (fine non registrata)"
}
diff --git a/archify/examples/locales/ja.json b/archify/examples/locales/ja.json
index e74d3466..83309b4d 100644
--- a/archify/examples/locales/ja.json
+++ b/archify/examples/locales/ja.json
@@ -421,5 +421,46 @@
"viewer.common.copyFailed": "コピーに失敗しました",
"viewer.common.copyLink": "リンクをコピー",
"viewer.common.clear": "クリア",
- "viewer.common.close": "閉じる"
+ "viewer.common.close": "閉じる",
+ "diagram.description.tree": "Archify が生成した階層図。",
+ "node.context.tree.root": "ルート",
+ "node.context.tree.branch": "枝",
+ "node.context.tree.leaf": "葉",
+ "tree.toggle.collapse": "{label} を折りたたむ(配下 {count} 件)",
+ "tree.toggle.expand": "{label} を展開する(非表示 {count} 件)",
+ "tree.expandAll": "すべて展開",
+ "diagram.description.class": "Archify が生成したクラスとインターフェースの図。",
+ "node.context.class.class": "クラス",
+ "node.context.class.abstract": "抽象クラス",
+ "node.context.class.interface": "インターフェース",
+ "node.context.class.enum": "列挙型",
+ "node.context.class.record": "レコード",
+ "legend.class.dependency": "依存",
+ "legend.class.association": "関連",
+ "legend.class.inheritance": "継承",
+ "legend.class.realization": "実装",
+ "legend.class.composition": "コンポジション",
+ "legend.class.aggregation": "集約",
+ "diagram.description.timeline": "Archify が生成したイベントのタイムライン。",
+ "timeline.axis": "時間",
+ "timeline.break": "軸の省略:イベントのない {duration} を省略",
+ "timeline.compressed": "イベントのない {count} 区間を圧縮(≈)",
+ "timeline.evidence.observed": "観測されたイベント",
+ "timeline.evidence.illustrative": "説明用データ",
+ "legend.timeline.default": "イベント",
+ "legend.timeline.change": "変更",
+ "legend.timeline.alert": "警告",
+ "legend.timeline.action": "対応",
+ "legend.timeline.recovery": "復旧",
+ "diagram.description.waterfall": "Archify が生成した実行のウォーターフォール図。",
+ "waterfall.evidence.measured": "計測された時間",
+ "waterfall.evidence.illustrative": "説明用の時間",
+ "waterfall.wall": "総経過時間 {duration}",
+ "waterfall.share": "総経過時間 {total} の {percent}",
+ "waterfall.incomplete": "未完了、≥ {duration}",
+ "waterfall.operation": "操作",
+ "legend.waterfall.ok": "完了",
+ "legend.waterfall.error": "エラー",
+ "legend.waterfall.cancelled": "キャンセル済み",
+ "legend.waterfall.incomplete": "未完了(終了記録なし)"
}
diff --git a/archify/examples/locales/pt.json b/archify/examples/locales/pt.json
index e48a8712..c99fe4d2 100644
--- a/archify/examples/locales/pt.json
+++ b/archify/examples/locales/pt.json
@@ -421,5 +421,46 @@
"viewer.common.copyFailed": "Falha ao copiar",
"viewer.common.copyLink": "Copiar link",
"viewer.common.clear": "Limpar",
- "viewer.common.close": "Fechar"
+ "viewer.common.close": "Fechar",
+ "diagram.description.tree": "Um diagrama hierárquico gerado pelo Archify.",
+ "node.context.tree.root": "Raiz",
+ "node.context.tree.branch": "Ramo",
+ "node.context.tree.leaf": "Folha",
+ "tree.toggle.collapse": "Recolher {label} ({count} descendentes)",
+ "tree.toggle.expand": "Expandir {label} ({count} ocultos)",
+ "tree.expandAll": "Expandir tudo",
+ "diagram.description.class": "Um diagrama de classes e interfaces gerado pelo Archify.",
+ "node.context.class.class": "Classe",
+ "node.context.class.abstract": "Classe abstrata",
+ "node.context.class.interface": "Interface",
+ "node.context.class.enum": "Enumeração",
+ "node.context.class.record": "Registro",
+ "legend.class.dependency": "Depende de",
+ "legend.class.association": "Associação",
+ "legend.class.inheritance": "Herda de",
+ "legend.class.realization": "Implementa",
+ "legend.class.composition": "Composição",
+ "legend.class.aggregation": "Agregação",
+ "diagram.description.timeline": "Uma linha do tempo de eventos gerada pelo Archify.",
+ "timeline.axis": "Tempo",
+ "timeline.break": "Quebra do eixo: omitido intervalo de {duration} sem eventos",
+ "timeline.compressed": "{count} período(s) sem atividade comprimido(s) (≈)",
+ "timeline.evidence.observed": "Eventos observados",
+ "timeline.evidence.illustrative": "Dados ilustrativos",
+ "legend.timeline.default": "Evento",
+ "legend.timeline.change": "Mudança",
+ "legend.timeline.alert": "Alerta",
+ "legend.timeline.action": "Resposta",
+ "legend.timeline.recovery": "Recuperação",
+ "diagram.description.waterfall": "Um diagrama em cascata de execução gerado pelo Archify.",
+ "waterfall.evidence.measured": "Tempos medidos",
+ "waterfall.evidence.illustrative": "Tempos ilustrativos",
+ "waterfall.wall": "Tempo total {duration}",
+ "waterfall.share": "{percent} do tempo total {total}",
+ "waterfall.incomplete": "incompleto, ≥ {duration}",
+ "waterfall.operation": "Operação",
+ "legend.waterfall.ok": "Concluído",
+ "legend.waterfall.error": "Erro",
+ "legend.waterfall.cancelled": "Cancelado",
+ "legend.waterfall.incomplete": "Incompleto (fim não registrado)"
}
diff --git a/archify/examples/locales/ru.json b/archify/examples/locales/ru.json
index d86e14f6..3c93c434 100644
--- a/archify/examples/locales/ru.json
+++ b/archify/examples/locales/ru.json
@@ -421,5 +421,46 @@
"viewer.common.copyFailed": "Не удалось скопировать",
"viewer.common.copyLink": "Скопировать ссылку",
"viewer.common.clear": "Очистить",
- "viewer.common.close": "Закрыть"
+ "viewer.common.close": "Закрыть",
+ "diagram.description.tree": "Иерархическая диаграмма, созданная Archify.",
+ "node.context.tree.root": "Корень",
+ "node.context.tree.branch": "Ветвь",
+ "node.context.tree.leaf": "Лист",
+ "tree.toggle.collapse": "Свернуть {label} (потомков: {count})",
+ "tree.toggle.expand": "Развернуть {label} (скрыто: {count})",
+ "tree.expandAll": "Развернуть всё",
+ "diagram.description.class": "Диаграмма классов и интерфейсов, созданная Archify.",
+ "node.context.class.class": "Класс",
+ "node.context.class.abstract": "Абстрактный класс",
+ "node.context.class.interface": "Интерфейс",
+ "node.context.class.enum": "Перечисление",
+ "node.context.class.record": "Запись",
+ "legend.class.dependency": "Зависит от",
+ "legend.class.association": "Ассоциация",
+ "legend.class.inheritance": "Наследует",
+ "legend.class.realization": "Реализует",
+ "legend.class.composition": "Композиция",
+ "legend.class.aggregation": "Агрегация",
+ "diagram.description.timeline": "Временная шкала событий, созданная Archify.",
+ "timeline.axis": "Время",
+ "timeline.break": "Разрыв оси: пропущен период без событий длительностью {duration}",
+ "timeline.compressed": "Сжато периодов без событий: {count} (≈)",
+ "timeline.evidence.observed": "Наблюдаемые события",
+ "timeline.evidence.illustrative": "Иллюстративные данные",
+ "legend.timeline.default": "Событие",
+ "legend.timeline.change": "Изменение",
+ "legend.timeline.alert": "Предупреждение",
+ "legend.timeline.action": "Реагирование",
+ "legend.timeline.recovery": "Восстановление",
+ "diagram.description.waterfall": "Каскадная диаграмма выполнения, созданная Archify.",
+ "waterfall.evidence.measured": "Измеренное время",
+ "waterfall.evidence.illustrative": "Иллюстративное время",
+ "waterfall.wall": "Полное время {duration}",
+ "waterfall.share": "{percent} от полного времени {total}",
+ "waterfall.incomplete": "не завершено, ≥ {duration}",
+ "waterfall.operation": "Операция",
+ "legend.waterfall.ok": "Завершено",
+ "legend.waterfall.error": "Ошибка",
+ "legend.waterfall.cancelled": "Отменено",
+ "legend.waterfall.incomplete": "Не завершено (конец не записан)"
}
diff --git a/archify/examples/sequence-cache-miss-request.html b/archify/examples/sequence-cache-miss-request.html
index 94615398..9e24715d 100644
--- a/archify/examples/sequence-cache-miss-request.html
+++ b/archify/examples/sequence-cache-miss-request.html
@@ -6712,13 +6712,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7610,6 +7615,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8135,6 +8271,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8179,7 +8317,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8940,6 +9078,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9289,6 +9432,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9436,6 +9581,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11886,145 +12032,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12362,6 +12369,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12462,6 +12471,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13058,6 +13069,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13294,6 +13306,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13731,6 +13745,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/subscription-billing-rendered.html b/archify/examples/subscription-billing-rendered.html
index a8f79284..35e65080 100644
--- a/archify/examples/subscription-billing-rendered.html
+++ b/archify/examples/subscription-billing-rendered.html
@@ -7089,13 +7089,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7987,6 +7992,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8512,6 +8648,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8556,7 +8694,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -9317,6 +9455,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9666,6 +9809,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9813,6 +9958,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -12263,145 +12409,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12739,6 +12746,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12839,6 +12848,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13435,6 +13446,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13671,6 +13683,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -14108,6 +14122,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/timeline-archify-dev-activity-rendered.html b/archify/examples/timeline-archify-dev-activity-rendered.html
index fa7b58e2..a7c21b15 100644
--- a/archify/examples/timeline-archify-dev-activity-rendered.html
+++ b/archify/examples/timeline-archify-dev-activity-rendered.html
@@ -6789,13 +6789,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7687,6 +7692,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8212,6 +8348,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8256,7 +8394,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -9017,6 +9155,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9366,6 +9509,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9513,6 +9658,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11963,145 +12109,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12439,6 +12446,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12539,6 +12548,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13135,6 +13146,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13371,6 +13383,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13808,6 +13822,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/timeline-payment-incident-rendered.html b/archify/examples/timeline-payment-incident-rendered.html
index 44e40889..e8b98244 100644
--- a/archify/examples/timeline-payment-incident-rendered.html
+++ b/archify/examples/timeline-payment-incident-rendered.html
@@ -6574,13 +6574,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7472,6 +7477,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -7997,6 +8133,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8041,7 +8179,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8802,6 +8940,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9151,6 +9294,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9298,6 +9443,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11748,145 +11894,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12224,6 +12231,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12324,6 +12333,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12920,6 +12931,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13156,6 +13168,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13593,6 +13607,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/tree-archify-repository-rendered.html b/archify/examples/tree-archify-repository-rendered.html
index 1acfc9e1..44197dda 100644
--- a/archify/examples/tree-archify-repository-rendered.html
+++ b/archify/examples/tree-archify-repository-rendered.html
@@ -5020,6 +5020,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
svg[data-tree-ui] .tree-edge { stroke-linejoin: round; stroke-linecap: round; }
svg[data-tree-ui] .tree-leaf { fill: var(--mask); stroke: var(--lane-stroke); }
svg[data-tree-ui] [data-tree-stack] { display: none; fill: var(--mask); }
+ svg[data-tree-ui] .tree-stack-frontend { stroke: var(--frontend-stroke); }
+ svg[data-tree-ui] .tree-stack-backend { stroke: var(--backend-stroke); }
svg[data-tree-ui] [data-tree-collapsed] [data-tree-stack] { display: inline; }
svg[data-tree-ui] [data-tree-hidden] { display: none; }
svg[data-tree-ui] .tree-toggle-hit { fill: transparent; }
@@ -5076,7 +5078,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<!-- Nodes -->
<g id="node-repo" data-node-id="repo" data-node-label="archify repository" tabindex="0" role="button" aria-label="Focus archify repository, Skill, viewer, and site, Root" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="Skill, viewer, and site" data-node-context="Root" data-tree-depth="0">
<title>archify repository · Skill, viewer, and site · Root</title>
- <rect data-tree-stack="" x="1064" y="69" width="196" height="59" rx="8" class="c-frontend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="1064" y="69" width="196" height="59" rx="8" class="tree-stack-frontend" stroke-width="1.2"/>
<rect x="1059" y="64" width="196" height="59" rx="8" class="c-mask"/>
<rect x="1059" y="64" width="196" height="59" rx="8" class="c-frontend" stroke-width="1.8"/>
<text data-node-label="" x="1157" class="t-primary" font-size="14.5" font-weight="750" text-anchor="middle"><tspan x="1157" y="88.5">archify repository</tspan></text>
@@ -5084,7 +5086,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-skill" data-node-id="skill" data-node-label="archify/" tabindex="0" role="button" aria-label="Focus archify/, Installable Skill package, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Installable Skill package" data-node-context="Branch" data-tree-depth="1" data-tree-ancestors="repo">
<title>archify/ · Installable Skill package · Branch</title>
- <rect data-tree-stack="" x="540" y="184" width="195" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="540" y="184" width="195" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="535" y="179" width="195" height="59" rx="8" class="c-mask"/>
<rect x="535" y="179" width="195" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="632.5" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="632.5" y="203.5">archify/</tspan></text>
@@ -5092,7 +5094,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-viewer" data-node-id="viewer" data-node-label="viewer/" tabindex="0" role="button" aria-label="Focus viewer/, Inlined into the template, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Inlined into the template" data-node-context="Branch" data-tree-depth="1" data-tree-ancestors="repo">
<title>viewer/ · Inlined into the template · Branch</title>
- <rect data-tree-stack="" x="1177" y="184" width="195" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="1177" y="184" width="195" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="1172" y="179" width="195" height="59" rx="8" class="c-mask"/>
<rect x="1172" y="179" width="195" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="1269.5" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="1269.5" y="203.5">viewer/</tspan></text>
@@ -5108,7 +5110,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-scripts" data-node-id="scripts" data-node-label="scripts/" tabindex="0" role="button" aria-label="Focus scripts/, Build and freshness tools, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Build and freshness tools" data-node-context="Branch" data-tree-depth="1" data-tree-ancestors="repo">
<title>scripts/ · Build and freshness tools · Branch</title>
- <rect data-tree-stack="" x="1588" y="184" width="195" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="1588" y="184" width="195" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="1583" y="179" width="195" height="59" rx="8" class="c-mask"/>
<rect x="1583" y="179" width="195" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="1680.5" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="1680.5" y="203.5">scripts/</tspan></text>
@@ -5116,7 +5118,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-renderers" data-node-id="renderers" data-node-label="renderers/" tabindex="0" role="button" aria-label="Focus renderers/, One per diagram type, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="One per diagram type" data-node-context="Branch" data-tree-depth="2" data-tree-ancestors="skill repo">
<title>renderers/ · One per diagram type · Branch</title>
- <rect data-tree-stack="" x="111" y="299" width="160" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="111" y="299" width="160" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="106" y="294" width="160" height="59" rx="8" class="c-mask"/>
<rect x="106" y="294" width="160" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="186" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="186" y="318.5">renderers/</tspan></text>
@@ -5132,7 +5134,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-bin" data-node-id="bin" data-node-label="bin/" tabindex="0" role="button" aria-label="Focus bin/, CLI entry points, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="CLI entry points" data-node-context="Branch" data-tree-depth="2" data-tree-ancestors="skill repo">
<title>bin/ · CLI entry points · Branch</title>
- <rect data-tree-stack="" x="745" y="299" width="140" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="745" y="299" width="140" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="740" y="294" width="140" height="59" rx="8" class="c-mask"/>
<rect x="740" y="294" width="140" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="810" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="810" y="318.5">bin/</tspan></text>
@@ -5204,7 +5206,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-r_shared" data-node-id="r_shared" data-node-label="shared/" tabindex="0" role="button" aria-label="Focus shared/, Shared helpers, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Shared helpers" data-node-context="Branch" data-tree-depth="3" data-tree-ancestors="renderers skill repo">
<title>shared/ · Shared helpers · Branch</title>
- <rect data-tree-stack="" x="262" y="414" width="140" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="262" y="414" width="140" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="257" y="409" width="140" height="59" rx="8" class="c-mask"/>
<rect x="257" y="409" width="140" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="327" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="327" y="433.5">shared/</tspan></text>
@@ -6806,13 +6808,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7704,6 +7711,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8229,6 +8367,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8273,7 +8413,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -9034,6 +9174,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9383,6 +9528,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9530,6 +9677,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11980,145 +12128,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12456,6 +12465,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12556,6 +12567,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13152,6 +13165,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13388,6 +13402,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13825,6 +13841,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/tree-payment-platform-rendered.html b/archify/examples/tree-payment-platform-rendered.html
index 2e4023bb..fa1648ce 100644
--- a/archify/examples/tree-payment-platform-rendered.html
+++ b/archify/examples/tree-payment-platform-rendered.html
@@ -5020,6 +5020,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
svg[data-tree-ui] .tree-edge { stroke-linejoin: round; stroke-linecap: round; }
svg[data-tree-ui] .tree-leaf { fill: var(--mask); stroke: var(--lane-stroke); }
svg[data-tree-ui] [data-tree-stack] { display: none; fill: var(--mask); }
+ svg[data-tree-ui] .tree-stack-frontend { stroke: var(--frontend-stroke); }
+ svg[data-tree-ui] .tree-stack-backend { stroke: var(--backend-stroke); }
svg[data-tree-ui] [data-tree-collapsed] [data-tree-stack] { display: inline; }
svg[data-tree-ui] [data-tree-hidden] { display: none; }
svg[data-tree-ui] .tree-toggle-hit { fill: transparent; }
@@ -5055,7 +5057,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<!-- Nodes -->
<g id="node-platform" data-node-id="platform" data-node-label="Payment platform" tabindex="0" role="button" aria-label="Focus Payment platform, Decomposed by capability, Root" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="Decomposed by capability" data-node-context="Root" data-tree-depth="0">
<title>Payment platform · Decomposed by capability · Root</title>
- <rect data-tree-stack="" x="434" y="69" width="188" height="59" rx="8" class="c-frontend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="434" y="69" width="188" height="59" rx="8" class="tree-stack-frontend" stroke-width="1.2"/>
<rect x="429" y="64" width="188" height="59" rx="8" class="c-mask"/>
<rect x="429" y="64" width="188" height="59" rx="8" class="c-frontend" stroke-width="1.8"/>
<text data-node-label="" x="523" class="t-primary" font-size="14.5" font-weight="750" text-anchor="middle"><tspan x="523" y="88.5">Payment platform</tspan></text>
@@ -5063,7 +5065,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-orders" data-node-id="orders" data-node-label="Orders" tabindex="0" role="button" aria-label="Focus Orders, Order lifecycle, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Order lifecycle" data-node-context="Branch" data-tree-depth="1" data-tree-ancestors="platform">
<title>Orders · Order lifecycle · Branch</title>
- <rect data-tree-stack="" x="121" y="184" width="140" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="121" y="184" width="140" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="116" y="179" width="140" height="59" rx="8" class="c-mask"/>
<rect x="116" y="179" width="140" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="186" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="186" y="203.5">Orders</tspan></text>
@@ -5071,7 +5073,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-payments" data-node-id="payments" data-node-label="Payments" tabindex="0" role="button" aria-label="Focus Payments, Money movement, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Money movement" data-node-context="Branch" data-tree-depth="1" data-tree-ancestors="platform">
<title>Payments · Money movement · Branch</title>
- <rect data-tree-stack="" x="458" y="184" width="140" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="458" y="184" width="140" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="453" y="179" width="140" height="59" rx="8" class="c-mask"/>
<rect x="453" y="179" width="140" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="523" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="523" y="203.5">Payments</tspan></text>
@@ -5079,7 +5081,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-operations" data-node-id="operations" data-node-label="Operations" tabindex="0" role="button" aria-label="Focus Operations, Back-office work, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Back-office work" data-node-context="Branch" data-tree-depth="1" data-tree-ancestors="platform">
<title>Operations · Back-office work · Branch</title>
- <rect data-tree-stack="" x="810" y="184" width="140" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="810" y="184" width="140" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="805" y="179" width="140" height="59" rx="8" class="c-mask"/>
<rect x="805" y="179" width="140" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="875" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="875" y="203.5">Operations</tspan></text>
@@ -6587,13 +6589,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7485,6 +7492,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8010,6 +8148,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8054,7 +8194,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8815,6 +8955,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9164,6 +9309,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9311,6 +9458,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11761,145 +11909,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12237,6 +12246,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12337,6 +12348,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12933,6 +12946,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13169,6 +13183,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13606,6 +13622,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/waterfall-checkout-request-rendered.html b/archify/examples/waterfall-checkout-request-rendered.html
index 49210619..85d109aa 100644
--- a/archify/examples/waterfall-checkout-request-rendered.html
+++ b/archify/examples/waterfall-checkout-request-rendered.html
@@ -6571,13 +6571,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7469,6 +7474,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -7994,6 +8130,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8038,7 +8176,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8799,6 +8937,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9148,6 +9291,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9295,6 +9440,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11745,145 +11891,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12221,6 +12228,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12321,6 +12330,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12917,6 +12928,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13153,6 +13165,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13590,6 +13604,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/waterfall-example-rebuild-rendered.html b/archify/examples/waterfall-example-rebuild-rendered.html
index 2a8ca0d7..2c86b320 100644
--- a/archify/examples/waterfall-example-rebuild-rendered.html
+++ b/archify/examples/waterfall-example-rebuild-rendered.html
@@ -6757,13 +6757,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7655,6 +7660,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8180,6 +8316,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8224,7 +8362,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8985,6 +9123,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9334,6 +9477,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9481,6 +9626,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11931,145 +12077,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12407,6 +12414,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12507,6 +12516,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13103,6 +13114,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13339,6 +13351,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13776,6 +13790,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/web-app-rendered.html b/archify/examples/web-app-rendered.html
index 6d86701b..f2104e76 100644
--- a/archify/examples/web-app-rendered.html
+++ b/archify/examples/web-app-rendered.html
@@ -6685,13 +6685,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7583,6 +7588,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8108,6 +8244,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8152,7 +8290,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8913,6 +9051,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9262,6 +9405,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9409,6 +9554,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11859,145 +12005,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12335,6 +12342,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12435,6 +12444,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13031,6 +13042,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13267,6 +13279,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13704,6 +13718,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/examples/workflow-agent-tool-call-rendered.html b/archify/examples/workflow-agent-tool-call-rendered.html
index 26693809..6b764917 100644
--- a/archify/examples/workflow-agent-tool-call-rendered.html
+++ b/archify/examples/workflow-agent-tool-call-rendered.html
@@ -6703,13 +6703,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7601,6 +7606,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8126,6 +8262,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8170,7 +8308,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8931,6 +9069,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9280,6 +9423,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9427,6 +9572,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11877,145 +12023,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12353,6 +12360,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12453,6 +12462,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13049,6 +13060,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13285,6 +13297,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13722,6 +13736,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/archify/renderers/class/README.md b/archify/renderers/class/README.md
index 55f9b1fb..e4f5454d 100644
--- a/archify/renderers/class/README.md
+++ b/archify/renderers/class/README.md
@@ -41,8 +41,10 @@ An attribute is `{ name, type?, visibility?, static? }` and draws as
`+ name: Type`. A method is `{ name, parameters?, returns?, visibility?,
static?, abstract? }` and draws as `+ name(parameters): Returns`. Visibility
uses the UML glyphs `+` public, `#` protected, `~` package, `-` private; a
-static member is underlined and an abstract method is italic. An interface may
-only declare `static` attributes (constants): `class/interface-state`.
+static member is underlined and an abstract method is italic. Interface
+attributes describe property contracts (for example, TypeScript's
+`interface Person { name: string }`); they do not imply stored implementation
+state. Interfaces may also declare static constants.
## Relationships
@@ -88,7 +90,9 @@ generalizations of one kind into one supertype, from subtypes placed below it
with at least 40px of gap, draw as one hierarchy bus: a single triangle and
trunk, a horizontal bus halfway down the gap, and a drop to each subtype. The
bus is drawn from the supertype outward so a dashed realization bus keeps one
-dash phase. A bus that would cross another type falls back to ordinary routes.
+dash phase. Its `data-motion-path` carries the source-to-target route so Viewer
+tokens and flow overlays follow the relationship's semantic direction. A bus
+that would cross another type falls back to ordinary routes.
All other relationships use the shared orthogonal router
(`../architecture/routing.mjs`) and the shared Clean Flow, crossing, corridor,
rhythm, and label-clearance gates.
diff --git a/archify/renderers/class/render-class.mjs b/archify/renderers/class/render-class.mjs
index c114b089..d4a72c4d 100644
--- a/archify/renderers/class/render-class.mjs
+++ b/archify/renderers/class/render-class.mjs
@@ -548,13 +548,6 @@ function validateClassDiagram() {
if (attributeNames.has(attribute.name)) problems.push(`Type "${type.id}" declares attribute "${attribute.name}" twice.`);
attributeNames.add(attribute.name);
}
- if (type.kind === 'interface' && asArray(type.attributes).some((attribute) => !attribute.static)) {
- fail(detail('class/interface-state',
- `Interface "${type.id}" declares instance attributes; an interface states a contract, not stored state. Move the fields to an implementing class, mark true constants as static, or use kind "abstract".`,
- { path: `/types/${index}`, typeId: type.id },
- { kind: type.kind, attributes: asArray(type.attributes).filter((attribute) => !attribute.static).map((attribute) => attribute.name) },
- ['Move the fields to an implementing class.', 'Mark constants as static.', 'Use kind "abstract" for a base class with state.']));
- }
// Members wrap, but the title is one line: a box must be wide enough for it.
const placed = types.get(type.id);
const needed = headerWidth(type);
@@ -808,7 +801,7 @@ function renderRelationshipPath(relationship, index) {
const routed = pathFor(relationship);
const reversed = busPaths.has(relationship);
const d = reversed ? roundedPath([...routed.points].reverse(), 8) : routed.d;
- const bus = reversed ? ` data-class-bus="${esc(relationship.to)}"` : '';
+ const bus = reversed ? ` data-class-bus="${esc(relationship.to)}" data-motion-path="${esc(routed.d)}"` : '';
return ` <path ${focusEdgeAttrs(relationship.from, relationship.to, relationship.label, index, relationship.id)} data-class-relationship="${relationship.kind}"${bus} data-composition-points="${routePointsValue(routed.points)}" d="${d}" class="${relationshipClass(relationship.kind)}"${animateAttr(cd.meta, 'edge', index)} stroke-width="1.5"${markerAttrs(relationship.kind, { reversed })}/>`;
}
diff --git a/archify/renderers/erd/grid.mjs b/archify/renderers/erd/grid.mjs
index 5fd8dc5e..4ec4c88d 100644
--- a/archify/renderers/erd/grid.mjs
+++ b/archify/renderers/erd/grid.mjs
@@ -52,8 +52,10 @@ const gridColumn = (col) => Number.isInteger(col * 2) && col >= 0;
export function bandedLayout(entities, grid) {
const widths = new Map();
const heights = new Map();
+ let maxCol = -1;
for (const entity of entities) {
if (!Number.isInteger(entity.row) || !gridColumn(entity.col)) continue;
+ maxCol = Math.max(maxCol, Math.ceil(entity.col));
if (Number.isInteger(entity.col)) widths.set(entity.col, Math.max(widths.get(entity.col) || 0, resolvedEntityWidth(entity, grid)));
heights.set(entity.row, Math.max(heights.get(entity.row) || 0, entity.height));
}
@@ -61,11 +63,23 @@ export function bandedLayout(entities, grid) {
const columnX = new Map();
const rowY = new Map();
let x = grid.origin[0];
- const maxCol = Math.max(-1, ...widths.keys());
for (let col = 0; col <= maxCol; col += 1) {
columnX.set(col, x);
x += (widths.get(col) || 0) + grid.gapX;
}
+ // A half-column box may be wider than its empty neighbouring bands. Keep
+ // every grid box inside the left margin without changing integer-only grids.
+ let leftInset = 0;
+ for (const entity of entities) {
+ if (!Number.isInteger(entity.row) || !gridColumn(entity.col) || Number.isInteger(entity.col)) continue;
+ const centre = (col) => columnX.get(col) + (widths.get(col) || 0) / 2;
+ const midpoint = (centre(Math.floor(entity.col)) + centre(Math.ceil(entity.col))) / 2;
+ leftInset = Math.max(leftInset, grid.origin[0] - midpoint + resolvedEntityWidth(entity, grid) / 2);
+ }
+ if (leftInset > 0) {
+ for (const [col, column] of columnX) columnX.set(col, column + leftInset);
+ x += leftInset;
+ }
let y = grid.origin[1];
const maxRow = Math.max(-1, ...heights.keys());
for (let row = 0; row <= maxRow; row += 1) {
diff --git a/archify/renderers/timeline/README.md b/archify/renderers/timeline/README.md
index 0ccfa822..392996b0 100644
--- a/archify/renderers/timeline/README.md
+++ b/archify/renderers/timeline/README.md
@@ -40,7 +40,8 @@ instant has one x in every lane, whatever offset each timestamp was written in.
`layout.breaks: "auto"` (default) compresses a quiet period longer than 8× the
median gap between distinct timestamps and 10% of the span (at most the eight
-longest). A break is a fixed-width hatched band with a zig-zag on the axis and
+longest that fit while preserving room for proportional time). A break is a
+fixed-width hatched band with a zig-zag on the axis and
the omitted duration (`≈ 1 d 11 h`); the axis caption states how many periods
were compressed, and each break carries `data-break-ms` and an accessible label.
Inside each segment the scale is the same constant, so distances there remain
diff --git a/archify/renderers/timeline/render-timeline.mjs b/archify/renderers/timeline/render-timeline.mjs
index 0b258b85..9bff3822 100644
--- a/archify/renderers/timeline/render-timeline.mjs
+++ b/archify/renderers/timeline/render-timeline.mjs
@@ -62,6 +62,14 @@ const layout = {
// Time is the one fact this diagram draws, so every timestamp must parse and
// state its own offset (the schema requires Z or ±HH:MM); the display zone must
// be a real IANA zone, and every event must sit in a declared lane.
+// Date.parse normalizes some impossible dates (February 30 becomes March 2).
+// Check the authored calendar date independently of its UTC offset first.
+function validCalendarDate(timestamp) {
+ const [year, month, day] = timestamp.slice(0, 10).split('-').map(Number);
+ const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
+ const days = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+ return month >= 1 && month <= 12 && day >= 1 && day <= days[month - 1];
+}
const timezone = tl.meta.timezone || 'UTC';
{
const problems = [];
@@ -81,7 +89,7 @@ const timezone = tl.meta.timezone || 'UTC';
for (const [index, event] of asArray(tl.events).entries()) {
if (seen.has(event.id)) fail('timeline/duplicate-id', `Event id "${event.id}" is declared twice.`, { path: `/events/${index}/id` }, { id: event.id }, ['Give every event a unique id.']);
seen.add(event.id);
- if (!Number.isFinite(Date.parse(event.at))) {
+ if (!validCalendarDate(event.at) || !Number.isFinite(Date.parse(event.at))) {
fail('timeline/invalid-timestamp', `Event "${event.id}" timestamp "${event.at}" is not a valid date and time.`,
{ path: `/events/${index}/at`, nodeId: event.id }, { at: event.at }, ['Use ISO 8601 with an explicit offset, e.g. "2026-10-01T10:05:00+08:00".']);
}
@@ -175,11 +183,26 @@ function approximateDuration(ms) {
const gaps = times.slice(1).map((time, index) => ({ from: times[index], to: time, length: time - times[index] }));
const sortedGaps = gaps.map((gap) => gap.length).sort((a, b) => a - b);
const medianGap = sortedGaps.length ? sortedGaps[Math.floor((sortedGaps.length - 1) / 2)] : 0;
-const breaks = tl.layout?.breaks === 'none' ? [] : gaps
+const SEGMENT_FLOOR = 28;
+const candidates = tl.layout?.breaks === 'none' ? [] : gaps
.filter((gap) => gap.length > 8 * medianGap && gap.length > 0.1 * span)
.sort((a, b) => b.length - a.length)
- .slice(0, 8)
- .sort((a, b) => a.from - b.from);
+ .slice(0, 8);
+
+// Reserve room for proportional time before accepting a break. If fixed-width
+// labels would exhaust the authored axis, leave shorter quiet periods on the
+// linear scale instead of collapsing all distinct instants to one position.
+const breaks = [];
+let fixedWidth = layout.edgePad * 2 + SEGMENT_FLOOR;
+for (const gap of candidates) {
+ gap.label = `≈ ${approximateDuration(gap.length)}`;
+ gap.width = Math.max(layout.breakW, Math.ceil(textUnits(gap.label) * 10.5 * ADVANCE + 18));
+ const addedWidth = gap.width + SEGMENT_FLOOR;
+ if (fixedWidth + addedWidth + layout.minTickPx > layout.axisWidth) continue;
+ breaks.push(gap);
+ fixedWidth += addedWidth;
+}
+breaks.sort((a, b) => a.from - b.from);
const segments = [];
{
@@ -196,11 +219,6 @@ const axisX0 = layout.margin + layout.laneLabelW;
// width so a lone event between two breaks never shares their x, and the rest
// of the axis is shared in proportion to time. Inside a segment the scale is
// one constant, so distances there are exact.
-const SEGMENT_FLOOR = 28;
-for (const gap of breaks) {
- gap.label = `≈ ${approximateDuration(gap.length)}`;
- gap.width = Math.max(layout.breakW, Math.ceil(textUnits(gap.label) * 10.5 * ADVANCE + 18));
-}
const drawable = layout.axisWidth - layout.edgePad * 2
- breaks.reduce((sum, gap) => sum + gap.width, 0) - SEGMENT_FLOOR * segments.length;
const scale = linearTime > 0 ? Math.max(0, drawable) / linearTime : 0;
diff --git a/archify/renderers/tree/render-tree.mjs b/archify/renderers/tree/render-tree.mjs
index b37d6f44..c92e362d 100644
--- a/archify/renderers/tree/render-tree.mjs
+++ b/archify/renderers/tree/render-tree.mjs
@@ -413,7 +413,7 @@ function renderNode(node) {
// A collapsed branch shows a stacked card behind it, so the hidden subtree
// stays visible as "there is more here" even before the badge is read.
const stack = childrenOf.get(node.id).length
- ? `<rect data-tree-stack="" x="${node.x + 5}" y="${node.y + 5}" width="${node.width}" height="${node.height}" rx="8" class="c-${tone}" stroke-width="1.2"/>`
+ ? `<rect data-tree-stack="" x="${node.x + 5}" y="${node.y + 5}" width="${node.width}" height="${node.height}" rx="8" class="tree-stack-${tone}" stroke-width="1.2"/>`
: '';
return ` <g ${focusNodeAttrs(node.id, node.label, passport, locale)} data-tree-depth="${node.depth}"${treeAttrs(node.id)}>
${focusNodeTitle(node.label, passport)}
@@ -461,6 +461,8 @@ ${renderDefinitions()}
svg[data-tree-ui] .tree-edge { stroke-linejoin: round; stroke-linecap: round; }
svg[data-tree-ui] .tree-leaf { fill: var(--mask); stroke: var(--lane-stroke); }
svg[data-tree-ui] [data-tree-stack] { display: none; fill: var(--mask); }
+ svg[data-tree-ui] .tree-stack-frontend { stroke: var(--frontend-stroke); }
+ svg[data-tree-ui] .tree-stack-backend { stroke: var(--backend-stroke); }
svg[data-tree-ui] [data-tree-collapsed] [data-tree-stack] { display: inline; }
svg[data-tree-ui] [data-tree-hidden] { display: none; }
svg[data-tree-ui] .tree-toggle-hit { fill: transparent; }
diff --git a/archify/test/class-motion-browser.test.mjs b/archify/test/class-motion-browser.test.mjs
new file mode 100644
index 00000000..9db7e155
--- /dev/null
+++ b/archify/test/class-motion-browser.test.mjs
@@ -0,0 +1,95 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
+import { execFileSync } from 'node:child_process';
+import { fileURLToPath, pathToFileURL } from 'node:url';
+import { findChrome } from '../bin/visual-check.mjs';
+import { desktopBrowser } from './helpers/desktop-browser.mjs';
+
+const skillRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
+const chrome = process.env.ARCHIFY_CHROME ? findChrome() : null;
+
+test('class: hierarchy bus motion follows from-to while retaining aligned visual dashes', {
+ skip: chrome ? false : 'Set ARCHIFY_CHROME to run class motion browser checks.',
+}, async (t) => {
+ const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-class-motion-'));
+ t.after(() => fs.rmSync(scratch, { recursive: true, force: true }));
+ const diagram = JSON.parse(fs.readFileSync(path.join(skillRoot, 'examples/payments.class.json'), 'utf8'));
+ diagram.meta.animation = 'trace';
+ const input = path.join(scratch, 'payments.class.json');
+ const output = path.join(scratch, 'payments.html');
+ fs.writeFileSync(input, JSON.stringify(diagram));
+ execFileSync(process.execPath, [path.join(skillRoot, 'renderers/class/render-class.mjs'), input, output]);
+ const browser = desktopBrowser(chrome);
+ t.after(() => browser.close());
+ const session = await browser.sessionPromise;
+ const send = (method, params = {}) => browser.cdp.send(method, params, session);
+ const run = async (expression) => {
+ const result = await send('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true });
+ assert.equal(result.exceptionDetails, undefined, result.exceptionDetails?.exception?.description);
+ return result.result?.value;
+ };
+ await send('Emulation.setDeviceMetricsOverride', { width: 1440, height: 900, deviceScaleFactor: 1, mobile: false });
+ await send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-reduced-motion', value: 'no-preference' }] });
+ await send('Page.addScriptToEvaluateOnNewDocument', { source: `try { localStorage.removeItem('archify-motion'); } catch (_) {}` });
+ const loaded = browser.cdp.waitFor('Page.loadEventFired', session);
+ await send('Page.navigate', { url: pathToFileURL(output).href });
+ await loaded;
+ await run('document.fonts.ready');
+ await run('Archify.viewerChromeLayout.whenStable()');
+ const result = await run(`(() => {
+ const edge = document.querySelector('path[data-edge-id="card_implements"]');
+ const visual = edge.getAttribute('d'), semantic = edge.getAttribute('data-motion-path');
+ const endpoints = pathData => {
+ const path = document.createElementNS('http://www.w3.org/2000/svg', 'path'); path.setAttribute('d', pathData);
+ const first = path.getPointAtLength(0), last = path.getPointAtLength(path.getTotalLength());
+ return [[first.x, first.y], [last.x, last.y]];
+ };
+ const token = Archify.flowTokens.create(edge, edge);
+ Archify.focus.inspectRelationshipById('card_implements', { toggle: false });
+ const pulse = document.querySelector('.relationship-flow-pulse').getAttribute('d');
+ const animatedToken = document.querySelector('.relationship-flow-token animateMotion').getAttribute('path');
+ Archify.focus.clear();
+ Archify.intentTrace.show('card_gateway');
+ const intent = document.querySelector('.intent-trace-flow').getAttribute('d');
+ Archify.intentTrace.clear();
+ Archify.semanticLens.select('class');
+ const lens = [...document.querySelectorAll('.semantic-lens-flow')].some(path => path.getAttribute('d') === semantic);
+ Archify.semanticLens.clear();
+ Archify.routeProbe.begin(); Archify.routeProbe.choose('card_gateway'); Archify.routeProbe.choose('payment_gateway');
+ const route = document.querySelector('.route-probe-flow').getAttribute('d');
+ Archify.routeProbe.selectJourneyIndex(1);
+ const journey = document.querySelector('.route-journey-flow').getAttribute('d');
+ return { visual, semantic, visualEnds: endpoints(visual), semanticEnds: endpoints(semantic),
+ token: token.querySelector('animateMotion').getAttribute('path'), pulse, animatedToken, intent, lens, route, journey,
+ original: edge.getAttribute('d'), marker: edge.getAttribute('marker-start') };
+ })()`);
+ assert.notEqual(result.visual, result.semantic);
+ assert.deepEqual(result.visualEnds, [...result.semanticEnds].reverse());
+ for (const mode of ['token', 'animatedToken', 'pulse', 'intent', 'route', 'journey']) assert.equal(result[mode], result.semantic, mode);
+ assert.equal(result.lens, true);
+ assert.equal(result.original, result.visual);
+ assert.equal(result.marker, 'url(#cl-triangle-start)');
+ const recording = await run(`(async () => {
+ Archify.routeProbe.clear();
+ const original = SVGGeometryElement.prototype.getPointAtLength;
+ const samples = [];
+ SVGGeometryElement.prototype.getPointAtLength = function (distance) {
+ const point = original.call(this, distance);
+ if (this.getAttribute('data-edge-id') === 'card_implements') samples.push({ d: this.getAttribute('d'), x: point.x, y: point.y });
+ return point;
+ };
+ try {
+ const blob = await Archify.motion.recordWebm({ duration: 250, fps: 10 });
+ return { type: blob.type, size: blob.size, samples };
+ } finally { SVGGeometryElement.prototype.getPointAtLength = original; }
+ })()`);
+ assert.match(recording.type, /^video\/webm/);
+ assert.ok(recording.size > 0);
+ assert.ok(recording.samples.length > 1);
+ assert.ok(recording.samples.every((sample) => sample.d === result.semantic));
+ assert.deepEqual([recording.samples[0].x, recording.samples[0].y], result.semanticEnds[0]);
+ assert.deepEqual([recording.samples.at(-1).x, recording.samples.at(-1).y], result.semanticEnds[1]);
+});
diff --git a/archify/test/class-rendering.test.mjs b/archify/test/class-rendering.test.mjs
index 8c687726..d9d849a1 100644
--- a/archify/test/class-rendering.test.mjs
+++ b/archify/test/class-rendering.test.mjs
@@ -7,6 +7,7 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { textUnits } from '../renderers/shared/utils.mjs';
+import { bandedLayout, resolveEntityPos } from '../renderers/erd/grid.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const skillRoot = path.resolve(__dirname, '..');
@@ -100,6 +101,32 @@ test('class: implementations of one supertype share a hierarchy bus and a single
assert.ok(Math.abs(centre(gateway) - (centre(boxes.get('card_gateway')) + centre(boxes.get('wallet_gateway'))) / 2) < 0.5);
});
+test('class: half columns remain placeable without occupied integer neighbours', () => {
+ const grid = { origin: [100, 40], gapX: 128, gapY: 84, entityW: 180 };
+ for (const col of [0.5, 1.5, 3.5]) {
+ const entity = { row: 0, col, width: 180, height: 60 };
+ const bands = bandedLayout([entity], grid);
+ assert.deepEqual(resolveEntityPos(entity, grid, bands), [Math.max(100, 100 + 128 * col - 90), 40]);
+ }
+ const diagram = clone(small);
+ diagram.types = [{ id: 'person', label: 'Person', kind: 'interface', row: 0, col: 0.5, width: 300 }];
+ diagram.relationships = [];
+ const result = render(diagram);
+ assert.equal(result.status, 0, result.stderr);
+ assert.doesNotMatch(result.svg, /NaN|Infinity/);
+ const box = typeBoxes(result.svg).get('person');
+ assert.ok(box.x >= 0, 'half-column box must stay inside the canvas');
+ const check = spawnSync(process.execPath, [checker, result.output], { encoding: 'utf8' });
+ assert.equal(JSON.parse(check.stdout).ok, true, check.stdout);
+});
+
+test('class: shared grid preserves integer-column positions for ERD callers', () => {
+ const grid = { origin: [32, 40], gapX: 56, gapY: 44, entityW: 240 };
+ const entities = [{ row: 0, col: 0, width: 240, height: 60 }, { row: 0, col: 2, width: 120, height: 60 }];
+ const bands = bandedLayout(entities, grid);
+ assert.deepEqual(entities.map((entity) => resolveEntityPos(entity, grid, bands)), [[32, 40], [384, 40]]);
+});
+
test('class: long members wrap inside the box instead of being truncated', () => {
const { svg, status, stderr } = render(large);
assert.equal(status, 0, stderr);
@@ -148,9 +175,27 @@ test('class: an inheritance cycle is rejected', () => {
assert.match(stderr, /class\/inheritance-cycle/);
});
-test('class: an interface cannot hold instance state', () => {
- const stderr = failure((d) => { d.types.find((t) => t.id === 'payment_gateway').attributes = [{ name: 'apiKey', type: 'String' }]; });
- assert.match(stderr, /class\/interface-state/);
+test('class: interfaces accept instance property contracts and static constants', () => {
+ const diagram = clone(small);
+ diagram.types.find((type) => type.id === 'payment_gateway').attributes = [
+ { name: 'name', type: 'string' },
+ { name: 'VERSION', type: 'string', static: true },
+ ];
+ const { status, stderr, svg } = render(diagram);
+ assert.equal(status, 0, stderr);
+ const text = svg.replace(/<[^>]+>/g, '');
+ assert.match(text, /name: string/);
+ assert.match(text, /VERSION: string/);
+});
+
+test('class: duplicate interface properties remain invalid', () => {
+ const stderr = failure((diagram) => {
+ diagram.types.find((type) => type.id === 'payment_gateway').attributes = [
+ { name: 'name', type: 'string' },
+ { name: 'name', type: 'string' },
+ ];
+ });
+ assert.match(stderr, /declares attribute "name" twice/);
});
test('class: an authored width too narrow for the title is reported, not clipped', () => {
diff --git a/archify/test/i18n.test.mjs b/archify/test/i18n.test.mjs
index 839996b2..fd4cae64 100644
--- a/archify/test/i18n.test.mjs
+++ b/archify/test/i18n.test.mjs
@@ -1118,14 +1118,20 @@ test('the bundled Korean catalog is complete and preserves interpolation variabl
// Additional checked-in example catalogs demonstrating the same data
// contract across a wider language set (representative real-diagram checks
-// requested in tt-a1i's review on #457): each is a complete, full-coverage
-// example a caller could supply via meta.translations, none of them built
-// into the renderer.
+// requested in tt-a1i's review on #457): reusable catalogs a caller can
+// supply via meta.translations. Historical key gaps fall back explicitly;
+// newly added diagram types must carry their own translations.
for (const locale of ['fr', 'pt', 'ja', 'de', 'it', 'ru']) {
- test(`the checked-in ${locale} example catalog validates reusable translations and discloses new-key gaps`, () => {
+ test(`the checked-in ${locale} example catalog validates reusable translations and discloses historical gaps`, () => {
const translations = JSON.parse(fs.readFileSync(path.join(skillRoot, `examples/locales/${locale}.json`), 'utf8'));
const report = validateTranslations(translations);
- assert.ok(report.coverage > 0.9, 'reuse the established catalog while new keys fall back explicitly');
+ assert.ok(report.coverage > 0.9, 'reuse the established catalog while historical gaps fall back explicitly');
+ const newDiagramKeys = catalogKeys().filter((key) =>
+ /\.(?:tree|class|timeline|waterfall)(?:\.|$)/.test(key) || /^(?:tree|timeline|waterfall)\./.test(key));
+ for (const key of newDiagramKeys) {
+ assert.equal(typeof translations[key], 'string', `${locale}: missing ${key}`);
+ assert.ok(translations[key].trim(), `${locale}: empty ${key}`);
+ }
assert.equal(report.unknownKeys.length, 0, `unknown: ${report.unknownKeys.join(', ')}`);
assert.equal(report.placeholderMismatches.length, 0, JSON.stringify(report.placeholderMismatches));
assert.equal(report.coveredKeys + report.missingKeys.length, report.totalKeys);
diff --git a/archify/test/repository-evidence-types.test.mjs b/archify/test/repository-evidence-types.test.mjs
index e87bb71a..36d6914a 100644
--- a/archify/test/repository-evidence-types.test.mjs
+++ b/archify/test/repository-evidence-types.test.mjs
@@ -199,7 +199,25 @@ for (const shape of TYPES) {
]) {
const result = run(args);
assert.equal(result.status, 1, type);
- assert.match(result.stdout, /ids must be unique|duplicate-node-id/, type);
+ const receipt = JSON.parse(result.stdout);
+ assert.equal(receipt.ok, false, type);
+ if (['tree', 'timeline', 'waterfall'].includes(type)) {
+ const duplicateDiagnostic = receipt.diagnostics.find((entry) => entry.code === `${type}/duplicate-id`);
+ assert.ok(duplicateDiagnostic, `${type}: duplicate ID diagnostic missing`);
+ assert.equal(duplicateDiagnostic.severity, 'error');
+ assert.deepEqual(duplicateDiagnostic.evidence, { id: first });
+ assert.deepEqual(duplicateDiagnostic.subject, {
+ diagramType: type,
+ path: `/${collection}/${data.diagram[collection].length - 1}/id`,
+ });
+ } else {
+ assert.ok(
+ /ids must be unique/.test(receipt.error) ||
+ receipt.diagnostics.some((entry) => entry.code === 'workflow/duplicate-node-id'),
+ `${type}: duplicate ID rejection missing`,
+ );
+ }
+ assert.equal(fs.readFileSync(output, 'utf8'), 'trusted previous artifact', `${type}/${args[0]}`);
}
assert.equal(fs.readFileSync(output, 'utf8'), 'trusted previous artifact');
});
diff --git a/archify/test/timeline-rendering.test.mjs b/archify/test/timeline-rendering.test.mjs
index 48c175b4..77035954 100644
--- a/archify/test/timeline-rendering.test.mjs
+++ b/archify/test/timeline-rendering.test.mjs
@@ -112,3 +112,48 @@ test('timeline: ambiguous or invalid time input is refused', () => {
assert.match(failure((d) => { d.events[0].lane = 'billing'; }), /timeline\/unknown-lane/);
assert.match(failure((d) => { delete d.meta.evidence; }), /evidence/);
});
+
+test('timeline: invalid calendar dates are rejected before Date.parse can normalize them', () => {
+ for (const at of ['2026-02-30T10:00:00Z', '2025-02-29T10:00:00+05:30', '2100-02-29T10:00:00Z', '2026-04-31T10:00:00-04:00']) {
+ assert.match(failure((diagram) => { diagram.events[0].at = at; }), /timeline\/invalid-timestamp/);
+ }
+ for (const at of ['2024-02-29T10:00:00+05:30', '2000-02-29T10:00:00Z']) {
+ const diagram = clone(small);
+ diagram.events[0].at = at;
+ const event = layoutOf(diagram).events.find((entry) => entry.id === diagram.events[0].id);
+ assert.equal(event.t, Date.parse(at));
+ }
+});
+
+function crowdedBreaksDiagram() {
+ const diagram = clone(small);
+ diagram.layout = { width: 480, breaks: 'auto' };
+ const start = Date.parse('2026-01-01T00:00:00Z');
+ // Nine short bursts separated by eight eligible quiet periods. Their labels
+ // and segment floors previously exhausted a 480px axis and set scale to 0.
+ diagram.events = Array.from({ length: 18 }, (_, index) => ({
+ id: `event_${index}`,
+ at: new Date(start + Math.floor(index / 2) * (35 * 60 * 60000) + (index % 2) * 10 * 60000).toISOString(),
+ title: `Event ${index}`,
+ lane: 'release',
+ }));
+ return diagram;
+}
+
+test('timeline: automatic breaks leave room for proportional time on a narrow axis', () => {
+ const report = layoutOf(crowdedBreaksDiagram());
+ assert.ok(report.breaks.length > 0, 'eligible quiet periods still compress');
+ assert.ok(report.scalePxPerMinute > 0, 'distinct instants must retain a positive scale');
+ assert.ok(report.events.every((event, index, all) => !index || event.x > all[index - 1].x), 'distinct instants must not collapse to one x');
+ for (const segment of report.segments) {
+ assert.ok(segment.x0 <= segment.x1);
+ assert.ok(segment.x1 <= report.viewBox[0] - 28 - 72, 'segments stay within the authored axis');
+ }
+ for (const gap of report.breaks) assert.ok(gap.x1 <= report.viewBox[0] - 28 - 72, 'breaks stay within the authored axis');
+ const result = run(crowdedBreaksDiagram());
+ assert.equal(result.status, 0, result.stderr);
+ const html = fs.readFileSync(result.output, 'utf8');
+ assert.equal((html.match(/data-timeline-break=""/g) || []).length, report.breaks.length);
+ const receipt = JSON.parse(spawnSync(process.execPath, [checker, result.output], { encoding: 'utf8' }).stdout);
+ assert.equal(receipt.ok, true, JSON.stringify(receipt.checks.filter((entry) => !entry.ok)));
+});
diff --git a/archify/test/tree-branches-browser.test.mjs b/archify/test/tree-branches-browser.test.mjs
index b8488d80..3f6c5762 100644
--- a/archify/test/tree-branches-browser.test.mjs
+++ b/archify/test/tree-branches-browser.test.mjs
@@ -19,9 +19,24 @@ test('Tree branches collapse in place, follow the keyboard, reveal selections, a
}, async (t) => {
const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-tree-browser-'));
t.after(() => fs.rmSync(scratch, { recursive: true, force: true }));
+ // Verified evidence on a root, branch and leaf exercises the shared beacon
+ // installer against both hidden stack decorations and actual node cards.
+ const git = (...args) => execFileSync('git', ['-C', scratch, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
+ fs.writeFileSync(path.join(scratch, 'source.js'), 'export const source = true;\n');
+ git('init');
+ git('config', 'user.name', 'Archify Tests');
+ git('config', 'user.email', '[email protected]');
+ git('add', 'source.js');
+ git('commit', '-m', 'source fixture');
+ git('remote', 'add', 'origin', 'https://github.com/example/evidence-repo');
const render = (example, name) => {
const output = path.join(scratch, name);
- execFileSync(process.execPath, [path.join(skillRoot, 'renderers/tree/render-tree.mjs'), path.join(skillRoot, 'examples', example), output]);
+ const diagram = JSON.parse(fs.readFileSync(path.join(skillRoot, 'examples', example), 'utf8'));
+ diagram.meta.repository = { url: 'https://github.com/example/evidence-repo', revision: git('rev-parse', 'HEAD') };
+ diagram.nodes.forEach((node) => { node.sources = [{ path: 'source.js', line: 1 }]; });
+ const input = path.join(scratch, name + '.json');
+ fs.writeFileSync(input, JSON.stringify(diagram));
+ execFileSync(process.execPath, [path.join(skillRoot, 'bin/archify.mjs'), 'render', 'tree', input, output, '--repo-root', scratch]);
return output;
};
const small = render('payment-platform.tree.json', 'small.html');
@@ -43,10 +58,11 @@ test('Tree branches collapse in place, follow the keyboard, reveal selections, a
assert.equal(result.exceptionDetails, undefined, result.exceptionDetails?.exception?.description);
return result.result?.value;
}
- async function load(file) {
+ let loadCount = 0;
+ async function load(file, hash = '', theme = 'light') {
await send('Emulation.setDeviceMetricsOverride', { width: 1440, height: 900, deviceScaleFactor: 1, mobile: false });
const loaded = browser.cdp.waitFor('Page.loadEventFired', session);
- await send('Page.navigate', { url: pathToFileURL(file).href + '?theme=light' });
+ await send('Page.navigate', { url: pathToFileURL(file).href + '?theme=' + theme + '&load=' + ++loadCount + hash });
await loaded;
await run('document.fonts.ready');
await run('Archify.viewerChromeLayout.whenStable()');
@@ -59,6 +75,17 @@ test('Tree branches collapse in place, follow the keyboard, reveal selections, a
await load(small);
assert.equal(await run('Archify.treeBranches.active'), true);
+ async function checkBeacons() {
+ assert.deepEqual(await run(`(() => ['platform', 'payments', 'card_payment'].map(id => {
+ const node = document.querySelector('[data-node-id="' + id + '"]');
+ const beacon = node.querySelector('[data-source-evidence-beacon]');
+ const card = node.querySelector('rect.c-mask').getBoundingClientRect();
+ const box = beacon && beacon.getBoundingClientRect();
+ return { id, exists: !!beacon, onCard: !!box && box.x >= card.x && box.x + box.width <= card.x + card.width
+ && box.y >= card.y && box.y + box.height <= card.y + card.height };
+ }))()`), ['platform', 'payments', 'card_payment'].map(id => ({ id, exists: true, onCard: true })));
+ }
+ await checkBeacons();
const before = await run(box('operations'));
const started = await run('performance.now()');
await run(`document.querySelector('[data-tree-toggle="payments"]').dispatchEvent(new MouseEvent('click', { bubbles: true }))`);
@@ -122,4 +149,21 @@ test('Tree branches collapse in place, follow the keyboard, reveal selections, a
await load(large);
assert.deepEqual(await run('Archify.treeBranches.collapsedIds()'), ['viewer']);
assert.equal(await run(`document.querySelector('[data-node-id="v_tree"]').hasAttribute('data-tree-hidden')`), true);
+
+ // Initial shared links reveal the authored collapsed ancestors before focus
+ // measures the node. Hash updates use an internal setter, as do multi-selects.
+ await load(large, '#focus=v_tree');
+ assert.deepEqual(await run('Archify.treeBranches.collapsedIds()'), []);
+ assert.equal(await run('Archify.focus.active()'), 'v_tree');
+ assert.equal(await run(`document.querySelector('[data-node-id="v_tree"]').getBoundingClientRect().width > 0`), true);
+ assert.equal(await run(`document.getElementById('focus-chip').hidden`), false);
+ await run(`Archify.treeBranches.collapse('viewer'); location.hash = 'focus=v_focus'`);
+ await run(`new Promise(resolve => setTimeout(resolve, 50))`);
+ assert.equal(await run('Archify.focus.active()'), 'v_focus');
+ assert.deepEqual(await run('Archify.treeBranches.collapsedIds()'), []);
+ await run(`Archify.treeBranches.collapse('viewer'); Archify.focus.setMany(['v_tree', 'v_focus'])`);
+ assert.deepEqual(await run('Archify.treeBranches.collapsedIds()'), []);
+
+ await load(small, '', 'dark');
+ await checkBeacons();
});
diff --git a/docs/assets/archify-live-proof.gif b/docs/assets/archify-live-proof.gif
index f2cde7ca..8322c377 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 0c6ee9a1..2d1ff63f 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": 816319,
- "sha256": "877555dff857fc332170d112d421ef5325afa0fd760c59bce3164367d1649645",
+ "bytes": 819442,
+ "sha256": "38a5c97d2611c524687d35855c80fab760990fd9268cd28cb648f93e73d04c2b",
"scenes": [
{
"id": "signal-flow",
"artifact": "docs/gallery/artifacts/agent-tool-call.workflow.html",
- "artifactSha256": "cf405de7beb905b4388dc2579edb120cb8814bf520dab766ccfcda3da128d404",
+ "artifactSha256": "ac7c33cb99f63f6807c9bbb9b1978f6875786c7b37173929b569062d7c1edec7",
"hash": "#focus=planner&reach=downstream",
"eyebrow": "WORKFLOW · SIGNAL FLOW",
"title": "Agent Tool Call",
@@ -22,7 +22,7 @@
{
"id": "blueprint",
"artifact": "docs/gallery/artifacts/production-deployment.architecture.html",
- "artifactSha256": "4b489129190d81e07e0b69c44b73f3eb0db0435a38e7f8e9fefc42b202e87862",
+ "artifactSha256": "1b69186699d94f1fb0a85dfae96aa0bbdad41d9cbbac3345310136bb912b1413",
"hash": "#lens=backend~database",
"eyebrow": "ARCHITECTURE · BLUEPRINT",
"title": "Production Deployment",
@@ -31,7 +31,7 @@
{
"id": "classic",
"artifact": "docs/gallery/artifacts/cache-miss.sequence.html",
- "artifactSha256": "af6fcf4a9bf56d23869e63adf929e662d21b0bb75a903ed6b99fb632de0012c7",
+ "artifactSha256": "7798abfc9cb7ab44c1d99540062a4decc88704d4b427cfc5215a162fd4322987",
"hash": "#route=web~db",
"eyebrow": "SEQUENCE · CLASSIC",
"title": "Cache Miss Request",
diff --git a/docs/gallery.html b/docs/gallery.html
index be3dbb89..1aa3bad8 100644
--- a/docs/gallery.html
+++ b/docs/gallery.html
@@ -299,7 +299,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="cf405de7beb905b4388dc2579edb120cb8814bf520dab766ccfcda3da128d404">cf405de7beb9</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="ac7c33cb99f63f6807c9bbb9b1978f6875786c7b37173929b569062d7c1edec7">ac7c33cb99f6</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/agent-tool-call.workflow.html#focus=planner" target="_blank" rel="noopener" data-en="Explore focus ↗" data-zh="探索聚焦路径 ↗">Explore focus ↗</a>
@@ -329,7 +329,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="4b489129190d81e07e0b69c44b73f3eb0db0435a38e7f8e9fefc42b202e87862">4b489129190d</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="1b69186699d94f1fb0a85dfae96aa0bbdad41d9cbbac3345310136bb912b1413">1b69186699d9</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/production-deployment.architecture.html#focus=gateway" target="_blank" rel="noopener" data-en="Explore focus ↗" data-zh="探索聚焦路径 ↗">Explore focus ↗</a>
@@ -358,7 +358,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="af6fcf4a9bf56d23869e63adf929e662d21b0bb75a903ed6b99fb632de0012c7">af6fcf4a9bf5</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="7798abfc9cb7ab44c1d99540062a4decc88704d4b427cfc5215a162fd4322987">7798abfc9cb7</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/cache-miss.sequence.html#focus=redis" target="_blank" rel="noopener" data-en="Explore focus ↗" data-zh="探索聚焦路径 ↗">Explore focus ↗</a>
@@ -387,7 +387,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="e8fb8f310b028a59785bb130f419c4ab631003e53d8dc20c65a11253a9371067">e8fb8f310b02</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="42d12e7206c4d85bd217dcb54f635fe7311eae1abb075a15b8fff01429d2bdd1">42d12e7206c4</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/release-delivery.workflow.html#focus=approval" target="_blank" rel="noopener" data-en="Explore focus ↗" data-zh="探索聚焦路径 ↗">Explore focus ↗</a>
@@ -416,7 +416,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="e1b5eff2da878f794979da28df5ccc8a7cfcd2b2d3f48d86db4484d5a727b6c1">e1b5eff2da87</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="1d3cf5f0b0ea91d13dcf24478c3be61b028dd18291a0a75c28abc02e7ca20da9">1d3cf5f0b0ea</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/incident-response.workflow.html#focus=triage" target="_blank" rel="noopener" data-en="Explore focus ↗" data-zh="探索聚焦路径 ↗">Explore focus ↗</a>
@@ -445,7 +445,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="8aeb66c9d02b95dcabe619294a13cb89ea8eaa6a66a8462b255055bc65342954">8aeb66c9d02b</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="17cc430e6bc88a2ca208175cecdc30e5e473cf568740f86b258feadfd7ad0afe">17cc430e6bc8</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/product-analytics.dataflow.html#focus=consent" target="_blank" rel="noopener" data-en="Explore focus ↗" data-zh="探索聚焦路径 ↗">Explore focus ↗</a>
@@ -474,7 +474,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="ff5932f91cd5a68ca731e00a94f6888bbdff3260e53cd5eacd78c815ca3d412e">ff5932f91cd5</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="2a707fe9dbaaf42971e16078ae87381ef626256fcb26907e990e10b58032b9fa">2a707fe9dbaa</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/async-job-roundtrip.sequence.html#focus=queue" target="_blank" rel="noopener" data-en="Explore focus ↗" data-zh="探索聚焦路径 ↗">Explore focus ↗</a>
@@ -503,7 +503,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="19eecad8fb6640d56e71fcaa8345efedde3052fee708838189793016e429ebbc">19eecad8fb66</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="91f3352ef20befe2a7bf4f22861175d207e4866cc57366bfc5989766df00a335">91f3352ef20b</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/event-stream.dataflow.html#focus=orders" target="_blank" rel="noopener" data-en="Explore focus ↗" data-zh="探索聚焦路径 ↗">Explore focus ↗</a>
@@ -532,7 +532,7 @@
<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 6E</span></div>
- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="900c56d7d2d5c2d3e4da6538e0212aa68f8cc56f64616c21ad3df64bb19d7d21">900c56d7d2d5</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="185bf3476ac757bba78ab55779c38283f1b68d296945b60330530530e82fab60">185bf3476ac7</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/agent-run.lifecycle.html#focus=approval" target="_blank" rel="noopener" data-en="Explore focus ↗" data-zh="探索聚焦路径 ↗">Explore focus ↗</a>
@@ -561,7 +561,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 · 11E</span></div>
- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="d71454a798124118752cfcbc17af16e15b2f69ccaeb385a8545739c9490dd6bf">d71454a79812</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="2c91ec452f00ac8e7fa9485fea6326a54da3645a98d88d98915322f8c700f681">2c91ec452f00</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/deployment-release.lifecycle.html#focus=live" target="_blank" rel="noopener" data-en="Explore focus ↗" data-zh="探索聚焦路径 ↗">Explore focus ↗</a>
@@ -590,7 +590,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="dcee442b2a4d02fa402651eff40a26d8ca31f180d1be7dcdf8175c298fcdf6bb">dcee442b2a4d</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="53e05fad17160f6419f6060c965ec4dd83b2760c85429031668afc03a0b359d3">53e05fad1716</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/web-app.architecture.html#focus=api" target="_blank" rel="noopener" data-en="Explore focus ↗" data-zh="探索聚焦路径 ↗">Explore focus ↗</a>
@@ -619,7 +619,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">6N · 5E</span></div>
- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="a016fd4ffd2abbeceb73555ce33e6b763932a3a7d54391c2e8120cbf85d5e2a6">a016fd4ffd2a</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="063d89de2bf0651fd1be1ed9518eb7314a1b6b15619b712035d996065195c12b">063d89de2bf0</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/orders.erd.html#focus=order" target="_blank" rel="noopener" data-en="Explore focus ↗" data-zh="探索聚焦路径 ↗">Explore focus ↗</a>
@@ -698,8 +698,8 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 12,
"edgeCount": 11,
- "artifactBytes": 775338,
- "artifactSha256": "cf405de7beb905b4388dc2579edb120cb8814bf520dab766ccfcda3da128d404",
+ "artifactBytes": 776281,
+ "artifactSha256": "ac7c33cb99f63f6807c9bbb9b1978f6875786c7b37173929b569062d7c1edec7",
"sourceBytes": 4939,
"sourceSha256": "d67965d50872c97e4ff3476271e645bf19fab6b3ab44e111bdb44b063e3aa36f",
"checks": [
@@ -833,8 +833,8 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>
"engineeringProfile": "deployment-ownership",
"nodeCount": 12,
"edgeCount": 12,
- "artifactBytes": 778065,
- "artifactSha256": "4b489129190d81e07e0b69c44b73f3eb0db0435a38e7f8e9fefc42b202e87862",
+ "artifactBytes": 779008,
+ "artifactSha256": "1b69186699d94f1fb0a85dfae96aa0bbdad41d9cbbac3345310136bb912b1413",
"sourceBytes": 4734,
"sourceSha256": "cb54bad2dfd0c2d02aa5b496bde6839789a0f07f23062343c4458b8d38806c13",
"checks": [
@@ -966,8 +966,8 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 7,
"edgeCount": 12,
- "artifactBytes": 769878,
- "artifactSha256": "af6fcf4a9bf56d23869e63adf929e662d21b0bb75a903ed6b99fb632de0012c7",
+ "artifactBytes": 770821,
+ "artifactSha256": "7798abfc9cb7ab44c1d99540062a4decc88704d4b427cfc5215a162fd4322987",
"sourceBytes": 3805,
"sourceSha256": "f8486daa803fff6c295cecca4604c561fbbf9acb2e83326022b5a87639e8afe6",
"checks": [
@@ -1100,8 +1100,8 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 10,
- "artifactBytes": 770852,
- "artifactSha256": "e8fb8f310b028a59785bb130f419c4ab631003e53d8dc20c65a11253a9371067",
+ "artifactBytes": 771795,
+ "artifactSha256": "42d12e7206c4d85bd217dcb54f635fe7311eae1abb075a15b8fff01429d2bdd1",
"sourceBytes": 4510,
"sourceSha256": "dbd5c174af66296caec372e7214cf4df7158b50a563508e16826b95ab8d1cd6c",
"checks": [
@@ -1240,8 +1240,8 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 11,
"edgeCount": 10,
- "artifactBytes": 768172,
- "artifactSha256": "e1b5eff2da878f794979da28df5ccc8a7cfcd2b2d3f48d86db4484d5a727b6c1",
+ "artifactBytes": 769115,
+ "artifactSha256": "1d3cf5f0b0ea91d13dcf24478c3be61b028dd18291a0a75c28abc02e7ca20da9",
"sourceBytes": 4723,
"sourceSha256": "630be98449925d2716ecb8439f404b2bff5fe65ba905b0ad0baea6d96890c526",
"checks": [
@@ -1426,8 +1426,8 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 10,
- "artifactBytes": 772172,
- "artifactSha256": "8aeb66c9d02b95dcabe619294a13cb89ea8eaa6a66a8462b255055bc65342954",
+ "artifactBytes": 773115,
+ "artifactSha256": "17cc430e6bc88a2ca208175cecdc30e5e473cf568740f86b258feadfd7ad0afe",
"sourceBytes": 5035,
"sourceSha256": "8a635db9e51a5b1a8d2955b9d66f5b9a450e0a298432ce8f2e2f0be11f372e05",
"checks": [
@@ -1561,8 +1561,8 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 7,
"edgeCount": 14,
- "artifactBytes": 768964,
- "artifactSha256": "ff5932f91cd5a68ca731e00a94f6888bbdff3260e53cd5eacd78c815ca3d412e",
+ "artifactBytes": 769907,
+ "artifactSha256": "2a707fe9dbaaf42971e16078ae87381ef626256fcb26907e990e10b58032b9fa",
"sourceBytes": 3766,
"sourceSha256": "b8c6c52f1763ede2933c77deb8da59b3e06917bc41d27e66df896136456b859a",
"checks": [
@@ -1713,8 +1713,8 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 12,
"edgeCount": 12,
- "artifactBytes": 776092,
- "artifactSha256": "19eecad8fb6640d56e71fcaa8345efedde3052fee708838189793016e429ebbc",
+ "artifactBytes": 777035,
+ "artifactSha256": "91f3352ef20befe2a7bf4f22861175d207e4866cc57366bfc5989766df00a335",
"sourceBytes": 4769,
"sourceSha256": "3bdd77674282009c7c68d588cf8a3c495bc98a3be1b9c45327fd1801a6f83a23",
"checks": [
@@ -1865,8 +1865,8 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 6,
- "artifactBytes": 766482,
- "artifactSha256": "900c56d7d2d5c2d3e4da6538e0212aa68f8cc56f64616c21ad3df64bb19d7d21",
+ "artifactBytes": 767425,
+ "artifactSha256": "185bf3476ac757bba78ab55779c38283f1b68d296945b60330530530e82fab60",
"sourceBytes": 3405,
"sourceSha256": "230242a7557663877766c43a9fe7cffe8b4fb66e4866457dccd24c63175b4917",
"checks": [
@@ -2036,8 +2036,8 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 11,
"edgeCount": 11,
- "artifactBytes": 773537,
- "artifactSha256": "d71454a798124118752cfcbc17af16e15b2f69ccaeb385a8545739c9490dd6bf",
+ "artifactBytes": 774480,
+ "artifactSha256": "2c91ec452f00ac8e7fa9485fea6326a54da3645a98d88d98915322f8c700f681",
"sourceBytes": 3507,
"sourceSha256": "f565a8acfebdb21453e2bccd82d3760b4736e38fe194fb2f0804b57817eba813",
"checks": [
@@ -2158,8 +2158,8 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 9,
- "artifactBytes": 769878,
- "artifactSha256": "dcee442b2a4d02fa402651eff40a26d8ca31f180d1be7dcdf8175c298fcdf6bb",
+ "artifactBytes": 770821,
+ "artifactSha256": "53e05fad17160f6419f6060c965ec4dd83b2760c85429031668afc03a0b359d3",
"sourceBytes": 3197,
"sourceSha256": "95e051b27a9e4a3307e194c0f666fca4af51470be7e2228d400ff48aea5b353b",
"checks": [
@@ -2304,8 +2304,8 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>
"engineeringProfile": null,
"nodeCount": 6,
"edgeCount": 5,
- "artifactBytes": 784373,
- "artifactSha256": "a016fd4ffd2abbeceb73555ce33e6b763932a3a7d54391c2e8120cbf85d5e2a6",
+ "artifactBytes": 785316,
+ "artifactSha256": "063d89de2bf0651fd1be1ed9518eb7314a1b6b15619b712035d996065195c12b",
"sourceBytes": 7321,
"sourceSha256": "1777a374647084466f4d7ce3a968004be6ab70ac9cf82459b96bed7c556cdfdd",
"checks": [
diff --git a/docs/gallery/artifacts/agent-run.lifecycle.html b/docs/gallery/artifacts/agent-run.lifecycle.html
index ffb094a4..ab54a458 100644
--- a/docs/gallery/artifacts/agent-run.lifecycle.html
+++ b/docs/gallery/artifacts/agent-run.lifecycle.html
@@ -6642,13 +6642,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7540,6 +7545,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8065,6 +8201,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8109,7 +8247,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8870,6 +9008,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9219,6 +9362,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9366,6 +9511,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11816,145 +11962,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12292,6 +12299,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12392,6 +12401,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12988,6 +12999,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13224,6 +13236,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13661,6 +13675,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/docs/gallery/artifacts/agent-tool-call.workflow.html b/docs/gallery/artifacts/agent-tool-call.workflow.html
index 26693809..6b764917 100644
--- a/docs/gallery/artifacts/agent-tool-call.workflow.html
+++ b/docs/gallery/artifacts/agent-tool-call.workflow.html
@@ -6703,13 +6703,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7601,6 +7606,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8126,6 +8262,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8170,7 +8308,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8931,6 +9069,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9280,6 +9423,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9427,6 +9572,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11877,145 +12023,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12353,6 +12360,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12453,6 +12462,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13049,6 +13060,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13285,6 +13297,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13722,6 +13736,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/docs/gallery/artifacts/async-job-roundtrip.sequence.html b/docs/gallery/artifacts/async-job-roundtrip.sequence.html
index f879e347..8377b294 100644
--- a/docs/gallery/artifacts/async-job-roundtrip.sequence.html
+++ b/docs/gallery/artifacts/async-job-roundtrip.sequence.html
@@ -6724,13 +6724,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7622,6 +7627,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8147,6 +8283,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8191,7 +8329,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8952,6 +9090,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9301,6 +9444,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9448,6 +9593,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11898,145 +12044,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12374,6 +12381,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12474,6 +12483,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13070,6 +13081,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13306,6 +13318,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13743,6 +13757,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/docs/gallery/artifacts/cache-miss.sequence.html b/docs/gallery/artifacts/cache-miss.sequence.html
index 94615398..9e24715d 100644
--- a/docs/gallery/artifacts/cache-miss.sequence.html
+++ b/docs/gallery/artifacts/cache-miss.sequence.html
@@ -6712,13 +6712,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7610,6 +7615,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8135,6 +8271,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8179,7 +8317,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8940,6 +9078,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9289,6 +9432,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9436,6 +9581,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11886,145 +12032,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12362,6 +12369,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12462,6 +12471,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13058,6 +13069,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13294,6 +13306,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13731,6 +13745,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/docs/gallery/artifacts/deployment-release.lifecycle.html b/docs/gallery/artifacts/deployment-release.lifecycle.html
index 89d825e7..13d479b1 100644
--- a/docs/gallery/artifacts/deployment-release.lifecycle.html
+++ b/docs/gallery/artifacts/deployment-release.lifecycle.html
@@ -6715,13 +6715,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7613,6 +7618,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8138,6 +8274,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8182,7 +8320,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8943,6 +9081,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9292,6 +9435,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9439,6 +9584,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11889,145 +12035,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12365,6 +12372,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12465,6 +12474,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13061,6 +13072,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13297,6 +13309,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13734,6 +13748,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/docs/gallery/artifacts/event-stream.dataflow.html b/docs/gallery/artifacts/event-stream.dataflow.html
index 4ef6d7ea..15a799ec 100644
--- a/docs/gallery/artifacts/event-stream.dataflow.html
+++ b/docs/gallery/artifacts/event-stream.dataflow.html
@@ -6736,13 +6736,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7634,6 +7639,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8159,6 +8295,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8203,7 +8341,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8964,6 +9102,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9313,6 +9456,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9460,6 +9605,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11910,145 +12056,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12386,6 +12393,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12486,6 +12495,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13082,6 +13093,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13318,6 +13330,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13755,6 +13769,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/docs/gallery/artifacts/incident-response.workflow.html b/docs/gallery/artifacts/incident-response.workflow.html
index 7c9f3291..32c12d8f 100644
--- a/docs/gallery/artifacts/incident-response.workflow.html
+++ b/docs/gallery/artifacts/incident-response.workflow.html
@@ -6663,13 +6663,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7561,6 +7566,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8086,6 +8222,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8130,7 +8268,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8891,6 +9029,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9240,6 +9383,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9387,6 +9532,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11837,145 +11983,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12313,6 +12320,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12413,6 +12422,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13009,6 +13020,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13245,6 +13257,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13682,6 +13696,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/docs/gallery/artifacts/orders.erd.html b/docs/gallery/artifacts/orders.erd.html
index 6dcc3fbd..4e1a96ad 100644
--- a/docs/gallery/artifacts/orders.erd.html
+++ b/docs/gallery/artifacts/orders.erd.html
@@ -6865,13 +6865,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7763,6 +7768,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8288,6 +8424,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8332,7 +8470,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -9093,6 +9231,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9442,6 +9585,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9589,6 +9734,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -12039,145 +12185,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12515,6 +12522,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12615,6 +12624,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13211,6 +13222,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13447,6 +13459,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13884,6 +13898,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/docs/gallery/artifacts/product-analytics.dataflow.html b/docs/gallery/artifacts/product-analytics.dataflow.html
index 44577180..a8cf286a 100644
--- a/docs/gallery/artifacts/product-analytics.dataflow.html
+++ b/docs/gallery/artifacts/product-analytics.dataflow.html
@@ -6697,13 +6697,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7595,6 +7600,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8120,6 +8256,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8164,7 +8302,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8925,6 +9063,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9274,6 +9417,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9421,6 +9566,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11871,145 +12017,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12347,6 +12354,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12447,6 +12456,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13043,6 +13054,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13279,6 +13291,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13716,6 +13730,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/docs/gallery/artifacts/production-deployment.architecture.html b/docs/gallery/artifacts/production-deployment.architecture.html
index 7539b83e..34818dcc 100644
--- a/docs/gallery/artifacts/production-deployment.architecture.html
+++ b/docs/gallery/artifacts/production-deployment.architecture.html
@@ -6740,13 +6740,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7638,6 +7643,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8163,6 +8299,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8207,7 +8345,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8968,6 +9106,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9317,6 +9460,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9464,6 +9609,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11914,145 +12060,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12390,6 +12397,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12490,6 +12499,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13086,6 +13097,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13322,6 +13334,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13759,6 +13773,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/docs/gallery/artifacts/release-delivery.workflow.html b/docs/gallery/artifacts/release-delivery.workflow.html
index 6274baf1..f92a170d 100644
--- a/docs/gallery/artifacts/release-delivery.workflow.html
+++ b/docs/gallery/artifacts/release-delivery.workflow.html
@@ -6689,13 +6689,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7587,6 +7592,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8112,6 +8248,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8156,7 +8294,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8917,6 +9055,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9266,6 +9409,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9413,6 +9558,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11863,145 +12009,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12339,6 +12346,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12439,6 +12448,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13035,6 +13046,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13271,6 +13283,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13708,6 +13722,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/docs/gallery/artifacts/web-app.architecture.html b/docs/gallery/artifacts/web-app.architecture.html
index 6d86701b..f2104e76 100644
--- a/docs/gallery/artifacts/web-app.architecture.html
+++ b/docs/gallery/artifacts/web-app.architecture.html
@@ -6685,13 +6685,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7583,6 +7588,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8108,6 +8244,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8152,7 +8290,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8913,6 +9051,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9262,6 +9405,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9409,6 +9554,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11859,145 +12005,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12335,6 +12342,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12435,6 +12444,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13031,6 +13042,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13267,6 +13279,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13704,6 +13718,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/docs/gallery/manifest.json b/docs/gallery/manifest.json
index ee623cb7..bc707e8a 100644
--- a/docs/gallery/manifest.json
+++ b/docs/gallery/manifest.json
@@ -19,8 +19,8 @@
"engineeringProfile": null,
"nodeCount": 12,
"edgeCount": 11,
- "artifactBytes": 775338,
- "artifactSha256": "cf405de7beb905b4388dc2579edb120cb8814bf520dab766ccfcda3da128d404",
+ "artifactBytes": 776281,
+ "artifactSha256": "ac7c33cb99f63f6807c9bbb9b1978f6875786c7b37173929b569062d7c1edec7",
"sourceBytes": 4939,
"sourceSha256": "d67965d50872c97e4ff3476271e645bf19fab6b3ab44e111bdb44b063e3aa36f",
"checks": [
@@ -154,8 +154,8 @@
"engineeringProfile": "deployment-ownership",
"nodeCount": 12,
"edgeCount": 12,
- "artifactBytes": 778065,
- "artifactSha256": "4b489129190d81e07e0b69c44b73f3eb0db0435a38e7f8e9fefc42b202e87862",
+ "artifactBytes": 779008,
+ "artifactSha256": "1b69186699d94f1fb0a85dfae96aa0bbdad41d9cbbac3345310136bb912b1413",
"sourceBytes": 4734,
"sourceSha256": "cb54bad2dfd0c2d02aa5b496bde6839789a0f07f23062343c4458b8d38806c13",
"checks": [
@@ -287,8 +287,8 @@
"engineeringProfile": null,
"nodeCount": 7,
"edgeCount": 12,
- "artifactBytes": 769878,
- "artifactSha256": "af6fcf4a9bf56d23869e63adf929e662d21b0bb75a903ed6b99fb632de0012c7",
+ "artifactBytes": 770821,
+ "artifactSha256": "7798abfc9cb7ab44c1d99540062a4decc88704d4b427cfc5215a162fd4322987",
"sourceBytes": 3805,
"sourceSha256": "f8486daa803fff6c295cecca4604c561fbbf9acb2e83326022b5a87639e8afe6",
"checks": [
@@ -421,8 +421,8 @@
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 10,
- "artifactBytes": 770852,
- "artifactSha256": "e8fb8f310b028a59785bb130f419c4ab631003e53d8dc20c65a11253a9371067",
+ "artifactBytes": 771795,
+ "artifactSha256": "42d12e7206c4d85bd217dcb54f635fe7311eae1abb075a15b8fff01429d2bdd1",
"sourceBytes": 4510,
"sourceSha256": "dbd5c174af66296caec372e7214cf4df7158b50a563508e16826b95ab8d1cd6c",
"checks": [
@@ -561,8 +561,8 @@
"engineeringProfile": null,
"nodeCount": 11,
"edgeCount": 10,
- "artifactBytes": 768172,
- "artifactSha256": "e1b5eff2da878f794979da28df5ccc8a7cfcd2b2d3f48d86db4484d5a727b6c1",
+ "artifactBytes": 769115,
+ "artifactSha256": "1d3cf5f0b0ea91d13dcf24478c3be61b028dd18291a0a75c28abc02e7ca20da9",
"sourceBytes": 4723,
"sourceSha256": "630be98449925d2716ecb8439f404b2bff5fe65ba905b0ad0baea6d96890c526",
"checks": [
@@ -747,8 +747,8 @@
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 10,
- "artifactBytes": 772172,
- "artifactSha256": "8aeb66c9d02b95dcabe619294a13cb89ea8eaa6a66a8462b255055bc65342954",
+ "artifactBytes": 773115,
+ "artifactSha256": "17cc430e6bc88a2ca208175cecdc30e5e473cf568740f86b258feadfd7ad0afe",
"sourceBytes": 5035,
"sourceSha256": "8a635db9e51a5b1a8d2955b9d66f5b9a450e0a298432ce8f2e2f0be11f372e05",
"checks": [
@@ -882,8 +882,8 @@
"engineeringProfile": null,
"nodeCount": 7,
"edgeCount": 14,
- "artifactBytes": 768964,
- "artifactSha256": "ff5932f91cd5a68ca731e00a94f6888bbdff3260e53cd5eacd78c815ca3d412e",
+ "artifactBytes": 769907,
+ "artifactSha256": "2a707fe9dbaaf42971e16078ae87381ef626256fcb26907e990e10b58032b9fa",
"sourceBytes": 3766,
"sourceSha256": "b8c6c52f1763ede2933c77deb8da59b3e06917bc41d27e66df896136456b859a",
"checks": [
@@ -1034,8 +1034,8 @@
"engineeringProfile": null,
"nodeCount": 12,
"edgeCount": 12,
- "artifactBytes": 776092,
- "artifactSha256": "19eecad8fb6640d56e71fcaa8345efedde3052fee708838189793016e429ebbc",
+ "artifactBytes": 777035,
+ "artifactSha256": "91f3352ef20befe2a7bf4f22861175d207e4866cc57366bfc5989766df00a335",
"sourceBytes": 4769,
"sourceSha256": "3bdd77674282009c7c68d588cf8a3c495bc98a3be1b9c45327fd1801a6f83a23",
"checks": [
@@ -1186,8 +1186,8 @@
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 6,
- "artifactBytes": 766482,
- "artifactSha256": "900c56d7d2d5c2d3e4da6538e0212aa68f8cc56f64616c21ad3df64bb19d7d21",
+ "artifactBytes": 767425,
+ "artifactSha256": "185bf3476ac757bba78ab55779c38283f1b68d296945b60330530530e82fab60",
"sourceBytes": 3405,
"sourceSha256": "230242a7557663877766c43a9fe7cffe8b4fb66e4866457dccd24c63175b4917",
"checks": [
@@ -1357,8 +1357,8 @@
"engineeringProfile": null,
"nodeCount": 11,
"edgeCount": 11,
- "artifactBytes": 773537,
- "artifactSha256": "d71454a798124118752cfcbc17af16e15b2f69ccaeb385a8545739c9490dd6bf",
+ "artifactBytes": 774480,
+ "artifactSha256": "2c91ec452f00ac8e7fa9485fea6326a54da3645a98d88d98915322f8c700f681",
"sourceBytes": 3507,
"sourceSha256": "f565a8acfebdb21453e2bccd82d3760b4736e38fe194fb2f0804b57817eba813",
"checks": [
@@ -1479,8 +1479,8 @@
"engineeringProfile": null,
"nodeCount": 10,
"edgeCount": 9,
- "artifactBytes": 769878,
- "artifactSha256": "dcee442b2a4d02fa402651eff40a26d8ca31f180d1be7dcdf8175c298fcdf6bb",
+ "artifactBytes": 770821,
+ "artifactSha256": "53e05fad17160f6419f6060c965ec4dd83b2760c85429031668afc03a0b359d3",
"sourceBytes": 3197,
"sourceSha256": "95e051b27a9e4a3307e194c0f666fca4af51470be7e2228d400ff48aea5b353b",
"checks": [
@@ -1625,8 +1625,8 @@
"engineeringProfile": null,
"nodeCount": 6,
"edgeCount": 5,
- "artifactBytes": 784373,
- "artifactSha256": "a016fd4ffd2abbeceb73555ce33e6b763932a3a7d54391c2e8120cbf85d5e2a6",
+ "artifactBytes": 785316,
+ "artifactSha256": "063d89de2bf0651fd1be1ed9518eb7314a1b6b15619b712035d996065195c12b",
"sourceBytes": 7321,
"sourceSha256": "1777a374647084466f4d7ce3a968004be6ab70ac9cf82459b96bed7c556cdfdd",
"checks": [
diff --git a/examples/checkout-platform-delta.html b/examples/checkout-platform-delta.html
index 15b61f9e..24291330 100644
--- a/examples/checkout-platform-delta.html
+++ b/examples/checkout-platform-delta.html
@@ -10538,6 +10538,17 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
Array.prototype.forEach.call(clone.querySelectorAll(&#39;[data-node-id][aria-pressed]&#39;), function (el) {
el.setAttribute(&#39;aria-pressed&#39;, &#39;false&#39;);
});
+ // A downloaded tree is always the complete hierarchy: collapsing is a
+ // reading aid, never a silent change to what the artifact contains.
+ clone.removeAttribute(&#39;data-tree-any-collapsed&#39;);
+ Array.prototype.forEach.call(clone.querySelectorAll(&#39;[data-tree-hidden], [data-tree-collapsed]&#39;), function (el) {
+ el.removeAttribute(&#39;data-tree-hidden&#39;);
+ el.removeAttribute(&#39;data-tree-collapsed&#39;);
+ });
+ Array.prototype.forEach.call(clone.querySelectorAll(&#39;[data-tree-toggle]&#39;), function (el) {
+ el.setAttribute(&#39;aria-expanded&#39;, &#39;true&#39;);
+ el.setAttribute(&#39;aria-label&#39;, el.getAttribute(&#39;data-tree-label-collapse&#39;) || &#39;&#39;);
+ });
return !clone.hasAttribute(&#39;data-view-scale&#39;) &amp;&amp;
!clone.hasAttribute(&#39;data-focus-active&#39;) &amp;&amp;
!clone.hasAttribute(&#39;data-reach-active&#39;) &amp;&amp;
@@ -10553,9 +10564,10 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
!clone.hasAttribute(&#39;data-route-journey&#39;) &amp;&amp;
!clone.hasAttribute(&#39;data-share-route&#39;) &amp;&amp;
!clone.hasAttribute(&#39;data-share-reach&#39;) &amp;&amp;
+ !clone.hasAttribute(&#39;data-tree-any-collapsed&#39;) &amp;&amp;
!clone.style.getPropertyValue(&#39;transform&#39;) &amp;&amp;
!clone.style.getPropertyValue(&#39;clip-path&#39;) &amp;&amp;
- clone.querySelectorAll(&#39;[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]&#39;).length === 0;
+ clone.querySelectorAll(&#39;[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], [data-tree-hidden], [data-tree-collapsed]&#39;).length === 0;
}
@@ -11331,13 +11343,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== &#39;function&#39; || typeof element.getPointAtLength !== &#39;function&#39;) return [];
+ var geometry = element;
+ if (element.getAttribute(&#39;data-motion-path&#39;)) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute(&#39;d&#39;, element.getAttribute(&#39;data-motion-path&#39;));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length &lt;= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i &lt;= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -12229,6 +12246,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector(&#39;.diagram-container &gt; svg[data-tree-ui]&#39;);
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll(&#39;[data-tree-toggle]&#39;), function (toggle) {
+ toggles[toggle.getAttribute(&#39;data-tree-toggle&#39;)] = toggle;
+ });
+ var tagged = svg.querySelectorAll(&#39;[data-tree-ancestors]&#39;);
+ var expandAll = svg.querySelector(&#39;[data-tree-expand-all]&#39;);
+
+ function ancestors(el) {
+ return (el.getAttribute(&#39;data-tree-ancestors&#39;) || &#39;&#39;).split(&#39; &#39;).filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute(&#39;data-tree-hidden&#39;, &#39;&#39;);
+ else el.removeAttribute(&#39;data-tree-hidden&#39;);
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute(&#39;aria-expanded&#39;, isCollapsed ? &#39;false&#39; : &#39;true&#39;);
+ toggle.setAttribute(&#39;aria-label&#39;, toggle.getAttribute(isCollapsed ? &#39;data-tree-label-expand&#39; : &#39;data-tree-label-collapse&#39;) || &#39;&#39;);
+ var node = svg.querySelector(&#39;[data-node-id=&quot;&#39; + id + &#39;&quot;]&#39;);
+ if (node) {
+ if (isCollapsed) node.setAttribute(&#39;data-tree-collapsed&#39;, &#39;&#39;);
+ else node.removeAttribute(&#39;data-tree-collapsed&#39;);
+ }
+ });
+ if (any) svg.setAttribute(&#39;data-tree-any-collapsed&#39;, &#39;&#39;);
+ else svg.removeAttribute(&#39;data-tree-any-collapsed&#39;);
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector(&#39;[data-node-id=&quot;&#39; + id + &#39;&quot;]&#39;);
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest(&#39;[data-tree-toggle], [data-tree-expand-all]&#39;);
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute(&#39;data-tree-expand-all&#39;)) {
+ restoreAll();
+ var root = svg.querySelector(&#39;[data-tree-toggle]:not([data-tree-ancestors])&#39;);
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute(&#39;data-tree-toggle&#39;));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener(&#39;click&#39;, activate, true);
+ svg.addEventListener(&#39;keydown&#39;, function (event) {
+ if (event.key === &#39;Enter&#39; || event.key === &#39; &#39;) { activate(event); return; }
+ var node = event.target.closest(&#39;[data-node-id]&#39;);
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute(&#39;data-node-id&#39;);
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === &#39;ArrowLeft&#39; &amp;&amp; toggles[id] &amp;&amp; !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === &#39;ArrowRight&#39; &amp;&amp; collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute &amp;&amp; el.hasAttribute(&#39;data-tree-hidden&#39;) &amp;&amp; el.getAttribute(&#39;aria-pressed&#39;) === &#39;true&#39;) {
+ reveal(el.getAttribute(&#39;data-node-id&#39;));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: [&#39;aria-pressed&#39;] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute(&#39;data-tree-initially-collapsed&#39;)) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -12754,6 +12902,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute(&#39;data-motion-path&#39;)) clone.setAttribute(&#39;d&#39;, relationshipTokenPath(shape));
+ clone.removeAttribute(&#39;data-motion-path&#39;);
clone.removeAttribute(&#39;id&#39;);
clone.removeAttribute(&#39;class&#39;);
clone.removeAttribute(&#39;style&#39;);
@@ -12798,7 +12948,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return &#39;&#39;;
var tagName = String(shape.tagName || &#39;&#39;).toLowerCase();
- if (tagName === &#39;path&#39;) return shape.getAttribute(&#39;d&#39;) || &#39;&#39;;
+ if (tagName === &#39;path&#39;) return shape.getAttribute(&#39;data-motion-path&#39;) || shape.getAttribute(&#39;d&#39;) || &#39;&#39;;
if (tagName === &#39;line&#39;) {
return &#39;M &#39; + shape.getAttribute(&#39;x1&#39;) + &#39; &#39; + shape.getAttribute(&#39;y1&#39;) +
&#39; L &#39; + shape.getAttribute(&#39;x2&#39;) + &#39; &#39; + shape.getAttribute(&#39;y2&#39;);
@@ -13559,6 +13709,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] &amp;&amp; normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches &amp;&amp; Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length &amp;&amp; normalized.every(function (id, index) { return activeIds[index] === id; }) &amp;&amp; options.toggle !== false) {
clear();
return true;
@@ -13908,6 +14063,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute(&#39;data-motion-path&#39;)) clone.setAttribute(&#39;d&#39;, shape.getAttribute(&#39;data-motion-path&#39;));
+ clone.removeAttribute(&#39;data-motion-path&#39;);
clone.removeAttribute(&#39;id&#39;);
clone.removeAttribute(&#39;class&#39;);
clone.removeAttribute(&#39;style&#39;);
@@ -14055,6 +14212,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -16505,6 +16663,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
+
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
The graph is read from renderer-owned stable IDs and relationship
@@ -16841,6 +17000,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute(&#39;data-motion-path&#39;)) clone.setAttribute(&#39;d&#39;, shape.getAttribute(&#39;data-motion-path&#39;));
+ clone.removeAttribute(&#39;data-motion-path&#39;);
clone.removeAttribute(&#39;id&#39;);
clone.removeAttribute(&#39;class&#39;);
clone.removeAttribute(&#39;style&#39;);
@@ -16941,6 +17102,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute(&#39;data-motion-path&#39;)) clone.setAttribute(&#39;d&#39;, shape.getAttribute(&#39;data-motion-path&#39;));
+ clone.removeAttribute(&#39;data-motion-path&#39;);
clone.removeAttribute(&#39;id&#39;);
clone.removeAttribute(&#39;class&#39;);
clone.removeAttribute(&#39;style&#39;);
@@ -17537,6 +17700,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -17773,6 +17937,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute(&#39;data-motion-path&#39;)) clone.setAttribute(&#39;d&#39;, shape.getAttribute(&#39;data-motion-path&#39;));
+ clone.removeAttribute(&#39;data-motion-path&#39;);
clone.removeAttribute(&#39;id&#39;);
clone.removeAttribute(&#39;class&#39;);
clone.removeAttribute(&#39;style&#39;);
@@ -18210,6 +18376,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
@@ -24599,6 +24766,17 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
Array.prototype.forEach.call(clone.querySelectorAll(&#39;[data-node-id][aria-pressed]&#39;), function (el) {
el.setAttribute(&#39;aria-pressed&#39;, &#39;false&#39;);
});
+ // A downloaded tree is always the complete hierarchy: collapsing is a
+ // reading aid, never a silent change to what the artifact contains.
+ clone.removeAttribute(&#39;data-tree-any-collapsed&#39;);
+ Array.prototype.forEach.call(clone.querySelectorAll(&#39;[data-tree-hidden], [data-tree-collapsed]&#39;), function (el) {
+ el.removeAttribute(&#39;data-tree-hidden&#39;);
+ el.removeAttribute(&#39;data-tree-collapsed&#39;);
+ });
+ Array.prototype.forEach.call(clone.querySelectorAll(&#39;[data-tree-toggle]&#39;), function (el) {
+ el.setAttribute(&#39;aria-expanded&#39;, &#39;true&#39;);
+ el.setAttribute(&#39;aria-label&#39;, el.getAttribute(&#39;data-tree-label-collapse&#39;) || &#39;&#39;);
+ });
return !clone.hasAttribute(&#39;data-view-scale&#39;) &amp;&amp;
!clone.hasAttribute(&#39;data-focus-active&#39;) &amp;&amp;
!clone.hasAttribute(&#39;data-reach-active&#39;) &amp;&amp;
@@ -24614,9 +24792,10 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
!clone.hasAttribute(&#39;data-route-journey&#39;) &amp;&amp;
!clone.hasAttribute(&#39;data-share-route&#39;) &amp;&amp;
!clone.hasAttribute(&#39;data-share-reach&#39;) &amp;&amp;
+ !clone.hasAttribute(&#39;data-tree-any-collapsed&#39;) &amp;&amp;
!clone.style.getPropertyValue(&#39;transform&#39;) &amp;&amp;
!clone.style.getPropertyValue(&#39;clip-path&#39;) &amp;&amp;
- clone.querySelectorAll(&#39;[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]&#39;).length === 0;
+ clone.querySelectorAll(&#39;[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], [data-tree-hidden], [data-tree-collapsed]&#39;).length === 0;
}
@@ -25392,13 +25571,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== &#39;function&#39; || typeof element.getPointAtLength !== &#39;function&#39;) return [];
+ var geometry = element;
+ if (element.getAttribute(&#39;data-motion-path&#39;)) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute(&#39;d&#39;, element.getAttribute(&#39;data-motion-path&#39;));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length &lt;= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i &lt;= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -26290,6 +26474,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector(&#39;.diagram-container &gt; svg[data-tree-ui]&#39;);
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll(&#39;[data-tree-toggle]&#39;), function (toggle) {
+ toggles[toggle.getAttribute(&#39;data-tree-toggle&#39;)] = toggle;
+ });
+ var tagged = svg.querySelectorAll(&#39;[data-tree-ancestors]&#39;);
+ var expandAll = svg.querySelector(&#39;[data-tree-expand-all]&#39;);
+
+ function ancestors(el) {
+ return (el.getAttribute(&#39;data-tree-ancestors&#39;) || &#39;&#39;).split(&#39; &#39;).filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute(&#39;data-tree-hidden&#39;, &#39;&#39;);
+ else el.removeAttribute(&#39;data-tree-hidden&#39;);
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute(&#39;aria-expanded&#39;, isCollapsed ? &#39;false&#39; : &#39;true&#39;);
+ toggle.setAttribute(&#39;aria-label&#39;, toggle.getAttribute(isCollapsed ? &#39;data-tree-label-expand&#39; : &#39;data-tree-label-collapse&#39;) || &#39;&#39;);
+ var node = svg.querySelector(&#39;[data-node-id=&quot;&#39; + id + &#39;&quot;]&#39;);
+ if (node) {
+ if (isCollapsed) node.setAttribute(&#39;data-tree-collapsed&#39;, &#39;&#39;);
+ else node.removeAttribute(&#39;data-tree-collapsed&#39;);
+ }
+ });
+ if (any) svg.setAttribute(&#39;data-tree-any-collapsed&#39;, &#39;&#39;);
+ else svg.removeAttribute(&#39;data-tree-any-collapsed&#39;);
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector(&#39;[data-node-id=&quot;&#39; + id + &#39;&quot;]&#39;);
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest(&#39;[data-tree-toggle], [data-tree-expand-all]&#39;);
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute(&#39;data-tree-expand-all&#39;)) {
+ restoreAll();
+ var root = svg.querySelector(&#39;[data-tree-toggle]:not([data-tree-ancestors])&#39;);
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute(&#39;data-tree-toggle&#39;));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener(&#39;click&#39;, activate, true);
+ svg.addEventListener(&#39;keydown&#39;, function (event) {
+ if (event.key === &#39;Enter&#39; || event.key === &#39; &#39;) { activate(event); return; }
+ var node = event.target.closest(&#39;[data-node-id]&#39;);
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute(&#39;data-node-id&#39;);
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === &#39;ArrowLeft&#39; &amp;&amp; toggles[id] &amp;&amp; !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === &#39;ArrowRight&#39; &amp;&amp; collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute &amp;&amp; el.hasAttribute(&#39;data-tree-hidden&#39;) &amp;&amp; el.getAttribute(&#39;aria-pressed&#39;) === &#39;true&#39;) {
+ reveal(el.getAttribute(&#39;data-node-id&#39;));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: [&#39;aria-pressed&#39;] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute(&#39;data-tree-initially-collapsed&#39;)) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -26815,6 +27130,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute(&#39;data-motion-path&#39;)) clone.setAttribute(&#39;d&#39;, relationshipTokenPath(shape));
+ clone.removeAttribute(&#39;data-motion-path&#39;);
clone.removeAttribute(&#39;id&#39;);
clone.removeAttribute(&#39;class&#39;);
clone.removeAttribute(&#39;style&#39;);
@@ -26859,7 +27176,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return &#39;&#39;;
var tagName = String(shape.tagName || &#39;&#39;).toLowerCase();
- if (tagName === &#39;path&#39;) return shape.getAttribute(&#39;d&#39;) || &#39;&#39;;
+ if (tagName === &#39;path&#39;) return shape.getAttribute(&#39;data-motion-path&#39;) || shape.getAttribute(&#39;d&#39;) || &#39;&#39;;
if (tagName === &#39;line&#39;) {
return &#39;M &#39; + shape.getAttribute(&#39;x1&#39;) + &#39; &#39; + shape.getAttribute(&#39;y1&#39;) +
&#39; L &#39; + shape.getAttribute(&#39;x2&#39;) + &#39; &#39; + shape.getAttribute(&#39;y2&#39;);
@@ -27620,6 +27937,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] &amp;&amp; normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches &amp;&amp; Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length &amp;&amp; normalized.every(function (id, index) { return activeIds[index] === id; }) &amp;&amp; options.toggle !== false) {
clear();
return true;
@@ -27969,6 +28291,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute(&#39;data-motion-path&#39;)) clone.setAttribute(&#39;d&#39;, shape.getAttribute(&#39;data-motion-path&#39;));
+ clone.removeAttribute(&#39;data-motion-path&#39;);
clone.removeAttribute(&#39;id&#39;);
clone.removeAttribute(&#39;class&#39;);
clone.removeAttribute(&#39;style&#39;);
@@ -28116,6 +28440,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -30566,6 +30891,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
+
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
The graph is read from renderer-owned stable IDs and relationship
@@ -30902,6 +31228,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute(&#39;data-motion-path&#39;)) clone.setAttribute(&#39;d&#39;, shape.getAttribute(&#39;data-motion-path&#39;));
+ clone.removeAttribute(&#39;data-motion-path&#39;);
clone.removeAttribute(&#39;id&#39;);
clone.removeAttribute(&#39;class&#39;);
clone.removeAttribute(&#39;style&#39;);
@@ -31002,6 +31330,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute(&#39;data-motion-path&#39;)) clone.setAttribute(&#39;d&#39;, shape.getAttribute(&#39;data-motion-path&#39;));
+ clone.removeAttribute(&#39;data-motion-path&#39;);
clone.removeAttribute(&#39;id&#39;);
clone.removeAttribute(&#39;class&#39;);
clone.removeAttribute(&#39;style&#39;);
@@ -31598,6 +31928,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -31834,6 +32165,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute(&#39;data-motion-path&#39;)) clone.setAttribute(&#39;d&#39;, shape.getAttribute(&#39;data-motion-path&#39;));
+ clone.removeAttribute(&#39;data-motion-path&#39;);
clone.removeAttribute(&#39;id&#39;);
clone.removeAttribute(&#39;class&#39;);
clone.removeAttribute(&#39;style&#39;);
@@ -32271,6 +32604,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/checkout-platform-delta.receipt.json b/examples/checkout-platform-delta.receipt.json
index 34c443af..beb38856 100644
--- a/examples/checkout-platform-delta.receipt.json
+++ b/examples/checkout-platform-delta.receipt.json
@@ -219,8 +219,8 @@
"Boundary identity is conservatively derived from kind + label."
],
"artifact": {
- "sha256": "55d4ed50832e3ade44345fc5e030a94d922549429791296966a069dcb3914cf7",
- "bytes": 2125904
+ "sha256": "cc68dc07d25fe77f19e0b740274efe3664ae2f270f0c8839973a5d35e750e283",
+ "bytes": 2143360
},
"validation": {
"checksPassed": 28,
diff --git a/examples/class-payment-processors-rendered.html b/examples/class-payment-processors-rendered.html
index d9352f23..abcfdd71 100644
--- a/examples/class-payment-processors-rendered.html
+++ b/examples/class-payment-processors-rendered.html
@@ -5064,11 +5064,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<path data-edge-from="checkout_orchestrator" data-edge-to="order" data-edge-label="updates" data-edge-key="2" data-edge-id="orchestrator_order" data-class-relationship="dependency" data-composition-points="182,274;182,378" d="M 182 274 L 182 378" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-end="url(#cl-open)"/>
<path data-edge-from="order" data-edge-to="line_item" data-edge-label="owns lines" data-edge-key="3" data-edge-id="order_lines" data-class-relationship="composition" data-composition-points="182,612;182,721" d="M 182 612 L 182 721" class="a-default cl-relationship" stroke-width="1.5" marker-start="url(#cl-diamond-filled)"/>
<path data-edge-from="order" data-edge-to="payment_status" data-edge-key="4" data-edge-id="order_status" data-class-relationship="association" data-composition-points="332,495;517,495" d="M 332 495 L 517 495" class="a-default cl-relationship" stroke-width="1.5" marker-end="url(#cl-open)"/>
- <path data-edge-from="retrying_processor" data-edge-to="payment_processor" data-edge-key="5" data-edge-id="retrying_implements" data-class-relationship="realization" data-class-bus="payment_processor" data-composition-points="1038,383;1038,339;1252,339;1252,294" d="M 1252 294 L 1252 331 Q 1252 339 1244 339 L 1046 339 Q 1038 339 1038 347 L 1038 383" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
- <path data-edge-from="bank_transfer" data-edge-to="payment_processor" data-edge-key="6" data-edge-id="bank_implements" data-class-relationship="realization" data-class-bus="payment_processor" data-composition-points="1466,413;1466,339;1252,339;1252,294" d="M 1252 294 L 1252 331 Q 1252 339 1260 339 L 1458 339 Q 1466 339 1466 347 L 1466 413" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
- <path data-edge-from="stripe_card" data-edge-to="retrying_processor" data-edge-key="7" data-edge-id="stripe_extends" data-class-relationship="inheritance" data-class-bus="retrying_processor" data-composition-points="610,726;610,652;1038,652;1038,607" d="M 1038 607 L 1038 644 Q 1038 652 1030 652 L 618 652 Q 610 652 610 660 L 610 726" class="a-default cl-relationship" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
- <path data-edge-from="adyen_card" data-edge-to="retrying_processor" data-edge-key="8" data-edge-id="adyen_extends" data-class-relationship="inheritance" data-class-bus="retrying_processor" data-composition-points="1038,726;1038,607" d="M 1038 607 L 1038 726" class="a-default cl-relationship" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
- <path data-edge-from="paypal_wallet" data-edge-to="retrying_processor" data-edge-key="9" data-edge-id="paypal_extends" data-class-relationship="inheritance" data-class-bus="retrying_processor" data-composition-points="1466,696;1466,652;1038,652;1038,607" d="M 1038 607 L 1038 644 Q 1038 652 1046 652 L 1458 652 Q 1466 652 1466 660 L 1466 696" class="a-default cl-relationship" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
+ <path data-edge-from="retrying_processor" data-edge-to="payment_processor" data-edge-key="5" data-edge-id="retrying_implements" data-class-relationship="realization" data-class-bus="payment_processor" data-motion-path="M 1038 383 L 1038 347 Q 1038 339 1046 339 L 1244 339 Q 1252 339 1252 331 L 1252 294" data-composition-points="1038,383;1038,339;1252,339;1252,294" d="M 1252 294 L 1252 331 Q 1252 339 1244 339 L 1046 339 Q 1038 339 1038 347 L 1038 383" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
+ <path data-edge-from="bank_transfer" data-edge-to="payment_processor" data-edge-key="6" data-edge-id="bank_implements" data-class-relationship="realization" data-class-bus="payment_processor" data-motion-path="M 1466 413 L 1466 347 Q 1466 339 1458 339 L 1260 339 Q 1252 339 1252 331 L 1252 294" data-composition-points="1466,413;1466,339;1252,339;1252,294" d="M 1252 294 L 1252 331 Q 1252 339 1260 339 L 1458 339 Q 1466 339 1466 347 L 1466 413" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
+ <path data-edge-from="stripe_card" data-edge-to="retrying_processor" data-edge-key="7" data-edge-id="stripe_extends" data-class-relationship="inheritance" data-class-bus="retrying_processor" data-motion-path="M 610 726 L 610 660 Q 610 652 618 652 L 1030 652 Q 1038 652 1038 644 L 1038 607" data-composition-points="610,726;610,652;1038,652;1038,607" d="M 1038 607 L 1038 644 Q 1038 652 1030 652 L 618 652 Q 610 652 610 660 L 610 726" class="a-default cl-relationship" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
+ <path data-edge-from="adyen_card" data-edge-to="retrying_processor" data-edge-key="8" data-edge-id="adyen_extends" data-class-relationship="inheritance" data-class-bus="retrying_processor" data-motion-path="M 1038 726 L 1038 607" data-composition-points="1038,726;1038,607" d="M 1038 607 L 1038 726" class="a-default cl-relationship" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
+ <path data-edge-from="paypal_wallet" data-edge-to="retrying_processor" data-edge-key="9" data-edge-id="paypal_extends" data-class-relationship="inheritance" data-class-bus="retrying_processor" data-motion-path="M 1466 696 L 1466 660 Q 1466 652 1458 652 L 1046 652 Q 1038 652 1038 644 L 1038 607" data-composition-points="1466,696;1466,652;1038,652;1038,607" d="M 1038 607 L 1038 644 Q 1038 652 1046 652 L 1458 652 Q 1466 652 1466 660 L 1466 696" class="a-default cl-relationship" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
<!-- Types -->
<g id="node-checkout_orchestrator" data-node-id="checkout_orchestrator" data-node-label="CheckoutOrchestrator" tabindex="0" role="button" aria-label="Focus CheckoutOrchestrator, Runs one checkout from order to receipt, Class" aria-pressed="false" data-node-kind="class" data-node-sublabel="Runs one checkout from order to receipt" data-node-context="Class" data-class-kind="class">
@@ -6777,13 +6777,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7675,6 +7680,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8200,6 +8336,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8244,7 +8382,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -9005,6 +9143,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9354,6 +9497,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9501,6 +9646,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11951,145 +12097,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12427,6 +12434,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12527,6 +12536,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13123,6 +13134,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13359,6 +13371,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13796,6 +13810,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/class-payments-rendered.html b/examples/class-payments-rendered.html
index d102dab5..9f622bb3 100644
--- a/examples/class-payments-rendered.html
+++ b/examples/class-payments-rendered.html
@@ -5055,8 +5055,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<!-- Relationships (before types for correct z-order) -->
<path data-edge-from="order_service" data-edge-to="payment_gateway" data-edge-label="pays through" data-edge-key="0" data-edge-id="uses_gateway" data-class-relationship="dependency" data-composition-points="274,97;570.5,97" d="M 274 97 L 570.5 97" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-end="url(#cl-open)"/>
<path data-edge-from="order_service" data-edge-to="order" data-edge-label="creates" data-edge-key="1" data-edge-id="creates_order" data-class-relationship="dependency" data-composition-points="153,154;153,238" d="M 153 154 L 153 238" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-end="url(#cl-open)"/>
- <path data-edge-from="card_gateway" data-edge-to="payment_gateway" data-edge-key="2" data-edge-id="card_implements" data-class-relationship="realization" data-class-bus="payment_gateway" data-composition-points="506.5,273;506.5,204;675,204;675,134" d="M 675 134 L 675 196 Q 675 204 667 204 L 514.5 204 Q 506.5 204 506.5 212 L 506.5 273" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
- <path data-edge-from="wallet_gateway" data-edge-to="payment_gateway" data-edge-key="3" data-edge-id="wallet_implements" data-class-relationship="realization" data-class-bus="payment_gateway" data-composition-points="843.5,273;843.5,204;675,204;675,134" d="M 675 134 L 675 196 Q 675 204 683 204 L 835.5 204 Q 843.5 204 843.5 212 L 843.5 273" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
+ <path data-edge-from="card_gateway" data-edge-to="payment_gateway" data-edge-key="2" data-edge-id="card_implements" data-class-relationship="realization" data-class-bus="payment_gateway" data-motion-path="M 506.5 273 L 506.5 212 Q 506.5 204 514.5 204 L 667 204 Q 675 204 675 196 L 675 134" data-composition-points="506.5,273;506.5,204;675,204;675,134" d="M 675 134 L 675 196 Q 675 204 667 204 L 514.5 204 Q 506.5 204 506.5 212 L 506.5 273" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
+ <path data-edge-from="wallet_gateway" data-edge-to="payment_gateway" data-edge-key="3" data-edge-id="wallet_implements" data-class-relationship="realization" data-class-bus="payment_gateway" data-motion-path="M 843.5 273 L 843.5 212 Q 843.5 204 835.5 204 L 683 204 Q 675 204 675 196 L 675 134" data-composition-points="843.5,273;843.5,204;675,204;675,134" d="M 675 134 L 675 196 Q 675 204 683 204 L 835.5 204 Q 843.5 204 843.5 212 L 843.5 273" class="a-default cl-relationship cl-dashed" stroke-width="1.5" marker-start="url(#cl-triangle-start)"/>
<!-- Types -->
<g id="node-order_service" data-node-id="order_service" data-node-label="OrderService" tabindex="0" role="button" aria-label="Focus OrderService, Creates orders and starts payment, Class" aria-pressed="false" data-node-kind="class" data-node-sublabel="Creates orders and starts payment" data-node-context="Class" data-class-kind="class">
@@ -6583,13 +6583,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7481,6 +7486,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8006,6 +8142,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8050,7 +8188,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8811,6 +8949,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9160,6 +9303,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9307,6 +9452,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11757,145 +11903,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12233,6 +12240,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12333,6 +12342,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12929,6 +12940,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13165,6 +13177,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13602,6 +13616,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/dataflow-product-analytics.html b/examples/dataflow-product-analytics.html
index 44577180..a8cf286a 100644
--- a/examples/dataflow-product-analytics.html
+++ b/examples/dataflow-product-analytics.html
@@ -6697,13 +6697,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7595,6 +7600,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8120,6 +8256,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8164,7 +8302,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8925,6 +9063,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9274,6 +9417,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9421,6 +9566,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11871,145 +12017,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12347,6 +12354,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12447,6 +12456,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13043,6 +13054,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13279,6 +13291,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13716,6 +13730,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/erd-orders-rendered.html b/examples/erd-orders-rendered.html
index 6dcc3fbd..4e1a96ad 100644
--- a/examples/erd-orders-rendered.html
+++ b/examples/erd-orders-rendered.html
@@ -6865,13 +6865,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7763,6 +7768,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8288,6 +8424,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8332,7 +8470,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -9093,6 +9231,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9442,6 +9585,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9589,6 +9734,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -12039,145 +12185,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12515,6 +12522,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12615,6 +12624,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13211,6 +13222,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13447,6 +13459,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13884,6 +13898,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/lifecycle-agent-run.html b/examples/lifecycle-agent-run.html
index ffb094a4..ab54a458 100644
--- a/examples/lifecycle-agent-run.html
+++ b/examples/lifecycle-agent-run.html
@@ -6642,13 +6642,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7540,6 +7545,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8065,6 +8201,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8109,7 +8247,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8870,6 +9008,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9219,6 +9362,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9366,6 +9511,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11816,145 +11962,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12292,6 +12299,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12392,6 +12401,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12988,6 +12999,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13224,6 +13236,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13661,6 +13675,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/sequence-cache-miss-request.html b/examples/sequence-cache-miss-request.html
index 94615398..9e24715d 100644
--- a/examples/sequence-cache-miss-request.html
+++ b/examples/sequence-cache-miss-request.html
@@ -6712,13 +6712,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7610,6 +7615,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8135,6 +8271,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8179,7 +8317,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8940,6 +9078,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9289,6 +9432,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9436,6 +9581,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11886,145 +12032,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12362,6 +12369,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12462,6 +12471,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13058,6 +13069,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13294,6 +13306,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13731,6 +13745,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/subscription-billing-rendered.html b/examples/subscription-billing-rendered.html
index a8f79284..35e65080 100644
--- a/examples/subscription-billing-rendered.html
+++ b/examples/subscription-billing-rendered.html
@@ -7089,13 +7089,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7987,6 +7992,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8512,6 +8648,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8556,7 +8694,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -9317,6 +9455,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9666,6 +9809,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9813,6 +9958,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -12263,145 +12409,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12739,6 +12746,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12839,6 +12848,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13435,6 +13446,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13671,6 +13683,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -14108,6 +14122,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/timeline-archify-dev-activity-rendered.html b/examples/timeline-archify-dev-activity-rendered.html
index fa7b58e2..a7c21b15 100644
--- a/examples/timeline-archify-dev-activity-rendered.html
+++ b/examples/timeline-archify-dev-activity-rendered.html
@@ -6789,13 +6789,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7687,6 +7692,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8212,6 +8348,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8256,7 +8394,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -9017,6 +9155,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9366,6 +9509,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9513,6 +9658,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11963,145 +12109,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12439,6 +12446,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12539,6 +12548,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13135,6 +13146,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13371,6 +13383,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13808,6 +13822,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/timeline-payment-incident-rendered.html b/examples/timeline-payment-incident-rendered.html
index 44e40889..e8b98244 100644
--- a/examples/timeline-payment-incident-rendered.html
+++ b/examples/timeline-payment-incident-rendered.html
@@ -6574,13 +6574,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7472,6 +7477,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -7997,6 +8133,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8041,7 +8179,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8802,6 +8940,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9151,6 +9294,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9298,6 +9443,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11748,145 +11894,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12224,6 +12231,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12324,6 +12333,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12920,6 +12931,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13156,6 +13168,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13593,6 +13607,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/tree-archify-repository-rendered.html b/examples/tree-archify-repository-rendered.html
index 1acfc9e1..44197dda 100644
--- a/examples/tree-archify-repository-rendered.html
+++ b/examples/tree-archify-repository-rendered.html
@@ -5020,6 +5020,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
svg[data-tree-ui] .tree-edge { stroke-linejoin: round; stroke-linecap: round; }
svg[data-tree-ui] .tree-leaf { fill: var(--mask); stroke: var(--lane-stroke); }
svg[data-tree-ui] [data-tree-stack] { display: none; fill: var(--mask); }
+ svg[data-tree-ui] .tree-stack-frontend { stroke: var(--frontend-stroke); }
+ svg[data-tree-ui] .tree-stack-backend { stroke: var(--backend-stroke); }
svg[data-tree-ui] [data-tree-collapsed] [data-tree-stack] { display: inline; }
svg[data-tree-ui] [data-tree-hidden] { display: none; }
svg[data-tree-ui] .tree-toggle-hit { fill: transparent; }
@@ -5076,7 +5078,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<!-- Nodes -->
<g id="node-repo" data-node-id="repo" data-node-label="archify repository" tabindex="0" role="button" aria-label="Focus archify repository, Skill, viewer, and site, Root" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="Skill, viewer, and site" data-node-context="Root" data-tree-depth="0">
<title>archify repository · Skill, viewer, and site · Root</title>
- <rect data-tree-stack="" x="1064" y="69" width="196" height="59" rx="8" class="c-frontend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="1064" y="69" width="196" height="59" rx="8" class="tree-stack-frontend" stroke-width="1.2"/>
<rect x="1059" y="64" width="196" height="59" rx="8" class="c-mask"/>
<rect x="1059" y="64" width="196" height="59" rx="8" class="c-frontend" stroke-width="1.8"/>
<text data-node-label="" x="1157" class="t-primary" font-size="14.5" font-weight="750" text-anchor="middle"><tspan x="1157" y="88.5">archify repository</tspan></text>
@@ -5084,7 +5086,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-skill" data-node-id="skill" data-node-label="archify/" tabindex="0" role="button" aria-label="Focus archify/, Installable Skill package, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Installable Skill package" data-node-context="Branch" data-tree-depth="1" data-tree-ancestors="repo">
<title>archify/ · Installable Skill package · Branch</title>
- <rect data-tree-stack="" x="540" y="184" width="195" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="540" y="184" width="195" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="535" y="179" width="195" height="59" rx="8" class="c-mask"/>
<rect x="535" y="179" width="195" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="632.5" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="632.5" y="203.5">archify/</tspan></text>
@@ -5092,7 +5094,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-viewer" data-node-id="viewer" data-node-label="viewer/" tabindex="0" role="button" aria-label="Focus viewer/, Inlined into the template, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Inlined into the template" data-node-context="Branch" data-tree-depth="1" data-tree-ancestors="repo">
<title>viewer/ · Inlined into the template · Branch</title>
- <rect data-tree-stack="" x="1177" y="184" width="195" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="1177" y="184" width="195" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="1172" y="179" width="195" height="59" rx="8" class="c-mask"/>
<rect x="1172" y="179" width="195" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="1269.5" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="1269.5" y="203.5">viewer/</tspan></text>
@@ -5108,7 +5110,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-scripts" data-node-id="scripts" data-node-label="scripts/" tabindex="0" role="button" aria-label="Focus scripts/, Build and freshness tools, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Build and freshness tools" data-node-context="Branch" data-tree-depth="1" data-tree-ancestors="repo">
<title>scripts/ · Build and freshness tools · Branch</title>
- <rect data-tree-stack="" x="1588" y="184" width="195" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="1588" y="184" width="195" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="1583" y="179" width="195" height="59" rx="8" class="c-mask"/>
<rect x="1583" y="179" width="195" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="1680.5" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="1680.5" y="203.5">scripts/</tspan></text>
@@ -5116,7 +5118,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-renderers" data-node-id="renderers" data-node-label="renderers/" tabindex="0" role="button" aria-label="Focus renderers/, One per diagram type, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="One per diagram type" data-node-context="Branch" data-tree-depth="2" data-tree-ancestors="skill repo">
<title>renderers/ · One per diagram type · Branch</title>
- <rect data-tree-stack="" x="111" y="299" width="160" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="111" y="299" width="160" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="106" y="294" width="160" height="59" rx="8" class="c-mask"/>
<rect x="106" y="294" width="160" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="186" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="186" y="318.5">renderers/</tspan></text>
@@ -5132,7 +5134,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-bin" data-node-id="bin" data-node-label="bin/" tabindex="0" role="button" aria-label="Focus bin/, CLI entry points, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="CLI entry points" data-node-context="Branch" data-tree-depth="2" data-tree-ancestors="skill repo">
<title>bin/ · CLI entry points · Branch</title>
- <rect data-tree-stack="" x="745" y="299" width="140" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="745" y="299" width="140" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="740" y="294" width="140" height="59" rx="8" class="c-mask"/>
<rect x="740" y="294" width="140" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="810" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="810" y="318.5">bin/</tspan></text>
@@ -5204,7 +5206,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-r_shared" data-node-id="r_shared" data-node-label="shared/" tabindex="0" role="button" aria-label="Focus shared/, Shared helpers, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Shared helpers" data-node-context="Branch" data-tree-depth="3" data-tree-ancestors="renderers skill repo">
<title>shared/ · Shared helpers · Branch</title>
- <rect data-tree-stack="" x="262" y="414" width="140" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="262" y="414" width="140" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="257" y="409" width="140" height="59" rx="8" class="c-mask"/>
<rect x="257" y="409" width="140" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="327" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="327" y="433.5">shared/</tspan></text>
@@ -6806,13 +6808,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7704,6 +7711,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8229,6 +8367,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8273,7 +8413,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -9034,6 +9174,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9383,6 +9528,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9530,6 +9677,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11980,145 +12128,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12456,6 +12465,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12556,6 +12567,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13152,6 +13165,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13388,6 +13402,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13825,6 +13841,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/tree-payment-platform-rendered.html b/examples/tree-payment-platform-rendered.html
index 2e4023bb..fa1648ce 100644
--- a/examples/tree-payment-platform-rendered.html
+++ b/examples/tree-payment-platform-rendered.html
@@ -5020,6 +5020,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
svg[data-tree-ui] .tree-edge { stroke-linejoin: round; stroke-linecap: round; }
svg[data-tree-ui] .tree-leaf { fill: var(--mask); stroke: var(--lane-stroke); }
svg[data-tree-ui] [data-tree-stack] { display: none; fill: var(--mask); }
+ svg[data-tree-ui] .tree-stack-frontend { stroke: var(--frontend-stroke); }
+ svg[data-tree-ui] .tree-stack-backend { stroke: var(--backend-stroke); }
svg[data-tree-ui] [data-tree-collapsed] [data-tree-stack] { display: inline; }
svg[data-tree-ui] [data-tree-hidden] { display: none; }
svg[data-tree-ui] .tree-toggle-hit { fill: transparent; }
@@ -5055,7 +5057,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
<!-- Nodes -->
<g id="node-platform" data-node-id="platform" data-node-label="Payment platform" tabindex="0" role="button" aria-label="Focus Payment platform, Decomposed by capability, Root" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="Decomposed by capability" data-node-context="Root" data-tree-depth="0">
<title>Payment platform · Decomposed by capability · Root</title>
- <rect data-tree-stack="" x="434" y="69" width="188" height="59" rx="8" class="c-frontend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="434" y="69" width="188" height="59" rx="8" class="tree-stack-frontend" stroke-width="1.2"/>
<rect x="429" y="64" width="188" height="59" rx="8" class="c-mask"/>
<rect x="429" y="64" width="188" height="59" rx="8" class="c-frontend" stroke-width="1.8"/>
<text data-node-label="" x="523" class="t-primary" font-size="14.5" font-weight="750" text-anchor="middle"><tspan x="523" y="88.5">Payment platform</tspan></text>
@@ -5063,7 +5065,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-orders" data-node-id="orders" data-node-label="Orders" tabindex="0" role="button" aria-label="Focus Orders, Order lifecycle, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Order lifecycle" data-node-context="Branch" data-tree-depth="1" data-tree-ancestors="platform">
<title>Orders · Order lifecycle · Branch</title>
- <rect data-tree-stack="" x="121" y="184" width="140" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="121" y="184" width="140" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="116" y="179" width="140" height="59" rx="8" class="c-mask"/>
<rect x="116" y="179" width="140" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="186" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="186" y="203.5">Orders</tspan></text>
@@ -5071,7 +5073,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-payments" data-node-id="payments" data-node-label="Payments" tabindex="0" role="button" aria-label="Focus Payments, Money movement, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Money movement" data-node-context="Branch" data-tree-depth="1" data-tree-ancestors="platform">
<title>Payments · Money movement · Branch</title>
- <rect data-tree-stack="" x="458" y="184" width="140" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="458" y="184" width="140" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="453" y="179" width="140" height="59" rx="8" class="c-mask"/>
<rect x="453" y="179" width="140" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="523" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="523" y="203.5">Payments</tspan></text>
@@ -5079,7 +5081,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
</g>
<g id="node-operations" data-node-id="operations" data-node-label="Operations" tabindex="0" role="button" aria-label="Focus Operations, Back-office work, Branch" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Back-office work" data-node-context="Branch" data-tree-depth="1" data-tree-ancestors="platform">
<title>Operations · Back-office work · Branch</title>
- <rect data-tree-stack="" x="810" y="184" width="140" height="59" rx="8" class="c-backend" stroke-width="1.2"/>
+ <rect data-tree-stack="" x="810" y="184" width="140" height="59" rx="8" class="tree-stack-backend" stroke-width="1.2"/>
<rect x="805" y="179" width="140" height="59" rx="8" class="c-mask"/>
<rect x="805" y="179" width="140" height="59" rx="8" class="c-backend" stroke-width="1.3"/>
<text data-node-label="" x="875" class="t-primary" font-size="13" font-weight="700" text-anchor="middle"><tspan x="875" y="203.5">Operations</tspan></text>
@@ -6587,13 +6589,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7485,6 +7492,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8010,6 +8148,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8054,7 +8194,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8815,6 +8955,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9164,6 +9309,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9311,6 +9458,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11761,145 +11909,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12237,6 +12246,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12337,6 +12348,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12933,6 +12946,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13169,6 +13183,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13606,6 +13622,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/waterfall-checkout-request-rendered.html b/examples/waterfall-checkout-request-rendered.html
index 49210619..85d109aa 100644
--- a/examples/waterfall-checkout-request-rendered.html
+++ b/examples/waterfall-checkout-request-rendered.html
@@ -6571,13 +6571,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7469,6 +7474,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -7994,6 +8130,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8038,7 +8176,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8799,6 +8937,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9148,6 +9291,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9295,6 +9440,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11745,145 +11891,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12221,6 +12228,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12321,6 +12330,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12917,6 +12928,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13153,6 +13165,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13590,6 +13604,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/waterfall-example-rebuild-rendered.html b/examples/waterfall-example-rebuild-rendered.html
index 2a8ca0d7..2c86b320 100644
--- a/examples/waterfall-example-rebuild-rendered.html
+++ b/examples/waterfall-example-rebuild-rendered.html
@@ -6757,13 +6757,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7655,6 +7660,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8180,6 +8316,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8224,7 +8362,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8985,6 +9123,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9334,6 +9477,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9481,6 +9626,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11931,145 +12077,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12407,6 +12414,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12507,6 +12516,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13103,6 +13114,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13339,6 +13351,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13776,6 +13790,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/web-app-rendered.html b/examples/web-app-rendered.html
index 6d86701b..f2104e76 100644
--- a/examples/web-app-rendered.html
+++ b/examples/web-app-rendered.html
@@ -6685,13 +6685,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7583,6 +7588,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8108,6 +8244,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8152,7 +8290,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8913,6 +9051,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9262,6 +9405,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9409,6 +9554,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11859,145 +12005,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12335,6 +12342,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12435,6 +12444,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13031,6 +13042,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13267,6 +13279,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13704,6 +13718,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/web-app.html b/examples/web-app.html
index 6d86701b..f2104e76 100644
--- a/examples/web-app.html
+++ b/examples/web-app.html
@@ -6685,13 +6685,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7583,6 +7588,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8108,6 +8244,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8152,7 +8290,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8913,6 +9051,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9262,6 +9405,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9409,6 +9554,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11859,145 +12005,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12335,6 +12342,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12435,6 +12444,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13031,6 +13042,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13267,6 +13279,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13704,6 +13718,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/examples/workflow-agent-tool-call-rendered.html b/examples/workflow-agent-tool-call-rendered.html
index 26693809..6b764917 100644
--- a/examples/workflow-agent-tool-call-rendered.html
+++ b/examples/workflow-agent-tool-call-rendered.html
@@ -6703,13 +6703,18 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
@@ -7601,6 +7606,137 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+ /* ============================================================
+ Tree Branches — expand/collapse for hierarchy diagrams. The renderer
+ lays out the complete tree once and tags every node, link, and toggle
+ with its ancestors; collapsing only hides descendants, so visible nodes
+ never move and the reader keeps their place. Selecting a hidden node
+ through Finder, Outline, or a shared link expands its ancestors. Export
+ always writes the complete tree (see Export Cleanup).
+ ============================================================ */
+ Archify.treeBranches = (function () {
+ var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
+ if (!svg) return { active: false };
+ var collapsed = Object.create(null);
+ var toggles = Object.create(null);
+ Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
+ toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
+ });
+ var tagged = svg.querySelectorAll('[data-tree-ancestors]');
+ var expandAll = svg.querySelector('[data-tree-expand-all]');
+
+ function ancestors(el) {
+ return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
+ }
+
+ function apply() {
+ Array.prototype.forEach.call(tagged, function (el) {
+ var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
+ if (hidden) el.setAttribute('data-tree-hidden', '');
+ else el.removeAttribute('data-tree-hidden');
+ });
+ var any = false;
+ Object.keys(toggles).forEach(function (id) {
+ var toggle = toggles[id];
+ var isCollapsed = Boolean(collapsed[id]);
+ any = any || isCollapsed;
+ toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
+ toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (node) {
+ if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
+ else node.removeAttribute('data-tree-collapsed');
+ }
+ });
+ if (any) svg.setAttribute('data-tree-any-collapsed', '');
+ else svg.removeAttribute('data-tree-any-collapsed');
+ }
+
+ function setCollapsed(id, value) {
+ if (!toggles[id]) return false;
+ if (value) collapsed[id] = true;
+ else delete collapsed[id];
+ apply();
+ return true;
+ }
+
+ function toggle(id) { return setCollapsed(id, !collapsed[id]); }
+
+ // Reveal a node by expanding every collapsed ancestor; nothing else moves.
+ function reveal(id) {
+ var node = svg.querySelector('[data-node-id="' + id + '"]');
+ if (!node) return false;
+ var changed = false;
+ ancestors(node).forEach(function (ancestor) {
+ if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
+ });
+ if (changed) apply();
+ return changed;
+ }
+
+ function restoreAll() {
+ collapsed = Object.create(null);
+ apply();
+ }
+
+ function activate(event) {
+ var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
+ if (!target || !svg.contains(target)) return false;
+ event.preventDefault();
+ event.stopPropagation();
+ if (target.hasAttribute('data-tree-expand-all')) {
+ restoreAll();
+ var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
+ if (root) root.focus();
+ } else {
+ toggle(target.getAttribute('data-tree-toggle'));
+ target.focus();
+ }
+ return true;
+ }
+
+ // Capture phase so the canvas focus handler never treats a toggle press
+ // as a background click that clears the current focus.
+ svg.addEventListener('click', activate, true);
+ svg.addEventListener('keydown', function (event) {
+ if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
+ var node = event.target.closest('[data-node-id]');
+ if (!node || !svg.contains(node)) return;
+ var id = node.getAttribute('data-node-id');
+ // Arrow keys follow the tree convention: left collapses, right expands.
+ if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
+ else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
+ }, true);
+
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
+ new MutationObserver(function (records) {
+ records.forEach(function (record) {
+ var el = record.target;
+ if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
+ reveal(el.getAttribute('data-node-id'));
+ }
+ });
+ }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
+
+ Object.keys(toggles).forEach(function (id) {
+ if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
+ });
+ apply();
+
+ return {
+ active: true,
+ toggle: toggle,
+ collapse: function (id) { return setCollapsed(id, true); },
+ expand: function (id) { return setCollapsed(id, false); },
+ reveal: reveal,
+ restoreAll: restoreAll,
+ collapsedIds: function () { return Object.keys(collapsed); },
+ expandAllControl: expandAll
+ };
+ })();
+
+
/* ============================================================
Explore — stable-ID neighborhood focus + dependency-free pan/zoom.
Renderer IDs become deep-linkable semantic hooks without turning the
@@ -8126,6 +8262,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -8170,7 +8308,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -8931,6 +9069,11 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
@@ -9280,6 +9423,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -9427,6 +9572,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Adaptive Reader Shell — one diagram across laptop and monitor.
The canonical SVG and viewBox never change. On ordinary desktop pages,
@@ -11877,145 +12023,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
- /* ============================================================
- Tree Branches — expand/collapse for hierarchy diagrams. The renderer
- lays out the complete tree once and tags every node, link, and toggle
- with its ancestors; collapsing only hides descendants, so visible nodes
- never move and the reader keeps their place. Selecting a hidden node
- through Finder, Outline, or a shared link expands its ancestors. Export
- always writes the complete tree (see Export Cleanup).
- ============================================================ */
- Archify.treeBranches = (function () {
- var svg = document.querySelector('.diagram-container > svg[data-tree-ui]');
- if (!svg) return { active: false };
- var collapsed = Object.create(null);
- var toggles = Object.create(null);
- Array.prototype.forEach.call(svg.querySelectorAll('[data-tree-toggle]'), function (toggle) {
- toggles[toggle.getAttribute('data-tree-toggle')] = toggle;
- });
- var tagged = svg.querySelectorAll('[data-tree-ancestors]');
- var expandAll = svg.querySelector('[data-tree-expand-all]');
-
- function ancestors(el) {
- return (el.getAttribute('data-tree-ancestors') || '').split(' ').filter(Boolean);
- }
-
- function apply() {
- Array.prototype.forEach.call(tagged, function (el) {
- var hidden = ancestors(el).some(function (id) { return collapsed[id]; });
- if (hidden) el.setAttribute('data-tree-hidden', '');
- else el.removeAttribute('data-tree-hidden');
- });
- var any = false;
- Object.keys(toggles).forEach(function (id) {
- var toggle = toggles[id];
- var isCollapsed = Boolean(collapsed[id]);
- any = any || isCollapsed;
- toggle.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
- toggle.setAttribute('aria-label', toggle.getAttribute(isCollapsed ? 'data-tree-label-expand' : 'data-tree-label-collapse') || '');
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (node) {
- if (isCollapsed) node.setAttribute('data-tree-collapsed', '');
- else node.removeAttribute('data-tree-collapsed');
- }
- });
- if (any) svg.setAttribute('data-tree-any-collapsed', '');
- else svg.removeAttribute('data-tree-any-collapsed');
- }
-
- function setCollapsed(id, value) {
- if (!toggles[id]) return false;
- if (value) collapsed[id] = true;
- else delete collapsed[id];
- apply();
- return true;
- }
-
- function toggle(id) { return setCollapsed(id, !collapsed[id]); }
-
- // Reveal a node by expanding every collapsed ancestor; nothing else moves.
- function reveal(id) {
- var node = svg.querySelector('[data-node-id="' + id + '"]');
- if (!node) return false;
- var changed = false;
- ancestors(node).forEach(function (ancestor) {
- if (collapsed[ancestor]) { delete collapsed[ancestor]; changed = true; }
- });
- if (changed) apply();
- return changed;
- }
-
- function restoreAll() {
- collapsed = Object.create(null);
- apply();
- }
-
- function activate(event) {
- var target = event.target.closest('[data-tree-toggle], [data-tree-expand-all]');
- if (!target || !svg.contains(target)) return false;
- event.preventDefault();
- event.stopPropagation();
- if (target.hasAttribute('data-tree-expand-all')) {
- restoreAll();
- var root = svg.querySelector('[data-tree-toggle]:not([data-tree-ancestors])');
- if (root) root.focus();
- } else {
- toggle(target.getAttribute('data-tree-toggle'));
- target.focus();
- }
- return true;
- }
-
- // Capture phase so the canvas focus handler never treats a toggle press
- // as a background click that clears the current focus.
- svg.addEventListener('click', activate, true);
- svg.addEventListener('keydown', function (event) {
- if (event.key === 'Enter' || event.key === ' ') { activate(event); return; }
- var node = event.target.closest('[data-node-id]');
- if (!node || !svg.contains(node)) return;
- var id = node.getAttribute('data-node-id');
- // Arrow keys follow the tree convention: left collapses, right expands.
- if (event.key === 'ArrowLeft' && toggles[id] && !collapsed[id]) { event.preventDefault(); setCollapsed(id, true); }
- else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
- }, true);
-
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
- new MutationObserver(function (records) {
- records.forEach(function (record) {
- var el = record.target;
- if (el.hasAttribute && el.hasAttribute('data-tree-hidden') && el.getAttribute('aria-pressed') === 'true') {
- reveal(el.getAttribute('data-node-id'));
- }
- });
- }).observe(svg, { subtree: true, attributes: true, attributeFilter: ['aria-pressed'] });
-
- Object.keys(toggles).forEach(function (id) {
- if (toggles[id].hasAttribute('data-tree-initially-collapsed')) collapsed[id] = true;
- });
- apply();
-
- return {
- active: true,
- toggle: toggle,
- collapse: function (id) { return setCollapsed(id, true); },
- expand: function (id) { return setCollapsed(id, false); },
- reveal: reveal,
- restoreAll: restoreAll,
- collapsedIds: function () { return Object.keys(collapsed); },
- expandAllControl: expandAll
- };
- })();
-
/* ============================================================
Route Probe — shortest directed path over compiled semantics.
@@ -12353,6 +12360,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -12453,6 +12462,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13049,6 +13060,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Semantic Lens — a counted, viewer-only legend over data-node-kind.
One selected kind reveals every authored relationship touching it.
@@ -13285,6 +13297,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -13722,6 +13736,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
};
})();
+
/* ============================================================
Diagram Guide — a factual command deck over existing interactions.
Counts come from compiled semantics; actions delegate to Finder, Route
diff --git a/scripts/run-browser-tests.mjs b/scripts/run-browser-tests.mjs
index cbdf1ead..47022d81 100644
--- a/scripts/run-browser-tests.mjs
+++ b/scripts/run-browser-tests.mjs
@@ -39,6 +39,7 @@ const testFiles = [
'repository-evidence.test.mjs',
'repository-evidence-types-browser.test.mjs',
'tree-branches-browser.test.mjs',
+ 'class-motion-browser.test.mjs',
];
const chrome = findChrome();
diff --git a/viewer/README.md b/viewer/README.md
index d5b75448..a8e8477d 100644
--- a/viewer/README.md
+++ b/viewer/README.md
@@ -14,12 +14,23 @@ main Viewer stylesheet, and `template.source.html` for the remaining shell.
`viewer.css` owns the complete main `<style>` block; the font-face block remains
in the shell because it carries its license notice and embedded font data.
`archify/assets/template.html` is the committed generated artifact, consumed
-unchanged by all five renderers and the installed Skill. These maintainer
+unchanged by all ten renderers and the installed Skill. These maintainer
sources live outside the packaged `archify/` directory.
From `archify/`, run `npm run generate:viewer` after editing any source.
`npm run check:viewer` verifies freshness without writing; `npm test` includes
-that check. Assembly inserts JavaScript fragments verbatim at fixed markers.
+that check. Shared Viewer changes also require rebuilding the checked-in
+Checkout comparison from its tracked snapshots. From the repository root, run:
+
+```sh
+node archify/bin/archify.mjs compare architecture archify/examples/checkout-platform.base.architecture.json archify/examples/checkout-platform.head.architecture.json examples/checkout-platform-delta.html --receipt examples/checkout-platform-delta.receipt.json --quality showcase --json
+```
+
+`archify/test/architecture-delta.test.mjs` verifies those artifact and receipt
+bytes. Rebuild other affected examples and distribution outputs according to
+[Contributing](../CONTRIBUTING.md#packages-and-generated-artifacts).
+
+Assembly inserts JavaScript fragments verbatim at fixed markers.
The CSS fragment is authored at column zero and reindented four spaces when it
is inserted into the shell's `<style>` block; this preserves the delivered
template bytes while keeping the standalone source easy to edit.
@@ -200,7 +211,9 @@ provider is part of Focus ownership, not a second initialization step.
- flowTokens consumes existing shape geometry, edge classes and node kinds. Kind
priority remains security, event, data, state, call. create produces a detached
token with the existing path, duration/class options and null behavior. Motion
- ownership remains in its existing module.
+ ownership remains in its existing module. If the visual `d` runs in reverse,
+ `data-motion-path` supplies the canonical from→to semantic path shared by
+ Focus, Intent Trace, Semantic Lens, Route Probe and WebM.
- Relationship pulse removes any previous pulse, clones existing shape geometry
and installs at most one flow token, retaining overlay placement and animation
end/cancel removal. Embed, hidden, paused Motion and reduced motion prevent new
diff --git a/viewer/export.js b/viewer/export.js
index 72d15d83..a2c667d1 100644
--- a/viewer/export.js
+++ b/viewer/export.js
@@ -819,13 +819,18 @@
function samplesFor(element) {
if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];
+ var geometry = element;
+ if (element.getAttribute('data-motion-path')) {
+ geometry = element.cloneNode(false);
+ geometry.setAttribute('d', element.getAttribute('data-motion-path'));
+ }
var length;
- try { length = element.getTotalLength(); } catch (_) { return []; }
+ try { length = geometry.getTotalLength(); } catch (_) { return []; }
if (!Number.isFinite(length) || length <= 0) return [];
var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));
var points = [];
for (var i = 0; i <= count; i++) {
- points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));
+ points.push(pointInRoot(element, geometry.getPointAtLength(length * i / count)));
}
return points;
}
diff --git a/viewer/focus.js b/viewer/focus.js
index 57c15672..91aaccd4 100644
--- a/viewer/focus.js
+++ b/viewer/focus.js
@@ -523,6 +523,8 @@
}
function relationshipPulseGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', relationshipTokenPath(shape));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -567,7 +569,7 @@
function relationshipTokenPath(shape) {
if (!shape) return '';
var tagName = String(shape.tagName || '').toLowerCase();
- if (tagName === 'path') return shape.getAttribute('d') || '';
+ if (tagName === 'path') return shape.getAttribute('data-motion-path') || shape.getAttribute('d') || '';
if (tagName === 'line') {
return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') +
' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');
@@ -1328,6 +1330,11 @@
if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);
});
if (!normalized.length) return false;
+ // Hash restoration and internal selections use this path too. Reveal
+ // tree ancestors before measuring the selected node for its lens.
+ if (Archify.treeBranches && Archify.treeBranches.active) {
+ normalized.forEach(function (id) { Archify.treeBranches.reveal(id); });
+ }
if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {
clear();
return true;
diff --git a/viewer/intent-trace.js b/viewer/intent-trace.js
index 754afcbd..67fac6a5 100644
--- a/viewer/intent-trace.js
+++ b/viewer/intent-trace.js
@@ -64,6 +64,8 @@
}
function traceGeometry(shape, direction) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -209,4 +211,4 @@
clear: clear,
active: function () { return activeId; }
};
- })();
\ No newline at end of file
+ })();
diff --git a/viewer/route-probe.js b/viewer/route-probe.js
index 398dc01a..fd6d6c26 100644
--- a/viewer/route-probe.js
+++ b/viewer/route-probe.js
@@ -334,6 +334,8 @@
}
function traceGeometry(shape, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -434,6 +436,8 @@
}
function journeyGeometry(shape) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -1028,4 +1032,4 @@
: null;
}
};
- })();
\ No newline at end of file
+ })();
diff --git a/viewer/semantic-lens.js b/viewer/semantic-lens.js
index 4b9f54cf..3ada5c09 100644
--- a/viewer/semantic-lens.js
+++ b/viewer/semantic-lens.js
@@ -234,6 +234,8 @@
}
function flowGeometry(shape, direction, step) {
var clone = shape.cloneNode(false);
+ if (shape.getAttribute('data-motion-path')) clone.setAttribute('d', shape.getAttribute('data-motion-path'));
+ clone.removeAttribute('data-motion-path');
clone.removeAttribute('id');
clone.removeAttribute('class');
clone.removeAttribute('style');
@@ -669,4 +671,4 @@
active: function () { return selectedKinds.length ? selectedKinds.slice() : null; },
kinds: function () { return collectKinds().map(function (kind) { return { id: kind.id, count: kind.nodes.length }; }); }
};
- })();
\ No newline at end of file
+ })();
diff --git a/viewer/template.source.html b/viewer/template.source.html
index ec78180c..c2031e4a 100644
--- a/viewer/template.source.html
+++ b/viewer/template.source.html
@@ -988,6 +988,8 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
})();
Archify.sourceEvidence.installBeacons();
+/* ARCHIFY:TREE_BRANCHES */
+
/* ARCHIFY:FOCUS */
/* ARCHIFY:INTENT_TRACE */
@@ -1168,7 +1170,6 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
/* ARCHIFY:NODE_OUTLINE */
-/* ARCHIFY:TREE_BRANCHES */
/* ARCHIFY:ROUTE_PROBE */
diff --git a/viewer/tree-branches.js b/viewer/tree-branches.js
index 395b608c..fd48afe7 100644
--- a/viewer/tree-branches.js
+++ b/viewer/tree-branches.js
@@ -100,17 +100,8 @@
else if (event.key === 'ArrowRight' && collapsed[id]) { event.preventDefault(); setCollapsed(id, false); }
}, true);
- // Finder, Outline, guided views, and shared links all select through the
- // focus state; a selected node must never stay hidden. The public setter
- // expands ancestors before the camera frames the node, and the observer
- // covers any path that changes the pressed state directly.
- if (Archify.focus && typeof Archify.focus.set === 'function') {
- var focusSet = Archify.focus.set;
- Archify.focus.set = function (ids) {
- (Array.isArray(ids) ? ids : [ids]).forEach(function (id) { if (typeof id === 'string') reveal(id); });
- return focusSet.apply(this, arguments);
- };
- }
+ // Focus reveals ancestors synchronously before positioning its lens.
+ // The observer also covers paths that change pressed state directly.
new MutationObserver(function (records) {
records.forEach(function (record) {
var el = record.target;