@tetrascience-npm/ts-lib-viz 0.1.4 → 0.1.5

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Version <!-- omit in toc -->
4
4
 
5
- v0.1.4
5
+ v0.1.5
6
6
 
7
7
  ## Table of Contents <!-- omit in toc -->
8
8
 
@@ -60,5 +60,5 @@ export function ColorLegend({ label, domain, ramp, center, breaks, ticks, format
60
60
  return (_jsxs("div", { className: "contents", children: [_jsx("span", { className: "text-xs text-muted-foreground", children: label }), _jsxs("span", { className: "flex min-w-0 flex-col gap-1", children: [_jsxs("svg", { width: BAR_W, height: BAR_H, "aria-hidden": true, children: [_jsx("defs", { children: _jsx("linearGradient", { id: gradientId, x1: "0", x2: "1", y1: "0", y2: "0", children: Array.from({ length: STOPS }, (_, step) => {
61
61
  const t = step / (STOPS - 1);
62
62
  return _jsx("stop", { offset: t, stopColor: ramp(lo + (hi - lo) * t) }, step);
63
- }) }) }), _jsx("rect", { x: 0, y: 0, width: BAR_W, height: BAR_H, fill: `url(#${gradientId})` })] }), named ?? (_jsx("span", { className: "flex justify-between", style: { width: BAR_W }, children: geoms.map((value) => (_jsx("span", { className: "text-2xs text-muted-foreground", style: TABULAR, children: say(value) }, value))) }))] })] }));
63
+ }) }) }), _jsx("rect", { x: 0, y: 0, width: BAR_W, height: BAR_H, fill: `url(#${gradientId})` })] }), named ?? (_jsx("span", { className: "flex justify-between", style: { width: BAR_W }, children: geoms.map((value, index) => (_jsx("span", { className: "text-2xs text-muted-foreground", style: TABULAR, children: say(value) }, `${index}-${value}`))) }))] })] }));
64
64
  }
@@ -406,7 +406,7 @@ function TraceGeoms({ trace, child, ctx }) {
406
406
  return (_jsx(Range, { points: data.readings, x: x, y: y, color: trace.color, fill: style?.fill, glyph: data.glyph, thickness: style?.thickness, opacity: style?.alpha, lineWidth: style?.linewidth }));
407
407
  }
408
408
  if (data.geom === "ribbon") {
409
- return (_jsx(Interval, { points: data.readings, x: x, y: y, color: trace.color, stroke: style?.color, lineWidth: style?.linewidth, opacity: style?.alpha }));
409
+ return (_jsx(Interval, { points: data.readings, x: x, y: y, color: trace.color, stroke: style?.color, lineWidth: style?.linewidth, opacity: style?.alpha, bandOpacity: style?.alpha }));
410
410
  }
411
411
  if (data.geom === "segment") {
412
412
  return (_jsx(Segment, { points: data.segments, x: x, y: y, transposed: transposed, color: trace.color, opacity: style?.alpha, lineWidth: style?.linewidth, arrow: style?.arrow, onHover: (hit) => reportHit(ctx, hit && { hit: { kind: "segment", trace, hit }, at: hit.at }), onSelect: ctx.onSelect ? (hit) => ctx.onSelect?.({ kind: "segment", trace, hit }) : undefined }));
@@ -24,5 +24,7 @@ export interface IntervalProps {
24
24
  stroke?: string;
25
25
  lineWidth?: number;
26
26
  opacity?: number;
27
+ /** Fill opacity of the band. Absent takes the band's default wash, scaled by `opacity`. */
28
+ bandOpacity?: number;
27
29
  }
28
- export declare function Interval({ points, x, y, color, stroke, lineWidth, opacity }: IntervalProps): import("react").JSX.Element | null;
30
+ export declare function Interval({ points, x, y, color, stroke, lineWidth, opacity, bandOpacity }: IntervalProps): import("react").JSX.Element | null;
@@ -17,7 +17,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
17
  import { useMemo } from "react";
18
18
  /** Matches `FitCurve`, so the two kinds of band read as one thing. */
19
19
  const BAND_OPACITY = 0.13;
20
- export function Interval({ points, x, y, color, stroke, lineWidth = 1.5, opacity = 1 }) {
20
+ export function Interval({ points, x, y, color, stroke, lineWidth = 1.5, opacity = 1, bandOpacity }) {
21
21
  const { band, estimate } = useMemo(() => {
22
22
  /* Forward along the high bound and back along the low one, which closes the region in one path. */
23
23
  let top = "";
@@ -35,5 +35,5 @@ export function Interval({ points, x, y, color, stroke, lineWidth = 1.5, opacity
35
35
  }, [points, x, y]);
36
36
  if (points.length < 2)
37
37
  return null;
38
- return (_jsxs("g", { children: [_jsx("path", { d: band, fill: color, fillOpacity: BAND_OPACITY * opacity, stroke: stroke ?? "none", ...(stroke ? { strokeWidth: lineWidth, strokeOpacity: opacity } : {}) }), estimate && (_jsx("path", { d: estimate, fill: "none", stroke: color, strokeWidth: lineWidth, strokeOpacity: opacity, strokeLinejoin: "round", strokeLinecap: "round" }))] }));
38
+ return (_jsxs("g", { children: [_jsx("path", { d: band, fill: color, fillOpacity: bandOpacity ?? BAND_OPACITY * opacity, stroke: stroke ?? "none", ...(stroke ? { strokeWidth: lineWidth, strokeOpacity: opacity } : {}) }), estimate && (_jsx("path", { d: estimate, fill: "none", stroke: color, strokeWidth: lineWidth, strokeOpacity: opacity, strokeLinejoin: "round", strokeLinecap: "round" }))] }));
39
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tetrascience-npm/ts-lib-viz",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",