@lilt-ui/charts 0.9.2 → 0.11.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +36 -10
  3. package/dist/cards/activity-ring-card.d.ts +7 -2
  4. package/dist/cards/calendar-heatmap-card.d.ts +18 -0
  5. package/dist/cards/cartesian-card.d.ts +10 -2
  6. package/dist/cards/chart-card.d.ts +4 -1
  7. package/dist/cards/funnel-chart-card.d.ts +7 -2
  8. package/dist/cards/heatmap-chart-card.d.ts +7 -2
  9. package/dist/cards/horizontal-bar-chart-card.d.ts +7 -2
  10. package/dist/cards/keys.d.ts +2 -0
  11. package/dist/cards/observations-card.d.ts +87 -0
  12. package/dist/cards/radar-chart-card.d.ts +7 -2
  13. package/dist/cards/radial-chart-card.d.ts +7 -2
  14. package/dist/cards/range-select.d.ts +28 -0
  15. package/dist/cards/sankey-chart-card.d.ts +7 -2
  16. package/dist/cards/scatter-chart-card.d.ts +7 -2
  17. package/dist/cards/slope-chart-card.d.ts +7 -2
  18. package/dist/cards/stat-card.d.ts +7 -2
  19. package/dist/cards/strip-chart-card.d.ts +15 -0
  20. package/dist/cards/timeline-chart-card.d.ts +18 -0
  21. package/dist/cards/treemap-chart-card.d.ts +24 -0
  22. package/dist/chart.d.ts +1 -1
  23. package/dist/engine/keyed.d.ts +19 -0
  24. package/dist/engine/lifecycle.d.ts +1 -1
  25. package/dist/engine/sankey.d.ts +16 -0
  26. package/dist/finance/cards/depth-chart-card.d.ts +7 -2
  27. package/dist/finance/order-book.d.ts +7 -2
  28. package/dist/finance.js +334 -327
  29. package/dist/index.d.ts +14 -2
  30. package/dist/index.js +3336 -2217
  31. package/dist/lifecycle/chart-empty.d.ts +29 -0
  32. package/dist/marks/contract.d.ts +0 -2
  33. package/dist/motion/use-chart-motion.d.ts +5 -0
  34. package/dist/motion/use-departing.d.ts +7 -0
  35. package/dist/motion/use-snap-bars.d.ts +27 -0
  36. package/dist/{report-context-CVNzZBRd.js → report-context-UrwaoLYZ.js} +408 -231
  37. package/dist/{skeleton-block-Ha7mwDOY.js → skeleton-block-CPaKI7op.js} +2188 -1813
  38. package/dist/styles.css +1 -1
  39. package/dist/types.d.ts +14 -0
  40. package/dist/watch/board/board-state.d.ts +0 -2
  41. package/dist/watch.js +129 -127
  42. package/package.json +11 -10
@@ -0,0 +1,24 @@
1
+ import { NumericKey, TextKey } from './keys';
2
+ import { ObservationsCardProps, ObservationScene } from './observations-card';
3
+ export interface TreemapChartCardProps<Row, Key extends NumericKey<Row>> extends ObservationsCardProps<Row> {
4
+ /** Unique text field naming each leaf within its group. */
5
+ label: TextKey<Row>;
6
+ /** Nonnegative area. Null is missing; zero has no area. */
7
+ value: Key;
8
+ /** Optional parent category. Input rows are leaves, never parent totals. */
9
+ group?: TextKey<Row>;
10
+ }
11
+ interface Rect {
12
+ x: number;
13
+ y: number;
14
+ width: number;
15
+ height: number;
16
+ }
17
+ /** Balanced binary tiling. Input order stays deterministic, with no random placement. */
18
+ export declare function tileAreas<T>(items: readonly T[], weight: (item: T) => number, rect: Rect): {
19
+ item: T;
20
+ rect: Rect;
21
+ }[];
22
+ export declare function treemapLayout<Row>(data: readonly Row[], label: string, value: string, group: string | undefined, width: number, height: number, color?: string): ObservationScene<Row>;
23
+ export declare function TreemapChartCard<Row, const Key extends NumericKey<Row>>({ label, value, group, color, ...props }: TreemapChartCardProps<Row, Key>): import("react/jsx-runtime").JSX.Element;
24
+ export {};
package/dist/chart.d.ts CHANGED
@@ -15,5 +15,5 @@ type ChartPlotRendererProps<T> = Omit<ChartProps<T>, 'className' | 'style'> & Om
15
15
  controllerLinked?: boolean;
16
16
  tooltipNode?: ReactNode;
17
17
  };
18
- export declare function ChartPlotRenderer<T>({ data, x, y, series, height, compactHeight, margins: marginProps, arrangement, marks, barLayout: barsProps, compact, tooltipNode, inspectionSeries: plotInspectionSeries, className, style, 'aria-label': ariaLabel, children, status, loadingStyle, interactive, error, renderRetry, motion: motionPreference, animateIn, resetKey, onSelectionChange, controller, linkedSelection, selectedCategoryId, onSelectedCategoryIdChange, compare, focus, live, brush, visibleSeries, onVisibleSeriesChange, toolkit, model, controllerLinked, axis: axisProp, pill, pillSeries, pillValue, pillPosition, axisInset, decimate, runoff, labelOverhang, }: ChartPlotRendererProps<T>): ReactElement;
18
+ export declare function ChartPlotRenderer<T>({ data, x, y, series, height, compactHeight, margins: marginProps, arrangement, marks, barLayout: barsProps, compact, tooltipNode, inspectionSeries: plotInspectionSeries, className, style, 'aria-label': ariaLabel, children, status, loadingStyle, empty: emptyState, interactive, error, renderRetry, motion: motionPreference, animateIn, resetKey, onSelectionChange, controller, linkedSelection, selectedCategoryId, onSelectedCategoryIdChange, compare, focus, live, brush, visibleSeries, onVisibleSeriesChange, toolkit, model, controllerLinked, axis: axisProp, pill, pillSeries, pillValue, pillPosition, axisInset, decimate, runoff, labelOverhang, }: ChartPlotRendererProps<T>): ReactElement;
19
19
  export {};
@@ -0,0 +1,19 @@
1
+ import { ChartSeries } from '../types';
2
+ import { NormalizedData } from './normalize';
3
+ /**
4
+ * Whether a change of rows can morph by x value rather than cross-fade: both frames are time or
5
+ * number data in ascending order, they keep the same series, and they share at least two x values
6
+ * to anchor the glide. A period switch such as 30 → 90 days qualifies; categories do not.
7
+ */
8
+ export declare function canMorphByKey<T>(from: NormalizedData<T>, to: NormalizedData<T>, series: readonly ChartSeries<T>[]): boolean;
9
+ /**
10
+ * One frame of a keyed morph: every row from both frames, in x order. Rows in both ease from
11
+ * their old values to their new ones; rows added after the old last row grow out of its value,
12
+ * so arriving data draws the line forward; other one-sided rows keep their own values, and the
13
+ * gliding domain carries them in or out past the plot edge.
14
+ */
15
+ export declare function keyedFrame<T>(from: NormalizedData<T>, to: NormalizedData<T>, progress: number): NormalizedData<T>;
16
+ /** Ease for something moving across the plot: slow out, quick through, soft landing. */
17
+ export declare function morphEase(progress: number): number;
18
+ /** A domain between two others, at the same eased progress as the data. */
19
+ export declare function mixDomain(from: readonly [number, number], to: readonly [number, number], progress: number): readonly [number, number];
@@ -5,6 +5,6 @@ export interface LifecycleGeneration {
5
5
  isCurrent: (generation: number) => boolean;
6
6
  }
7
7
  export declare function createLifecycleGeneration(): LifecycleGeneration;
8
- export declare function durationForPhase(phase: 'initial' | 'matched-update' | 'topology-update', reducedMotion: boolean, animateIn?: boolean): number;
8
+ export declare function durationForPhase(phase: 'initial' | 'matched-update' | 'keyed-update' | 'topology-update', reducedMotion: boolean, animateIn?: boolean): number;
9
9
  /** Preserve full data fidelity while avoiding repeated per-sample geometry tweens. */
10
10
  export declare function skipDataTweenForWorkload(sampleCount: number, millisecondsSinceLastUpdate: number): boolean;
@@ -34,3 +34,19 @@ export declare function layoutSankey(graph: SankeyGraph, width: number, height:
34
34
  nodes: PositionedSankeyNode[];
35
35
  links: PositionedSankeyLink[];
36
36
  };
37
+ /**
38
+ * A frame between two layouts of the same flows, at `t` from 0 to 1 (a spring may pass 1).
39
+ * Nodes move and resize, links keep their ends attached as they thicken or thin, and nodes or
40
+ * links new to `to` grow from nothing. Matched by id, so a period change reads as the same
41
+ * flows changing rather than a redraw.
42
+ */
43
+ export declare function mixSankeyLayout(from: {
44
+ nodes: readonly PositionedSankeyNode[];
45
+ links: readonly PositionedSankeyLink[];
46
+ }, to: {
47
+ nodes: readonly PositionedSankeyNode[];
48
+ links: readonly PositionedSankeyLink[];
49
+ }, t: number): {
50
+ nodes: PositionedSankeyNode[];
51
+ links: PositionedSankeyLink[];
52
+ };
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, ReactElement } from 'react';
2
- import { ChartAxis, ChartBackground, ChartHoverStyle, ChartLoadingStyle, ChartMotion, ChartStyle, ChartSurface } from '../../types';
2
+ import { ChartAxis, ChartBackground, ChartHoverStyle, ChartLoadingStyle, ChartEmptyState, ChartMotion, ChartStyle, ChartSurface } from '../../types';
3
3
  import { AnimatedNumberVariant } from '../../motion/animated-number';
4
4
  import { BookLevel } from '../indicators';
5
5
  export interface DepthChartCardProps {
@@ -29,6 +29,11 @@ export interface DepthChartCardProps {
29
29
  numberStyle?: AnimatedNumberVariant;
30
30
  loading?: boolean;
31
31
  loadingStyle?: ChartLoadingStyle;
32
+ /**
33
+ * What the card shows when there is no data: `dots` (default), the chart's own `shape`, your
34
+ * own element such as `<ChartEmpty>No book yet</ChartEmpty>`, or `null` for nothing.
35
+ */
36
+ empty?: ChartEmptyState;
32
37
  motion?: ChartMotion;
33
38
  className?: string;
34
39
  style?: CSSProperties | ChartStyle;
@@ -37,4 +42,4 @@ export interface DepthChartCardProps {
37
42
  * Order book depth: how much could trade at each price, buying and selling, as stepped areas, with
38
43
  * the mid, spread and total depth in the header. Hover reads the size resting at each price.
39
44
  */
40
- export declare function DepthChartCard({ title, header, 'aria-label': ariaLabel, bids, asks, valueFormat, sizeFormat, locale, height, axis, background, hoverStyle, surface, numberStyle, loading, loadingStyle, motion, className, style, depth, }: DepthChartCardProps): ReactElement;
45
+ export declare function DepthChartCard({ title, header, 'aria-label': ariaLabel, bids, asks, valueFormat, sizeFormat, locale, height, axis, background, hoverStyle, surface, numberStyle, loading, loadingStyle, empty, motion, className, style, depth, }: DepthChartCardProps): ReactElement;
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, ReactElement } from 'react';
2
- import { ChartLoadingStyle, ChartMotion, ChartStyle, ChartSurface } from '../types';
2
+ import { ChartEmptyState, ChartLoadingStyle, ChartMotion, ChartStyle, ChartSurface } from '../types';
3
3
  import { BookLevel } from './indicators';
4
4
  export interface OrderBookProps {
5
5
  /** Optional visible table caption. */
@@ -24,6 +24,11 @@ export interface OrderBookProps {
24
24
  surface?: ChartSurface;
25
25
  loading?: boolean;
26
26
  loadingStyle?: ChartLoadingStyle;
27
+ /**
28
+ * What the card shows when there is no data: `dots` (default), the chart's own `shape`, your
29
+ * own element such as `<ChartEmpty>No book yet</ChartEmpty>`, or `null` for nothing.
30
+ */
31
+ empty?: ChartEmptyState;
27
32
  motion?: ChartMotion;
28
33
  className?: string;
29
34
  style?: CSSProperties | ChartStyle;
@@ -32,4 +37,4 @@ export interface OrderBookProps {
32
37
  * A price ladder: asks above, bids below, a spread row between, and a depth bar behind each
33
38
  * level sized by its running total. It is a real table, so screen readers read it row by row.
34
39
  */
35
- export declare function OrderBook({ title, header, 'aria-label': ariaLabel, bids, asks, levels, depth, valueFormat, sizeFormat, locale, flash, surface, loading, loadingStyle, motion, className, style, }: OrderBookProps): ReactElement;
40
+ export declare function OrderBook({ title, header, 'aria-label': ariaLabel, bids, asks, levels, depth, valueFormat, sizeFormat, locale, flash, surface, loading, loadingStyle, empty: emptyState, motion, className, style, }: OrderBookProps): ReactElement;