@usetheo/ui 0.32.0 → 0.33.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.
@@ -1 +1 @@
1
- export { linScale, niceMax, seriesPath, TrendChart, type TrendChartProps, type TrendPoint, type TrendSeries, } from "./trend-chart.js";
1
+ export { linScale, niceMax, pontosComMarcador, seriesPath, TrendChart, type TrendChartProps, type TrendPoint, type TrendSeries, } from "./trend-chart.js";
@@ -50,6 +50,28 @@ export declare function niceMax(values: number[]): number;
50
50
  * marker is what makes it visible.
51
51
  */
52
52
  export declare function seriesPath(points: TrendPoint[], xScale: (x: number) => number, yScale: (y: number) => number): string;
53
+ /**
54
+ * Quais pontos recebem marcador.
55
+ *
56
+ * Duas razões distintas para marcar, e a segunda só apareceu quando séries com lacuna passaram a
57
+ * existir (M144):
58
+ *
59
+ * 1. **Série esparsa** (< `SPARSE_MARKER_MAX` baldes) — 1-4 pontos leem como um penhasco dramático;
60
+ * o marcador ancora o leitor no dado real. Regra do M76, preservada.
61
+ * 2. **Ponto isolado** — um ponto finito cercado de lacunas dos dois lados vira um `M` sozinho no
62
+ * `path`, e um `M` sozinho **desenha nada**: bounding-box zero, invisível. O dado existe, está
63
+ * correto, e o operador não vê. Medido no e2e do M144 (`d="M419.86,92.00 M448.00,36.00"`).
64
+ *
65
+ * A regra antiga só cobria (1), chaveando no TOTAL de pontos em vez de perguntar se o ponto de fato
66
+ * é desenhado — apesar de o comentário dela já declarar a intenção *"a dot keeps real data from
67
+ * rendering as an invisible line"*. Depois da densificação, uma série de 30 dias com dois dias
68
+ * finitos separados por lacuna cai fora de (1) e desaparece. Chart.js e Plotly marcam o ponto
69
+ * isolado exatamente por isto.
70
+ *
71
+ * Fora do JSX de propósito: é a aritmética da decisão, e aritmética isolada é aritmética que a
72
+ * mutação alcança.
73
+ */
74
+ export declare function pontosComMarcador(points: TrendPoint[]): TrendPoint[];
53
75
  export interface TrendChartProps extends HTMLAttributes<HTMLElement> {
54
76
  title: string;
55
77
  series: TrendSeries[];
package/dist/index.js CHANGED
@@ -5110,6 +5110,11 @@ function seriesPath(points, xScale, yScale) {
5110
5110
  var VIEW_W = 600;
5111
5111
  var PAD = { top: 8, right: 8, bottom: 4, left: 40 };
5112
5112
  var SPARSE_MARKER_MAX = 5;
5113
+ function pontosComMarcador(points) {
5114
+ const finito = (p) => Number.isFinite(p?.y);
5115
+ if (points.length < SPARSE_MARKER_MAX) return points.filter(finito);
5116
+ return points.filter((p, i) => finito(p) && !finito(points[i - 1]) && !finito(points[i + 1]));
5117
+ }
5113
5118
  var TrendChart = forwardRef(
5114
5119
  ({
5115
5120
  title,
@@ -5219,7 +5224,7 @@ var TrendChart = forwardRef(
5219
5224
  children: /* @__PURE__ */ jsx("title", { children: s.name })
5220
5225
  }
5221
5226
  ),
5222
- s.points.length < SPARSE_MARKER_MAX ? s.points.filter((p) => Number.isFinite(p.y)).map((p, i) => /* @__PURE__ */ jsx(
5227
+ pontosComMarcador(s.points).map((p, i) => /* @__PURE__ */ jsx(
5223
5228
  "circle",
5224
5229
  {
5225
5230
  "data-slot": "trend-chart-dot",
@@ -5230,7 +5235,7 @@ var TrendChart = forwardRef(
5230
5235
  children: /* @__PURE__ */ jsx("title", { children: s.name })
5231
5236
  },
5232
5237
  `${s.name}-${p.x}-${i}`
5233
- )) : null
5238
+ ))
5234
5239
  ] }, s.name))
5235
5240
  ]
5236
5241
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@usetheo/ui",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "packageManager": "pnpm@10.32.1+sha512.a706938f0e89ac1456b6563eab4edf1d1faf3368d1191fc5c59790e96dc918e4456ab2e67d613de1043d2e8c81f87303e6b40d4ffeca9df15ef1ad567348f2be",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
- "description": "Violet Forge design system \u2014 generic React components + primitives (the non-AI foundation of @theokit/ui).",
7
+ "description": "Violet Forge design system — generic React components + primitives (the non-AI foundation of @theokit/ui).",
8
8
  "sideEffects": false,
9
9
  "files": [
10
10
  "dist"