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,53 @@
import type { Edge, Node } from '../../rendering-util/types.js';
import type { EntityNode, Attribute, Relationship, EntityClass, RelSpec } from './erTypes.js';
import type { DiagramDB } from '../../diagram-api/types.js';
export declare class ErDB implements DiagramDB {
private entities;
private relationships;
private classes;
private direction;
private Cardinality;
private Identification;
constructor();
/**
* Add entity
* @param name - The name of the entity
* @param alias - The alias of the entity
*/
addEntity(name: string, alias?: string): EntityNode;
getEntity(name: string): EntityNode | undefined;
getEntities(): Map<string, EntityNode>;
getClasses(): Map<string, EntityClass>;
addAttributes(entityName: string, attribs: Attribute[]): void;
/**
* Add a relationship
*
* @param entA - The first entity in the relationship
* @param rolA - The role played by the first entity in relation to the second
* @param entB - The second entity in the relationship
* @param rSpec - The details of the relationship between the two entities
*/
addRelationship(entA: string, rolA: string, entB: string, rSpec: RelSpec): void;
getRelationships(): Relationship[];
getDirection(): string;
setDirection(dir: string): void;
private getCompiledStyles;
addCssStyles(ids: string[], styles: string[]): void;
addClass(ids: string[], style: string[]): void;
setClass(ids: string[], classNames: string[]): void;
clear(): void;
getData(): {
nodes: Node[];
edges: Edge[];
other: {};
config: import("../../config.type.js").MermaidConfig;
direction: string;
};
setAccTitle: (txt: string) => void;
getAccTitle: () => string;
setAccDescription: (txt: string) => void;
getAccDescription: () => string;
setDiagramTitle: (txt: string) => void;
getDiagramTitle: () => string;
getConfig: () => import("../../config.type.js").ErDiagramConfig | undefined;
}

View File

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

View File

@@ -0,0 +1,8 @@
import { ErDB } from './erDb.js';
import * as renderer from './erRenderer-unified.js';
export declare const diagram: {
parser: any;
readonly db: ErDB;
renderer: typeof renderer;
styles: (options: import("../flowchart/styles.js").FlowChartStyleOptions) => string;
};

View File

@@ -0,0 +1,24 @@
declare namespace _default {
export { ERMarkers };
export { insertMarkers };
}
export default _default;
declare namespace ERMarkers {
let ONLY_ONE_START: string;
let ONLY_ONE_END: string;
let ZERO_OR_ONE_START: string;
let ZERO_OR_ONE_END: string;
let ONE_OR_MORE_START: string;
let ONE_OR_MORE_END: string;
let ZERO_OR_MORE_START: string;
let ZERO_OR_MORE_END: string;
let MD_PARENT_END: string;
let MD_PARENT_START: string;
}
/**
* Put the markers into the svg DOM for later use with edge paths
*
* @param elem
* @param conf
*/
declare function insertMarkers(elem: any, conf: any): void;

View File

@@ -0,0 +1 @@
export declare const draw: (text: string, id: string, _version: string, diag: any) => Promise<void>;

View File

@@ -0,0 +1,19 @@
/**
* Return a unique id based on the given string. Start with the prefix, then a hyphen, then the
* simplified str, then a hyphen, then a unique uuid based on the str. (Hyphens are only included if needed.)
* Although the official XML standard for ids says that many more characters are valid in the id,
* this keeps things simple by accepting only A-Za-z0-9.
*
* @param {string} str Given string to use as the basis for the id. Default is `''`
* @param {string} prefix String to put at the start, followed by '-'. Default is `''`
* @returns {string}
* @see https://www.w3.org/TR/xml/#NT-Name
*/
export function generateId(str?: string, prefix?: string): string;
export function setConf(cnf: any): void;
export function draw(text: any, id: any, _version: any, diagObj: any): void;
declare namespace _default {
export { setConf };
export { draw };
}
export default _default;

View File

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

View File

@@ -0,0 +1,33 @@
export interface EntityNode {
id: string;
label: string;
attributes: Attribute[];
alias: string;
shape: string;
look?: string;
cssClasses?: string;
cssStyles?: string[];
cssCompiledStyles?: string[];
}
export interface Attribute {
type: string;
name: string;
keys: ('PK' | 'FK' | 'UK')[];
comment: string;
}
export interface Relationship {
entityA: string;
roleA: string;
entityB: string;
relSpec: RelSpec;
}
export interface RelSpec {
cardA: string;
cardB: string;
relType: string;
}
export interface EntityClass {
id: string;
styles: string[];
textStyles: string[];
}

View File

@@ -0,0 +1,3 @@
import type { FlowChartStyleOptions } from '../flowchart/styles.js';
declare const getStyles: (options: FlowChartStyleOptions) => string;
export default getStyles;