@usetheo/ui 0.32.0 → 0.34.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, markedPoints, niceMax, seriesPath, TrendChart, type TrendChartProps, type TrendPoint, type TrendSeries, } from "./trend-chart.js";
|
|
@@ -50,6 +50,29 @@ 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` pontos FINITOS) — 1-4 pontos leem como um penhasco
|
|
60
|
+
* dramático; o marcador ancora o leitor no dado real. Regra do M76 — que passou a contar dado,
|
|
61
|
+
* não slot, porque a densificação do M144 desfez a equivalência entre os dois.
|
|
62
|
+
* 2. **Ponto isolado** — um ponto finito cercado de lacunas dos dois lados vira um `M` sozinho no
|
|
63
|
+
* `path`, e um `M` sozinho **desenha nada**: bounding-box zero, invisível. O dado existe, está
|
|
64
|
+
* correto, e o operador não vê. Medido no e2e do M144 (`d="M419.86,92.00 M448.00,36.00"`).
|
|
65
|
+
*
|
|
66
|
+
* A regra antiga só cobria (1), chaveando no TOTAL de pontos em vez de perguntar se o ponto de fato
|
|
67
|
+
* é desenhado — apesar de o comentário dela já declarar a intenção *"a dot keeps real data from
|
|
68
|
+
* rendering as an invisible line"*. Depois da densificação, uma série de 30 dias com dois dias
|
|
69
|
+
* finitos separados por lacuna cai fora de (1) e desaparece. Chart.js e Plotly marcam o ponto
|
|
70
|
+
* isolado exatamente por isto.
|
|
71
|
+
*
|
|
72
|
+
* Fora do JSX de propósito: é a aritmética da decisão, e aritmética isolada é aritmética que a
|
|
73
|
+
* mutação alcança.
|
|
74
|
+
*/
|
|
75
|
+
export declare function markedPoints(points: TrendPoint[]): TrendPoint[];
|
|
53
76
|
export interface TrendChartProps extends HTMLAttributes<HTMLElement> {
|
|
54
77
|
title: string;
|
|
55
78
|
series: TrendSeries[];
|
package/dist/index.js
CHANGED
|
@@ -5110,6 +5110,12 @@ 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 markedPoints(points) {
|
|
5114
|
+
const finito = (p) => Number.isFinite(p?.y);
|
|
5115
|
+
const finitos = points.filter(finito);
|
|
5116
|
+
if (finitos.length < SPARSE_MARKER_MAX) return finitos;
|
|
5117
|
+
return points.filter((p, i) => finito(p) && !finito(points[i - 1]) && !finito(points[i + 1]));
|
|
5118
|
+
}
|
|
5113
5119
|
var TrendChart = forwardRef(
|
|
5114
5120
|
({
|
|
5115
5121
|
title,
|
|
@@ -5219,18 +5225,18 @@ var TrendChart = forwardRef(
|
|
|
5219
5225
|
children: /* @__PURE__ */ jsx("title", { children: s.name })
|
|
5220
5226
|
}
|
|
5221
5227
|
),
|
|
5222
|
-
s.points
|
|
5228
|
+
markedPoints(s.points).map((p, i) => /* @__PURE__ */ jsx(
|
|
5223
5229
|
"circle",
|
|
5224
5230
|
{
|
|
5225
5231
|
"data-slot": "trend-chart-dot",
|
|
5226
5232
|
cx: xScale(p.x),
|
|
5227
5233
|
cy: yScale(p.y),
|
|
5228
|
-
r:
|
|
5234
|
+
r: 4,
|
|
5229
5235
|
fill: s.color,
|
|
5230
5236
|
children: /* @__PURE__ */ jsx("title", { children: s.name })
|
|
5231
5237
|
},
|
|
5232
5238
|
`${s.name}-${p.x}-${i}`
|
|
5233
|
-
))
|
|
5239
|
+
))
|
|
5234
5240
|
] }, s.name))
|
|
5235
5241
|
]
|
|
5236
5242
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usetheo/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.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
|
|
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"
|