@quantumwake/terminal-ux-dashboard-components 0.1.26 → 0.1.28

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.d.cts CHANGED
@@ -325,12 +325,18 @@ declare function PieView({ records, groupColumn, data: presetData, style }: PieV
325
325
 
326
326
  interface LineSerie {
327
327
  id: string;
328
+ /** Explicit serie color — STABLE identity coloring: the host assigns a
329
+ * color to the entity, so toggling other series never repaints this
330
+ * one (index-based palette assignment reshuffles on every selection
331
+ * change). Absent ⇒ the fixed-order palette by index. */
332
+ color?: string;
328
333
  /** lo/hi (optional, per point) draw a soft envelope band behind the
329
334
  * line — the reading for "this line summarizes several": the band is
330
- * the min–max spread of what it aggregates. */
335
+ * the min–max spread of what it aggregates. y may be null for an
336
+ * honest gap (the line breaks instead of bridging). */
331
337
  data: {
332
338
  x: string;
333
- y: number;
339
+ y: number | null;
334
340
  lo?: number;
335
341
  hi?: number;
336
342
  }[];
package/dist/index.d.ts CHANGED
@@ -325,12 +325,18 @@ declare function PieView({ records, groupColumn, data: presetData, style }: PieV
325
325
 
326
326
  interface LineSerie {
327
327
  id: string;
328
+ /** Explicit serie color — STABLE identity coloring: the host assigns a
329
+ * color to the entity, so toggling other series never repaints this
330
+ * one (index-based palette assignment reshuffles on every selection
331
+ * change). Absent ⇒ the fixed-order palette by index. */
332
+ color?: string;
328
333
  /** lo/hi (optional, per point) draw a soft envelope band behind the
329
334
  * line — the reading for "this line summarizes several": the band is
330
- * the min–max spread of what it aggregates. */
335
+ * the min–max spread of what it aggregates. y may be null for an
336
+ * honest gap (the line breaks instead of bridging). */
331
337
  data: {
332
338
  x: string;
333
- y: number;
339
+ y: number | null;
334
340
  lo?: number;
335
341
  hi?: number;
336
342
  }[];
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createContext, useContext, useMemo, useRef, useId, useState, useEffect, useCallback, Suspense } from 'react';
1
+ import { createContext, useContext, useMemo, useId, useState, useEffect, useRef, useCallback, Suspense } from 'react';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { interpolateRdYlGn } from 'd3-scale-chromatic';
4
4
  import { ResponsiveBar } from '@nivo/bar';
@@ -666,16 +666,14 @@ function LineView({ records, xColumn, yColumn, data: presetData, style }) {
666
666
  const { frameClass, frameStyle, margin } = chartSizing(style, { top: 20, right: 20, bottom: 60, left: 60 });
667
667
  const colorById = new Map(data.map((serie, i) => [
668
668
  serie.id,
669
- s.seriesColors.length || data.length > 1 ? seriesColor(i, s) : "rgba(96, 165, 250, 0.9)"
669
+ serie.color ?? (s.seriesColors.length || data.length > 1 ? seriesColor(i, s) : "rgba(96, 165, 250, 0.9)")
670
670
  ]));
671
671
  const longest = data.reduce((a, b) => b.data.length > a.data.length ? b : a, { id: "", data: [] });
672
672
  const tickValues = thinTicks(longest.data.map((d) => d.x), s.maxXTicks);
673
- const ceilRef = useRef(0);
674
673
  let yScale = { type: "linear", min: "auto", max: "auto" };
675
674
  if (s.yFromZero) {
676
- const dataMax = Math.max(0, ...data.flatMap((serie) => serie.data.map((d) => Math.max(d.y, d.hi ?? d.y))));
677
- ceilRef.current = Math.max(ceilRef.current, niceCeil(dataMax));
678
- yScale = { type: "linear", min: 0, max: ceilRef.current };
675
+ const dataMax = Math.max(0, ...data.flatMap((serie) => serie.data.map((d) => Math.max(d.y ?? 0, d.hi ?? d.y ?? 0))));
676
+ yScale = { type: "linear", min: 0, max: niceCeil(dataMax) };
679
677
  }
680
678
  const bandedIds = new Set(data.filter((serie) => serie.data.some((d) => d.lo != null)).map((serie) => serie.id));
681
679
  const bandsLayer = ({ series, yScale: yScale2, lineGenerator }) => /* @__PURE__ */ jsx(Fragment, { children: series.map((serie) => {