vizmatic 0.3.0 → 0.3.2

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 CHANGED
@@ -157,6 +157,7 @@ __export(index_exports, {
157
157
  toneGradients: () => toneGradients,
158
158
  tween: () => tween,
159
159
  typography: () => typography,
160
+ withColorAlpha: () => withColorAlpha,
160
161
  wrapWithBrand: () => wrapWithBrand,
161
162
  wrapWithWatermark: () => wrapWithWatermark
162
163
  });
@@ -381,7 +382,7 @@ function getReadableToneColor(tone, c, background = c.bgCard, backdrop = c.bgCar
381
382
  return colorContrast(color, background, backdrop) >= 4.5 ? color : getReadableTextColor(background, c, backdrop);
382
383
  }
383
384
  function getToneFill(tone, c) {
384
- if (c.preset !== "engineering") return `${getToneColor(tone, c)}16`;
385
+ if (c.preset !== "engineering") return withColorAlpha(getToneColor(tone, c), 22 / 255);
385
386
  return {
386
387
  blue: "#cddcfa",
387
388
  purple: "#dfcff8",
@@ -518,6 +519,17 @@ function parseColor(color) {
518
519
  alpha: parsed.alpha
519
520
  };
520
521
  }
522
+ function withColorAlpha(color, opacity) {
523
+ if (typeof color !== "string" || !Number.isFinite(opacity)) return "transparent";
524
+ const parsed = parseColor(color);
525
+ if (!parsed) return "transparent";
526
+ const alpha = Math.min(1, Math.max(0, parsed.alpha * Math.min(1, Math.max(0, opacity))));
527
+ const hex = color.trim();
528
+ if (/^#[\da-f]{6}$/i.test(hex)) {
529
+ return `${hex}${Math.round(alpha * 255).toString(16).padStart(2, "0")}`;
530
+ }
531
+ return `rgba(${parsed.channels.join(", ")}, ${Number(alpha.toFixed(6))})`;
532
+ }
521
533
  function colorLuminance(color, backdrop) {
522
534
  const parsed = parseColor(color);
523
535
  if (!parsed) return void 0;
@@ -1432,10 +1444,10 @@ function Box({
1432
1444
  style.backgroundColor = "transparent";
1433
1445
  } else if (gradient) {
1434
1446
  style.backgroundImage = gradientBg;
1435
- style.boxShadow = `0 4px 20px ${solidColor}30`;
1447
+ style.boxShadow = `0 4px 20px ${withColorAlpha(solidColor, 48 / 255)}`;
1436
1448
  } else {
1437
1449
  style.backgroundColor = solidColor;
1438
- style.boxShadow = `0 4px 20px ${solidColor}30`;
1450
+ style.boxShadow = `0 4px 20px ${withColorAlpha(solidColor, 48 / 255)}`;
1439
1451
  }
1440
1452
  return import_react2.default.createElement(
1441
1453
  "div",
@@ -1457,7 +1469,7 @@ function Box({
1457
1469
  style: {
1458
1470
  fontSize: fontSize - 2,
1459
1471
  fontWeight: 400,
1460
- color: outlined ? c.textMuted : gradient ? `${c.textOnColor}b3` : solidTextColor,
1472
+ color: outlined ? c.textMuted : gradient ? withColorAlpha(c.textOnColor, 179 / 255) : solidTextColor,
1461
1473
  fontFamily: c.fontMono,
1462
1474
  textAlign: "center"
1463
1475
  }
@@ -1987,8 +1999,8 @@ function BadgePill({
1987
1999
  ...height != null ? { height } : {},
1988
2000
  padding,
1989
2001
  borderRadius: engineering ? Math.min(radius, 5) : radius,
1990
- ...engineering ? { backgroundColor: getToneFill(tone, c) } : filled ? { backgroundImage: getToneGradient(tone) } : { backgroundColor: `${accent}18` },
1991
- border: `1px solid ${engineering ? accent : filled ? `${accent}00` : `${accent}55`}`,
2002
+ ...engineering ? { backgroundColor: getToneFill(tone, c) } : filled ? { backgroundImage: getToneGradient(tone) } : { backgroundColor: withColorAlpha(accent, 24 / 255) },
2003
+ border: `1px solid ${engineering ? accent : filled ? withColorAlpha(accent, 0) : withColorAlpha(accent, 85 / 255)}`,
1992
2004
  color: engineering ? c.textPrimary : filled ? c.textOnColor : accentText,
1993
2005
  fontSize,
1994
2006
  fontWeight: 800,
@@ -2090,7 +2102,7 @@ function StepCard({
2090
2102
  radius: engineering ? 5 : radius,
2091
2103
  shadow: engineering ? false : shadow,
2092
2104
  background: engineering ? getToneFill(tone, c) : void 0,
2093
- borderColor: engineering ? accent : `${accent}88`,
2105
+ borderColor: engineering ? accent : withColorAlpha(accent, 136 / 255),
2094
2106
  children: import_react3.default.createElement(
2095
2107
  "div",
2096
2108
  {
@@ -2166,7 +2178,7 @@ function MetricCard({
2166
2178
  padding,
2167
2179
  radius,
2168
2180
  shadow,
2169
- borderColor: `${accent}66`,
2181
+ borderColor: withColorAlpha(accent, 102 / 255),
2170
2182
  children: import_react3.default.createElement(
2171
2183
  "div",
2172
2184
  {
@@ -2416,7 +2428,7 @@ function DetailList({
2416
2428
  padding,
2417
2429
  borderRadius: 8,
2418
2430
  backgroundColor: c.bgSubtle,
2419
- border: `1px solid ${tone ? `${accent}44` : c.borderSubtle}`,
2431
+ border: `1px solid ${tone ? withColorAlpha(accent, 68 / 255) : c.borderSubtle}`,
2420
2432
  color: c.textSecondary,
2421
2433
  fontSize,
2422
2434
  lineHeight: 1.3,
@@ -2480,7 +2492,7 @@ function Tile({
2480
2492
  padding,
2481
2493
  radius,
2482
2494
  shadow,
2483
- borderColor: `${accent}88`,
2495
+ borderColor: withColorAlpha(accent, 136 / 255),
2484
2496
  children: import_react4.default.createElement(
2485
2497
  "div",
2486
2498
  {
@@ -2614,7 +2626,7 @@ function CodeBlock({
2614
2626
  width: "100%",
2615
2627
  padding: accent ? "3px 7px" : "1px 0",
2616
2628
  borderRadius: accent ? 5 : 0,
2617
- ...accent ? { backgroundColor: `${accent}1f` } : {},
2629
+ ...accent ? { backgroundColor: withColorAlpha(accent, 31 / 255) } : {},
2618
2630
  boxSizing: "border-box"
2619
2631
  }
2620
2632
  },
@@ -2670,7 +2682,7 @@ function CodeBlock({
2670
2682
  padding,
2671
2683
  borderRadius: radius,
2672
2684
  backgroundColor: background ?? c.bgSubtle,
2673
- border: `1px solid ${tone ? `${headerAccent}44` : c.borderSubtle}`,
2685
+ border: `1px solid ${tone ? withColorAlpha(headerAccent, 68 / 255) : c.borderSubtle}`,
2674
2686
  boxSizing: "border-box",
2675
2687
  ...shadow ? { boxShadow: `0 9px 24px ${c.shadow}` } : {}
2676
2688
  }
@@ -3032,7 +3044,7 @@ function StatusRow({
3032
3044
  const markerAlpha = 38 / 255;
3033
3045
  const rowAlpha = boxed ? 18 / 255 : 0;
3034
3046
  const markerBackgroundAlpha = Math.round((rowAlpha + markerAlpha * (1 - rowAlpha)) * 255);
3035
- const markerBackground = `${accent}${markerBackgroundAlpha.toString(16).padStart(2, "0")}`;
3047
+ const markerBackground = withColorAlpha(accent, markerBackgroundAlpha / 255);
3036
3048
  const accentText = getReadableToneColor(resolvedTone, c, markerBackground, c.bgCard);
3037
3049
  const glyph = statusGlyphs[status];
3038
3050
  const marker = import_react5.default.createElement("div", {
@@ -3044,7 +3056,7 @@ function StatusRow({
3044
3056
  height: 18,
3045
3057
  flexShrink: 0,
3046
3058
  borderRadius: 999,
3047
- backgroundColor: status === "dot" ? accent : `${accent}26`,
3059
+ backgroundColor: status === "dot" ? accent : withColorAlpha(accent, 38 / 255),
3048
3060
  border: `1px solid ${accent}`,
3049
3061
  color: accentText,
3050
3062
  fontFamily: "Inter",
@@ -3065,8 +3077,8 @@ function StatusRow({
3065
3077
  ...boxed ? {
3066
3078
  padding: "7px 10px",
3067
3079
  borderRadius: 8,
3068
- backgroundColor: `${accent}12`,
3069
- border: `1px solid ${accent}3a`
3080
+ backgroundColor: withColorAlpha(accent, 18 / 255),
3081
+ border: `1px solid ${withColorAlpha(accent, 58 / 255)}`
3070
3082
  } : { padding: "3px 0" }
3071
3083
  }
3072
3084
  },
@@ -3131,7 +3143,7 @@ function renderTimelineCard(event, c, math, width) {
3131
3143
  ...typeof resolvedWidth === "string" ? { minWidth: 0 } : {},
3132
3144
  padding: "10px 12px",
3133
3145
  borderRadius: 8,
3134
- border: `1px solid ${accent}44`,
3146
+ border: `1px solid ${withColorAlpha(accent, 68 / 255)}`,
3135
3147
  backgroundColor: c.bgCard,
3136
3148
  boxShadow: `0 7px 18px ${c.shadow}`,
3137
3149
  boxSizing: "border-box"
@@ -4009,10 +4021,10 @@ function LayeredNetwork({
4009
4021
  width: nodeSize + 28,
4010
4022
  height: nodeSize + 28,
4011
4023
  borderRadius: 999,
4012
- backgroundColor: `${c.warningLight}2e`,
4024
+ backgroundColor: withColorAlpha(c.warningLight, 46 / 255),
4013
4025
  border: `4px solid ${c.warningLight}`,
4014
4026
  boxSizing: "border-box",
4015
- boxShadow: `0 0 18px ${c.warningLight}66`
4027
+ boxShadow: `0 0 18px ${withColorAlpha(c.warningLight, 102 / 255)}`
4016
4028
  }
4017
4029
  }),
4018
4030
  import_react7.default.createElement("div", {
@@ -4031,7 +4043,7 @@ function LayeredNetwork({
4031
4043
  color: getReadableTextColor(color, c),
4032
4044
  border: active ? `3px solid ${c.warningLight}` : `1.5px solid ${color}`,
4033
4045
  boxSizing: "border-box",
4034
- boxShadow: active ? `0 0 16px ${c.warningLight}70` : `0 8px 14px ${c.shadow}`,
4046
+ boxShadow: active ? `0 0 16px ${withColorAlpha(c.warningLight, 112 / 255)}` : `0 8px 14px ${c.shadow}`,
4035
4047
  fontFamily: "JetBrains Mono",
4036
4048
  fontSize: 16,
4037
4049
  fontWeight: 900,
@@ -4605,8 +4617,8 @@ function GraphDiagram({
4605
4617
  display: "flex",
4606
4618
  boxSizing: "border-box",
4607
4619
  borderRadius: c.preset === "engineering" ? 6 : 12,
4608
- border: `${c.preset === "engineering" ? 1.25 : 1.5}px ${group.muted ? "dashed" : "solid"} ${accent}${group.muted ? "55" : "77"}`,
4609
- backgroundColor: `${accent}${c.preset === "engineering" ? "08" : "0d"}`,
4620
+ border: `${c.preset === "engineering" ? 1.25 : 1.5}px ${group.muted ? "dashed" : "solid"} ${withColorAlpha(accent, (group.muted ? 85 : 119) / 255)}`,
4621
+ backgroundColor: withColorAlpha(accent, (c.preset === "engineering" ? 8 : 13) / 255),
4610
4622
  opacity: group.muted ? 0.68 : 1
4611
4623
  }
4612
4624
  }, import_react7.default.createElement(
@@ -4776,7 +4788,7 @@ function GraphDiagram({
4776
4788
  boxSizing: "border-box",
4777
4789
  borderRadius: c.preset === "engineering" ? 5 : 10,
4778
4790
  backgroundColor: node.muted ? c.bgSubtle : fill,
4779
- border: `${c.preset === "engineering" ? 1.25 : 1.5}px solid ${node.muted ? c.borderLight : `${accent}${c.preset === "engineering" ? "" : "88"}`}`,
4791
+ border: `${c.preset === "engineering" ? 1.25 : 1.5}px solid ${node.muted ? c.borderLight : c.preset === "engineering" ? accent : withColorAlpha(accent, 136 / 255)}`,
4780
4792
  ...!node.muted && c.preset !== "engineering" ? { boxShadow: `0 8px 18px ${c.shadow}` } : {},
4781
4793
  opacity: node.muted ? 0.62 : 1,
4782
4794
  color: c.preset === "engineering" ? c.textPrimary : accentText,
@@ -5000,7 +5012,7 @@ function TreeDiagram({
5000
5012
  boxSizing: "border-box",
5001
5013
  borderRadius: 8,
5002
5014
  backgroundColor: node.muted ? c.bgSubtle : c.bgCard,
5003
- border: `1.5px solid ${node.muted ? c.borderLight : `${accent}88`}`,
5015
+ border: `1.5px solid ${node.muted ? c.borderLight : withColorAlpha(accent, 136 / 255)}`,
5004
5016
  ...!node.muted ? { boxShadow: `0 8px 18px ${c.shadow}` } : {},
5005
5017
  opacity: node.muted ? 0.62 : 1,
5006
5018
  color: accentText,
@@ -5060,7 +5072,7 @@ function CalloutCard({
5060
5072
  padding,
5061
5073
  borderRadius: engineering ? 5 : 10,
5062
5074
  boxSizing: "border-box",
5063
- ...engineering ? { backgroundColor: getToneFill(tone, c), color: c.textPrimary, border: `1px solid ${accent}` } : filled ? { backgroundImage: getToneGradient(tone), color: c.textOnColor, border: `1px solid ${accent}00` } : { backgroundColor: c.bgCard, color: c.textPrimary, border: `1px solid ${accent}66` },
5075
+ ...engineering ? { backgroundColor: getToneFill(tone, c), color: c.textPrimary, border: `1px solid ${accent}` } : filled ? { backgroundImage: getToneGradient(tone), color: c.textOnColor, border: `1px solid ${withColorAlpha(accent, 0)}` } : { backgroundColor: c.bgCard, color: c.textPrimary, border: `1px solid ${withColorAlpha(accent, 102 / 255)}` },
5064
5076
  display: "flex",
5065
5077
  flexDirection: "column",
5066
5078
  alignItems: align === "center" ? "center" : "flex-start",
@@ -5406,8 +5418,8 @@ function SequenceDiagram({
5406
5418
  height: spanHeight,
5407
5419
  display: "flex",
5408
5420
  boxSizing: "border-box",
5409
- border: `1.25px ${span.fragment.muted ? "dotted" : "dashed"} ${accent}${span.fragment.muted ? "55" : "99"}`,
5410
- backgroundColor: `${accent}0b`,
5421
+ border: `1.25px ${span.fragment.muted ? "dotted" : "dashed"} ${withColorAlpha(accent, (span.fragment.muted ? 85 : 153) / 255)}`,
5422
+ backgroundColor: withColorAlpha(accent, 11 / 255),
5411
5423
  borderRadius: c.preset === "engineering" ? 4 : 8,
5412
5424
  pointerEvents: "none"
5413
5425
  }
@@ -5557,7 +5569,7 @@ function SequenceDiagram({
5557
5569
  padding: "6px 9px",
5558
5570
  borderRadius: c.preset === "engineering" ? 3 : 7,
5559
5571
  backgroundColor: note.muted ? c.bgSubtle : getToneFill(tone, c),
5560
- border: `1px solid ${accent}${note.muted ? "66" : "99"}`,
5572
+ border: `1px solid ${withColorAlpha(accent, (note.muted ? 102 : 153) / 255)}`,
5561
5573
  color: note.muted ? c.textMuted : getReadableTextColor(getToneFill(tone, c), c),
5562
5574
  fontFamily: c.fontSans,
5563
5575
  fontSize: 11,
@@ -6732,8 +6744,8 @@ function TiledMatrix({
6732
6744
  height: cellSize,
6733
6745
  boxSizing: "border-box",
6734
6746
  borderRadius: Math.max(2, Math.min(6, Math.round(cellSize * 0.18))),
6735
- backgroundColor: region ? `${accent}42` : muted ? c.bgSubtle : `${baseAccent}0f`,
6736
- border: `1px solid ${region ? `${accent}aa` : c.borderSubtle}`,
6747
+ backgroundColor: region ? withColorAlpha(accent, 66 / 255) : muted ? c.bgSubtle : withColorAlpha(baseAccent, 15 / 255),
6748
+ border: `1px solid ${region ? withColorAlpha(accent, 170 / 255) : c.borderSubtle}`,
6737
6749
  opacity: muted ? 0.55 : 1
6738
6750
  }
6739
6751
  });
@@ -6908,7 +6920,7 @@ function Grid({
6908
6920
  const config = isGridCell(cell) ? cell : {};
6909
6921
  const toneColor = config.tone ? getToneColor(config.tone, c) : void 0;
6910
6922
  const isHeader = rowIndex < headerRows || colIndex < headerCols;
6911
- const backgroundColor = config.backgroundColor ?? (toneColor ? `${toneColor}22` : isHeader ? c.bgSubtle : c.bgHover);
6923
+ const backgroundColor = config.backgroundColor ?? (toneColor ? withColorAlpha(toneColor, 34 / 255) : isHeader ? c.bgSubtle : c.bgHover);
6912
6924
  const toneTextColor = config.tone ? getReadableToneColor(config.tone, c, backgroundColor, c.bgHover) : void 0;
6913
6925
  return {
6914
6926
  width: cellWidth,
@@ -6918,7 +6930,7 @@ function Grid({
6918
6930
  justifyContent: "center",
6919
6931
  borderRadius: radius,
6920
6932
  backgroundColor,
6921
- border: `1px solid ${config.borderColor ?? (toneColor ? `${toneColor}55` : c.borderSubtle)}`,
6933
+ border: `1px solid ${config.borderColor ?? (toneColor ? withColorAlpha(toneColor, 85 / 255) : c.borderSubtle)}`,
6922
6934
  color: config.color ?? (toneTextColor ?? (isHeader ? c.textPrimary : c.textSecondary)),
6923
6935
  ...config.opacity !== void 0 ? { opacity: config.opacity } : {},
6924
6936
  fontFamily: "JetBrains Mono",
@@ -9066,14 +9078,14 @@ function Badge({ label, c, color = "primary" }) {
9066
9078
  display: "flex",
9067
9079
  alignItems: "center",
9068
9080
  justifyContent: "center",
9069
- backgroundColor: `${solidColor}20`,
9081
+ backgroundColor: withColorAlpha(solidColor, 32 / 255),
9070
9082
  color: solidColor,
9071
9083
  borderRadius: 999,
9072
9084
  padding: "4px 12px",
9073
9085
  fontSize: 11,
9074
9086
  fontWeight: 600,
9075
9087
  fontFamily: "Inter",
9076
- border: `1px solid ${solidColor}40`
9088
+ border: `1px solid ${withColorAlpha(solidColor, 64 / 255)}`
9077
9089
  }
9078
9090
  }, label);
9079
9091
  }
@@ -9092,7 +9104,7 @@ function DotPoint({ x, y, label, color, c, size = 12, labelOffset }) {
9092
9104
  height: size,
9093
9105
  borderRadius: "50%",
9094
9106
  backgroundColor: color,
9095
- boxShadow: `0 0 14px ${color}50`,
9107
+ boxShadow: `0 0 14px ${withColorAlpha(color, 80 / 255)}`,
9096
9108
  display: "flex"
9097
9109
  }
9098
9110
  }),
@@ -9216,8 +9228,11 @@ function CanvasItem({ children, x, y, width, height }) {
9216
9228
  if (!Number.isFinite(x) || !Number.isFinite(y)) throw new Error("CanvasItem x and y must be finite numbers.");
9217
9229
  const sizedChildren = import_react14.default.Children.map(children, (child) => {
9218
9230
  if (!import_react14.default.isValidElement(child)) return child;
9219
- const sized = import_react14.default.cloneElement(child, { ...width !== void 0 ? { width } : {}, ...height !== void 0 ? { height } : {} });
9220
- return width !== void 0 && height !== void 0 && isCanvasChart(child.type) ? import_react14.default.createElement(CanvasChartFit, { width, height, __vizmaticTextScope: child.props.__vizmaticTextScope }, sized) : sized;
9231
+ if (width !== void 0 && height !== void 0 && isCanvasChart(child.type)) {
9232
+ const chart = import_react14.default.cloneElement(child, { width: child.props.width ?? width, height: child.props.height ?? height });
9233
+ return import_react14.default.createElement(CanvasChartFit, { width, height, __vizmaticTextScope: child.props.__vizmaticTextScope }, chart);
9234
+ }
9235
+ return import_react14.default.cloneElement(child, { ...width !== void 0 ? { width } : {}, ...height !== void 0 ? { height } : {} });
9221
9236
  });
9222
9237
  return import_react14.default.createElement("div", { style: {
9223
9238
  display: "flex",
@@ -12206,6 +12221,7 @@ async function checkFrame(input, options = {}) {
12206
12221
  toneGradients,
12207
12222
  tween,
12208
12223
  typography,
12224
+ withColorAlpha,
12209
12225
  wrapWithBrand,
12210
12226
  wrapWithWatermark
12211
12227
  });
package/dist/index.d.cts CHANGED
@@ -207,6 +207,8 @@ type ColorName = 'primary' | 'secondary' | 'positive' | 'warning' | 'critical' |
207
207
  declare function getColor(name: ColorName, c?: ThemeColors): string;
208
208
  /** Get a semantic color variant that remains readable as text in either theme. */
209
209
  declare function getReadableColor(name: ColorName, c: ThemeColors): string;
210
+ /** Apply an opacity multiplier to any CSS color accepted by parse-css-color. */
211
+ declare function withColorAlpha(color: string, opacity: number): string;
210
212
  /** Choose readable foreground text, compositing translucent backgrounds over their backdrop. */
211
213
  declare function getReadableTextColor(background: string, c: ThemeColors, backdrop?: string): string;
212
214
  /**
@@ -1740,7 +1742,7 @@ interface CanvasItemProps {
1740
1742
  }
1741
1743
  /** A fixed canvas for freely positioned, composable visuals. */
1742
1744
  declare function Board({ children, c, width, height, background }: BoardProps): React.ReactElement;
1743
- /** Positions an item in Board coordinates and supplies its size to the child. */
1745
+ /** Positions an item in Board coordinates, sizing its child or fitting a complete chart. */
1744
1746
  declare function CanvasItem({ children, x, y, width, height }: CanvasItemProps): React.ReactElement;
1745
1747
 
1746
1748
  /**
@@ -2214,4 +2216,4 @@ interface CheckFrameReport {
2214
2216
  */
2215
2217
  declare function checkFrame(input: CheckFrameInput, options?: CheckOptions): Promise<CheckFrameReport>;
2216
2218
 
2217
- export { type AnimatedScene, type AnimationCadenceAnalysis, type AnimationDefinition, type AnimationEasing, type AnimationEasingName, type AnimationFrameContext, type AnimationHoldStep, type AnimationInterpolator, type AnimationKeyframeStep, type AnimationOptions, type AnimationOutput, type AnimationOverflowContext, type AnimationParallelStep, type AnimationParallelTracks, type AnimationPropertyStep, type AnimationTimelineStep, type AnimationTweenStep, Arrow, ArrowMarkerDef, AxisPlot, type AxisPlotPath, type AxisPlotPoint, type AxisPlotVector, Badge, BadgePill, BarChart, type BarChartDatum, Board, type BoardProps, Box, CANVAS_ITEM_COMPONENT, CHECK_DIAGNOSTIC_CODES, CalloutCard, Canvas, CanvasItem, type CanvasItemProps, CanvasOverflowError, Card, ChartFrame, type ChartLegendItem, type ChartMargins, type ChartValueFormat, type CheckAutoSize, type CheckAutoSizeAxes, type CheckDiagnostic, type CheckDiagnosticCode, type CheckDiagnosticCounts, type CheckDiagnosticLocation, type CheckFailurePolicy, type CheckFrameInput, type CheckFrameReport, type CheckOptions, type CheckThemeReport, CodeBlock, type CodeLineSpec, type ColorName, Column, Comparison, type ComparisonSideSpec, Connector, type CropMode, type CropRegion, DashedLine, DataTable, type DataflowBoundary, DataflowDiagram, type DataflowDiagramProps, type DataflowEdge, type DataflowEdgeMode, type DataflowNode, type DataflowNodeKind, type DataflowSchema, type DataflowSchemaDefinition, type DataflowSchemaField, type DefinedAnimation, type DeploymentBoundary, type DeploymentBoundaryKind, type DeploymentConnection, type DeploymentConnectionKind, DeploymentDiagram, type DeploymentDiagramProps, type DeploymentNode, type DeploymentNodeKind, type DeploymentPort, type DeploymentPortDirection, type DeploymentPortInput, DetailList, type DiagnosticSeverity, type DiagramIconDefinition, type DiagramIconRenderProps, DonutChart, type DonutChartSegment, DotPoint, EquationCard, Flow, FlowArrow, type FlowStageSpec, GradientChip, GraphDiagram, type GraphDiagramEdge, type GraphDiagramEdgeArrow, type GraphDiagramEdgeKind, type GraphDiagramEdgeStyle, type GraphDiagramGroup, type GraphDiagramNode, type GraphDiagramPort, type GraphDiagramProps, type GraphImportDiagnostic, type GraphImportDiagnosticCode, type GraphImportDirection, type GraphImportGraph, type GraphImportResult, type GraphImportSource, type GraphPortSide, type GraphRouting, Grid, type GridCell, Heatmap, Icon, type IconName, type IconProps, type IllustrationBuilder, type IntervalDatum, IntervalPlot, KeyValueList, type KeyValueRow, LayeredNetwork, type LayeredNetworkLayer, Legend, type LegendItem, LineChart, type LineChartSeries, MathText, Matrix, MetricCard, MiniBarChart, type MiniBarDatum, type OverflowResult, Panel, ParetoBarChart, type ParetoBarChartProps, ParetoChart, type ParetoChartProps, type ParetoObjective, type ParetoXScale, PieChart, type PieChartProps, Pipeline, type PipelineStage, type PlotArea, ProgressList, ProgressRow, type ProgressRowSpec, QuadrantChart, type QuadrantChartProps, type QuadrantRegion, type RenderBackground, type RenderOptions, type RenderOutput, Row, type SampleAnimationOptions, type SampledAnimationFrame, ScatterPlot, type ScatterPoint, Scene, type SequenceActivation, SequenceDiagram, type SequenceDiagramProps, type SequenceFragment, type SequenceFragmentBranch, type SequenceFragmentKind, type SequenceItem, type SequenceMessage, type SequenceMessageKind, type SequenceNote, type SequenceParticipant, type SequenceParticipantKind, Stack, StackedBar, type StackedBarSegment, type StatusKind, StatusList, StatusRow, type StatusRowSpec, StepCard, SvgFrame, SvgMathText, SvgPoint, type TensorDimension, type TensorShape, type TensorShapeObject, TextLabel, type ThemeColors, type ThemeMode, type ThemePreset, Tile, TileGrid, type TileSpec, TiledMatrix, type TiledMatrixRegion, Timeline, type TimelineEventSpec, TitleBar, type ToneName, ToneStrip, type TransformerBlock, type TransformerBlockKind, type TransformerRoute, type TransformerRouteKind, TransformerTopology, type TransformerTopologyProps, type TransitionType, TreeDiagram, type TreeNodeSpec, ValuePill, VectorArrow, VectorSegment, Watermark, type WatermarkElementProps, type WatermarkImageOptions, type WatermarkInput, type WatermarkOptions, type WatermarkPosition, WindowFrame, analyzeAnimationCadence, canvas, checkFrame, colors, createPlotArea, cropPixels, defineAnimation, defineDiagramIcon, defineIconRegistry, defineIllustration, detectBackgroundColor, detectContentBounds, detectOverflow, formatMathText, formatTensorShape, getColor, getFonts, getGradient, getReadableColor, getReadableTextColor, getReadableToneColor, getStyles, getThemeColors, getToneColor, getToneFill, getToneGradient, gradients, heatColor, hold, importD2Graph, importMermaidGraph, keyframe, loadAdditionalAsset, normalizeWatermark, parallel, renderAnimatedGif, renderAnimatedGifWithOutput, renderAnimationGif, renderAnimationGifWithOutput, renderToBuffer, renderToPng, renderToPngWithOutput, renderToSvg, sampleAnimation, sampleAnimationFrames, styles, toneGradients, tween, typography, wrapWithBrand, wrapWithWatermark };
2219
+ export { type AnimatedScene, type AnimationCadenceAnalysis, type AnimationDefinition, type AnimationEasing, type AnimationEasingName, type AnimationFrameContext, type AnimationHoldStep, type AnimationInterpolator, type AnimationKeyframeStep, type AnimationOptions, type AnimationOutput, type AnimationOverflowContext, type AnimationParallelStep, type AnimationParallelTracks, type AnimationPropertyStep, type AnimationTimelineStep, type AnimationTweenStep, Arrow, ArrowMarkerDef, AxisPlot, type AxisPlotPath, type AxisPlotPoint, type AxisPlotVector, Badge, BadgePill, BarChart, type BarChartDatum, Board, type BoardProps, Box, CANVAS_ITEM_COMPONENT, CHECK_DIAGNOSTIC_CODES, CalloutCard, Canvas, CanvasItem, type CanvasItemProps, CanvasOverflowError, Card, ChartFrame, type ChartLegendItem, type ChartMargins, type ChartValueFormat, type CheckAutoSize, type CheckAutoSizeAxes, type CheckDiagnostic, type CheckDiagnosticCode, type CheckDiagnosticCounts, type CheckDiagnosticLocation, type CheckFailurePolicy, type CheckFrameInput, type CheckFrameReport, type CheckOptions, type CheckThemeReport, CodeBlock, type CodeLineSpec, type ColorName, Column, Comparison, type ComparisonSideSpec, Connector, type CropMode, type CropRegion, DashedLine, DataTable, type DataflowBoundary, DataflowDiagram, type DataflowDiagramProps, type DataflowEdge, type DataflowEdgeMode, type DataflowNode, type DataflowNodeKind, type DataflowSchema, type DataflowSchemaDefinition, type DataflowSchemaField, type DefinedAnimation, type DeploymentBoundary, type DeploymentBoundaryKind, type DeploymentConnection, type DeploymentConnectionKind, DeploymentDiagram, type DeploymentDiagramProps, type DeploymentNode, type DeploymentNodeKind, type DeploymentPort, type DeploymentPortDirection, type DeploymentPortInput, DetailList, type DiagnosticSeverity, type DiagramIconDefinition, type DiagramIconRenderProps, DonutChart, type DonutChartSegment, DotPoint, EquationCard, Flow, FlowArrow, type FlowStageSpec, GradientChip, GraphDiagram, type GraphDiagramEdge, type GraphDiagramEdgeArrow, type GraphDiagramEdgeKind, type GraphDiagramEdgeStyle, type GraphDiagramGroup, type GraphDiagramNode, type GraphDiagramPort, type GraphDiagramProps, type GraphImportDiagnostic, type GraphImportDiagnosticCode, type GraphImportDirection, type GraphImportGraph, type GraphImportResult, type GraphImportSource, type GraphPortSide, type GraphRouting, Grid, type GridCell, Heatmap, Icon, type IconName, type IconProps, type IllustrationBuilder, type IntervalDatum, IntervalPlot, KeyValueList, type KeyValueRow, LayeredNetwork, type LayeredNetworkLayer, Legend, type LegendItem, LineChart, type LineChartSeries, MathText, Matrix, MetricCard, MiniBarChart, type MiniBarDatum, type OverflowResult, Panel, ParetoBarChart, type ParetoBarChartProps, ParetoChart, type ParetoChartProps, type ParetoObjective, type ParetoXScale, PieChart, type PieChartProps, Pipeline, type PipelineStage, type PlotArea, ProgressList, ProgressRow, type ProgressRowSpec, QuadrantChart, type QuadrantChartProps, type QuadrantRegion, type RenderBackground, type RenderOptions, type RenderOutput, Row, type SampleAnimationOptions, type SampledAnimationFrame, ScatterPlot, type ScatterPoint, Scene, type SequenceActivation, SequenceDiagram, type SequenceDiagramProps, type SequenceFragment, type SequenceFragmentBranch, type SequenceFragmentKind, type SequenceItem, type SequenceMessage, type SequenceMessageKind, type SequenceNote, type SequenceParticipant, type SequenceParticipantKind, Stack, StackedBar, type StackedBarSegment, type StatusKind, StatusList, StatusRow, type StatusRowSpec, StepCard, SvgFrame, SvgMathText, SvgPoint, type TensorDimension, type TensorShape, type TensorShapeObject, TextLabel, type ThemeColors, type ThemeMode, type ThemePreset, Tile, TileGrid, type TileSpec, TiledMatrix, type TiledMatrixRegion, Timeline, type TimelineEventSpec, TitleBar, type ToneName, ToneStrip, type TransformerBlock, type TransformerBlockKind, type TransformerRoute, type TransformerRouteKind, TransformerTopology, type TransformerTopologyProps, type TransitionType, TreeDiagram, type TreeNodeSpec, ValuePill, VectorArrow, VectorSegment, Watermark, type WatermarkElementProps, type WatermarkImageOptions, type WatermarkInput, type WatermarkOptions, type WatermarkPosition, WindowFrame, analyzeAnimationCadence, canvas, checkFrame, colors, createPlotArea, cropPixels, defineAnimation, defineDiagramIcon, defineIconRegistry, defineIllustration, detectBackgroundColor, detectContentBounds, detectOverflow, formatMathText, formatTensorShape, getColor, getFonts, getGradient, getReadableColor, getReadableTextColor, getReadableToneColor, getStyles, getThemeColors, getToneColor, getToneFill, getToneGradient, gradients, heatColor, hold, importD2Graph, importMermaidGraph, keyframe, loadAdditionalAsset, normalizeWatermark, parallel, renderAnimatedGif, renderAnimatedGifWithOutput, renderAnimationGif, renderAnimationGifWithOutput, renderToBuffer, renderToPng, renderToPngWithOutput, renderToSvg, sampleAnimation, sampleAnimationFrames, styles, toneGradients, tween, typography, withColorAlpha, wrapWithBrand, wrapWithWatermark };
package/dist/index.d.ts CHANGED
@@ -207,6 +207,8 @@ type ColorName = 'primary' | 'secondary' | 'positive' | 'warning' | 'critical' |
207
207
  declare function getColor(name: ColorName, c?: ThemeColors): string;
208
208
  /** Get a semantic color variant that remains readable as text in either theme. */
209
209
  declare function getReadableColor(name: ColorName, c: ThemeColors): string;
210
+ /** Apply an opacity multiplier to any CSS color accepted by parse-css-color. */
211
+ declare function withColorAlpha(color: string, opacity: number): string;
210
212
  /** Choose readable foreground text, compositing translucent backgrounds over their backdrop. */
211
213
  declare function getReadableTextColor(background: string, c: ThemeColors, backdrop?: string): string;
212
214
  /**
@@ -1740,7 +1742,7 @@ interface CanvasItemProps {
1740
1742
  }
1741
1743
  /** A fixed canvas for freely positioned, composable visuals. */
1742
1744
  declare function Board({ children, c, width, height, background }: BoardProps): React.ReactElement;
1743
- /** Positions an item in Board coordinates and supplies its size to the child. */
1745
+ /** Positions an item in Board coordinates, sizing its child or fitting a complete chart. */
1744
1746
  declare function CanvasItem({ children, x, y, width, height }: CanvasItemProps): React.ReactElement;
1745
1747
 
1746
1748
  /**
@@ -2214,4 +2216,4 @@ interface CheckFrameReport {
2214
2216
  */
2215
2217
  declare function checkFrame(input: CheckFrameInput, options?: CheckOptions): Promise<CheckFrameReport>;
2216
2218
 
2217
- export { type AnimatedScene, type AnimationCadenceAnalysis, type AnimationDefinition, type AnimationEasing, type AnimationEasingName, type AnimationFrameContext, type AnimationHoldStep, type AnimationInterpolator, type AnimationKeyframeStep, type AnimationOptions, type AnimationOutput, type AnimationOverflowContext, type AnimationParallelStep, type AnimationParallelTracks, type AnimationPropertyStep, type AnimationTimelineStep, type AnimationTweenStep, Arrow, ArrowMarkerDef, AxisPlot, type AxisPlotPath, type AxisPlotPoint, type AxisPlotVector, Badge, BadgePill, BarChart, type BarChartDatum, Board, type BoardProps, Box, CANVAS_ITEM_COMPONENT, CHECK_DIAGNOSTIC_CODES, CalloutCard, Canvas, CanvasItem, type CanvasItemProps, CanvasOverflowError, Card, ChartFrame, type ChartLegendItem, type ChartMargins, type ChartValueFormat, type CheckAutoSize, type CheckAutoSizeAxes, type CheckDiagnostic, type CheckDiagnosticCode, type CheckDiagnosticCounts, type CheckDiagnosticLocation, type CheckFailurePolicy, type CheckFrameInput, type CheckFrameReport, type CheckOptions, type CheckThemeReport, CodeBlock, type CodeLineSpec, type ColorName, Column, Comparison, type ComparisonSideSpec, Connector, type CropMode, type CropRegion, DashedLine, DataTable, type DataflowBoundary, DataflowDiagram, type DataflowDiagramProps, type DataflowEdge, type DataflowEdgeMode, type DataflowNode, type DataflowNodeKind, type DataflowSchema, type DataflowSchemaDefinition, type DataflowSchemaField, type DefinedAnimation, type DeploymentBoundary, type DeploymentBoundaryKind, type DeploymentConnection, type DeploymentConnectionKind, DeploymentDiagram, type DeploymentDiagramProps, type DeploymentNode, type DeploymentNodeKind, type DeploymentPort, type DeploymentPortDirection, type DeploymentPortInput, DetailList, type DiagnosticSeverity, type DiagramIconDefinition, type DiagramIconRenderProps, DonutChart, type DonutChartSegment, DotPoint, EquationCard, Flow, FlowArrow, type FlowStageSpec, GradientChip, GraphDiagram, type GraphDiagramEdge, type GraphDiagramEdgeArrow, type GraphDiagramEdgeKind, type GraphDiagramEdgeStyle, type GraphDiagramGroup, type GraphDiagramNode, type GraphDiagramPort, type GraphDiagramProps, type GraphImportDiagnostic, type GraphImportDiagnosticCode, type GraphImportDirection, type GraphImportGraph, type GraphImportResult, type GraphImportSource, type GraphPortSide, type GraphRouting, Grid, type GridCell, Heatmap, Icon, type IconName, type IconProps, type IllustrationBuilder, type IntervalDatum, IntervalPlot, KeyValueList, type KeyValueRow, LayeredNetwork, type LayeredNetworkLayer, Legend, type LegendItem, LineChart, type LineChartSeries, MathText, Matrix, MetricCard, MiniBarChart, type MiniBarDatum, type OverflowResult, Panel, ParetoBarChart, type ParetoBarChartProps, ParetoChart, type ParetoChartProps, type ParetoObjective, type ParetoXScale, PieChart, type PieChartProps, Pipeline, type PipelineStage, type PlotArea, ProgressList, ProgressRow, type ProgressRowSpec, QuadrantChart, type QuadrantChartProps, type QuadrantRegion, type RenderBackground, type RenderOptions, type RenderOutput, Row, type SampleAnimationOptions, type SampledAnimationFrame, ScatterPlot, type ScatterPoint, Scene, type SequenceActivation, SequenceDiagram, type SequenceDiagramProps, type SequenceFragment, type SequenceFragmentBranch, type SequenceFragmentKind, type SequenceItem, type SequenceMessage, type SequenceMessageKind, type SequenceNote, type SequenceParticipant, type SequenceParticipantKind, Stack, StackedBar, type StackedBarSegment, type StatusKind, StatusList, StatusRow, type StatusRowSpec, StepCard, SvgFrame, SvgMathText, SvgPoint, type TensorDimension, type TensorShape, type TensorShapeObject, TextLabel, type ThemeColors, type ThemeMode, type ThemePreset, Tile, TileGrid, type TileSpec, TiledMatrix, type TiledMatrixRegion, Timeline, type TimelineEventSpec, TitleBar, type ToneName, ToneStrip, type TransformerBlock, type TransformerBlockKind, type TransformerRoute, type TransformerRouteKind, TransformerTopology, type TransformerTopologyProps, type TransitionType, TreeDiagram, type TreeNodeSpec, ValuePill, VectorArrow, VectorSegment, Watermark, type WatermarkElementProps, type WatermarkImageOptions, type WatermarkInput, type WatermarkOptions, type WatermarkPosition, WindowFrame, analyzeAnimationCadence, canvas, checkFrame, colors, createPlotArea, cropPixels, defineAnimation, defineDiagramIcon, defineIconRegistry, defineIllustration, detectBackgroundColor, detectContentBounds, detectOverflow, formatMathText, formatTensorShape, getColor, getFonts, getGradient, getReadableColor, getReadableTextColor, getReadableToneColor, getStyles, getThemeColors, getToneColor, getToneFill, getToneGradient, gradients, heatColor, hold, importD2Graph, importMermaidGraph, keyframe, loadAdditionalAsset, normalizeWatermark, parallel, renderAnimatedGif, renderAnimatedGifWithOutput, renderAnimationGif, renderAnimationGifWithOutput, renderToBuffer, renderToPng, renderToPngWithOutput, renderToSvg, sampleAnimation, sampleAnimationFrames, styles, toneGradients, tween, typography, wrapWithBrand, wrapWithWatermark };
2219
+ export { type AnimatedScene, type AnimationCadenceAnalysis, type AnimationDefinition, type AnimationEasing, type AnimationEasingName, type AnimationFrameContext, type AnimationHoldStep, type AnimationInterpolator, type AnimationKeyframeStep, type AnimationOptions, type AnimationOutput, type AnimationOverflowContext, type AnimationParallelStep, type AnimationParallelTracks, type AnimationPropertyStep, type AnimationTimelineStep, type AnimationTweenStep, Arrow, ArrowMarkerDef, AxisPlot, type AxisPlotPath, type AxisPlotPoint, type AxisPlotVector, Badge, BadgePill, BarChart, type BarChartDatum, Board, type BoardProps, Box, CANVAS_ITEM_COMPONENT, CHECK_DIAGNOSTIC_CODES, CalloutCard, Canvas, CanvasItem, type CanvasItemProps, CanvasOverflowError, Card, ChartFrame, type ChartLegendItem, type ChartMargins, type ChartValueFormat, type CheckAutoSize, type CheckAutoSizeAxes, type CheckDiagnostic, type CheckDiagnosticCode, type CheckDiagnosticCounts, type CheckDiagnosticLocation, type CheckFailurePolicy, type CheckFrameInput, type CheckFrameReport, type CheckOptions, type CheckThemeReport, CodeBlock, type CodeLineSpec, type ColorName, Column, Comparison, type ComparisonSideSpec, Connector, type CropMode, type CropRegion, DashedLine, DataTable, type DataflowBoundary, DataflowDiagram, type DataflowDiagramProps, type DataflowEdge, type DataflowEdgeMode, type DataflowNode, type DataflowNodeKind, type DataflowSchema, type DataflowSchemaDefinition, type DataflowSchemaField, type DefinedAnimation, type DeploymentBoundary, type DeploymentBoundaryKind, type DeploymentConnection, type DeploymentConnectionKind, DeploymentDiagram, type DeploymentDiagramProps, type DeploymentNode, type DeploymentNodeKind, type DeploymentPort, type DeploymentPortDirection, type DeploymentPortInput, DetailList, type DiagnosticSeverity, type DiagramIconDefinition, type DiagramIconRenderProps, DonutChart, type DonutChartSegment, DotPoint, EquationCard, Flow, FlowArrow, type FlowStageSpec, GradientChip, GraphDiagram, type GraphDiagramEdge, type GraphDiagramEdgeArrow, type GraphDiagramEdgeKind, type GraphDiagramEdgeStyle, type GraphDiagramGroup, type GraphDiagramNode, type GraphDiagramPort, type GraphDiagramProps, type GraphImportDiagnostic, type GraphImportDiagnosticCode, type GraphImportDirection, type GraphImportGraph, type GraphImportResult, type GraphImportSource, type GraphPortSide, type GraphRouting, Grid, type GridCell, Heatmap, Icon, type IconName, type IconProps, type IllustrationBuilder, type IntervalDatum, IntervalPlot, KeyValueList, type KeyValueRow, LayeredNetwork, type LayeredNetworkLayer, Legend, type LegendItem, LineChart, type LineChartSeries, MathText, Matrix, MetricCard, MiniBarChart, type MiniBarDatum, type OverflowResult, Panel, ParetoBarChart, type ParetoBarChartProps, ParetoChart, type ParetoChartProps, type ParetoObjective, type ParetoXScale, PieChart, type PieChartProps, Pipeline, type PipelineStage, type PlotArea, ProgressList, ProgressRow, type ProgressRowSpec, QuadrantChart, type QuadrantChartProps, type QuadrantRegion, type RenderBackground, type RenderOptions, type RenderOutput, Row, type SampleAnimationOptions, type SampledAnimationFrame, ScatterPlot, type ScatterPoint, Scene, type SequenceActivation, SequenceDiagram, type SequenceDiagramProps, type SequenceFragment, type SequenceFragmentBranch, type SequenceFragmentKind, type SequenceItem, type SequenceMessage, type SequenceMessageKind, type SequenceNote, type SequenceParticipant, type SequenceParticipantKind, Stack, StackedBar, type StackedBarSegment, type StatusKind, StatusList, StatusRow, type StatusRowSpec, StepCard, SvgFrame, SvgMathText, SvgPoint, type TensorDimension, type TensorShape, type TensorShapeObject, TextLabel, type ThemeColors, type ThemeMode, type ThemePreset, Tile, TileGrid, type TileSpec, TiledMatrix, type TiledMatrixRegion, Timeline, type TimelineEventSpec, TitleBar, type ToneName, ToneStrip, type TransformerBlock, type TransformerBlockKind, type TransformerRoute, type TransformerRouteKind, TransformerTopology, type TransformerTopologyProps, type TransitionType, TreeDiagram, type TreeNodeSpec, ValuePill, VectorArrow, VectorSegment, Watermark, type WatermarkElementProps, type WatermarkImageOptions, type WatermarkInput, type WatermarkOptions, type WatermarkPosition, WindowFrame, analyzeAnimationCadence, canvas, checkFrame, colors, createPlotArea, cropPixels, defineAnimation, defineDiagramIcon, defineIconRegistry, defineIllustration, detectBackgroundColor, detectContentBounds, detectOverflow, formatMathText, formatTensorShape, getColor, getFonts, getGradient, getReadableColor, getReadableTextColor, getReadableToneColor, getStyles, getThemeColors, getToneColor, getToneFill, getToneGradient, gradients, heatColor, hold, importD2Graph, importMermaidGraph, keyframe, loadAdditionalAsset, normalizeWatermark, parallel, renderAnimatedGif, renderAnimatedGifWithOutput, renderAnimationGif, renderAnimationGifWithOutput, renderToBuffer, renderToPng, renderToPngWithOutput, renderToSvg, sampleAnimation, sampleAnimationFrames, styles, toneGradients, tween, typography, withColorAlpha, wrapWithBrand, wrapWithWatermark };