Files
archify-vscode-ext/src/sources/evidence.ts
T
root-at-skic 97b3b5f685 Add a 3D view of every diagram; organise source by job; 0.6.0
3D view: a "3D" menu beside Export switches the diagram to a three.js
scene built from the live Archify SVG. Nodes become blocks topped with
the node as Archify draws it, relationships become lit pipes along
Archify's routes, and the canvas, frames, lanes and legend form the
floor. Clicks and hover go to the SVG nodes, so focus, the Semantic
Passport and the intent trace work as in 2D; Archify's own animations
(trace, node pulse, passport/path/lens flows) are mirrored live. The
menu also offers flat or stacked levels, reset view and a top view;
Export gains "3D view" (PNG). Trackpad scrolling pans, pinch and the
mouse wheel zoom, and the zoom buttons work beyond the 2D limits.
The scene draws only when something moves. New setting
archify.defaultView.

Source: src/ is split by job (commands, views, webview, archify,
sources, language, util, viewer3d); behaviour unchanged.
2026-10-11 00:54:00 +03:00

32 lines
1.2 KiB
TypeScript

import { DiagramType } from './detect';
/** Node collection that may carry `sources` evidence, per diagram type. */
export const EVIDENCE_COLLECTIONS: Record<DiagramType, string> = {
architecture: 'components',
workflow: 'nodes',
sequence: 'participants',
dataflow: 'nodes',
lifecycle: 'states',
};
export function hasSourceEvidence(type: DiagramType, diagram: Record<string, unknown>): boolean {
const meta = diagram.meta as Record<string, unknown> | undefined;
if (meta && meta.repository) return true;
const nodes = diagram[EVIDENCE_COLLECTIONS[type]];
return Array.isArray(nodes) && nodes.some((node) => Array.isArray(node?.sources) && node.sources.length > 0);
}
/** Returns a copy of the diagram with repository evidence removed. */
export function stripSourceEvidence(type: DiagramType, diagram: Record<string, unknown>): Record<string, unknown> {
const copy = structuredClone(diagram);
const meta = copy.meta as Record<string, unknown> | undefined;
if (meta) delete meta.repository;
const nodes = copy[EVIDENCE_COLLECTIONS[type]];
if (Array.isArray(nodes)) {
for (const node of nodes) {
if (node && typeof node === 'object') delete node.sources;
}
}
return copy;
}