@opendata-ai/openchart-engine 6.19.3 → 6.20.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/index.js CHANGED
@@ -583,7 +583,7 @@ function computeAnnotations(spec, scales, chartArea, strategy, isDark = false, o
583
583
  }
584
584
 
585
585
  // src/charts/bar/compute.ts
586
- import { abbreviateNumber, formatNumber, isGradientDef } from "@opendata-ai/openchart-core";
586
+ import { isGradientDef } from "@opendata-ai/openchart-core";
587
587
 
588
588
  // src/transforms/predicates.ts
589
589
  function isFieldPredicate(pred) {
@@ -653,6 +653,13 @@ function isConditionalValueDef(def) {
653
653
  return def !== null && typeof def === "object" && "condition" in def;
654
654
  }
655
655
 
656
+ // src/charts/_shared/format-label-value.ts
657
+ import { abbreviateNumber, formatNumber } from "@opendata-ai/openchart-core";
658
+ function formatLabelValue(value2) {
659
+ if (Math.abs(value2) >= 1e3) return abbreviateNumber(value2);
660
+ return formatNumber(value2);
661
+ }
662
+
656
663
  // src/charts/utils.ts
657
664
  var DEFAULT_COLOR = "#1b7fa3";
658
665
  function scaleValue(scale, scaleType, value2) {
@@ -735,10 +742,6 @@ function orientGradientForHorizontalBar(grad) {
735
742
  return { ...lg, x1: 0, y1: 0, x2: 1, y2: 0 };
736
743
  }
737
744
  var MIN_BAR_WIDTH = 1;
738
- function formatBarValue(value2) {
739
- if (Math.abs(value2) >= 1e3) return abbreviateNumber(value2);
740
- return formatNumber(value2);
741
- }
742
745
  function computeBarMarks(spec, scales, _chartArea, _strategy) {
743
746
  const encoding = spec.encoding;
744
747
  const xChannel = encoding.x;
@@ -836,7 +839,7 @@ function computeStackedBars(data, valueField, categoryField, colorField, xScale,
836
839
  const xRight = xScale(cumulativeValue + value2);
837
840
  const barWidth = Math.max(Math.abs(xRight - xLeft), MIN_BAR_WIDTH);
838
841
  const aria = {
839
- label: `${category}, ${groupKey2}: ${formatBarValue(rawValue)}`
842
+ label: `${category}, ${groupKey2}: ${formatLabelValue(rawValue)}`
840
843
  };
841
844
  marks.push({
842
845
  type: "rect",
@@ -883,7 +886,7 @@ function computeGroupedBars(data, valueField, categoryField, colorField, xScale,
883
886
  const barWidth = Math.max(Math.abs(xScale(value2) - baseline), MIN_BAR_WIDTH);
884
887
  const subY = bandY + groupIndex * (subBandHeight + gap);
885
888
  const aria = {
886
- label: `${category}, ${groupKey2}: ${formatBarValue(value2)}`
889
+ label: `${category}, ${groupKey2}: ${formatLabelValue(value2)}`
887
890
  };
888
891
  marks.push({
889
892
  type: "rect",
@@ -914,7 +917,7 @@ function computeColoredBars(data, valueField, categoryField, colorField, xScale,
914
917
  const xPos = value2 >= 0 ? baseline : xScale(value2);
915
918
  const barWidth = Math.max(Math.abs(xScale(value2) - baseline), MIN_BAR_WIDTH);
916
919
  const aria = {
917
- label: `${category}, ${groupKey2}: ${formatBarValue(value2)}`
920
+ label: `${category}, ${groupKey2}: ${formatLabelValue(value2)}`
918
921
  };
919
922
  marks.push({
920
923
  type: "rect",
@@ -955,7 +958,7 @@ function computeSimpleBars(data, valueField, categoryField, xScale, yScale, band
955
958
  const xPos = value2 >= 0 ? baseline : xScale(value2);
956
959
  const barWidth = Math.max(Math.abs(xScale(value2) - baseline), MIN_BAR_WIDTH);
957
960
  const aria = {
958
- label: `${category}: ${formatBarValue(value2)}`
961
+ label: `${category}: ${formatLabelValue(value2)}`
959
962
  };
960
963
  marks.push({
961
964
  type: "rect",
@@ -975,17 +978,11 @@ function computeSimpleBars(data, valueField, categoryField, xScale, yScale, band
975
978
 
976
979
  // src/charts/bar/labels.ts
977
980
  import {
978
- abbreviateNumber as abbreviateNumber2,
979
981
  buildD3Formatter,
980
982
  estimateTextWidth as estimateTextWidth2,
981
- formatNumber as formatNumber2,
982
983
  getRepresentativeColor,
983
984
  resolveCollisions
984
985
  } from "@opendata-ai/openchart-core";
985
- function formatBarValue2(value2) {
986
- if (Math.abs(value2) >= 1e3) return abbreviateNumber2(value2);
987
- return formatNumber2(value2);
988
- }
989
986
  var SUFFIX_MULTIPLIERS = {
990
987
  K: 1e3,
991
988
  M: 1e6,
@@ -1023,7 +1020,7 @@ function computeBarLabels(marks, _chartArea, density = "auto", labelFormat, labe
1023
1020
  if (formatter && Number.isFinite(rawNum)) {
1024
1021
  valuePart = formatter(rawNum);
1025
1022
  } else if (Number.isFinite(rawNum)) {
1026
- valuePart = formatBarValue2(rawNum);
1023
+ valuePart = formatLabelValue(rawNum);
1027
1024
  } else {
1028
1025
  const ariaLabel = mark.aria.label;
1029
1026
  const lastColon = ariaLabel.lastIndexOf(":");
@@ -1135,12 +1132,8 @@ var barRenderer = (spec, scales, chartArea, strategy, _theme) => {
1135
1132
  };
1136
1133
 
1137
1134
  // src/charts/column/compute.ts
1138
- import { abbreviateNumber as abbreviateNumber3, formatNumber as formatNumber3, isGradientDef as isGradientDef2 } from "@opendata-ai/openchart-core";
1135
+ import { isGradientDef as isGradientDef2 } from "@opendata-ai/openchart-core";
1139
1136
  var MIN_COLUMN_HEIGHT = 1;
1140
- function formatColumnValue(value2) {
1141
- if (Math.abs(value2) >= 1e3) return abbreviateNumber3(value2);
1142
- return formatNumber3(value2);
1143
- }
1144
1137
  function computeColumnMarks(spec, scales, _chartArea, _strategy) {
1145
1138
  const encoding = spec.encoding;
1146
1139
  const xChannel = encoding.x;
@@ -1241,7 +1234,7 @@ function computeSimpleColumns(data, categoryField, valueField, xScale, yScale, b
1241
1234
  const columnHeight = Math.max(Math.abs(baseline - yPos), MIN_COLUMN_HEIGHT);
1242
1235
  const y2 = value2 >= 0 ? yPos : baseline;
1243
1236
  const aria = {
1244
- label: `${category}: ${formatColumnValue(value2)}`
1237
+ label: `${category}: ${formatLabelValue(value2)}`
1245
1238
  };
1246
1239
  marks.push({
1247
1240
  type: "rect",
@@ -1272,7 +1265,7 @@ function computeColoredColumns(data, categoryField, valueField, colorField, xSca
1272
1265
  const columnHeight = Math.max(Math.abs(baseline - yPos), MIN_COLUMN_HEIGHT);
1273
1266
  const y2 = value2 >= 0 ? yPos : baseline;
1274
1267
  const aria = {
1275
- label: `${category}, ${groupKey2}: ${formatColumnValue(value2)}`
1268
+ label: `${category}, ${groupKey2}: ${formatLabelValue(value2)}`
1276
1269
  };
1277
1270
  marks.push({
1278
1271
  type: "rect",
@@ -1320,7 +1313,7 @@ function computeGroupedColumns(data, categoryField, valueField, colorField, xSca
1320
1313
  const y2 = value2 >= 0 ? yPos : baseline;
1321
1314
  const subX = bandX + groupIndex * (subBandWidth + gap);
1322
1315
  const aria = {
1323
- label: `${category}, ${groupKey2}: ${formatColumnValue(value2)}`
1316
+ label: `${category}, ${groupKey2}: ${formatLabelValue(value2)}`
1324
1317
  };
1325
1318
  marks.push({
1326
1319
  type: "rect",
@@ -1360,7 +1353,7 @@ function computeStackedColumns(data, categoryField, valueField, colorField, xSca
1360
1353
  const yBottom = yScale(cumulativeValue);
1361
1354
  const columnHeight = Math.max(Math.abs(yBottom - yTop), MIN_COLUMN_HEIGHT);
1362
1355
  const aria = {
1363
- label: `${category}, ${groupKey2}: ${formatColumnValue(rawValue)}`
1356
+ label: `${category}, ${groupKey2}: ${formatLabelValue(rawValue)}`
1364
1357
  };
1365
1358
  marks.push({
1366
1359
  type: "rect",
@@ -1383,17 +1376,11 @@ function computeStackedColumns(data, categoryField, valueField, colorField, xSca
1383
1376
 
1384
1377
  // src/charts/column/labels.ts
1385
1378
  import {
1386
- abbreviateNumber as abbreviateNumber4,
1387
1379
  buildD3Formatter as buildD3Formatter2,
1388
1380
  estimateTextWidth as estimateTextWidth3,
1389
- formatNumber as formatNumber4,
1390
1381
  getRepresentativeColor as getRepresentativeColor2,
1391
1382
  resolveCollisions as resolveCollisions2
1392
1383
  } from "@opendata-ai/openchart-core";
1393
- function formatColumnValue2(value2) {
1394
- if (Math.abs(value2) >= 1e3) return abbreviateNumber4(value2);
1395
- return formatNumber4(value2);
1396
- }
1397
1384
  var LABEL_FONT_SIZE2 = 10;
1398
1385
  var LABEL_FONT_WEIGHT2 = 600;
1399
1386
  var LABEL_OFFSET_Y = 6;
@@ -1408,7 +1395,7 @@ function computeColumnLabels(marks, _chartArea, density = "auto", labelFormat, l
1408
1395
  if (formatter && Number.isFinite(rawNum)) {
1409
1396
  valuePart = formatter(rawNum);
1410
1397
  } else if (Number.isFinite(rawNum)) {
1411
- valuePart = formatColumnValue2(rawNum);
1398
+ valuePart = formatLabelValue(rawNum);
1412
1399
  } else {
1413
1400
  const ariaLabel = mark.aria.label;
1414
1401
  const lastColon = ariaLabel.lastIndexOf(":");
@@ -1627,17 +1614,11 @@ function computeLollipopMarks(data, valueField, categoryField, xScale, yScale, b
1627
1614
 
1628
1615
  // src/charts/dot/labels.ts
1629
1616
  import {
1630
- abbreviateNumber as abbreviateNumber5,
1631
1617
  buildD3Formatter as buildD3Formatter3,
1632
1618
  estimateTextWidth as estimateTextWidth4,
1633
- formatNumber as formatNumber5,
1634
1619
  getRepresentativeColor as getRepresentativeColor3,
1635
1620
  resolveCollisions as resolveCollisions3
1636
1621
  } from "@opendata-ai/openchart-core";
1637
- function formatDotValue(value2) {
1638
- if (Math.abs(value2) >= 1e3) return abbreviateNumber5(value2);
1639
- return formatNumber5(value2);
1640
- }
1641
1622
  var LABEL_FONT_SIZE3 = 11;
1642
1623
  var LABEL_FONT_WEIGHT3 = 600;
1643
1624
  var LABEL_OFFSET_X = 10;
@@ -1652,7 +1633,7 @@ function computeDotLabels(marks, _chartArea, density = "auto", labelPrefix, labe
1652
1633
  if (formatter && Number.isFinite(rawNum)) {
1653
1634
  valuePart = formatter(rawNum);
1654
1635
  } else if (Number.isFinite(rawNum)) {
1655
- valuePart = formatDotValue(rawNum);
1636
+ valuePart = formatLabelValue(rawNum);
1656
1637
  } else {
1657
1638
  const ariaLabel = mark.aria.label;
1658
1639
  const lastColon = ariaLabel.lastIndexOf(":");
@@ -7769,12 +7750,12 @@ var DEFAULT_COLLISION_PADDING = 5;
7769
7750
 
7770
7751
  // src/layout/axes.ts
7771
7752
  import {
7772
- abbreviateNumber as abbreviateNumber6,
7753
+ abbreviateNumber as abbreviateNumber2,
7773
7754
  buildD3Formatter as buildD3Formatter4,
7774
7755
  buildTemporalFormatter,
7775
7756
  estimateTextWidth as estimateTextWidth7,
7776
7757
  formatDate,
7777
- formatNumber as formatNumber6
7758
+ formatNumber as formatNumber2
7778
7759
  } from "@opendata-ai/openchart-core";
7779
7760
  var TICK_COUNTS = {
7780
7761
  full: 12,
@@ -7904,8 +7885,8 @@ function formatTickLabel(value2, resolvedScale) {
7904
7885
  const fmt = buildD3Formatter4(formatStr);
7905
7886
  if (fmt) return fmt(num);
7906
7887
  }
7907
- if (Math.abs(num) >= 1e3) return abbreviateNumber6(num);
7908
- return formatNumber6(num);
7888
+ if (Math.abs(num) >= 1e3) return abbreviateNumber2(num);
7889
+ return formatNumber2(num);
7909
7890
  }
7910
7891
  return String(value2);
7911
7892
  }
@@ -8719,10 +8700,46 @@ function computeScales(spec, chartArea, data) {
8719
8700
  }
8720
8701
 
8721
8702
  // src/legend/compute.ts
8722
- import { BRAND_RESERVE_WIDTH, estimateTextWidth as estimateTextWidth9 } from "@opendata-ai/openchart-core";
8703
+ import { BRAND_RESERVE_WIDTH, estimateTextWidth as estimateTextWidth10 } from "@opendata-ai/openchart-core";
8704
+
8705
+ // src/legend/wrap.ts
8706
+ import { estimateTextWidth as estimateTextWidth9 } from "@opendata-ai/openchart-core";
8723
8707
  var SWATCH_SIZE2 = 12;
8724
8708
  var SWATCH_GAP2 = 6;
8725
8709
  var ENTRY_GAP2 = 16;
8710
+ function measureLegendWrap(entries, maxWidth, labelStyle, maxRows) {
8711
+ if (entries.length === 0) {
8712
+ return { rowCount: 0, fittingCount: 0, rowWidths: [] };
8713
+ }
8714
+ let rowCount = 1;
8715
+ let rowWidth = 0;
8716
+ const rowWidths = [];
8717
+ let fittingCount = entries.length;
8718
+ let fittingCountLocked = false;
8719
+ for (let i = 0; i < entries.length; i++) {
8720
+ const labelWidth = estimateTextWidth9(
8721
+ entries[i].label,
8722
+ labelStyle.fontSize,
8723
+ labelStyle.fontWeight
8724
+ );
8725
+ const entryWidth = SWATCH_SIZE2 + SWATCH_GAP2 + labelWidth + ENTRY_GAP2;
8726
+ if (rowWidth + entryWidth > maxWidth && rowWidth > 0) {
8727
+ rowWidths.push(rowWidth);
8728
+ rowCount++;
8729
+ rowWidth = entryWidth;
8730
+ if (!fittingCountLocked && maxRows != null && rowCount > maxRows) {
8731
+ fittingCount = i;
8732
+ fittingCountLocked = true;
8733
+ }
8734
+ } else {
8735
+ rowWidth += entryWidth;
8736
+ }
8737
+ }
8738
+ rowWidths.push(rowWidth);
8739
+ return { rowCount, fittingCount, rowWidths };
8740
+ }
8741
+
8742
+ // src/legend/compute.ts
8726
8743
  var LEGEND_PADDING = 8;
8727
8744
  var LEGEND_RIGHT_WIDTH = 120;
8728
8745
  var RIGHT_LEGEND_MAX_HEIGHT_RATIO = 0.4;
@@ -8763,26 +8780,6 @@ function extractColorEntries(spec, theme) {
8763
8780
  };
8764
8781
  });
8765
8782
  }
8766
- function entriesThatFit(entries, maxWidth, maxRows, labelStyle) {
8767
- let row = 1;
8768
- let rowWidth = 0;
8769
- for (let i = 0; i < entries.length; i++) {
8770
- const labelWidth = estimateTextWidth9(
8771
- entries[i].label,
8772
- labelStyle.fontSize,
8773
- labelStyle.fontWeight
8774
- );
8775
- const entryWidth = SWATCH_SIZE2 + SWATCH_GAP2 + labelWidth + ENTRY_GAP2;
8776
- if (rowWidth + entryWidth > maxWidth && rowWidth > 0) {
8777
- row++;
8778
- rowWidth = entryWidth;
8779
- if (row > maxRows) return i;
8780
- } else {
8781
- rowWidth += entryWidth;
8782
- }
8783
- }
8784
- return entries.length;
8785
- }
8786
8783
  function truncateEntries(entries, maxCount) {
8787
8784
  if (maxCount >= entries.length || maxCount <= 0) return entries;
8788
8785
  const truncated = entries.slice(0, maxCount);
@@ -8850,7 +8847,7 @@ function computeLegend(spec, strategy, theme, chartArea, watermark = true) {
8850
8847
  }
8851
8848
  if (resolvedPosition === "right" || resolvedPosition === "bottom-right") {
8852
8849
  const maxLabelWidth = Math.max(
8853
- ...entries.map((e) => estimateTextWidth9(e.label, labelStyle.fontSize, labelStyle.fontWeight))
8850
+ ...entries.map((e) => estimateTextWidth10(e.label, labelStyle.fontSize, labelStyle.fontWeight))
8854
8851
  );
8855
8852
  const legendWidth = Math.min(
8856
8853
  LEGEND_RIGHT_WIDTH,
@@ -8896,26 +8893,15 @@ function computeLegend(spec, strategy, theme, chartArea, watermark = true) {
8896
8893
  }
8897
8894
  }
8898
8895
  const maxRows = spec.legend?.maxRows != null ? Math.max(1, spec.legend.maxRows) : spec.legend?.columns != null ? Math.ceil(entries.length / spec.legend.columns) : TOP_LEGEND_MAX_ROWS;
8899
- const maxFit = entriesThatFit(entries, availableWidth, maxRows, labelStyle);
8900
- if (maxFit < entries.length) {
8901
- entries = truncateEntries(entries, maxFit);
8896
+ const { fittingCount } = measureLegendWrap(entries, availableWidth, labelStyle, maxRows);
8897
+ if (fittingCount < entries.length) {
8898
+ entries = truncateEntries(entries, fittingCount);
8902
8899
  }
8903
8900
  const totalWidth = entries.reduce((sum2, entry) => {
8904
- const labelWidth = estimateTextWidth9(entry.label, labelStyle.fontSize, labelStyle.fontWeight);
8901
+ const labelWidth = estimateTextWidth10(entry.label, labelStyle.fontSize, labelStyle.fontWeight);
8905
8902
  return sum2 + SWATCH_SIZE2 + SWATCH_GAP2 + labelWidth + ENTRY_GAP2;
8906
8903
  }, 0);
8907
- let rowCount = 1;
8908
- let rowWidth = 0;
8909
- for (const entry of entries) {
8910
- const labelWidth = estimateTextWidth9(entry.label, labelStyle.fontSize, labelStyle.fontWeight);
8911
- const entryWidth = SWATCH_SIZE2 + SWATCH_GAP2 + labelWidth + ENTRY_GAP2;
8912
- if (rowWidth + entryWidth > availableWidth && rowWidth > 0) {
8913
- rowCount++;
8914
- rowWidth = entryWidth;
8915
- } else {
8916
- rowWidth += entryWidth;
8917
- }
8918
- }
8904
+ const { rowCount } = measureLegendWrap(entries, availableWidth, labelStyle);
8919
8905
  const rowHeight = SWATCH_SIZE2 + 4;
8920
8906
  const legendHeight = rowCount * rowHeight + LEGEND_PADDING * 2;
8921
8907
  const offsetDx = spec.legend?.offset?.dx ?? 0;
@@ -8941,8 +8927,8 @@ import {
8941
8927
  adaptTheme as adaptTheme2,
8942
8928
  buildD3Formatter as buildD3Formatter5,
8943
8929
  computeChrome as computeChrome3,
8944
- estimateTextWidth as estimateTextWidth10,
8945
- formatNumber as formatNumber7,
8930
+ estimateTextWidth as estimateTextWidth11,
8931
+ formatNumber as formatNumber3,
8946
8932
  resolveTheme as resolveTheme2
8947
8933
  } from "@opendata-ai/openchart-core";
8948
8934
 
@@ -9418,9 +9404,6 @@ function generateLinkPath(link) {
9418
9404
  }
9419
9405
 
9420
9406
  // src/sankey/compile-sankey.ts
9421
- var SWATCH_SIZE3 = 12;
9422
- var SWATCH_GAP3 = 6;
9423
- var ENTRY_GAP3 = 16;
9424
9407
  var LABEL_GAP = 6;
9425
9408
  var LINK_OPACITY_LIGHT = 0.5;
9426
9409
  var LINK_OPACITY_DARK = 0.75;
@@ -9625,7 +9608,7 @@ function compileSankey(spec, options) {
9625
9608
  if (labelsLeft) continue;
9626
9609
  const labelX = (node.x1 ?? nodeWidth) + LABEL_GAP;
9627
9610
  const labelText = node.label ?? node.id;
9628
- const labelWidth = estimateTextWidth10(labelText, labelFontSize, labelFontWeight);
9611
+ const labelWidth = estimateTextWidth11(labelText, labelFontSize, labelFontWeight);
9629
9612
  const overflow = labelX + labelWidth - rightEdge;
9630
9613
  if (overflow > maxOverflow) maxOverflow = overflow;
9631
9614
  }
@@ -9790,22 +9773,11 @@ function buildSankeyLegend(nodeColorMap, colorField, data, sourceField, targetFi
9790
9773
  }
9791
9774
  let bounds = { x: 0, y: 0, width: 0, height: 0 };
9792
9775
  if (entries.length > 0) {
9793
- const ROW_HEIGHT = SWATCH_SIZE3 + 4;
9776
+ const ROW_HEIGHT = SWATCH_SIZE2 + 4;
9794
9777
  const availableWidth = area.width;
9795
- let rowCount = 1;
9796
- let rowX = 0;
9797
- for (const entry of entries) {
9798
- const labelWidth = estimateTextWidth10(entry.label, labelStyle.fontSize, labelStyle.fontWeight);
9799
- const entryWidth = SWATCH_SIZE3 + SWATCH_GAP3 + labelWidth + ENTRY_GAP3;
9800
- if (rowX > 0 && rowX + entryWidth > availableWidth) {
9801
- rowCount++;
9802
- rowX = entryWidth;
9803
- } else {
9804
- rowX += entryWidth;
9805
- }
9806
- }
9807
- rowCount = Math.min(rowCount, 2);
9808
- const legendHeight = rowCount * ROW_HEIGHT;
9778
+ const { rowCount } = measureLegendWrap(entries, availableWidth, labelStyle);
9779
+ const cappedRowCount = Math.min(rowCount, 2);
9780
+ const legendHeight = cappedRowCount * ROW_HEIGHT;
9809
9781
  bounds = {
9810
9782
  x: area.x,
9811
9783
  y: area.y,
@@ -9818,9 +9790,9 @@ function buildSankeyLegend(nodeColorMap, colorField, data, sourceField, targetFi
9818
9790
  entries,
9819
9791
  bounds,
9820
9792
  labelStyle,
9821
- swatchSize: SWATCH_SIZE3,
9822
- swatchGap: SWATCH_GAP3,
9823
- entryGap: ENTRY_GAP3
9793
+ swatchSize: SWATCH_SIZE2,
9794
+ swatchGap: SWATCH_GAP2,
9795
+ entryGap: ENTRY_GAP2
9824
9796
  };
9825
9797
  }
9826
9798
  function formatFlowValue(value2, valueFormat) {
@@ -9828,7 +9800,7 @@ function formatFlowValue(value2, valueFormat) {
9828
9800
  const fmt = buildD3Formatter5(valueFormat);
9829
9801
  if (fmt) return fmt(value2);
9830
9802
  }
9831
- return formatNumber7(value2);
9803
+ return formatNumber3(value2);
9832
9804
  }
9833
9805
  function buildTooltipDescriptors(nodes, links, valueFormat) {
9834
9806
  const descriptors = /* @__PURE__ */ new Map();
@@ -9876,9 +9848,9 @@ function emptyLayout(area, chrome, theme, options, watermark) {
9876
9848
  fill: theme.colors.text,
9877
9849
  lineHeight: 1.3
9878
9850
  },
9879
- swatchSize: SWATCH_SIZE3,
9880
- swatchGap: SWATCH_GAP3,
9881
- entryGap: ENTRY_GAP3
9851
+ swatchSize: SWATCH_SIZE2,
9852
+ swatchGap: SWATCH_GAP2,
9853
+ entryGap: ENTRY_GAP2
9882
9854
  },
9883
9855
  tooltipDescriptors: /* @__PURE__ */ new Map(),
9884
9856
  a11y: {
@@ -9897,7 +9869,7 @@ function emptyLayout(area, chrome, theme, options, watermark) {
9897
9869
  }
9898
9870
 
9899
9871
  // src/tables/compile-table.ts
9900
- import { computeChrome as computeChrome4, estimateTextWidth as estimateTextWidth11 } from "@opendata-ai/openchart-core";
9872
+ import { computeChrome as computeChrome4, estimateTextWidth as estimateTextWidth12 } from "@opendata-ai/openchart-core";
9901
9873
 
9902
9874
  // src/tables/bar-column.ts
9903
9875
  var NEGATIVE_BAR_COLOR = "#c44e52";
@@ -10014,7 +9986,7 @@ function computeCategoryColors(data, column, theme, darkMode) {
10014
9986
  }
10015
9987
 
10016
9988
  // src/tables/format-cells.ts
10017
- import { buildD3Formatter as buildD3Formatter6, formatDate as formatDate2, formatNumber as formatNumber8 } from "@opendata-ai/openchart-core";
9989
+ import { buildD3Formatter as buildD3Formatter6, formatDate as formatDate2, formatNumber as formatNumber4 } from "@opendata-ai/openchart-core";
10018
9990
  function isNumericValue(value2) {
10019
9991
  if (typeof value2 === "number") return Number.isFinite(value2);
10020
9992
  return false;
@@ -10045,7 +10017,7 @@ function formatCell(value2, column) {
10045
10017
  if (isNumericValue(value2)) {
10046
10018
  return {
10047
10019
  value: value2,
10048
- formattedValue: formatNumber8(value2),
10020
+ formattedValue: formatNumber4(value2),
10049
10021
  style
10050
10022
  };
10051
10023
  }
@@ -10071,7 +10043,7 @@ function formatValueForSearch(value2, column) {
10071
10043
  }
10072
10044
  }
10073
10045
  if (isNumericValue(value2)) {
10074
- return formatNumber8(value2);
10046
+ return formatNumber4(value2);
10075
10047
  }
10076
10048
  return String(value2);
10077
10049
  }
@@ -10312,13 +10284,13 @@ function estimateColumnWidth(col, data, fontSize) {
10312
10284
  if (col.image) return (col.image.width ?? 24) + PADDING;
10313
10285
  if (col.flag) return 60;
10314
10286
  const label = col.label ?? col.key;
10315
- const headerWidth = estimateTextWidth11(label, fontSize, 600) + PADDING;
10287
+ const headerWidth = estimateTextWidth12(label, fontSize, 600) + PADDING;
10316
10288
  const sampleSize = Math.min(100, data.length);
10317
10289
  let maxDataWidth = 0;
10318
10290
  for (let i = 0; i < sampleSize; i++) {
10319
10291
  const val = data[i][col.key];
10320
10292
  const text = val == null ? "" : String(val);
10321
- const width = estimateTextWidth11(text, fontSize, 400) + PADDING;
10293
+ const width = estimateTextWidth12(text, fontSize, 400) + PADDING;
10322
10294
  if (width > maxDataWidth) maxDataWidth = width;
10323
10295
  }
10324
10296
  return Math.max(MIN_WIDTH, headerWidth, maxDataWidth);
@@ -10546,7 +10518,7 @@ function compileTableLayout(spec, options, theme) {
10546
10518
  import {
10547
10519
  buildTemporalFormatter as buildTemporalFormatter2,
10548
10520
  formatDate as formatDate3,
10549
- formatNumber as formatNumber9,
10521
+ formatNumber as formatNumber5,
10550
10522
  getRepresentativeColor as getRepresentativeColor10
10551
10523
  } from "@opendata-ai/openchart-core";
10552
10524
  function formatValue(value2, fieldType, format2) {
@@ -10561,10 +10533,10 @@ function formatValue(value2, fieldType, format2) {
10561
10533
  try {
10562
10534
  return format(format2)(value2);
10563
10535
  } catch {
10564
- return formatNumber9(value2);
10536
+ return formatNumber5(value2);
10565
10537
  }
10566
10538
  }
10567
- return formatNumber9(value2);
10539
+ return formatNumber5(value2);
10568
10540
  }
10569
10541
  return String(value2);
10570
10542
  }