@uigraph/sdk 1.2.12 → 1.2.13
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 +728 -100
- package/dist/index.d.cts +92 -1
- package/dist/index.d.mts +92 -1
- package/dist/index.mjs +718 -101
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -914,4 +914,95 @@ declare function convertMermaidToReactFlowWithContext(mermaidCode: string, conte
|
|
|
914
914
|
//#region src/uig-converter/index.d.ts
|
|
915
915
|
declare function convertUiGraphToMermaid(input: UiGraphInput, options?: UiGraphOptions): UigOutput;
|
|
916
916
|
//#endregion
|
|
917
|
-
|
|
917
|
+
//#region src/registry/node-types.d.ts
|
|
918
|
+
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"];
|
|
919
|
+
type ShapeId = (typeof SHAPE_IDS)[number];
|
|
920
|
+
declare const STROKE_STYLES: readonly ["solid", "dashed", "dotted"];
|
|
921
|
+
type StrokeStyleId = (typeof STROKE_STYLES)[number];
|
|
922
|
+
type DiagramTypeId = 'flowchart' | 'sequence' | 'c4';
|
|
923
|
+
/** Style fields a beautify-style patch may carry, independent of node tag. */
|
|
924
|
+
type NodeStylePatchInput = {
|
|
925
|
+
fill?: string;
|
|
926
|
+
stroke?: string;
|
|
927
|
+
strokeWidth?: number;
|
|
928
|
+
strokeStyle?: StrokeStyleId;
|
|
929
|
+
cornerRadius?: number;
|
|
930
|
+
textColor?: string;
|
|
931
|
+
textFontSize?: number;
|
|
932
|
+
shape?: ShapeId;
|
|
933
|
+
};
|
|
934
|
+
type NodeTypeSpec = {
|
|
935
|
+
tag: string;
|
|
936
|
+
diagramTypes: DiagramTypeId[];
|
|
937
|
+
isContainer: boolean;
|
|
938
|
+
/** Whether AI/beautify is allowed to resize this node type directly. */
|
|
939
|
+
geometryEditable: boolean;
|
|
940
|
+
/** Valid `data.shape` values for this tag, if it supports shapes. */
|
|
941
|
+
shapes?: readonly ShapeId[];
|
|
942
|
+
/** Maps a generic style patch onto this node type's own `data` field names. */
|
|
943
|
+
mapStylePatch: (patch: NodeStylePatchInput) => Record<string, unknown>;
|
|
944
|
+
};
|
|
945
|
+
/**
|
|
946
|
+
* Canonical per-node-tag registry, shared by generate, beautify, and (later)
|
|
947
|
+
* MCP tools, so node-type vocabulary and style-field mapping live in exactly
|
|
948
|
+
* one place instead of being re-declared per consumer.
|
|
949
|
+
*/
|
|
950
|
+
declare const NODE_TYPE_REGISTRY: Record<string, NodeTypeSpec>;
|
|
951
|
+
declare function getNodeTypeSpec(type: string | undefined): NodeTypeSpec | undefined;
|
|
952
|
+
/** Replaces the old per-route `buildNodeDataPatch` switch statement. */
|
|
953
|
+
declare function buildNodeStyleDataPatch(type: string | undefined, patch: NodeStylePatchInput): Record<string, unknown>;
|
|
954
|
+
declare function isGeometryEditableNodeType(type: string | undefined): boolean;
|
|
955
|
+
//#endregion
|
|
956
|
+
//#region src/registry/themes.d.ts
|
|
957
|
+
/**
|
|
958
|
+
* Beautify's color source of truth. Instead of asking an LLM to invent raw
|
|
959
|
+
* hex values per request (inconsistent contrast, no guarantee a container's
|
|
960
|
+
* fill differs from its boundary, no way to keep edge labels legible when
|
|
961
|
+
* the palette changes), the model picks a themeId and assigns each node a
|
|
962
|
+
* semantic role — the actual colors always come from here, pre-chosen and
|
|
963
|
+
* checked for contrast once, not re-derived per call.
|
|
964
|
+
*/
|
|
965
|
+
declare const THEME_ROLES: readonly ["boundary", "client", "service", "data", "messaging", "neutral"];
|
|
966
|
+
type ThemeRole = (typeof THEME_ROLES)[number];
|
|
967
|
+
type ThemeColorPair = {
|
|
968
|
+
fill: string;
|
|
969
|
+
stroke: string;
|
|
970
|
+
};
|
|
971
|
+
type ThemeSpec = {
|
|
972
|
+
id: string;
|
|
973
|
+
label: string;
|
|
974
|
+
description: string;
|
|
975
|
+
mode: 'dark' | 'light';
|
|
976
|
+
/** Surfaced in the beautify prompt so a free-text request ("soft pastel")
|
|
977
|
+
* can be matched to the closest catalog theme. */
|
|
978
|
+
promptHint: string;
|
|
979
|
+
/** Text color used on every role-colored node (boundary included). */
|
|
980
|
+
nodeText: string;
|
|
981
|
+
/**
|
|
982
|
+
* Color for anything drawn directly on the app's canvas rather than on a
|
|
983
|
+
* node's own fill — currently just sequence diagram participants (their
|
|
984
|
+
* name and lifeline have no box, no fill, and can never have one). The
|
|
985
|
+
* canvas is a fixed dark `#141925` regardless of the chosen theme's mode,
|
|
986
|
+
* so this must always be light/bright enough to read against it — it is
|
|
987
|
+
* NOT the same requirement as `nodeText`, which is chosen to read against
|
|
988
|
+
* that theme's own (possibly light) role fills.
|
|
989
|
+
*/
|
|
990
|
+
canvasText: string;
|
|
991
|
+
roles: Record<ThemeRole, ThemeColorPair>;
|
|
992
|
+
edge: {
|
|
993
|
+
stroke: string;
|
|
994
|
+
strokeWidth: number;
|
|
995
|
+
labelBackground: string;
|
|
996
|
+
labelText: string;
|
|
997
|
+
emphasizedStroke: string;
|
|
998
|
+
emphasizedStrokeWidth: number;
|
|
999
|
+
};
|
|
1000
|
+
};
|
|
1001
|
+
declare const DEFAULT_THEME_ID = "professional";
|
|
1002
|
+
declare const THEME_REGISTRY: Record<string, ThemeSpec>;
|
|
1003
|
+
declare function getTheme(themeId: string | undefined): ThemeSpec;
|
|
1004
|
+
/** Renders the catalog as prompt context so the model can match a free-text
|
|
1005
|
+
* style request to the closest theme instead of inventing colors. */
|
|
1006
|
+
declare function buildThemeCatalogPromptContext(): string;
|
|
1007
|
+
//#endregion
|
|
1008
|
+
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, parseC4Diagram, sanitizeMermaidLabels, syncBaseData };
|
package/dist/index.d.mts
CHANGED
|
@@ -914,4 +914,95 @@ declare function convertMermaidToReactFlowWithContext(mermaidCode: string, conte
|
|
|
914
914
|
//#region src/uig-converter/index.d.ts
|
|
915
915
|
declare function convertUiGraphToMermaid(input: UiGraphInput, options?: UiGraphOptions): UigOutput;
|
|
916
916
|
//#endregion
|
|
917
|
-
|
|
917
|
+
//#region src/registry/node-types.d.ts
|
|
918
|
+
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"];
|
|
919
|
+
type ShapeId = (typeof SHAPE_IDS)[number];
|
|
920
|
+
declare const STROKE_STYLES: readonly ["solid", "dashed", "dotted"];
|
|
921
|
+
type StrokeStyleId = (typeof STROKE_STYLES)[number];
|
|
922
|
+
type DiagramTypeId = 'flowchart' | 'sequence' | 'c4';
|
|
923
|
+
/** Style fields a beautify-style patch may carry, independent of node tag. */
|
|
924
|
+
type NodeStylePatchInput = {
|
|
925
|
+
fill?: string;
|
|
926
|
+
stroke?: string;
|
|
927
|
+
strokeWidth?: number;
|
|
928
|
+
strokeStyle?: StrokeStyleId;
|
|
929
|
+
cornerRadius?: number;
|
|
930
|
+
textColor?: string;
|
|
931
|
+
textFontSize?: number;
|
|
932
|
+
shape?: ShapeId;
|
|
933
|
+
};
|
|
934
|
+
type NodeTypeSpec = {
|
|
935
|
+
tag: string;
|
|
936
|
+
diagramTypes: DiagramTypeId[];
|
|
937
|
+
isContainer: boolean;
|
|
938
|
+
/** Whether AI/beautify is allowed to resize this node type directly. */
|
|
939
|
+
geometryEditable: boolean;
|
|
940
|
+
/** Valid `data.shape` values for this tag, if it supports shapes. */
|
|
941
|
+
shapes?: readonly ShapeId[];
|
|
942
|
+
/** Maps a generic style patch onto this node type's own `data` field names. */
|
|
943
|
+
mapStylePatch: (patch: NodeStylePatchInput) => Record<string, unknown>;
|
|
944
|
+
};
|
|
945
|
+
/**
|
|
946
|
+
* Canonical per-node-tag registry, shared by generate, beautify, and (later)
|
|
947
|
+
* MCP tools, so node-type vocabulary and style-field mapping live in exactly
|
|
948
|
+
* one place instead of being re-declared per consumer.
|
|
949
|
+
*/
|
|
950
|
+
declare const NODE_TYPE_REGISTRY: Record<string, NodeTypeSpec>;
|
|
951
|
+
declare function getNodeTypeSpec(type: string | undefined): NodeTypeSpec | undefined;
|
|
952
|
+
/** Replaces the old per-route `buildNodeDataPatch` switch statement. */
|
|
953
|
+
declare function buildNodeStyleDataPatch(type: string | undefined, patch: NodeStylePatchInput): Record<string, unknown>;
|
|
954
|
+
declare function isGeometryEditableNodeType(type: string | undefined): boolean;
|
|
955
|
+
//#endregion
|
|
956
|
+
//#region src/registry/themes.d.ts
|
|
957
|
+
/**
|
|
958
|
+
* Beautify's color source of truth. Instead of asking an LLM to invent raw
|
|
959
|
+
* hex values per request (inconsistent contrast, no guarantee a container's
|
|
960
|
+
* fill differs from its boundary, no way to keep edge labels legible when
|
|
961
|
+
* the palette changes), the model picks a themeId and assigns each node a
|
|
962
|
+
* semantic role — the actual colors always come from here, pre-chosen and
|
|
963
|
+
* checked for contrast once, not re-derived per call.
|
|
964
|
+
*/
|
|
965
|
+
declare const THEME_ROLES: readonly ["boundary", "client", "service", "data", "messaging", "neutral"];
|
|
966
|
+
type ThemeRole = (typeof THEME_ROLES)[number];
|
|
967
|
+
type ThemeColorPair = {
|
|
968
|
+
fill: string;
|
|
969
|
+
stroke: string;
|
|
970
|
+
};
|
|
971
|
+
type ThemeSpec = {
|
|
972
|
+
id: string;
|
|
973
|
+
label: string;
|
|
974
|
+
description: string;
|
|
975
|
+
mode: 'dark' | 'light';
|
|
976
|
+
/** Surfaced in the beautify prompt so a free-text request ("soft pastel")
|
|
977
|
+
* can be matched to the closest catalog theme. */
|
|
978
|
+
promptHint: string;
|
|
979
|
+
/** Text color used on every role-colored node (boundary included). */
|
|
980
|
+
nodeText: string;
|
|
981
|
+
/**
|
|
982
|
+
* Color for anything drawn directly on the app's canvas rather than on a
|
|
983
|
+
* node's own fill — currently just sequence diagram participants (their
|
|
984
|
+
* name and lifeline have no box, no fill, and can never have one). The
|
|
985
|
+
* canvas is a fixed dark `#141925` regardless of the chosen theme's mode,
|
|
986
|
+
* so this must always be light/bright enough to read against it — it is
|
|
987
|
+
* NOT the same requirement as `nodeText`, which is chosen to read against
|
|
988
|
+
* that theme's own (possibly light) role fills.
|
|
989
|
+
*/
|
|
990
|
+
canvasText: string;
|
|
991
|
+
roles: Record<ThemeRole, ThemeColorPair>;
|
|
992
|
+
edge: {
|
|
993
|
+
stroke: string;
|
|
994
|
+
strokeWidth: number;
|
|
995
|
+
labelBackground: string;
|
|
996
|
+
labelText: string;
|
|
997
|
+
emphasizedStroke: string;
|
|
998
|
+
emphasizedStrokeWidth: number;
|
|
999
|
+
};
|
|
1000
|
+
};
|
|
1001
|
+
declare const DEFAULT_THEME_ID = "professional";
|
|
1002
|
+
declare const THEME_REGISTRY: Record<string, ThemeSpec>;
|
|
1003
|
+
declare function getTheme(themeId: string | undefined): ThemeSpec;
|
|
1004
|
+
/** Renders the catalog as prompt context so the model can match a free-text
|
|
1005
|
+
* style request to the closest theme instead of inventing colors. */
|
|
1006
|
+
declare function buildThemeCatalogPromptContext(): string;
|
|
1007
|
+
//#endregion
|
|
1008
|
+
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, parseC4Diagram, sanitizeMermaidLabels, syncBaseData };
|