@uigraph/sdk 1.2.12 → 1.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +731 -102
- package/dist/index.d.cts +98 -1
- package/dist/index.d.mts +98 -1
- package/dist/index.mjs +720 -103
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -880,6 +880,12 @@ declare const SEQUENCE_LAYOUT: {
|
|
|
880
880
|
readonly BOX_BOTTOM_PADDING: 24;
|
|
881
881
|
};
|
|
882
882
|
//#endregion
|
|
883
|
+
//#region src/mermaid-converter/flow-chart/to-react-flow.d.ts
|
|
884
|
+
declare function layoutFlowchart(nodes: MermaidNode[], edges: MermaidEdge[], subgraphs: SubgraphInfo[], direction: string): {
|
|
885
|
+
nodes: Node[];
|
|
886
|
+
edges: Edge[];
|
|
887
|
+
};
|
|
888
|
+
//#endregion
|
|
883
889
|
//#region src/mermaid-converter/mermaid-sanitizer.d.ts
|
|
884
890
|
declare function sanitizeMermaidLabels(src: string): string;
|
|
885
891
|
//#endregion
|
|
@@ -914,4 +920,95 @@ declare function convertMermaidToReactFlowWithContext(mermaidCode: string, conte
|
|
|
914
920
|
//#region src/uig-converter/index.d.ts
|
|
915
921
|
declare function convertUiGraphToMermaid(input: UiGraphInput, options?: UiGraphOptions): UigOutput;
|
|
916
922
|
//#endregion
|
|
917
|
-
|
|
923
|
+
//#region src/registry/node-types.d.ts
|
|
924
|
+
declare const SHAPE_IDS: readonly ["rectangle", "rounded-rect", "ellipse", "diamond", "triangle", "parallelogram", "trapezoid", "hexagon", "document", "cylinder", "delay", "off-page-connector", "display", "collate", "sort", "terminator", "or", "database", "multiple-documents", "subroutine", "manual-input", "summing-junction", "internal-storage"];
|
|
925
|
+
type ShapeId = (typeof SHAPE_IDS)[number];
|
|
926
|
+
declare const STROKE_STYLES: readonly ["solid", "dashed", "dotted"];
|
|
927
|
+
type StrokeStyleId = (typeof STROKE_STYLES)[number];
|
|
928
|
+
type DiagramTypeId = 'flowchart' | 'sequence' | 'c4';
|
|
929
|
+
/** Style fields a beautify-style patch may carry, independent of node tag. */
|
|
930
|
+
type NodeStylePatchInput = {
|
|
931
|
+
fill?: string;
|
|
932
|
+
stroke?: string;
|
|
933
|
+
strokeWidth?: number;
|
|
934
|
+
strokeStyle?: StrokeStyleId;
|
|
935
|
+
cornerRadius?: number;
|
|
936
|
+
textColor?: string;
|
|
937
|
+
textFontSize?: number;
|
|
938
|
+
shape?: ShapeId;
|
|
939
|
+
};
|
|
940
|
+
type NodeTypeSpec = {
|
|
941
|
+
tag: string;
|
|
942
|
+
diagramTypes: DiagramTypeId[];
|
|
943
|
+
isContainer: boolean;
|
|
944
|
+
/** Whether AI/beautify is allowed to resize this node type directly. */
|
|
945
|
+
geometryEditable: boolean;
|
|
946
|
+
/** Valid `data.shape` values for this tag, if it supports shapes. */
|
|
947
|
+
shapes?: readonly ShapeId[];
|
|
948
|
+
/** Maps a generic style patch onto this node type's own `data` field names. */
|
|
949
|
+
mapStylePatch: (patch: NodeStylePatchInput) => Record<string, unknown>;
|
|
950
|
+
};
|
|
951
|
+
/**
|
|
952
|
+
* Canonical per-node-tag registry, shared by generate, beautify, and (later)
|
|
953
|
+
* MCP tools, so node-type vocabulary and style-field mapping live in exactly
|
|
954
|
+
* one place instead of being re-declared per consumer.
|
|
955
|
+
*/
|
|
956
|
+
declare const NODE_TYPE_REGISTRY: Record<string, NodeTypeSpec>;
|
|
957
|
+
declare function getNodeTypeSpec(type: string | undefined): NodeTypeSpec | undefined;
|
|
958
|
+
/** Replaces the old per-route `buildNodeDataPatch` switch statement. */
|
|
959
|
+
declare function buildNodeStyleDataPatch(type: string | undefined, patch: NodeStylePatchInput): Record<string, unknown>;
|
|
960
|
+
declare function isGeometryEditableNodeType(type: string | undefined): boolean;
|
|
961
|
+
//#endregion
|
|
962
|
+
//#region src/registry/themes.d.ts
|
|
963
|
+
/**
|
|
964
|
+
* Beautify's color source of truth. Instead of asking an LLM to invent raw
|
|
965
|
+
* hex values per request (inconsistent contrast, no guarantee a container's
|
|
966
|
+
* fill differs from its boundary, no way to keep edge labels legible when
|
|
967
|
+
* the palette changes), the model picks a themeId and assigns each node a
|
|
968
|
+
* semantic role — the actual colors always come from here, pre-chosen and
|
|
969
|
+
* checked for contrast once, not re-derived per call.
|
|
970
|
+
*/
|
|
971
|
+
declare const THEME_ROLES: readonly ["boundary", "client", "service", "data", "messaging", "neutral"];
|
|
972
|
+
type ThemeRole = (typeof THEME_ROLES)[number];
|
|
973
|
+
type ThemeColorPair = {
|
|
974
|
+
fill: string;
|
|
975
|
+
stroke: string;
|
|
976
|
+
};
|
|
977
|
+
type ThemeSpec = {
|
|
978
|
+
id: string;
|
|
979
|
+
label: string;
|
|
980
|
+
description: string;
|
|
981
|
+
mode: 'dark' | 'light';
|
|
982
|
+
/** Surfaced in the beautify prompt so a free-text request ("soft pastel")
|
|
983
|
+
* can be matched to the closest catalog theme. */
|
|
984
|
+
promptHint: string;
|
|
985
|
+
/** Text color used on every role-colored node (boundary included). */
|
|
986
|
+
nodeText: string;
|
|
987
|
+
/**
|
|
988
|
+
* Color for anything drawn directly on the app's canvas rather than on a
|
|
989
|
+
* node's own fill — currently just sequence diagram participants (their
|
|
990
|
+
* name and lifeline have no box, no fill, and can never have one). The
|
|
991
|
+
* canvas is a fixed dark `#141925` regardless of the chosen theme's mode,
|
|
992
|
+
* so this must always be light/bright enough to read against it — it is
|
|
993
|
+
* NOT the same requirement as `nodeText`, which is chosen to read against
|
|
994
|
+
* that theme's own (possibly light) role fills.
|
|
995
|
+
*/
|
|
996
|
+
canvasText: string;
|
|
997
|
+
roles: Record<ThemeRole, ThemeColorPair>;
|
|
998
|
+
edge: {
|
|
999
|
+
stroke: string;
|
|
1000
|
+
strokeWidth: number;
|
|
1001
|
+
labelBackground: string;
|
|
1002
|
+
labelText: string;
|
|
1003
|
+
emphasizedStroke: string;
|
|
1004
|
+
emphasizedStrokeWidth: number;
|
|
1005
|
+
};
|
|
1006
|
+
};
|
|
1007
|
+
declare const DEFAULT_THEME_ID = "professional";
|
|
1008
|
+
declare const THEME_REGISTRY: Record<string, ThemeSpec>;
|
|
1009
|
+
declare function getTheme(themeId: string | undefined): ThemeSpec;
|
|
1010
|
+
/** Renders the catalog as prompt context so the model can match a free-text
|
|
1011
|
+
* style request to the closest theme instead of inventing colors. */
|
|
1012
|
+
declare function buildThemeCatalogPromptContext(): string;
|
|
1013
|
+
//#endregion
|
|
1014
|
+
export { AstToSqlGenerator, AstToUiConverter, BasicDetailsSchema, C4Boundary, C4BoundaryKind, C4DiagramData, C4DiagramType, C4Direction, C4Element, C4ElementKind, C4ElementShape, C4ElementStyle, C4LayoutConfig, C4NodeType, C4RelDirection, C4RelStyle, C4Relationship, C4_COLORS, C4_LAYOUT, CheckConstraintAST, ColumnAST, ComponentInputType, ConstraintAST, CustomData, DEFAULT_THEME_ID, DataTypeAST, DefaultValueAST, type DiagramTypeId, DialectIdSchema, DocumentCollectionSchema, DocumentIndexSchema, DynamoAttributeSchema, DynamoEditorSchema, DynamoGsiSchema, EditorSupportedDialectSchema, ForeignKeyConstraintAST, IndexAST, IndexColumnAST, IndexMethodAST, JsonEditorSchema, LinkOrFileValue, MermaidEdge, MermaidNode, MongoCollectionSchema, MongoEditorSchema, MongoIndexFieldSchema, MongoIndexSchema, MongoNestedFieldSchema, NODE_TYPE_REGISTRY, NestedFieldSchema, NoSqlFieldSchema, type NodeStylePatchInput, type NodeTypeSpec, PrimaryKeyConstraintAST, RFComponentField, ReactFlowData, ReferentialActionAST, SEQUENCE_LAYOUT, SHAPE_IDS, STROKE_STYLES, SchemaAST, SchemaDialect, SchemaUIRepresentation, SequenceActivation, SequenceArrowHead, SequenceAutonumber, SequenceBlock, SequenceBlockSection, SequenceBlockType, SequenceBox, SequenceDiagramData, SequenceMessage, SequenceNote, SequenceParticipant, SequenceParticipantLink, SequenceParticipantType, ServerComponentField, ServerComponentFieldInput, type ShapeId, SqlToAstParser, type StrokeStyleId, SubgraphInfo, SubgraphLayout, THEME_REGISTRY, THEME_ROLES, TParsedColumn, TParsedForeignKey, TParsedIndex, TParsedSchema, TParsedTable, TableAST, TableOptionsAST, type ThemeColorPair, type ThemeRole, type ThemeSpec, UniqueConstraintAST, buildMetaData, buildNodeStyleDataPatch, buildThemeCatalogPromptContext, computeDiagramSyncHash, contextSchema, convertC4MermaidToReactFlow, convertC4ToReactFlow, convertDynamoSchemaToAst, convertJsonSchemaToAst, convertMermaidToReactFlow, convertMermaidToReactFlowWithContext, convertMongoSchemaToAst, convertNoSQLToAst, convertReactFlowToC4Mermaid, convertReactFlowToC4UiGraph, convertReactFlowToSequenceMermaid, convertReactFlowToSequenceUiGraph, convertUiGraphToMermaid, estimateSequenceMessageBoxSize, flattenMetaData, generateTableNodeId, generateUUID, getC4ElementColors, getNodeTypeSpec, getTheme, isC4Diagram, isC4ReactFlowDiagram, isGeometryEditableNodeType, isSequenceDiagram, layoutFlowchart, parseC4Diagram, sanitizeMermaidLabels, syncBaseData };
|
package/dist/index.d.mts
CHANGED
|
@@ -880,6 +880,12 @@ declare const SEQUENCE_LAYOUT: {
|
|
|
880
880
|
readonly BOX_BOTTOM_PADDING: 24;
|
|
881
881
|
};
|
|
882
882
|
//#endregion
|
|
883
|
+
//#region src/mermaid-converter/flow-chart/to-react-flow.d.ts
|
|
884
|
+
declare function layoutFlowchart(nodes: MermaidNode[], edges: MermaidEdge[], subgraphs: SubgraphInfo[], direction: string): {
|
|
885
|
+
nodes: Node[];
|
|
886
|
+
edges: Edge[];
|
|
887
|
+
};
|
|
888
|
+
//#endregion
|
|
883
889
|
//#region src/mermaid-converter/mermaid-sanitizer.d.ts
|
|
884
890
|
declare function sanitizeMermaidLabels(src: string): string;
|
|
885
891
|
//#endregion
|
|
@@ -914,4 +920,95 @@ declare function convertMermaidToReactFlowWithContext(mermaidCode: string, conte
|
|
|
914
920
|
//#region src/uig-converter/index.d.ts
|
|
915
921
|
declare function convertUiGraphToMermaid(input: UiGraphInput, options?: UiGraphOptions): UigOutput;
|
|
916
922
|
//#endregion
|
|
917
|
-
|
|
923
|
+
//#region src/registry/node-types.d.ts
|
|
924
|
+
declare const SHAPE_IDS: readonly ["rectangle", "rounded-rect", "ellipse", "diamond", "triangle", "parallelogram", "trapezoid", "hexagon", "document", "cylinder", "delay", "off-page-connector", "display", "collate", "sort", "terminator", "or", "database", "multiple-documents", "subroutine", "manual-input", "summing-junction", "internal-storage"];
|
|
925
|
+
type ShapeId = (typeof SHAPE_IDS)[number];
|
|
926
|
+
declare const STROKE_STYLES: readonly ["solid", "dashed", "dotted"];
|
|
927
|
+
type StrokeStyleId = (typeof STROKE_STYLES)[number];
|
|
928
|
+
type DiagramTypeId = 'flowchart' | 'sequence' | 'c4';
|
|
929
|
+
/** Style fields a beautify-style patch may carry, independent of node tag. */
|
|
930
|
+
type NodeStylePatchInput = {
|
|
931
|
+
fill?: string;
|
|
932
|
+
stroke?: string;
|
|
933
|
+
strokeWidth?: number;
|
|
934
|
+
strokeStyle?: StrokeStyleId;
|
|
935
|
+
cornerRadius?: number;
|
|
936
|
+
textColor?: string;
|
|
937
|
+
textFontSize?: number;
|
|
938
|
+
shape?: ShapeId;
|
|
939
|
+
};
|
|
940
|
+
type NodeTypeSpec = {
|
|
941
|
+
tag: string;
|
|
942
|
+
diagramTypes: DiagramTypeId[];
|
|
943
|
+
isContainer: boolean;
|
|
944
|
+
/** Whether AI/beautify is allowed to resize this node type directly. */
|
|
945
|
+
geometryEditable: boolean;
|
|
946
|
+
/** Valid `data.shape` values for this tag, if it supports shapes. */
|
|
947
|
+
shapes?: readonly ShapeId[];
|
|
948
|
+
/** Maps a generic style patch onto this node type's own `data` field names. */
|
|
949
|
+
mapStylePatch: (patch: NodeStylePatchInput) => Record<string, unknown>;
|
|
950
|
+
};
|
|
951
|
+
/**
|
|
952
|
+
* Canonical per-node-tag registry, shared by generate, beautify, and (later)
|
|
953
|
+
* MCP tools, so node-type vocabulary and style-field mapping live in exactly
|
|
954
|
+
* one place instead of being re-declared per consumer.
|
|
955
|
+
*/
|
|
956
|
+
declare const NODE_TYPE_REGISTRY: Record<string, NodeTypeSpec>;
|
|
957
|
+
declare function getNodeTypeSpec(type: string | undefined): NodeTypeSpec | undefined;
|
|
958
|
+
/** Replaces the old per-route `buildNodeDataPatch` switch statement. */
|
|
959
|
+
declare function buildNodeStyleDataPatch(type: string | undefined, patch: NodeStylePatchInput): Record<string, unknown>;
|
|
960
|
+
declare function isGeometryEditableNodeType(type: string | undefined): boolean;
|
|
961
|
+
//#endregion
|
|
962
|
+
//#region src/registry/themes.d.ts
|
|
963
|
+
/**
|
|
964
|
+
* Beautify's color source of truth. Instead of asking an LLM to invent raw
|
|
965
|
+
* hex values per request (inconsistent contrast, no guarantee a container's
|
|
966
|
+
* fill differs from its boundary, no way to keep edge labels legible when
|
|
967
|
+
* the palette changes), the model picks a themeId and assigns each node a
|
|
968
|
+
* semantic role — the actual colors always come from here, pre-chosen and
|
|
969
|
+
* checked for contrast once, not re-derived per call.
|
|
970
|
+
*/
|
|
971
|
+
declare const THEME_ROLES: readonly ["boundary", "client", "service", "data", "messaging", "neutral"];
|
|
972
|
+
type ThemeRole = (typeof THEME_ROLES)[number];
|
|
973
|
+
type ThemeColorPair = {
|
|
974
|
+
fill: string;
|
|
975
|
+
stroke: string;
|
|
976
|
+
};
|
|
977
|
+
type ThemeSpec = {
|
|
978
|
+
id: string;
|
|
979
|
+
label: string;
|
|
980
|
+
description: string;
|
|
981
|
+
mode: 'dark' | 'light';
|
|
982
|
+
/** Surfaced in the beautify prompt so a free-text request ("soft pastel")
|
|
983
|
+
* can be matched to the closest catalog theme. */
|
|
984
|
+
promptHint: string;
|
|
985
|
+
/** Text color used on every role-colored node (boundary included). */
|
|
986
|
+
nodeText: string;
|
|
987
|
+
/**
|
|
988
|
+
* Color for anything drawn directly on the app's canvas rather than on a
|
|
989
|
+
* node's own fill — currently just sequence diagram participants (their
|
|
990
|
+
* name and lifeline have no box, no fill, and can never have one). The
|
|
991
|
+
* canvas is a fixed dark `#141925` regardless of the chosen theme's mode,
|
|
992
|
+
* so this must always be light/bright enough to read against it — it is
|
|
993
|
+
* NOT the same requirement as `nodeText`, which is chosen to read against
|
|
994
|
+
* that theme's own (possibly light) role fills.
|
|
995
|
+
*/
|
|
996
|
+
canvasText: string;
|
|
997
|
+
roles: Record<ThemeRole, ThemeColorPair>;
|
|
998
|
+
edge: {
|
|
999
|
+
stroke: string;
|
|
1000
|
+
strokeWidth: number;
|
|
1001
|
+
labelBackground: string;
|
|
1002
|
+
labelText: string;
|
|
1003
|
+
emphasizedStroke: string;
|
|
1004
|
+
emphasizedStrokeWidth: number;
|
|
1005
|
+
};
|
|
1006
|
+
};
|
|
1007
|
+
declare const DEFAULT_THEME_ID = "professional";
|
|
1008
|
+
declare const THEME_REGISTRY: Record<string, ThemeSpec>;
|
|
1009
|
+
declare function getTheme(themeId: string | undefined): ThemeSpec;
|
|
1010
|
+
/** Renders the catalog as prompt context so the model can match a free-text
|
|
1011
|
+
* style request to the closest theme instead of inventing colors. */
|
|
1012
|
+
declare function buildThemeCatalogPromptContext(): string;
|
|
1013
|
+
//#endregion
|
|
1014
|
+
export { AstToSqlGenerator, AstToUiConverter, BasicDetailsSchema, C4Boundary, C4BoundaryKind, C4DiagramData, C4DiagramType, C4Direction, C4Element, C4ElementKind, C4ElementShape, C4ElementStyle, C4LayoutConfig, C4NodeType, C4RelDirection, C4RelStyle, C4Relationship, C4_COLORS, C4_LAYOUT, CheckConstraintAST, ColumnAST, ComponentInputType, ConstraintAST, CustomData, DEFAULT_THEME_ID, DataTypeAST, DefaultValueAST, type DiagramTypeId, DialectIdSchema, DocumentCollectionSchema, DocumentIndexSchema, DynamoAttributeSchema, DynamoEditorSchema, DynamoGsiSchema, EditorSupportedDialectSchema, ForeignKeyConstraintAST, IndexAST, IndexColumnAST, IndexMethodAST, JsonEditorSchema, LinkOrFileValue, MermaidEdge, MermaidNode, MongoCollectionSchema, MongoEditorSchema, MongoIndexFieldSchema, MongoIndexSchema, MongoNestedFieldSchema, NODE_TYPE_REGISTRY, NestedFieldSchema, NoSqlFieldSchema, type NodeStylePatchInput, type NodeTypeSpec, PrimaryKeyConstraintAST, RFComponentField, ReactFlowData, ReferentialActionAST, SEQUENCE_LAYOUT, SHAPE_IDS, STROKE_STYLES, SchemaAST, SchemaDialect, SchemaUIRepresentation, SequenceActivation, SequenceArrowHead, SequenceAutonumber, SequenceBlock, SequenceBlockSection, SequenceBlockType, SequenceBox, SequenceDiagramData, SequenceMessage, SequenceNote, SequenceParticipant, SequenceParticipantLink, SequenceParticipantType, ServerComponentField, ServerComponentFieldInput, type ShapeId, SqlToAstParser, type StrokeStyleId, SubgraphInfo, SubgraphLayout, THEME_REGISTRY, THEME_ROLES, TParsedColumn, TParsedForeignKey, TParsedIndex, TParsedSchema, TParsedTable, TableAST, TableOptionsAST, type ThemeColorPair, type ThemeRole, type ThemeSpec, UniqueConstraintAST, buildMetaData, buildNodeStyleDataPatch, buildThemeCatalogPromptContext, computeDiagramSyncHash, contextSchema, convertC4MermaidToReactFlow, convertC4ToReactFlow, convertDynamoSchemaToAst, convertJsonSchemaToAst, convertMermaidToReactFlow, convertMermaidToReactFlowWithContext, convertMongoSchemaToAst, convertNoSQLToAst, convertReactFlowToC4Mermaid, convertReactFlowToC4UiGraph, convertReactFlowToSequenceMermaid, convertReactFlowToSequenceUiGraph, convertUiGraphToMermaid, estimateSequenceMessageBoxSize, flattenMetaData, generateTableNodeId, generateUUID, getC4ElementColors, getNodeTypeSpec, getTheme, isC4Diagram, isC4ReactFlowDiagram, isGeometryEditableNodeType, isSequenceDiagram, layoutFlowchart, parseC4Diagram, sanitizeMermaidLabels, syncBaseData };
|