@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,29 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ import { ChartEmptyLook, ChartEmptyState } from '../types';
3
+ /** The outline a chart family lays behind its empty message with the `shape` look. */
4
+ export type ChartEmptyShape = 'wave' | 'bars' | 'rows' | 'ring' | 'points' | 'tiles' | 'web' | 'flow';
5
+ /** Set by a card around its chart, so the chart's empty slot draws the family's own outline. */
6
+ export declare const EmptyShapeContext: import('react').Context<ChartEmptyShape>;
7
+ export interface ChartEmptyProps {
8
+ /** `dots` (default) or the chart's own `shape`. */
9
+ look?: ChartEmptyLook;
10
+ /** The message. Defaults to the chart's own, e.g. "No data for this period". */
11
+ children?: ReactNode;
12
+ }
13
+ /**
14
+ * Lilt's empty state: a still look and one quiet line. Pass it to a chart's `empty` prop with your
15
+ * own words, e.g. `empty={<ChartEmpty>No visits yet</ChartEmpty>}`; inside a chart it takes the
16
+ * chart's shape and message.
17
+ */
18
+ export declare function ChartEmpty({ look, children }: ChartEmptyProps): ReactElement;
19
+ /**
20
+ * Where a chart's empty state sits. Over a plot it fills the plot area; in place of a card's body
21
+ * (`block`) it holds the body's height, so an empty card keeps its size. The outline defaults to
22
+ * the one the card around it names.
23
+ */
24
+ export declare function EmptySlot({ state, shape: ownShape, message, block, }: {
25
+ state?: ChartEmptyState;
26
+ shape?: ChartEmptyShape;
27
+ message?: string;
28
+ block?: boolean;
29
+ }): ReactElement | null;
@@ -60,5 +60,3 @@ export declare function markSeries<T>(mark: string, descriptors: readonly ChartS
60
60
  export declare function rowFields(row: NormalizedRow<unknown>, series: string, fields: readonly string[]): number[] | null;
61
61
  /** An observation's own color, falling back to the series color. */
62
62
  export declare function observationColor<T>(descriptor: ChartSeries<T>, row: NormalizedRow<T>, fallback: string): string;
63
- /** Rows whose x lies in the visible domain. */
64
- export declare function rowsInView<T>(snapshot: ChartSnapshot<T>): readonly NormalizedRow<T>[];
@@ -5,6 +5,11 @@ export interface TimelineSpec {
5
5
  key: string | number;
6
6
  duration: number;
7
7
  active: boolean;
8
+ /**
9
+ * Run on Lilt's spring instead of the reveal ease, keeping its slight overshoot: progress may
10
+ * pass 1 briefly before it settles there. For marks that should land like physical objects.
11
+ */
12
+ spring?: boolean;
8
13
  }
9
14
  export declare function useChartTimeline(spec: TimelineSpec, reducedMotion: boolean): number;
10
15
  export { REVEAL_EASE };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Items that just left the data, kept for `duration` milliseconds so they can animate out
3
+ * instead of vanishing. Changes are detected by key, so a list rebuilt every render is fine, and
4
+ * each departing item keeps the last place it was drawn. Derived while rendering, so it is never
5
+ * missing for a frame before its exit starts; an item that comes back stops departing at once.
6
+ */
7
+ export declare function useDeparting<T>(items: readonly T[], keyOf: (item: T) => string, duration: number): readonly T[];
@@ -0,0 +1,27 @@
1
+ import { BarGeometry } from '../engine/bars';
2
+ /** One bar as drawn on a frame of a snap: its geometry and how far it has risen. */
3
+ export interface SnapBar {
4
+ key: string;
5
+ bar: BarGeometry;
6
+ /** Share of the bar's height above its floor: 0 drained, 1 full; a spring may overshoot. */
7
+ rise: number;
8
+ opacity: number;
9
+ /** Gaussian blur in pixels while the bar arrives or leaves. */
10
+ blur: number;
11
+ leaving: boolean;
12
+ }
13
+ /** Closed-form damped spring from 0 to 1 that lands with a slight overshoot in about 0.55s. */
14
+ export declare function snapSpring(seconds: number): number;
15
+ /**
16
+ * Bars that behave like real objects when the set of bars changes, such as a new period: new
17
+ * bars rise out of the floor with a soft blur, leaving bars drain back into it and narrow toward
18
+ * where their gap closes, and the rest spring to their new places, widths and heights. Returns
19
+ * the frame to draw while that runs, and `null` when at rest, so ordinary updates and the first
20
+ * entrance are untouched. `pulse` counts snaps, to restart the plot's light motion blur.
21
+ */
22
+ export declare function useSnapBars(bars: readonly BarGeometry[] | undefined, keyOf: (bar: BarGeometry) => string, enabled: boolean,
23
+ /** The chart is revealing its first data: every bar arrives the way new bars do. */
24
+ entrance?: boolean): {
25
+ frame: SnapBar[] | null;
26
+ pulse: number;
27
+ };