@spectratools/graphic-designer-cli 0.9.0 → 0.11.0
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 +321 -135
- package/dist/index.d.ts +48 -8
- package/dist/index.js +325 -85
- package/dist/qa.d.ts +1 -1
- package/dist/qa.js +47 -7
- package/dist/renderer.d.ts +1 -1
- package/dist/renderer.js +262 -133
- package/dist/{spec.schema-B_Z-KNqt.d.ts → spec.schema-CYlOLxmK.d.ts} +573 -49
- package/dist/spec.schema.d.ts +1 -1
- package/dist/spec.schema.js +47 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Cli } from 'incur';
|
|
2
|
-
import { T as ThemeInput, D as DesignSpec, a as Rect$1, b as DrawCommand, c as Theme, d as RenderedElement, A as AnchorHint, C as ConnectionElement } from './spec.schema-
|
|
3
|
-
export { e as AutoLayoutConfig, B as BuiltInTheme, f as CardElement, g as CodeBlockElement, h as ConstraintSpec, i as DEFAULT_GENERATOR_VERSION, j as DEFAULT_RAINBOW_COLORS, k as Decorator, l as DesignCardSpec, m as DesignSafeFrame, n as DesignTheme, o as DiagramElement, p as DiagramLayout, q as DiagramSpec, r as
|
|
2
|
+
import { T as ThemeInput, D as DesignSpec, a as Rect$1, b as DrawCommand, c as Theme, d as RenderedElement, A as AnchorHint, C as ConnectionElement } from './spec.schema-CYlOLxmK.js';
|
|
3
|
+
export { e as AutoLayoutConfig, B as BuiltInTheme, f as CardElement, g as CodeBlockElement, h as ConstraintSpec, i as DEFAULT_GENERATOR_VERSION, j as DEFAULT_RAINBOW_COLORS, k as Decorator, l as DesignCardSpec, m as DesignSafeFrame, n as DesignTheme, o as DiagramElement, p as DiagramLayout, q as DiagramSpec, r as DrawArc, s as DrawBadge, t as DrawBezier, u as DrawCircle, v as DrawFontFamily, w as DrawGradientRect, x as DrawLine, y as DrawPath, z as DrawPoint, E as DrawRect, F as DrawShadow, G as DrawText, H as DrawTextRow, I as DrawTextRowSegment, J as Element, K as FlowNodeElement, L as Gradient, M as GradientOverlayDecorator, N as GradientSpec, O as GradientStop, P as GridLayoutConfig, Q as ImageElement, S as IterationMeta, U as LayoutConfig, V as LayoutSnapshot, W as ManualLayoutConfig, X as RainbowRuleDecorator, Y as RenderDesignOptions, R as RenderMetadata, Z as RenderResult, _ as ShapeElement, $ as StackLayoutConfig, a0 as TerminalElement, a1 as TextElement, a2 as ThemeInput, a3 as VignetteDecorator, a4 as WrittenArtifacts, a5 as builtInThemeBackgrounds, a6 as builtInThemes, a7 as computeSpecHash, a8 as connectionElementSchema, a9 as defaultAutoLayout, aa as defaultCanvas, ab as defaultConstraints, ac as defaultGridLayout, ad as defaultLayout, ae as defaultStackLayout, af as defaultTheme, ag as deriveSafeFrame, ah as designSpecSchema, ai as diagramElementSchema, aj as diagramLayoutSchema, ak as diagramSpecSchema, al as drawGradientRect, am as drawRainbowRule, an as drawVignette, ao as flowNodeElementSchema, ap as inferLayout, aq as inferSidecarPath, ar as parseDesignSpec, as as parseDiagramSpec, at as renderDesign, au as resolveTheme, av as writeRenderArtifacts } from './spec.schema-CYlOLxmK.js';
|
|
4
4
|
import { SKRSContext2D } from '@napi-rs/canvas';
|
|
5
5
|
export { QaIssue, QaReferenceResult, QaReport, QaSeverity, readMetadata, runQa } from './qa.js';
|
|
6
6
|
import { Highlighter } from 'shiki';
|
|
@@ -223,10 +223,10 @@ type ElkLayoutResult = LayoutResult & {
|
|
|
223
223
|
/**
|
|
224
224
|
* Render an array of freestyle draw commands onto a canvas context.
|
|
225
225
|
*
|
|
226
|
-
* Supports
|
|
227
|
-
* `path`, `badge`,
|
|
228
|
-
*
|
|
229
|
-
* downstream QA checks.
|
|
226
|
+
* Supports draw command types including `rect`, `circle`, `text`, `line`,
|
|
227
|
+
* `arc`, `bezier`, `path`, `badge`, `gradient-rect`, `grid`, and `text-row`.
|
|
228
|
+
* Each command is rendered in order and produces a corresponding
|
|
229
|
+
* {@link RenderedElement} with computed bounds for downstream QA checks.
|
|
230
230
|
*
|
|
231
231
|
* @param ctx - The `@napi-rs/canvas` 2D rendering context to draw into.
|
|
232
232
|
* @param commands - Array of {@link DrawCommand} objects from the design spec's
|
|
@@ -245,9 +245,16 @@ type Point$1 = {
|
|
|
245
245
|
|
|
246
246
|
type Point = Point$1;
|
|
247
247
|
type Rect = Rect$1;
|
|
248
|
-
type ConnectionRouting = 'auto' | 'orthogonal' | 'curve' | 'arc';
|
|
248
|
+
type ConnectionRouting = 'auto' | 'orthogonal' | 'curve' | 'arc' | 'straight';
|
|
249
|
+
type ConnectionCurveMode = 'normal' | 'ellipse';
|
|
249
250
|
type ConnectionArrow = 'none' | 'end' | 'start' | 'both';
|
|
250
251
|
type ConnectionStrokeStyle = 'solid' | 'dashed' | 'dotted';
|
|
252
|
+
type EllipseParams = {
|
|
253
|
+
cx: number;
|
|
254
|
+
cy: number;
|
|
255
|
+
rx: number;
|
|
256
|
+
ry: number;
|
|
257
|
+
};
|
|
251
258
|
type ConnectionRenderOptions = {
|
|
252
259
|
fromBounds: Rect;
|
|
253
260
|
toBounds: Rect;
|
|
@@ -292,6 +299,38 @@ declare function curveRoute(fromBounds: Rect, toBounds: Rect, diagramCenter: Poi
|
|
|
292
299
|
* automatic edge anchor calculation.
|
|
293
300
|
*/
|
|
294
301
|
declare function arcRoute(fromBounds: Rect, toBounds: Rect, diagramCenter: Point, tension: number, fromAnchor?: AnchorHint, toAnchor?: AnchorHint): [CubicBezierSegment, CubicBezierSegment];
|
|
302
|
+
/**
|
|
303
|
+
* Infer ellipse parameters from the bounding boxes of all flow-node elements.
|
|
304
|
+
*
|
|
305
|
+
* When explicit `ellipseRx`/`ellipseRy` are provided they are used directly.
|
|
306
|
+
* Otherwise the ellipse is fitted by computing the centroid of all node centers
|
|
307
|
+
* as the center, with `rx` and `ry` derived from the maximum horizontal and
|
|
308
|
+
* vertical distance from the centroid to any node center.
|
|
309
|
+
*/
|
|
310
|
+
declare function inferEllipseParams(nodeBounds: Rect[], explicitCenter?: Point, explicitRx?: number, explicitRy?: number): EllipseParams;
|
|
311
|
+
/**
|
|
312
|
+
* Compute a cubic bezier curve that traces an arc on a shared global ellipse.
|
|
313
|
+
*
|
|
314
|
+
* Uses the generalized kappa formula: `κ = (4/3) × tan(angularSpan / 4)`
|
|
315
|
+
* to produce control points from the ellipse tangent vectors at the source
|
|
316
|
+
* and target angles.
|
|
317
|
+
*
|
|
318
|
+
* The source and target points are the edge anchors of the respective node
|
|
319
|
+
* bounding boxes (not points on the ellipse itself), but the control points
|
|
320
|
+
* are derived from the ellipse tangent at the angle each node center makes
|
|
321
|
+
* with the ellipse center. This produces curves that follow the global
|
|
322
|
+
* ellipse arc while connecting node boundaries correctly.
|
|
323
|
+
*
|
|
324
|
+
* @returns `[startPoint, controlPoint1, controlPoint2, endPoint]`
|
|
325
|
+
*/
|
|
326
|
+
declare function ellipseRoute(fromBounds: Rect, toBounds: Rect, ellipse: EllipseParams, fromAnchor?: AnchorHint, toAnchor?: AnchorHint): [Point, Point, Point, Point];
|
|
327
|
+
/**
|
|
328
|
+
* Compute a straight-line route between two rectangles.
|
|
329
|
+
*
|
|
330
|
+
* When `fromAnchor` or `toAnchor` hints are provided, they override the
|
|
331
|
+
* automatic edge anchor calculation.
|
|
332
|
+
*/
|
|
333
|
+
declare function straightRoute(fromBounds: Rect, toBounds: Rect, fromAnchor?: AnchorHint, toAnchor?: AnchorHint): [Point, Point];
|
|
295
334
|
/**
|
|
296
335
|
* Compute an orthogonal (right-angle) path between two rectangles.
|
|
297
336
|
* Returns an array of waypoints forming a 3-segment path.
|
|
@@ -309,6 +348,7 @@ declare function bezierPointAt(p0: Point, cp1: Point, cp2: Point, p3: Point, t:
|
|
|
309
348
|
declare function computeDiagramCenter(nodeBounds: Rect[], canvasCenter?: Point): Point;
|
|
310
349
|
declare function renderConnection(ctx: SKRSContext2D, conn: ConnectionElement, fromBounds: Rect, toBounds: Rect, theme: Theme, edgeRoute?: EdgeRoute, options?: {
|
|
311
350
|
diagramCenter?: Point;
|
|
351
|
+
ellipseParams?: EllipseParams;
|
|
312
352
|
}): RenderedElement[];
|
|
313
353
|
|
|
314
354
|
/**
|
|
@@ -366,4 +406,4 @@ declare function highlightCode(code: string, language: string, themeName: string
|
|
|
366
406
|
*/
|
|
367
407
|
declare function disposeHighlighter(): void;
|
|
368
408
|
|
|
369
|
-
export { type CompareImagesOptions, type CompareImagesReport, type CompareRegionScore, type CompareVerdict, type ConnectionArrow, ConnectionElement, type ConnectionRenderOptions, type ConnectionRouting, type ConnectionStrokeStyle, type CubicBezierSegment, DesignSpec, DrawCommand, type EdgeRoute, type ElkLayoutResult, type HighlightedLine, type LayoutResult, type Point, Rect$1 as Rect, RenderedElement, Theme, arcRoute, bezierPointAt, buildCardsSpec, buildCodeSpec, buildFlowchartSpec, buildTerminalSpec, cli, compareImages, computeDiagramCenter, curveRoute, disposeHighlighter, edgeAnchor, highlightCode, initHighlighter, loadFonts, orthogonalRoute, outwardNormal, rectCenter, renderConnection, renderDrawCommands, resolveShikiTheme, themeToShikiMap };
|
|
409
|
+
export { type CompareImagesOptions, type CompareImagesReport, type CompareRegionScore, type CompareVerdict, type ConnectionArrow, type ConnectionCurveMode, ConnectionElement, type ConnectionRenderOptions, type ConnectionRouting, type ConnectionStrokeStyle, type CubicBezierSegment, DesignSpec, DrawCommand, type EdgeRoute, type ElkLayoutResult, type EllipseParams, type HighlightedLine, type LayoutResult, type Point, Rect$1 as Rect, RenderedElement, Theme, arcRoute, bezierPointAt, buildCardsSpec, buildCodeSpec, buildFlowchartSpec, buildTerminalSpec, cli, compareImages, computeDiagramCenter, curveRoute, disposeHighlighter, edgeAnchor, ellipseRoute, highlightCode, inferEllipseParams, initHighlighter, loadFonts, orthogonalRoute, outwardNormal, rectCenter, renderConnection, renderDrawCommands, resolveShikiTheme, straightRoute, themeToShikiMap };
|