@spectratools/graphic-designer-cli 0.7.0 → 0.7.1

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 CHANGED
@@ -752,9 +752,19 @@ var linearGradientSchema = z2.object({
752
752
  }).strict();
753
753
  var radialGradientSchema = z2.object({
754
754
  type: z2.literal("radial"),
755
+ cx: z2.number().optional(),
756
+ cy: z2.number().optional(),
757
+ innerRadius: z2.number().min(0).optional(),
758
+ outerRadius: z2.number().min(0).optional(),
755
759
  stops: z2.array(gradientStopSchema).min(2)
756
760
  }).strict();
757
761
  var gradientSchema = z2.discriminatedUnion("type", [linearGradientSchema, radialGradientSchema]);
762
+ var drawShadowSchema = z2.object({
763
+ color: colorHexSchema2.default("rgba(0,0,0,0.5)"),
764
+ blur: z2.number().min(0).max(64).default(10),
765
+ offsetX: z2.number().default(0),
766
+ offsetY: z2.number().default(4)
767
+ }).strict();
758
768
  var drawFontFamilySchema = z2.enum(["heading", "body", "mono"]);
759
769
  var drawRectSchema = z2.object({
760
770
  type: z2.literal("rect"),
@@ -766,7 +776,8 @@ var drawRectSchema = z2.object({
766
776
  stroke: colorHexSchema2.optional(),
767
777
  strokeWidth: z2.number().min(0).max(32).default(0),
768
778
  radius: z2.number().min(0).max(256).default(0),
769
- opacity: z2.number().min(0).max(1).default(1)
779
+ opacity: z2.number().min(0).max(1).default(1),
780
+ shadow: drawShadowSchema.optional()
770
781
  }).strict();
771
782
  var drawCircleSchema = z2.object({
772
783
  type: z2.literal("circle"),
@@ -776,7 +787,8 @@ var drawCircleSchema = z2.object({
776
787
  fill: colorHexSchema2.optional(),
777
788
  stroke: colorHexSchema2.optional(),
778
789
  strokeWidth: z2.number().min(0).max(32).default(0),
779
- opacity: z2.number().min(0).max(1).default(1)
790
+ opacity: z2.number().min(0).max(1).default(1),
791
+ shadow: drawShadowSchema.optional()
780
792
  }).strict();
781
793
  var drawTextSchema = z2.object({
782
794
  type: z2.literal("text"),
@@ -791,7 +803,8 @@ var drawTextSchema = z2.object({
791
803
  baseline: z2.enum(["top", "middle", "alphabetic", "bottom"]).default("alphabetic"),
792
804
  letterSpacing: z2.number().min(-10).max(50).default(0),
793
805
  maxWidth: z2.number().positive().optional(),
794
- opacity: z2.number().min(0).max(1).default(1)
806
+ opacity: z2.number().min(0).max(1).default(1),
807
+ shadow: drawShadowSchema.optional()
795
808
  }).strict();
796
809
  var drawLineSchema = z2.object({
797
810
  type: z2.literal("line"),
@@ -804,7 +817,8 @@ var drawLineSchema = z2.object({
804
817
  dash: z2.array(z2.number()).max(6).optional(),
805
818
  arrow: z2.enum(["none", "end", "start", "both"]).default("none"),
806
819
  arrowSize: z2.number().min(4).max(32).default(10),
807
- opacity: z2.number().min(0).max(1).default(1)
820
+ opacity: z2.number().min(0).max(1).default(1),
821
+ shadow: drawShadowSchema.optional()
808
822
  }).strict();
809
823
  var drawPointSchema = z2.object({
810
824
  x: z2.number(),
@@ -818,7 +832,8 @@ var drawBezierSchema = z2.object({
818
832
  dash: z2.array(z2.number()).max(6).optional(),
819
833
  arrow: z2.enum(["none", "end", "start", "both"]).default("none"),
820
834
  arrowSize: z2.number().min(4).max(32).default(10),
821
- opacity: z2.number().min(0).max(1).default(1)
835
+ opacity: z2.number().min(0).max(1).default(1),
836
+ shadow: drawShadowSchema.optional()
822
837
  }).strict();
823
838
  var drawPathSchema = z2.object({
824
839
  type: z2.literal("path"),
@@ -826,7 +841,8 @@ var drawPathSchema = z2.object({
826
841
  fill: colorHexSchema2.optional(),
827
842
  stroke: colorHexSchema2.optional(),
828
843
  strokeWidth: z2.number().min(0).max(32).default(0),
829
- opacity: z2.number().min(0).max(1).default(1)
844
+ opacity: z2.number().min(0).max(1).default(1),
845
+ shadow: drawShadowSchema.optional()
830
846
  }).strict();
831
847
  var drawBadgeSchema = z2.object({
832
848
  type: z2.literal("badge"),
@@ -840,7 +856,8 @@ var drawBadgeSchema = z2.object({
840
856
  paddingX: z2.number().min(0).max(64).default(10),
841
857
  paddingY: z2.number().min(0).max(32).default(4),
842
858
  borderRadius: z2.number().min(0).max(64).default(12),
843
- opacity: z2.number().min(0).max(1).default(1)
859
+ opacity: z2.number().min(0).max(1).default(1),
860
+ shadow: drawShadowSchema.optional()
844
861
  }).strict();
845
862
  var drawGradientRectSchema = z2.object({
846
863
  type: z2.literal("gradient-rect"),
@@ -850,7 +867,8 @@ var drawGradientRectSchema = z2.object({
850
867
  height: z2.number().positive(),
851
868
  gradient: gradientSchema,
852
869
  radius: z2.number().min(0).max(256).default(0),
853
- opacity: z2.number().min(0).max(1).default(1)
870
+ opacity: z2.number().min(0).max(1).default(1),
871
+ shadow: drawShadowSchema.optional()
854
872
  }).strict();
855
873
  var drawGridSchema = z2.object({
856
874
  type: z2.literal("grid"),
@@ -2499,12 +2517,12 @@ function withAlpha2(color, alpha) {
2499
2517
  }
2500
2518
  function drawGradientRect(ctx, rect, gradient, borderRadius = 0) {
2501
2519
  const fill = gradient.type === "linear" ? createLinearRectGradient(ctx, rect, gradient.angle ?? 180) : ctx.createRadialGradient(
2502
- rect.x + rect.width / 2,
2503
- rect.y + rect.height / 2,
2504
- 0,
2505
- rect.x + rect.width / 2,
2506
- rect.y + rect.height / 2,
2507
- Math.max(rect.width, rect.height) / 2
2520
+ gradient.cx ?? rect.x + rect.width / 2,
2521
+ gradient.cy ?? rect.y + rect.height / 2,
2522
+ gradient.innerRadius ?? 0,
2523
+ gradient.cx ?? rect.x + rect.width / 2,
2524
+ gradient.cy ?? rect.y + rect.height / 2,
2525
+ gradient.outerRadius ?? Math.max(rect.width, rect.height) / 2
2508
2526
  );
2509
2527
  addGradientStops(fill, gradient.stops);
2510
2528
  ctx.save();
@@ -3726,6 +3744,13 @@ function expandRect(rect, amount) {
3726
3744
  height: rect.height + amount * 2
3727
3745
  };
3728
3746
  }
3747
+ function applyDrawShadow(ctx, shadow) {
3748
+ if (!shadow) return;
3749
+ ctx.shadowColor = shadow.color;
3750
+ ctx.shadowBlur = shadow.blur;
3751
+ ctx.shadowOffsetX = shadow.offsetX;
3752
+ ctx.shadowOffsetY = shadow.offsetY;
3753
+ }
3729
3754
  function fromPoints(points) {
3730
3755
  const minX = Math.min(...points.map((point) => point.x));
3731
3756
  const minY = Math.min(...points.map((point) => point.y));
@@ -3907,6 +3932,7 @@ function renderDrawCommands(ctx, commands, theme) {
3907
3932
  height: command.height
3908
3933
  };
3909
3934
  withOpacity(ctx, command.opacity, () => {
3935
+ applyDrawShadow(ctx, command.shadow);
3910
3936
  roundRectPath(ctx, rect, command.radius);
3911
3937
  if (command.fill) {
3912
3938
  ctx.fillStyle = command.fill;
@@ -3930,6 +3956,7 @@ function renderDrawCommands(ctx, commands, theme) {
3930
3956
  }
3931
3957
  case "circle": {
3932
3958
  withOpacity(ctx, command.opacity, () => {
3959
+ applyDrawShadow(ctx, command.shadow);
3933
3960
  ctx.beginPath();
3934
3961
  ctx.arc(command.cx, command.cy, command.radius, 0, Math.PI * 2);
3935
3962
  ctx.closePath();
@@ -3964,6 +3991,7 @@ function renderDrawCommands(ctx, commands, theme) {
3964
3991
  case "text": {
3965
3992
  const fontFamily = resolveDrawFont(theme, command.fontFamily);
3966
3993
  withOpacity(ctx, command.opacity, () => {
3994
+ applyDrawShadow(ctx, command.shadow);
3967
3995
  applyFont(ctx, {
3968
3996
  size: command.fontSize,
3969
3997
  weight: command.fontWeight,
@@ -4014,6 +4042,7 @@ function renderDrawCommands(ctx, commands, theme) {
4014
4042
  const to = { x: command.x2, y: command.y2 };
4015
4043
  const lineAngle = angleBetween(from, to);
4016
4044
  withOpacity(ctx, command.opacity, () => {
4045
+ applyDrawShadow(ctx, command.shadow);
4017
4046
  drawLine(ctx, from, to, {
4018
4047
  color: command.color,
4019
4048
  width: command.width,
@@ -4038,6 +4067,7 @@ function renderDrawCommands(ctx, commands, theme) {
4038
4067
  case "bezier": {
4039
4068
  const points = command.points;
4040
4069
  withOpacity(ctx, command.opacity, () => {
4070
+ applyDrawShadow(ctx, command.shadow);
4041
4071
  drawBezier(ctx, points, {
4042
4072
  color: command.color,
4043
4073
  width: command.width,
@@ -4071,6 +4101,7 @@ function renderDrawCommands(ctx, commands, theme) {
4071
4101
  const operations = parseSvgPath(command.d);
4072
4102
  const baseBounds = pathBounds(operations);
4073
4103
  withOpacity(ctx, command.opacity, () => {
4104
+ applyDrawShadow(ctx, command.shadow);
4074
4105
  applySvgOperations(ctx, operations);
4075
4106
  if (command.fill) {
4076
4107
  ctx.fillStyle = command.fill;
@@ -4111,9 +4142,16 @@ function renderDrawCommands(ctx, commands, theme) {
4111
4142
  height: textHeight + command.paddingY * 2
4112
4143
  };
4113
4144
  withOpacity(ctx, command.opacity, () => {
4145
+ applyDrawShadow(ctx, command.shadow);
4114
4146
  roundRectPath(ctx, rect, command.borderRadius);
4115
4147
  ctx.fillStyle = command.background;
4116
4148
  ctx.fill();
4149
+ if (command.shadow) {
4150
+ ctx.shadowColor = "transparent";
4151
+ ctx.shadowBlur = 0;
4152
+ ctx.shadowOffsetX = 0;
4153
+ ctx.shadowOffsetY = 0;
4154
+ }
4117
4155
  applyFont(ctx, {
4118
4156
  size: command.fontSize,
4119
4157
  weight: 600,
@@ -4141,6 +4179,7 @@ function renderDrawCommands(ctx, commands, theme) {
4141
4179
  height: command.height
4142
4180
  };
4143
4181
  withOpacity(ctx, command.opacity, () => {
4182
+ applyDrawShadow(ctx, command.shadow);
4144
4183
  drawGradientRect(ctx, rect, command.gradient, command.radius);
4145
4184
  });
4146
4185
  rendered.push({
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-BeFz_nk1.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 DrawBadge, s as DrawBezier, t as DrawCircle, u as DrawFontFamily, v as DrawGradientRect, w as DrawLine, x as DrawPath, y as DrawPoint, z as DrawRect, E as DrawText, F as Element, G as FlowNodeElement, H as Gradient, I as GradientOverlayDecorator, J as GradientSpec, K as GradientStop, L as GridLayoutConfig, M as ImageElement, N as LayoutConfig, O as LayoutSnapshot, P as ManualLayoutConfig, Q as RainbowRuleDecorator, R as RenderMetadata, S as RenderResult, U as ShapeElement, V as StackLayoutConfig, W as TerminalElement, X as TextElement, Y as ThemeInput, Z as VignetteDecorator, _ as WrittenArtifacts, $ as builtInThemeBackgrounds, a0 as builtInThemes, a1 as computeSpecHash, a2 as connectionElementSchema, a3 as defaultAutoLayout, a4 as defaultCanvas, a5 as defaultConstraints, a6 as defaultGridLayout, a7 as defaultLayout, a8 as defaultStackLayout, a9 as defaultTheme, aa as deriveSafeFrame, ab as designSpecSchema, ac as diagramElementSchema, ad as diagramLayoutSchema, ae as diagramSpecSchema, af as drawGradientRect, ag as drawRainbowRule, ah as drawVignette, ai as flowNodeElementSchema, aj as inferLayout, ak as inferSidecarPath, al as parseDesignSpec, am as parseDiagramSpec, an as renderDesign, ao as resolveTheme, ap as writeRenderArtifacts } from './spec.schema-BeFz_nk1.js';
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-BDvtn_mJ.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 DrawBadge, s as DrawBezier, t as DrawCircle, u as DrawFontFamily, v as DrawGradientRect, w as DrawLine, x as DrawPath, y as DrawPoint, z as DrawRect, E as DrawShadow, F as DrawText, G as Element, H as FlowNodeElement, I as Gradient, J as GradientOverlayDecorator, K as GradientSpec, L as GradientStop, M as GridLayoutConfig, N as ImageElement, O as LayoutConfig, P as LayoutSnapshot, Q as ManualLayoutConfig, S as RainbowRuleDecorator, R as RenderMetadata, U as RenderResult, V as ShapeElement, W as StackLayoutConfig, X as TerminalElement, Y as TextElement, Z as ThemeInput, _ as VignetteDecorator, $ as WrittenArtifacts, a0 as builtInThemeBackgrounds, a1 as builtInThemes, a2 as computeSpecHash, a3 as connectionElementSchema, a4 as defaultAutoLayout, a5 as defaultCanvas, a6 as defaultConstraints, a7 as defaultGridLayout, a8 as defaultLayout, a9 as defaultStackLayout, aa as defaultTheme, ab as deriveSafeFrame, ac as designSpecSchema, ad as diagramElementSchema, ae as diagramLayoutSchema, af as diagramSpecSchema, ag as drawGradientRect, ah as drawRainbowRule, ai as drawVignette, aj as flowNodeElementSchema, ak as inferLayout, al as inferSidecarPath, am as parseDesignSpec, an as parseDiagramSpec, ao as renderDesign, ap as resolveTheme, aq as writeRenderArtifacts } from './spec.schema-BDvtn_mJ.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';
package/dist/index.js CHANGED
@@ -761,9 +761,19 @@ var linearGradientSchema = z2.object({
761
761
  }).strict();
762
762
  var radialGradientSchema = z2.object({
763
763
  type: z2.literal("radial"),
764
+ cx: z2.number().optional(),
765
+ cy: z2.number().optional(),
766
+ innerRadius: z2.number().min(0).optional(),
767
+ outerRadius: z2.number().min(0).optional(),
764
768
  stops: z2.array(gradientStopSchema).min(2)
765
769
  }).strict();
766
770
  var gradientSchema = z2.discriminatedUnion("type", [linearGradientSchema, radialGradientSchema]);
771
+ var drawShadowSchema = z2.object({
772
+ color: colorHexSchema2.default("rgba(0,0,0,0.5)"),
773
+ blur: z2.number().min(0).max(64).default(10),
774
+ offsetX: z2.number().default(0),
775
+ offsetY: z2.number().default(4)
776
+ }).strict();
767
777
  var drawFontFamilySchema = z2.enum(["heading", "body", "mono"]);
768
778
  var drawRectSchema = z2.object({
769
779
  type: z2.literal("rect"),
@@ -775,7 +785,8 @@ var drawRectSchema = z2.object({
775
785
  stroke: colorHexSchema2.optional(),
776
786
  strokeWidth: z2.number().min(0).max(32).default(0),
777
787
  radius: z2.number().min(0).max(256).default(0),
778
- opacity: z2.number().min(0).max(1).default(1)
788
+ opacity: z2.number().min(0).max(1).default(1),
789
+ shadow: drawShadowSchema.optional()
779
790
  }).strict();
780
791
  var drawCircleSchema = z2.object({
781
792
  type: z2.literal("circle"),
@@ -785,7 +796,8 @@ var drawCircleSchema = z2.object({
785
796
  fill: colorHexSchema2.optional(),
786
797
  stroke: colorHexSchema2.optional(),
787
798
  strokeWidth: z2.number().min(0).max(32).default(0),
788
- opacity: z2.number().min(0).max(1).default(1)
799
+ opacity: z2.number().min(0).max(1).default(1),
800
+ shadow: drawShadowSchema.optional()
789
801
  }).strict();
790
802
  var drawTextSchema = z2.object({
791
803
  type: z2.literal("text"),
@@ -800,7 +812,8 @@ var drawTextSchema = z2.object({
800
812
  baseline: z2.enum(["top", "middle", "alphabetic", "bottom"]).default("alphabetic"),
801
813
  letterSpacing: z2.number().min(-10).max(50).default(0),
802
814
  maxWidth: z2.number().positive().optional(),
803
- opacity: z2.number().min(0).max(1).default(1)
815
+ opacity: z2.number().min(0).max(1).default(1),
816
+ shadow: drawShadowSchema.optional()
804
817
  }).strict();
805
818
  var drawLineSchema = z2.object({
806
819
  type: z2.literal("line"),
@@ -813,7 +826,8 @@ var drawLineSchema = z2.object({
813
826
  dash: z2.array(z2.number()).max(6).optional(),
814
827
  arrow: z2.enum(["none", "end", "start", "both"]).default("none"),
815
828
  arrowSize: z2.number().min(4).max(32).default(10),
816
- opacity: z2.number().min(0).max(1).default(1)
829
+ opacity: z2.number().min(0).max(1).default(1),
830
+ shadow: drawShadowSchema.optional()
817
831
  }).strict();
818
832
  var drawPointSchema = z2.object({
819
833
  x: z2.number(),
@@ -827,7 +841,8 @@ var drawBezierSchema = z2.object({
827
841
  dash: z2.array(z2.number()).max(6).optional(),
828
842
  arrow: z2.enum(["none", "end", "start", "both"]).default("none"),
829
843
  arrowSize: z2.number().min(4).max(32).default(10),
830
- opacity: z2.number().min(0).max(1).default(1)
844
+ opacity: z2.number().min(0).max(1).default(1),
845
+ shadow: drawShadowSchema.optional()
831
846
  }).strict();
832
847
  var drawPathSchema = z2.object({
833
848
  type: z2.literal("path"),
@@ -835,7 +850,8 @@ var drawPathSchema = z2.object({
835
850
  fill: colorHexSchema2.optional(),
836
851
  stroke: colorHexSchema2.optional(),
837
852
  strokeWidth: z2.number().min(0).max(32).default(0),
838
- opacity: z2.number().min(0).max(1).default(1)
853
+ opacity: z2.number().min(0).max(1).default(1),
854
+ shadow: drawShadowSchema.optional()
839
855
  }).strict();
840
856
  var drawBadgeSchema = z2.object({
841
857
  type: z2.literal("badge"),
@@ -849,7 +865,8 @@ var drawBadgeSchema = z2.object({
849
865
  paddingX: z2.number().min(0).max(64).default(10),
850
866
  paddingY: z2.number().min(0).max(32).default(4),
851
867
  borderRadius: z2.number().min(0).max(64).default(12),
852
- opacity: z2.number().min(0).max(1).default(1)
868
+ opacity: z2.number().min(0).max(1).default(1),
869
+ shadow: drawShadowSchema.optional()
853
870
  }).strict();
854
871
  var drawGradientRectSchema = z2.object({
855
872
  type: z2.literal("gradient-rect"),
@@ -859,7 +876,8 @@ var drawGradientRectSchema = z2.object({
859
876
  height: z2.number().positive(),
860
877
  gradient: gradientSchema,
861
878
  radius: z2.number().min(0).max(256).default(0),
862
- opacity: z2.number().min(0).max(1).default(1)
879
+ opacity: z2.number().min(0).max(1).default(1),
880
+ shadow: drawShadowSchema.optional()
863
881
  }).strict();
864
882
  var drawGridSchema = z2.object({
865
883
  type: z2.literal("grid"),
@@ -2512,12 +2530,12 @@ function withAlpha2(color, alpha) {
2512
2530
  }
2513
2531
  function drawGradientRect(ctx, rect, gradient, borderRadius = 0) {
2514
2532
  const fill = gradient.type === "linear" ? createLinearRectGradient(ctx, rect, gradient.angle ?? 180) : ctx.createRadialGradient(
2515
- rect.x + rect.width / 2,
2516
- rect.y + rect.height / 2,
2517
- 0,
2518
- rect.x + rect.width / 2,
2519
- rect.y + rect.height / 2,
2520
- Math.max(rect.width, rect.height) / 2
2533
+ gradient.cx ?? rect.x + rect.width / 2,
2534
+ gradient.cy ?? rect.y + rect.height / 2,
2535
+ gradient.innerRadius ?? 0,
2536
+ gradient.cx ?? rect.x + rect.width / 2,
2537
+ gradient.cy ?? rect.y + rect.height / 2,
2538
+ gradient.outerRadius ?? Math.max(rect.width, rect.height) / 2
2521
2539
  );
2522
2540
  addGradientStops(fill, gradient.stops);
2523
2541
  ctx.save();
@@ -3743,6 +3761,13 @@ function expandRect(rect, amount) {
3743
3761
  height: rect.height + amount * 2
3744
3762
  };
3745
3763
  }
3764
+ function applyDrawShadow(ctx, shadow) {
3765
+ if (!shadow) return;
3766
+ ctx.shadowColor = shadow.color;
3767
+ ctx.shadowBlur = shadow.blur;
3768
+ ctx.shadowOffsetX = shadow.offsetX;
3769
+ ctx.shadowOffsetY = shadow.offsetY;
3770
+ }
3746
3771
  function fromPoints(points) {
3747
3772
  const minX = Math.min(...points.map((point) => point.x));
3748
3773
  const minY = Math.min(...points.map((point) => point.y));
@@ -3924,6 +3949,7 @@ function renderDrawCommands(ctx, commands, theme) {
3924
3949
  height: command.height
3925
3950
  };
3926
3951
  withOpacity(ctx, command.opacity, () => {
3952
+ applyDrawShadow(ctx, command.shadow);
3927
3953
  roundRectPath(ctx, rect, command.radius);
3928
3954
  if (command.fill) {
3929
3955
  ctx.fillStyle = command.fill;
@@ -3947,6 +3973,7 @@ function renderDrawCommands(ctx, commands, theme) {
3947
3973
  }
3948
3974
  case "circle": {
3949
3975
  withOpacity(ctx, command.opacity, () => {
3976
+ applyDrawShadow(ctx, command.shadow);
3950
3977
  ctx.beginPath();
3951
3978
  ctx.arc(command.cx, command.cy, command.radius, 0, Math.PI * 2);
3952
3979
  ctx.closePath();
@@ -3981,6 +4008,7 @@ function renderDrawCommands(ctx, commands, theme) {
3981
4008
  case "text": {
3982
4009
  const fontFamily = resolveDrawFont(theme, command.fontFamily);
3983
4010
  withOpacity(ctx, command.opacity, () => {
4011
+ applyDrawShadow(ctx, command.shadow);
3984
4012
  applyFont(ctx, {
3985
4013
  size: command.fontSize,
3986
4014
  weight: command.fontWeight,
@@ -4031,6 +4059,7 @@ function renderDrawCommands(ctx, commands, theme) {
4031
4059
  const to = { x: command.x2, y: command.y2 };
4032
4060
  const lineAngle = angleBetween(from, to);
4033
4061
  withOpacity(ctx, command.opacity, () => {
4062
+ applyDrawShadow(ctx, command.shadow);
4034
4063
  drawLine(ctx, from, to, {
4035
4064
  color: command.color,
4036
4065
  width: command.width,
@@ -4055,6 +4084,7 @@ function renderDrawCommands(ctx, commands, theme) {
4055
4084
  case "bezier": {
4056
4085
  const points = command.points;
4057
4086
  withOpacity(ctx, command.opacity, () => {
4087
+ applyDrawShadow(ctx, command.shadow);
4058
4088
  drawBezier(ctx, points, {
4059
4089
  color: command.color,
4060
4090
  width: command.width,
@@ -4088,6 +4118,7 @@ function renderDrawCommands(ctx, commands, theme) {
4088
4118
  const operations = parseSvgPath(command.d);
4089
4119
  const baseBounds = pathBounds(operations);
4090
4120
  withOpacity(ctx, command.opacity, () => {
4121
+ applyDrawShadow(ctx, command.shadow);
4091
4122
  applySvgOperations(ctx, operations);
4092
4123
  if (command.fill) {
4093
4124
  ctx.fillStyle = command.fill;
@@ -4128,9 +4159,16 @@ function renderDrawCommands(ctx, commands, theme) {
4128
4159
  height: textHeight + command.paddingY * 2
4129
4160
  };
4130
4161
  withOpacity(ctx, command.opacity, () => {
4162
+ applyDrawShadow(ctx, command.shadow);
4131
4163
  roundRectPath(ctx, rect, command.borderRadius);
4132
4164
  ctx.fillStyle = command.background;
4133
4165
  ctx.fill();
4166
+ if (command.shadow) {
4167
+ ctx.shadowColor = "transparent";
4168
+ ctx.shadowBlur = 0;
4169
+ ctx.shadowOffsetX = 0;
4170
+ ctx.shadowOffsetY = 0;
4171
+ }
4134
4172
  applyFont(ctx, {
4135
4173
  size: command.fontSize,
4136
4174
  weight: 600,
@@ -4158,6 +4196,7 @@ function renderDrawCommands(ctx, commands, theme) {
4158
4196
  height: command.height
4159
4197
  };
4160
4198
  withOpacity(ctx, command.opacity, () => {
4199
+ applyDrawShadow(ctx, command.shadow);
4161
4200
  drawGradientRect(ctx, rect, command.gradient, command.radius);
4162
4201
  });
4163
4202
  rendered.push({
package/dist/qa.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RenderMetadata, D as DesignSpec } from './spec.schema-BeFz_nk1.js';
1
+ import { R as RenderMetadata, D as DesignSpec } from './spec.schema-BDvtn_mJ.js';
2
2
  import 'zod';
3
3
  import '@napi-rs/canvas';
4
4
 
package/dist/qa.js CHANGED
@@ -495,9 +495,19 @@ var linearGradientSchema = z2.object({
495
495
  }).strict();
496
496
  var radialGradientSchema = z2.object({
497
497
  type: z2.literal("radial"),
498
+ cx: z2.number().optional(),
499
+ cy: z2.number().optional(),
500
+ innerRadius: z2.number().min(0).optional(),
501
+ outerRadius: z2.number().min(0).optional(),
498
502
  stops: z2.array(gradientStopSchema).min(2)
499
503
  }).strict();
500
504
  var gradientSchema = z2.discriminatedUnion("type", [linearGradientSchema, radialGradientSchema]);
505
+ var drawShadowSchema = z2.object({
506
+ color: colorHexSchema2.default("rgba(0,0,0,0.5)"),
507
+ blur: z2.number().min(0).max(64).default(10),
508
+ offsetX: z2.number().default(0),
509
+ offsetY: z2.number().default(4)
510
+ }).strict();
501
511
  var drawFontFamilySchema = z2.enum(["heading", "body", "mono"]);
502
512
  var drawRectSchema = z2.object({
503
513
  type: z2.literal("rect"),
@@ -509,7 +519,8 @@ var drawRectSchema = z2.object({
509
519
  stroke: colorHexSchema2.optional(),
510
520
  strokeWidth: z2.number().min(0).max(32).default(0),
511
521
  radius: z2.number().min(0).max(256).default(0),
512
- opacity: z2.number().min(0).max(1).default(1)
522
+ opacity: z2.number().min(0).max(1).default(1),
523
+ shadow: drawShadowSchema.optional()
513
524
  }).strict();
514
525
  var drawCircleSchema = z2.object({
515
526
  type: z2.literal("circle"),
@@ -519,7 +530,8 @@ var drawCircleSchema = z2.object({
519
530
  fill: colorHexSchema2.optional(),
520
531
  stroke: colorHexSchema2.optional(),
521
532
  strokeWidth: z2.number().min(0).max(32).default(0),
522
- opacity: z2.number().min(0).max(1).default(1)
533
+ opacity: z2.number().min(0).max(1).default(1),
534
+ shadow: drawShadowSchema.optional()
523
535
  }).strict();
524
536
  var drawTextSchema = z2.object({
525
537
  type: z2.literal("text"),
@@ -534,7 +546,8 @@ var drawTextSchema = z2.object({
534
546
  baseline: z2.enum(["top", "middle", "alphabetic", "bottom"]).default("alphabetic"),
535
547
  letterSpacing: z2.number().min(-10).max(50).default(0),
536
548
  maxWidth: z2.number().positive().optional(),
537
- opacity: z2.number().min(0).max(1).default(1)
549
+ opacity: z2.number().min(0).max(1).default(1),
550
+ shadow: drawShadowSchema.optional()
538
551
  }).strict();
539
552
  var drawLineSchema = z2.object({
540
553
  type: z2.literal("line"),
@@ -547,7 +560,8 @@ var drawLineSchema = z2.object({
547
560
  dash: z2.array(z2.number()).max(6).optional(),
548
561
  arrow: z2.enum(["none", "end", "start", "both"]).default("none"),
549
562
  arrowSize: z2.number().min(4).max(32).default(10),
550
- opacity: z2.number().min(0).max(1).default(1)
563
+ opacity: z2.number().min(0).max(1).default(1),
564
+ shadow: drawShadowSchema.optional()
551
565
  }).strict();
552
566
  var drawPointSchema = z2.object({
553
567
  x: z2.number(),
@@ -561,7 +575,8 @@ var drawBezierSchema = z2.object({
561
575
  dash: z2.array(z2.number()).max(6).optional(),
562
576
  arrow: z2.enum(["none", "end", "start", "both"]).default("none"),
563
577
  arrowSize: z2.number().min(4).max(32).default(10),
564
- opacity: z2.number().min(0).max(1).default(1)
578
+ opacity: z2.number().min(0).max(1).default(1),
579
+ shadow: drawShadowSchema.optional()
565
580
  }).strict();
566
581
  var drawPathSchema = z2.object({
567
582
  type: z2.literal("path"),
@@ -569,7 +584,8 @@ var drawPathSchema = z2.object({
569
584
  fill: colorHexSchema2.optional(),
570
585
  stroke: colorHexSchema2.optional(),
571
586
  strokeWidth: z2.number().min(0).max(32).default(0),
572
- opacity: z2.number().min(0).max(1).default(1)
587
+ opacity: z2.number().min(0).max(1).default(1),
588
+ shadow: drawShadowSchema.optional()
573
589
  }).strict();
574
590
  var drawBadgeSchema = z2.object({
575
591
  type: z2.literal("badge"),
@@ -583,7 +599,8 @@ var drawBadgeSchema = z2.object({
583
599
  paddingX: z2.number().min(0).max(64).default(10),
584
600
  paddingY: z2.number().min(0).max(32).default(4),
585
601
  borderRadius: z2.number().min(0).max(64).default(12),
586
- opacity: z2.number().min(0).max(1).default(1)
602
+ opacity: z2.number().min(0).max(1).default(1),
603
+ shadow: drawShadowSchema.optional()
587
604
  }).strict();
588
605
  var drawGradientRectSchema = z2.object({
589
606
  type: z2.literal("gradient-rect"),
@@ -593,7 +610,8 @@ var drawGradientRectSchema = z2.object({
593
610
  height: z2.number().positive(),
594
611
  gradient: gradientSchema,
595
612
  radius: z2.number().min(0).max(256).default(0),
596
- opacity: z2.number().min(0).max(1).default(1)
613
+ opacity: z2.number().min(0).max(1).default(1),
614
+ shadow: drawShadowSchema.optional()
597
615
  }).strict();
598
616
  var drawGridSchema = z2.object({
599
617
  type: z2.literal("grid"),
@@ -1,3 +1,3 @@
1
- export { i as DEFAULT_GENERATOR_VERSION, O as LayoutSnapshot, a as Rect, R as RenderMetadata, S as RenderResult, d as RenderedElement, _ as WrittenArtifacts, a1 as computeSpecHash, ak as inferSidecarPath, an as renderDesign, ap as writeRenderArtifacts } from './spec.schema-BeFz_nk1.js';
1
+ export { i as DEFAULT_GENERATOR_VERSION, P as LayoutSnapshot, a as Rect, R as RenderMetadata, U as RenderResult, d as RenderedElement, $ as WrittenArtifacts, a2 as computeSpecHash, al as inferSidecarPath, ao as renderDesign, aq as writeRenderArtifacts } from './spec.schema-BDvtn_mJ.js';
2
2
  import 'zod';
3
3
  import '@napi-rs/canvas';