@bitcobblers/wod-wiki-ui 0.55.2206 → 0.56.2210

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.
@@ -330,7 +330,7 @@ var lineIdsExtension = view.ViewPlugin.fromClass(
330
330
  if (!label) label = timestamp;
331
331
  }
332
332
  id = label.toLowerCase().replace(/[^\w]+/g, "-");
333
- } else if (/^```(time|log)/.test(trimmed)) {
333
+ } else if (/^```(time|wod|whiteboard|log)/i.test(trimmed)) {
334
334
  id = `workout-line-${i}`;
335
335
  }
336
336
  if (id && line.from >= view$1.viewport.from && line.to <= view$1.viewport.to) {
@@ -6706,6 +6706,27 @@ function QueryValue({ result, unit: unitProp, label, thresholds }) {
6706
6706
  ] })
6707
6707
  ] });
6708
6708
  }
6709
+ function formatWithUnit(formattedNumber, unit) {
6710
+ const cleanUnit = unit?.trim();
6711
+ return cleanUnit ? `${formattedNumber} ${cleanUnit}` : formattedNumber;
6712
+ }
6713
+ function formatTimeseriesTick(value, unit) {
6714
+ const numeric = Number(value);
6715
+ if (!Number.isFinite(numeric)) {
6716
+ return formatWithUnit(String(value), unit);
6717
+ }
6718
+ const maximumFractionDigits = Math.abs(numeric) >= 100 ? 0 : 1;
6719
+ const formatted = new Intl.NumberFormat(void 0, { maximumFractionDigits }).format(numeric);
6720
+ return formatWithUnit(formatted, unit);
6721
+ }
6722
+ function formatTimeseriesTooltipValue(value, unit) {
6723
+ const numeric = Number(value);
6724
+ if (!Number.isFinite(numeric)) {
6725
+ return formatWithUnit(String(value), unit);
6726
+ }
6727
+ const formatted = new Intl.NumberFormat(void 0, { maximumFractionDigits: 1 }).format(numeric);
6728
+ return formatWithUnit(formatted, unit);
6729
+ }
6709
6730
  function WqlTimeseries({ result, unit: unitProp }) {
6710
6731
  const shape = useChartShape(result);
6711
6732
  const data2 = React2.useMemo(() => mergeSeries(result.series), [result]);
@@ -6734,7 +6755,7 @@ function WqlTimeseries({ result, unit: unitProp }) {
6734
6755
  width: 64,
6735
6756
  stroke: "hsl(var(--muted-foreground))",
6736
6757
  tick: { fill: "hsl(var(--muted-foreground))", fontSize: 10 },
6737
- unit: unit ? ` ${unit}` : ""
6758
+ tickFormatter: (v) => formatTimeseriesTick(v, unit)
6738
6759
  }
6739
6760
  ),
6740
6761
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -6747,7 +6768,7 @@ function WqlTimeseries({ result, unit: unitProp }) {
6747
6768
  color: "hsl(var(--popover-foreground))"
6748
6769
  },
6749
6770
  labelFormatter: (v) => tooltipTimestamp(v),
6750
- formatter: (v) => [`${Number(v).toLocaleString()} ${unit ?? ""}`.trim(), ""]
6771
+ formatter: (v) => [formatTimeseriesTooltipValue(v, unit), ""]
6751
6772
  }
6752
6773
  ),
6753
6774
  result.series.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, { wrapperStyle: { fontSize: 11 } }),
@@ -6822,9 +6843,6 @@ function WqlBars({ result, unit: unitProp }) {
6822
6843
  ] }) });
6823
6844
  }
6824
6845
  var MAX_ROWS = 12;
6825
- function formatValue(v, unit) {
6826
- return `${v.toLocaleString()}${unit ? ` ${unit}` : ""}`;
6827
- }
6828
6846
  function WqlTable({ result, unit: unitProp }) {
6829
6847
  const shape = useChartShape(result);
6830
6848
  const unit = result.series[0]?.unit ?? unitProp ?? "";
@@ -6832,14 +6850,14 @@ function WqlTable({ result, unit: unitProp }) {
6832
6850
  if (shape.kind === "scalar") {
6833
6851
  return {
6834
6852
  head: ["Metric", "Value"],
6835
- body: [[result.series[0]?.label ?? "scalar", formatValue(shape.value, unit)]],
6853
+ body: [[result.series[0]?.label ?? "scalar", formatTimeseriesTooltipValue(shape.value, unit)]],
6836
6854
  more: 0
6837
6855
  };
6838
6856
  }
6839
6857
  if (shape.kind === "bars") {
6840
6858
  const all = result.series.map((s) => [
6841
6859
  s.label,
6842
- formatValue(s.points[0]?.value ?? 0, unit)
6860
+ formatTimeseriesTooltipValue(s.points[0]?.value ?? 0, unit)
6843
6861
  ]);
6844
6862
  return {
6845
6863
  head: ["Series", "Value"],
@@ -6860,7 +6878,7 @@ function WqlTable({ result, unit: unitProp }) {
6860
6878
  formatTimestamp(ts),
6861
6879
  ...result.series.map((s) => {
6862
6880
  const v = seriesMap.get(s.label)?.get(ts);
6863
- return v !== void 0 ? formatValue(v, unit) : "\u2014";
6881
+ return v !== void 0 ? formatTimeseriesTooltipValue(v, unit) : "\u2014";
6864
6882
  })
6865
6883
  ]);
6866
6884
  return { head, body, more: Math.max(0, timestamps.length - MAX_ROWS) };