state sync

This commit is contained in:
2025-11-23 14:59:17 -08:00
parent 537bdf1ad7
commit 39f4a8d3fc
812 changed files with 373062 additions and 84 deletions

View File

@@ -0,0 +1,27 @@
import type { DiagramDB } from '../../diagram-api/types.js';
import type { DiagramStyleClassDef } from '../../diagram-api/types.js';
import type { TreemapDiagramConfig, TreemapNode } from './types.js';
export declare class TreeMapDB implements DiagramDB {
private nodes;
private levels;
private outerNodes;
private classes;
private root?;
getNodes(): TreemapNode[];
getConfig(): Required<TreemapDiagramConfig>;
addNode(node: TreemapNode, level: number): void;
getRoot(): {
name: string;
children: TreemapNode[];
};
addClass(id: string, _style: string): void;
getClasses(): Map<string, DiagramStyleClassDef>;
getStylesForClass(classSelector: string): string[];
clear(): void;
setAccTitle: (txt: string) => void;
getAccTitle: () => string;
setDiagramTitle: (txt: string) => void;
getDiagramTitle: () => string;
getAccDescription: () => string;
setAccDescription: (txt: string) => void;
}

View File

@@ -0,0 +1,2 @@
import type { ExternalDiagramDefinition } from '../../diagram-api/types.js';
export declare const treemap: ExternalDiagramDefinition;

View File

@@ -0,0 +1,2 @@
import type { DiagramDefinition } from '../../diagram-api/types.js';
export declare const diagram: DiagramDefinition;

View File

@@ -0,0 +1,2 @@
import type { ParserDefinition } from '../../diagram-api/types.js';
export declare const parser: ParserDefinition;

View File

@@ -0,0 +1,2 @@
import type { DiagramRenderer } from '../../diagram-api/types.js';
export declare const renderer: DiagramRenderer;

View File

@@ -0,0 +1,3 @@
import type { DiagramStylesProvider } from '../../diagram-api/types.js';
export declare const getStyles: DiagramStylesProvider;
export default getStyles;

View File

@@ -0,0 +1,71 @@
import type { DiagramDBBase, DiagramStyleClassDef } from '../../diagram-api/types.js';
import type { BaseDiagramConfig } from '../../config.type.js';
export interface TreemapNode {
name: string;
children?: TreemapNode[];
value?: number;
parent?: TreemapNode;
classSelector?: string;
cssCompiledStyles?: string[];
}
export interface TreemapDB extends DiagramDBBase<TreemapDiagramConfig> {
getNodes: () => TreemapNode[];
addNode: (node: TreemapNode, level: number) => void;
getRoot: () => TreemapNode | undefined;
getClasses: () => Map<string, DiagramStyleClassDef>;
addClass: (className: string, style: string) => void;
getStylesForClass: (classSelector: string) => string[];
}
export interface TreemapStyleOptions {
sectionStrokeColor?: string;
sectionStrokeWidth?: string;
sectionFillColor?: string;
leafStrokeColor?: string;
leafStrokeWidth?: string;
leafFillColor?: string;
labelColor?: string;
labelFontSize?: string;
valueFontSize?: string;
valueColor?: string;
titleColor?: string;
titleFontSize?: string;
}
export interface TreemapData {
nodes: TreemapNode[];
levels: Map<TreemapNode, number>;
root?: TreemapNode;
outerNodes: TreemapNode[];
classes: Map<string, DiagramStyleClassDef>;
}
export interface TreemapItem {
$type: string;
name: string;
value?: number;
classSelector?: string;
}
export interface TreemapRow {
$type: string;
indent?: string;
item?: TreemapItem;
className?: string;
styleText?: string;
}
export interface TreemapAst {
TreemapRows?: TreemapRow[];
title?: string;
description?: string;
accDescription?: string;
accTitle?: string;
diagramTitle?: string;
}
export interface TreemapDiagramConfig extends BaseDiagramConfig {
padding?: number;
diagramPadding?: number;
showValues?: boolean;
nodeWidth?: number;
nodeHeight?: number;
borderWidth?: number;
valueFontSize?: number;
labelFontSize?: number;
valueFormat?: string;
}

View File

@@ -0,0 +1,14 @@
import type { TreemapNode } from './types.js';
/**
* Converts a flat array of treemap items into a hierarchical structure
* @param items - Array of flat treemap items with level, name, type, and optional value
* @returns A hierarchical tree structure
*/
export declare function buildHierarchy(items: {
level: number;
name: string;
type: string;
value?: number;
classSelector?: string;
cssCompiledStyles?: string;
}[]): TreemapNode[];

View File

@@ -0,0 +1 @@
export {};