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.
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import fs from 'node:fs';
|
|
|
|
export interface Brand {
|
|
id: string;
|
|
title: string;
|
|
category: string;
|
|
aliases: string[];
|
|
}
|
|
|
|
/** Archify's built-in brand marks, read from brand-marks/catalog.json. */
|
|
export function loadBrandCatalog(file: string): Brand[] {
|
|
const catalog = JSON.parse(fs.readFileSync(file, 'utf8')) as { marks?: Partial<Brand>[] };
|
|
return (catalog.marks ?? [])
|
|
.filter((mark): mark is Partial<Brand> & { id: string } => typeof mark.id === 'string')
|
|
.map((mark) => ({ id: mark.id, title: mark.title ?? mark.id, category: mark.category ?? '', aliases: mark.aliases ?? [] }));
|
|
}
|
|
|
|
export interface BrandValue {
|
|
/** What has been typed of the value so far. */
|
|
typed: string;
|
|
}
|
|
|
|
/**
|
|
* Whether the text before the cursor ends inside a `brand` value:
|
|
* `brand: post` or `{ id: db, brand: "post` in YAML, `"brand": "post` in JSON.
|
|
*/
|
|
export function brandValueAt(linePrefix: string, format: 'yaml' | 'json'): BrandValue | undefined {
|
|
const match =
|
|
format === 'yaml'
|
|
? /(?:^|[\s{,])brand:\s*["']?([\w.-]*)$/.exec(linePrefix)
|
|
: /"brand"\s*:\s*"([\w.-]*)$/.exec(linePrefix);
|
|
return match ? { typed: match[1] } : undefined;
|
|
}
|