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.
This commit is contained in:
1 parent
20786f4b5a
commit
97b3b5f685
40 files changed
+2553
-353
No files matched your search
@@ -0,0 +1,55 @@
|
||||
import { execFile } from 'node:child_process';
|
||||
import path from 'node:path';
|
||||
import * as vscode from 'vscode';
|
||||
import { log } from '../util/log';
|
||||
import { RuntimeOptions } from './cli';
|
||||
|
||||
const gitRoots = new Map<string, Promise<string | undefined>>();
|
||||
|
||||
function gitTopLevel(dir: string): Promise<string | undefined> {
|
||||
let pending = gitRoots.get(dir);
|
||||
if (!pending) {
|
||||
pending = new Promise((resolve) => {
|
||||
execFile('git', ['rev-parse', '--show-toplevel'], { cwd: dir, timeout: 10_000 }, (error, stdout) => {
|
||||
resolve(error ? undefined : path.resolve(stdout.trim()));
|
||||
});
|
||||
});
|
||||
gitRoots.set(dir, pending);
|
||||
}
|
||||
return pending;
|
||||
}
|
||||
|
||||
export function clearGitRootCache(): void {
|
||||
gitRoots.clear();
|
||||
}
|
||||
|
||||
/** The checkout used to verify source evidence for a file, if any. */
|
||||
export async function repoRootFor(uri: vscode.Uri | undefined): Promise<string | undefined> {
|
||||
const configured = vscode.workspace.getConfiguration('archify', uri).get<string>('repoRoot', '').trim();
|
||||
if (configured) {
|
||||
if (path.isAbsolute(configured)) return configured;
|
||||
const folder = (uri && vscode.workspace.getWorkspaceFolder(uri)) ?? vscode.workspace.workspaceFolders?.[0];
|
||||
return folder ? path.resolve(folder.uri.fsPath, configured) : path.resolve(configured);
|
||||
}
|
||||
if (!uri || uri.scheme !== 'file') return undefined;
|
||||
return gitTopLevel(path.dirname(uri.fsPath));
|
||||
}
|
||||
|
||||
export async function runtimeFor(context: vscode.ExtensionContext, uri: vscode.Uri | undefined): Promise<RuntimeOptions> {
|
||||
const config = vscode.workspace.getConfiguration('archify', uri);
|
||||
const nodePath = config.get<string>('nodePath', '').trim();
|
||||
const quality = config.get<string>('quality', '');
|
||||
return {
|
||||
cliPath: context.asAbsolutePath(path.join('vendor', 'archify', 'bin', 'archify.mjs')),
|
||||
nodePath: nodePath || process.execPath,
|
||||
runAsNode: !nodePath,
|
||||
workDir: path.join(context.globalStorageUri.fsPath, 'renders'),
|
||||
quality: quality || undefined,
|
||||
repoRoot: await repoRootFor(uri),
|
||||
log: (line) => log().debug(line),
|
||||
};
|
||||
}
|
||||
|
||||
export function evidenceMode(uri: vscode.Uri | undefined): 'fallback' | 'strict' {
|
||||
return vscode.workspace.getConfiguration('archify', uri).get<'fallback' | 'strict'>('sourceEvidence', 'fallback');
|
||||
}
|
||||
Reference in new issue
Block a user