@spectratools/graphic-designer-cli 0.14.2 → 0.14.3
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/cli.js +65 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +68 -1
- package/dist/qa.d.ts +1 -1
- package/dist/qa.js +23 -0
- package/dist/renderer.d.ts +1 -1
- package/dist/renderer.js +23 -0
- package/dist/{spec.schema-De-IkUjn.d.ts → spec.schema-BY5MjmA8.d.ts} +1655 -1586
- package/dist/spec.schema.d.ts +1 -1
- package/dist/spec.schema.js +57 -0
- package/package.json +1 -1
package/dist/spec.schema.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'zod';
|
|
2
|
-
export { A as AnchorHint, e as AutoLayoutConfig, B as BuiltInTheme, f as CardElement, g as CodeBlockElement,
|
|
2
|
+
export { A as AnchorHint, e as AutoLayoutConfig, B as BuiltInTheme, f as CardElement, g as CodeBlockElement, aB as CodeBlockStyle, C as ConnectionElement, h as ConstraintSpec, k as Decorator, l as DesignCardSpec, m as DesignSafeFrame, D as DesignSpec, n as DesignTheme, o as DiagramElement, p as DiagramLayout, q as DiagramSpec, r as DrawArc, s as DrawBadge, t as DrawBezier, u as DrawCircle, b as DrawCommand, v as DrawFontFamily, w as DrawGradientRect, aC as DrawGrid, x as DrawLine, y as DrawPath, z as DrawPoint, E as DrawRect, F as DrawShadow, aD as DrawStatsBar, aE as DrawStatsBarItem, aF as DrawStrokeGradient, G as DrawText, H as DrawTextRow, I as DrawTextRowSegment, J as Element, K as EllipseLayoutConfig, L as FlowNodeElement, aG as FlowNodeShadow, M as Gradient, N as GradientOverlayDecorator, aH as GradientStop, Q as GraphSpec, S as GridLayoutConfig, U as ImageElement, W as LayoutConfig, aI as LinearGradient, Y as ManualLayoutConfig, aJ as RadialGradient, Z as RainbowRuleDecorator, aK as RingElement, aL as RingSegment, a0 as ShapeElement, a1 as StackLayoutConfig, a2 as TerminalElement, a3 as TextElement, c as Theme, a4 as ThemeInput, a5 as VignetteDecorator, a7 as builtInThemeBackgrounds, a8 as builtInThemes, aa as connectionElementSchema, ab as defaultAutoLayout, ac as defaultCanvas, ad as defaultConstraints, ae as defaultGridLayout, af as defaultLayout, ag as defaultStackLayout, ah as defaultTheme, ai as deriveSafeFrame, aj as designSpecSchema, ak as diagramElementSchema, al as diagramLayoutSchema, am as diagramSpecSchema, aq as flowNodeElementSchema, ar as graphSpecSchema, as as graphSpecToDesignSpec, at as inferLayout, av as parseDesignSpec, aw as parseDiagramSpec, ax as parseSpecInput, az as resolveTheme } from './spec.schema-BY5MjmA8.js';
|
|
3
3
|
import '@napi-rs/canvas';
|
package/dist/spec.schema.js
CHANGED
|
@@ -901,6 +901,60 @@ function parseDiagramSpec(input) {
|
|
|
901
901
|
function parseDesignSpec(input) {
|
|
902
902
|
return designSpecSchema.parse(input);
|
|
903
903
|
}
|
|
904
|
+
var graphNodeSchema = z2.object({
|
|
905
|
+
id: z2.string().min(1).max(120),
|
|
906
|
+
label: z2.string().min(1).max(200),
|
|
907
|
+
shape: z2.enum([
|
|
908
|
+
"box",
|
|
909
|
+
"rounded-box",
|
|
910
|
+
"diamond",
|
|
911
|
+
"circle",
|
|
912
|
+
"pill",
|
|
913
|
+
"cylinder",
|
|
914
|
+
"parallelogram",
|
|
915
|
+
"hexagon"
|
|
916
|
+
]).optional()
|
|
917
|
+
}).strict();
|
|
918
|
+
var graphEdgeSchema = z2.object({
|
|
919
|
+
from: z2.string().min(1).max(120),
|
|
920
|
+
to: z2.string().min(1).max(120),
|
|
921
|
+
label: z2.string().min(1).max(200).optional()
|
|
922
|
+
}).strict();
|
|
923
|
+
var graphSpecSchema = z2.object({
|
|
924
|
+
nodes: z2.array(graphNodeSchema).min(1),
|
|
925
|
+
edges: z2.array(graphEdgeSchema).default([])
|
|
926
|
+
}).strict();
|
|
927
|
+
function isGraphSpecInput(input) {
|
|
928
|
+
return typeof input === "object" && input !== null && "nodes" in input;
|
|
929
|
+
}
|
|
930
|
+
function graphSpecToDesignSpec(graph) {
|
|
931
|
+
const elements = [
|
|
932
|
+
...graph.nodes.map((n) => ({
|
|
933
|
+
type: "flow-node",
|
|
934
|
+
id: n.id,
|
|
935
|
+
label: n.label,
|
|
936
|
+
...n.shape ? { shape: n.shape } : {}
|
|
937
|
+
})),
|
|
938
|
+
...graph.edges.map((e) => ({
|
|
939
|
+
type: "connection",
|
|
940
|
+
from: e.from,
|
|
941
|
+
to: e.to,
|
|
942
|
+
...e.label ? { label: e.label } : {}
|
|
943
|
+
}))
|
|
944
|
+
];
|
|
945
|
+
return designSpecSchema.parse({
|
|
946
|
+
version: 2,
|
|
947
|
+
elements,
|
|
948
|
+
layout: { mode: "auto", algorithm: "layered", direction: "TB" }
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
function parseSpecInput(input) {
|
|
952
|
+
if (isGraphSpecInput(input)) {
|
|
953
|
+
const graph = graphSpecSchema.parse(input);
|
|
954
|
+
return graphSpecToDesignSpec(graph);
|
|
955
|
+
}
|
|
956
|
+
return designSpecSchema.parse(input);
|
|
957
|
+
}
|
|
904
958
|
export {
|
|
905
959
|
builtInThemeBackgrounds,
|
|
906
960
|
builtInThemes,
|
|
@@ -918,8 +972,11 @@ export {
|
|
|
918
972
|
diagramLayoutSchema,
|
|
919
973
|
diagramSpecSchema,
|
|
920
974
|
flowNodeElementSchema,
|
|
975
|
+
graphSpecSchema,
|
|
976
|
+
graphSpecToDesignSpec,
|
|
921
977
|
inferLayout,
|
|
922
978
|
parseDesignSpec,
|
|
923
979
|
parseDiagramSpec,
|
|
980
|
+
parseSpecInput,
|
|
924
981
|
resolveTheme
|
|
925
982
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectratools/graphic-designer-cli",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"description": "Deterministic visual content generator — code screenshots, terminal shots, flowcharts, and infographics. No browser dependency.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|