Adding treemap

This commit is contained in:
Knut Sveidqvist
2025-05-07 18:16:00 +02:00
parent 40eb0cc240
commit e0a075ecca
14 changed files with 705 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ export {
Architecture,
GitGraph,
Radar,
TreemapDoc,
Branch,
Commit,
Merge,
@@ -19,6 +20,7 @@ export {
isPieSection,
isArchitecture,
isGitGraph,
isTreemapDoc,
isBranch,
isCommit,
isMerge,
@@ -32,6 +34,7 @@ export {
ArchitectureGeneratedModule,
GitGraphGeneratedModule,
RadarGeneratedModule,
TreemapGeneratedModule,
} from './generated/module.js';
export * from './gitGraph/index.js';
@@ -41,3 +44,4 @@ export * from './packet/index.js';
export * from './pie/index.js';
export * from './architecture/index.js';
export * from './radar/index.js';
export * from './treemap/index.js';

View File

@@ -1,6 +1,6 @@
import type { LangiumParser, ParseResult } from 'langium';
import type { Info, Packet, Pie, Architecture, GitGraph, Radar } from './index.js';
import type { Info, Packet, Pie, Architecture, GitGraph, Radar, Treemap } from './index.js';
export type DiagramAST = Info | Packet | Pie | Architecture | GitGraph | Radar;
@@ -36,6 +36,11 @@ const initializers = {
const parser = createRadarServices().Radar.parser.LangiumParser;
parsers.radar = parser;
},
treemap: async () => {
const { createTreemapServices } = await import('./language/treemap/index.js');
const parser = createTreemapServices().Treemap.parser.LangiumParser;
parsers.treemap = parser;
},
} as const;
export async function parse(diagramType: 'info', text: string): Promise<Info>;
@@ -44,6 +49,7 @@ export async function parse(diagramType: 'pie', text: string): Promise<Pie>;
export async function parse(diagramType: 'architecture', text: string): Promise<Architecture>;
export async function parse(diagramType: 'gitGraph', text: string): Promise<GitGraph>;
export async function parse(diagramType: 'radar', text: string): Promise<Radar>;
export async function parse(diagramType: 'treemap', text: string): Promise<Treemap>;
export async function parse<T extends DiagramAST>(
diagramType: keyof typeof initializers,