@lilt-ui/charts 0.9.1 → 0.10.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 (40) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +40 -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 +9 -3
  6. package/dist/cards/chart-card.d.ts +7 -3
  7. package/dist/cards/funnel-chart-card.d.ts +9 -3
  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 +82 -0
  12. package/dist/cards/progress-card.d.ts +7 -2
  13. package/dist/cards/radar-chart-card.d.ts +9 -3
  14. package/dist/cards/radial-chart-card.d.ts +9 -3
  15. package/dist/cards/range-select.d.ts +28 -0
  16. package/dist/cards/sankey-chart-card.d.ts +7 -2
  17. package/dist/cards/scatter-chart-card.d.ts +9 -3
  18. package/dist/cards/slope-chart-card.d.ts +7 -2
  19. package/dist/cards/stat-card.d.ts +7 -2
  20. package/dist/cards/strip-chart-card.d.ts +15 -0
  21. package/dist/cards/timeline-chart-card.d.ts +18 -0
  22. package/dist/cards/treemap-chart-card.d.ts +24 -0
  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 +324 -326
  29. package/dist/index.d.ts +11 -1
  30. package/dist/index.js +3258 -2144
  31. package/dist/marks/contract.d.ts +0 -2
  32. package/dist/motion/use-chart-motion.d.ts +5 -0
  33. package/dist/motion/use-departing.d.ts +7 -0
  34. package/dist/motion/use-snap-bars.d.ts +27 -0
  35. package/dist/{report-context-CkzH-r8B.js → report-context-UrwaoLYZ.js} +416 -238
  36. package/dist/{skeleton-block-CHH5SIAo.js → skeleton-block-C8gOUsxn.js} +1672 -1422
  37. package/dist/styles.css +1 -1
  38. package/dist/watch/board/board-state.d.ts +0 -2
  39. package/dist/watch.js +129 -127
  40. package/package.json +1 -1
@@ -0,0 +1,18 @@
1
+ import { TextKey, TimeKey } from './keys';
2
+ import { ObservationsCardProps, ObservationScene } from './observations-card';
3
+ export interface TimelineChartCardProps<Row> extends ObservationsCardProps<Row> {
4
+ label: TextKey<Row>;
5
+ /** Optional stable identity when labels repeat. */
6
+ id?: TextKey<Row>;
7
+ start: TimeKey<Row>;
8
+ end: TimeKey<Row>;
9
+ /** Intervals sharing a lane stack into subrows when they overlap. */
10
+ lane?: TextKey<Row>;
11
+ /** Optional color category, such as a machine state. */
12
+ group?: TextKey<Row>;
13
+ /** Formats UTC axis labels and interval endpoints. */
14
+ formatTime?: (timestamp: number) => string;
15
+ }
16
+ export declare function intervalTime(value: unknown): number | null;
17
+ export declare function timelineLayout<Row>(data: readonly Row[], options: Pick<TimelineChartCardProps<Row>, 'label' | 'id' | 'start' | 'end' | 'lane' | 'group' | 'color'>, width: number, height: number, formatTime: (time: number) => string): ObservationScene<Row>;
18
+ export declare function TimelineChartCard<Row>({ label, id, start, end, lane, group, color, formatTime: suppliedFormatTime, locale, formatValue, aggregate, ...props }: TimelineChartCardProps<Row>): import("react/jsx-runtime").JSX.Element;
@@ -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 {};
@@ -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
+ };
@@ -3,7 +3,12 @@ import { ChartAxis, ChartBackground, ChartHoverStyle, ChartLoadingStyle, ChartMo
3
3
  import { AnimatedNumberVariant } from '../../motion/animated-number';
4
4
  import { BookLevel } from '../indicators';
5
5
  export interface DepthChartCardProps {
6
- title: string;
6
+ /** Optional visible title. Use aria-label to name an embedded chart. */
7
+ title?: string;
8
+ /** Show the header, including headline and period controls. Defaults to true. */
9
+ header?: boolean;
10
+ /** Accessible name, independent of the visible title. */
11
+ 'aria-label'?: string;
7
12
  /** Resting buy orders: a price and the size at it. Order does not matter. */
8
13
  bids: readonly BookLevel[];
9
14
  /** Resting sell orders. */
@@ -32,4 +37,4 @@ export interface DepthChartCardProps {
32
37
  * Order book depth: how much could trade at each price, buying and selling, as stepped areas, with
33
38
  * the mid, spread and total depth in the header. Hover reads the size resting at each price.
34
39
  */
35
- export declare function DepthChartCard({ title, bids, asks, valueFormat, sizeFormat, locale, height, axis, background, hoverStyle, surface, numberStyle, loading, loadingStyle, motion, className, style, depth, }: DepthChartCardProps): ReactElement;
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;
@@ -2,7 +2,12 @@ import { CSSProperties, ReactElement } from 'react';
2
2
  import { ChartLoadingStyle, ChartMotion, ChartStyle, ChartSurface } from '../types';
3
3
  import { BookLevel } from './indicators';
4
4
  export interface OrderBookProps {
5
- title: string;
5
+ /** Optional visible table caption. */
6
+ title?: string;
7
+ /** Show the caption. Column headings remain available. Defaults to true. */
8
+ header?: boolean;
9
+ /** Accessible name, independent of the visible caption. */
10
+ 'aria-label'?: string;
6
11
  bids: readonly BookLevel[];
7
12
  asks: readonly BookLevel[];
8
13
  /** Price levels shown on each side of the spread. Defaults to 8. */
@@ -27,4 +32,4 @@ export interface OrderBookProps {
27
32
  * A price ladder: asks above, bids below, a spread row between, and a depth bar behind each
28
33
  * level sized by its running total. It is a real table, so screen readers read it row by row.
29
34
  */
30
- export declare function OrderBook({ title, bids, asks, levels, depth, valueFormat, sizeFormat, locale, flash, surface, loading, loadingStyle, motion, className, style, }: OrderBookProps): ReactElement;
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;