From: Javier Sagredo Date: Wed, 6 May 2026 22:49:42 +0000 (+0200) Subject: Show class→assoc-family links in the instance view X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=8a8d349224b861a48c350b5304692b228b965006;p=classgraph.git Show class→assoc-family links in the instance view Until now the assoc-family edges only appeared in the classes view; the instance view of, say, BftCrypto would show its families (BftDSIGN, BftHash, …) only as descendants of the *individual* fam-instances surfaced for each instance. Add an `assoc` arrow straight from the focused class node to each entry of `ciAssocTypes`, so the user can see what families the class declares without having to find an instance that exercises them. Co-Authored-By: Claude Opus 4.7 (1M context) --- diff --git a/data/viewer.js b/data/viewer.js index 060c739..25684ad 100644 --- a/data/viewer.js +++ b/data/viewer.js @@ -722,6 +722,25 @@ // Focus class at the top. const focusedId = ensureClassNode(cls.ciName, { focused: true }); + // Associated type families of the focused class. Surface them up + // front (regardless of whether any current instance contributes a + // fam-instance) so the user can see at a glance which families + // the class declares — same `assoc` link the classes view shows. + cls.ciAssocTypes.forEach(famQn => { + const famNodeId = ensureFamilyNode(famQn); + const linkId = focusedId + '~~' + famNodeId; + if (!seenNodes.has(linkId)) { + seenNodes.add(linkId); + els.push({ group: 'edges', data: { + id: linkId, + source: focusedId, + target: famNodeId, + kind: 'assoc', + label: 'assoc', + }}); + } + }); + // One row of instance nodes, anchored to the focused class. insts.forEach((inst, idx) => { const instId = ensureInstanceNode(inst, cls.ciName,