@lilt-ui/charts 0.5.0 → 0.6.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.
- package/CHANGELOG.md +14 -0
- package/dist/activity-ring.d.ts +3 -2
- package/dist/cards/activity-ring-card.d.ts +3 -2
- package/dist/cards/cartesian-card.d.ts +9 -2
- package/dist/cards/funnel-chart-card.d.ts +3 -2
- package/dist/cards/heatmap-chart-card.d.ts +3 -2
- package/dist/cards/horizontal-bar-chart-card.d.ts +3 -2
- package/dist/cards/progress-card.d.ts +3 -2
- package/dist/cards/radar-chart-card.d.ts +3 -2
- package/dist/cards/radial-chart-card.d.ts +4 -2
- package/dist/cards/sankey-chart-card.d.ts +3 -2
- package/dist/cards/scatter-chart-card.d.ts +3 -2
- package/dist/cards/slope-chart-card.d.ts +3 -2
- package/dist/cards/stat-card.d.ts +3 -2
- package/dist/chart.d.ts +1 -1
- package/dist/finance/cards/depth-chart-card.d.ts +3 -2
- package/dist/finance/order-book.d.ts +4 -2
- package/dist/finance.js +432 -370
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2453 -2045
- package/dist/lifecycle/loading-layer.d.ts +14 -3
- package/dist/lifecycle/skeleton-block.d.ts +6 -0
- package/dist/lifecycle/skeleton-sheen.d.ts +15 -2
- package/dist/lifecycle/use-skeleton-clock.d.ts +5 -0
- package/dist/marks/contract.d.ts +15 -0
- package/dist/marks/range-loading-mark.d.ts +3 -0
- package/dist/primitives/depth-paint.d.ts +5 -1
- package/dist/{cartesian-card-7DAiMU3w.js → skeleton-block-Uf1lywJi.js} +1986 -1761
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +8 -0
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import { ChartAxisStyle } from '../types';
|
|
2
|
+
import { ChartAxisStyle, ChartBarAppearance, ChartLoadingStyle } from '../types';
|
|
3
|
+
import { LoadingMark } from '../marks/contract';
|
|
4
|
+
export { skeletonClock, SKELETON_CYCLE } from './use-skeleton-clock';
|
|
3
5
|
export interface LoadingLayerProps {
|
|
4
6
|
width: number;
|
|
5
7
|
height: number;
|
|
@@ -12,17 +14,26 @@ export interface LoadingLayerProps {
|
|
|
12
14
|
reducedMotion: boolean;
|
|
13
15
|
id: string;
|
|
14
16
|
/** The marks the skeleton stands in for. */
|
|
15
|
-
marks?: 'line' | 'bars' | 'area-stack' | 'bar-stack';
|
|
17
|
+
marks?: 'line' | 'bars' | 'area-stack' | 'bar-stack' | 'columns';
|
|
18
|
+
mark?: LoadingMark;
|
|
16
19
|
compact?: boolean;
|
|
17
20
|
barCount?: number;
|
|
18
21
|
seriesCount?: number;
|
|
22
|
+
barAppearances?: readonly ChartBarAppearance[];
|
|
23
|
+
barWidth?: number;
|
|
19
24
|
showLine?: boolean;
|
|
25
|
+
lineDepth?: boolean;
|
|
20
26
|
/** Mirror the real axis: which placeholders and grid rows to draw. Defaults to `classic`. */
|
|
21
27
|
axis?: ChartAxisStyle;
|
|
22
28
|
/** Padding between the plot edges and label placeholders, as on the real axis. */
|
|
23
29
|
inset?: number;
|
|
24
30
|
/** Gap between the plot edges and the skeleton shape; 0 when marks run edge to edge. */
|
|
25
31
|
edge?: number;
|
|
32
|
+
/**
|
|
33
|
+
* How the skeleton moves: `shimmer` (default) sweeps a highlight over still shapes, `draw`
|
|
34
|
+
* reveals bars or contours in order, and `breathe` lets them rise and settle.
|
|
35
|
+
*/
|
|
36
|
+
loadingStyle?: ChartLoadingStyle;
|
|
26
37
|
}
|
|
27
38
|
export declare const SKELETON_CONTOUR: number[];
|
|
28
39
|
export interface SkeletonGeometry {
|
|
@@ -35,4 +46,4 @@ export interface SkeletonGeometry {
|
|
|
35
46
|
xBars: string;
|
|
36
47
|
}
|
|
37
48
|
export declare function buildSkeletonGeometry({ width, height, left, right, top, bottom, axis, inset, edge, }: Pick<LoadingLayerProps, 'width' | 'height' | 'left' | 'right' | 'top' | 'bottom' | 'axis' | 'inset' | 'edge'>): SkeletonGeometry;
|
|
38
|
-
export declare function LoadingLayer({ width, height, left, right, top, bottom, visible, opacity, reducedMotion, id, marks, compact, barCount, seriesCount, showLine, axis, inset: labelInset, edge, }: LoadingLayerProps): ReactElement | null;
|
|
49
|
+
export declare function LoadingLayer({ width, height, left, right, top, bottom, visible, opacity, reducedMotion, id, marks, mark, compact, barCount, seriesCount, barAppearances, barWidth, showLine, lineDepth, axis, inset: labelInset, edge, loadingStyle, }: LoadingLayerProps): ReactElement | null;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { ChartLoadingStyle } from '../types';
|
|
3
|
+
export declare const SKELETON_INK = "color-mix(in srgb, var(--lilt-skeleton) 64%, var(--lilt-surface))";
|
|
2
4
|
export interface SkeletonSheenProps {
|
|
3
5
|
/** The skeleton shapes. Their CSS paints them with `--lilt-skeleton-paint`. */
|
|
4
6
|
children: ReactNode;
|
|
7
|
+
/** A plain silhouette when shaded children contain their own SVG definitions. */
|
|
8
|
+
mask?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* For rings: a white path with `pathLength={1}`, `strokeDasharray="1"`, and the
|
|
11
|
+
* `lilt-skeleton__sweep` class. Drawing sweeps it round; breathing fills and empties part of
|
|
12
|
+
* it. Other skeletons move each mark on its own with `data-skeleton` (see loading.css).
|
|
13
|
+
*/
|
|
14
|
+
sweep?: ReactNode;
|
|
15
|
+
loadingStyle?: ChartLoadingStyle;
|
|
16
|
+
depth?: boolean;
|
|
5
17
|
/** The area the sheen sweeps across, in the SVG's own units. */
|
|
6
18
|
width: number;
|
|
7
19
|
height: number;
|
|
@@ -13,6 +25,7 @@ export interface SkeletonSheenProps {
|
|
|
13
25
|
/**
|
|
14
26
|
* Skeleton shapes with the same moving highlight as the Cartesian loading state. The shapes are
|
|
15
27
|
* drawn once for the eye and once more, in white, as the mask the highlight shows through, so
|
|
16
|
-
* the sheen lights only the placeholder and never the space around it.
|
|
28
|
+
* the sheen lights only the placeholder and never the space around it. With `draw` or `breathe`
|
|
29
|
+
* the highlight gives way to the marks' own motion.
|
|
17
30
|
*/
|
|
18
|
-
export declare function SkeletonSheen({ children, width, height, x, y, reduced, }: SkeletonSheenProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare function SkeletonSheen({ children, mask, sweep, loadingStyle, depth, width, height, x, y, reduced, }: SkeletonSheenProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ChartLoadingStyle } from '../types';
|
|
2
|
+
export declare const SKELETON_CYCLE = 2800;
|
|
3
|
+
export declare function skeletonClock(now: number): string;
|
|
4
|
+
/** Read the shared wall clock after hydration, including when the selected style changes. */
|
|
5
|
+
export declare function useSkeletonClock<Element extends HTMLElement | SVGElement>(active: boolean, style: ChartLoadingStyle): import('react').RefObject<Element | null>;
|
package/dist/marks/contract.d.ts
CHANGED
|
@@ -2,6 +2,19 @@ import { ReactElement, ReactNode } from 'react';
|
|
|
2
2
|
import { ChartSnapshot } from '../chart-context';
|
|
3
3
|
import { NormalizedRow } from '../engine/normalize';
|
|
4
4
|
import { ChartSeries } from '../types';
|
|
5
|
+
import { RangeScales } from '../engine/ranges';
|
|
6
|
+
/** A neutral column uses the mark's own geometry, never an accepted observation. */
|
|
7
|
+
export interface LoadingMark {
|
|
8
|
+
kind: string;
|
|
9
|
+
depth?: boolean;
|
|
10
|
+
render: (input: {
|
|
11
|
+
cx: number;
|
|
12
|
+
low: number;
|
|
13
|
+
high: number;
|
|
14
|
+
scales: RangeScales;
|
|
15
|
+
mask: boolean;
|
|
16
|
+
}) => ReactNode;
|
|
17
|
+
}
|
|
5
18
|
/**
|
|
6
19
|
* The private contract every range mark is built on. A mark is an ordinary primitive that
|
|
7
20
|
* draws from the chart context; its spec tells the plot how to lay it out and inspect it.
|
|
@@ -17,6 +30,7 @@ export interface MarkSpec<P> {
|
|
|
17
30
|
series: (props: P) => string;
|
|
18
31
|
/** Field IDs the mark reads from its series. */
|
|
19
32
|
fields: (props: P) => readonly string[];
|
|
33
|
+
loading?: (props: P) => LoadingMark;
|
|
20
34
|
/** Draws one observation emphasized, over the dimmed marks, while it is inspected. */
|
|
21
35
|
highlight?: (props: P, input: MarkHighlightInput) => ReactNode;
|
|
22
36
|
}
|
|
@@ -31,6 +45,7 @@ export interface PlotMark {
|
|
|
31
45
|
series: string;
|
|
32
46
|
layout: MarkSpec<unknown>['layout'];
|
|
33
47
|
fields: readonly string[];
|
|
48
|
+
loading?: LoadingMark;
|
|
34
49
|
highlight?: (input: MarkHighlightInput) => ReactNode;
|
|
35
50
|
}
|
|
36
51
|
export declare function defineMark<P>(component: (props: P) => ReactElement, spec: MarkSpec<P>): (props: P) => ReactElement;
|
|
@@ -84,12 +84,16 @@ export declare function DropShadow({ id, size, region, }: {
|
|
|
84
84
|
* A line drawn as a lit tube: every layer of `tubeLayers` along one path. The centerline stays
|
|
85
85
|
* the line's own path, so every point reads exactly where the flat line puts it.
|
|
86
86
|
*/
|
|
87
|
-
export declare function TubePath({ d, color, width, dasharray, opacity, }: {
|
|
87
|
+
export declare function TubePath({ d, color, width, dasharray, opacity, pathLength, className, }: {
|
|
88
88
|
d: string;
|
|
89
89
|
color: string;
|
|
90
90
|
width: number;
|
|
91
91
|
dasharray?: string;
|
|
92
92
|
opacity?: number;
|
|
93
|
+
/** With `dasharray`, lets every layer draw along the line together, e.g. a loading pen. */
|
|
94
|
+
pathLength?: number;
|
|
95
|
+
/** Set on every layer. */
|
|
96
|
+
className?: string;
|
|
93
97
|
}): ReactElement;
|
|
94
98
|
/** The width a line takes as a tube: wide enough for its light to read. */
|
|
95
99
|
export declare const tubeWidth: (lineWidth?: number) => number;
|