Model page: Registry panel lists registry files, elements inside each

- one collapsible header per .archify-registry file with its element
  count and an Open button that opens the registry view; files start
  collapsed, the Registry panel open
- view types moved to views/viewTypes.ts so the diagram page can open a
  registry without a circular import
- 0.7.1
This commit is contained in:
2026-10-19 20:39:24 +03:00
parent 4382730343
commit de1a57e4c6
8 changed files with 57 additions and 22 deletions
+10 -6
View File
@@ -14,9 +14,9 @@ import { handleWebviewMessage, WebviewMessage } from '../webview/messages';
import { makeNonce, messagePage, modelPage, prepareDiagramHtml } from '../webview/page';
import { viewer3dOption, viewerRoots } from '../webview/viewer3d';
export const PREVIEW_VIEW_TYPE = 'archify.preview';
/** Default editor for .archify files: the rendered diagram. */
export const DIAGRAM_EDITOR_VIEW_TYPE = 'archify.diagram';
import { DIAGRAM_EDITOR_VIEW_TYPE, PREVIEW_VIEW_TYPE, REGISTRY_VIEW_TYPE } from './viewTypes';
export { DIAGRAM_EDITOR_VIEW_TYPE, PREVIEW_VIEW_TYPE };
interface PreviewState {
uri: string;
@@ -59,7 +59,11 @@ class DiagramPreview implements vscode.Disposable {
return;
}
if (message.type === 'openDiagram') {
void this.openLinked(message.path);
void this.openLinked(message.path, DIAGRAM_EDITOR_VIEW_TYPE);
return;
}
if (message.type === 'openRegistry') {
void this.openLinked(message.file, REGISTRY_VIEW_TYPE);
return;
}
void handleWebviewMessage(message, this.uri, this.panel);
@@ -96,7 +100,7 @@ class DiagramPreview implements vscode.Disposable {
}
/** Opens a diagram of the model, given its path relative to the model root. */
private async openLinked(relativePath: string): Promise<void> {
private async openLinked(relativePath: string, viewType: string): Promise<void> {
if (!this.root) return;
const target = vscode.Uri.joinPath(this.root, ...relativePath.split('/'));
try {
@@ -105,7 +109,7 @@ class DiagramPreview implements vscode.Disposable {
vscode.window.showWarningMessage(`Archify: ${relativePath} does not exist in this model.`);
return;
}
await vscode.commands.executeCommand('vscode.openWith', target, DIAGRAM_EDITOR_VIEW_TYPE, vscode.ViewColumn.Active);
await vscode.commands.executeCommand('vscode.openWith', target, viewType, vscode.ViewColumn.Active);
}
private showModelPage(model: ModelPanel): void {