@duskmoon-dev/visualization 0.0.0-stage → 2.2.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/README.md CHANGED
@@ -1,3 +1,61 @@
1
- # Temporary Holding Version
1
+ # Duskmoon Visualization for React
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The standalone React package exports `DmVizLineChart`, `DmVizBarChart`,
4
+ `DmVizScatterChart`, `DmVizHeatmap`, `DmVizNetworkGraph`, and
5
+ `DmVizMapChart`. Each takes a chart input, an optional
6
+ fixed `width`, a plot `height` (300 by default) and an optional `loading` state.
7
+ Without a fixed width, the chart measures its container on the client.
8
+
9
+ ```tsx
10
+ import { DmVizLineChart } from "@duskmoon-dev/visualization";
11
+
12
+ <DmVizLineChart
13
+ chart={{
14
+ kind: "line",
15
+ xAxis: { type: "category" },
16
+ yAxis: { type: "numeric", unit: "ms" },
17
+ series: [
18
+ {
19
+ id: "latency",
20
+ name: "Latency",
21
+ data: [
22
+ { id: "mon", x: "Mon", y: 15 },
23
+ { id: "tue", x: "Tue", y: null },
24
+ { id: "wed", x: "Wed", y: 17 },
25
+ { id: "thu", x: "Thu", y: 19 },
26
+ ],
27
+ },
28
+ ],
29
+ options: { title: "Request latency", marker: { visible: true } },
30
+ }}
31
+ />;
32
+ ```
33
+
34
+ Charts use the Duskmoon Core CSS color variables when available. Supply
35
+ `chart.options.theme` to override colors for an individual chart. Chart
36
+ inputs follow the [shared contract](https://github.com/duskmoon-dev/duskmoon-web/tree/main/specs/visualization/v1).
37
+
38
+ | Component | Chart input and interactions |
39
+ | --- | --- |
40
+ | Line | Use numeric, time, or category x values. Null y values break the line. Numeric and time axes support zoom and x-range selection. |
41
+ | Bar | Use category IDs as x. Group series vertically or horizontally around the zero baseline. |
42
+ | Scatter | Give each point a stable ID and use numeric x/y values. Zoom applies to both axes. |
43
+ | Heatmap | Supply ordered rows and columns plus cells addressed by their IDs. Use continuous color stops for measured values and a separate color for missing values. |
44
+ | Network | Supply fixed x/y coordinates and stable node and edge IDs. The scene supports pan, zoom, and node drag. |
45
+ | Map | Supply offline GeoJSON with stable feature IDs. Mercator supports Polygon, MultiPolygon, and Point within ±85° latitude and without antimeridian crossings. |
46
+
47
+ Inspect a mark by hovering, tapping, or focusing the plot and pressing arrow
48
+ keys. Enter or Space selects the focused mark. Use Shift with Left/Right to
49
+ brush a numeric or time line, Shift with arrows to pan a scene, and Alt with
50
+ arrows to move the focused network node. The chart toolbar provides zoom,
51
+ clear, and reset controls where applicable. The chart's data disclosure
52
+ shows raw values, including hidden series and missing values.
53
+
54
+ Pass `onEvent` to receive `VizEvent` values. Provide `selection`,
55
+ `hiddenSeriesIds`, or `viewport` independently to control that state and
56
+ write the emitted value back from your application. Uncontrolled selection
57
+ can be seeded with `defaultSelection`. Keep IDs stable when updating data.
58
+
59
+ The gallery uses the contract fixtures. The contract's capability matrix
60
+ lists extensions such as stacked bars, force layout, and map tiles.
61
+ See [Phoenix LiveView setup](https://github.com/duskmoon-dev/duskmoon-web/blob/main/docs/visualization-phoenix.md).
@@ -0,0 +1,37 @@
1
+ import type { ReactNode } from "react";
2
+ import type { ChartOptions, XYLayout } from "@duskmoon-dev/visualization-core";
3
+ export type ChartSize = {
4
+ width?: number;
5
+ height?: number;
6
+ loading?: boolean;
7
+ };
8
+ export declare function token(name: string, fallback: string): string;
9
+ export declare const seriesColors: string[];
10
+ export type ChartRow = {
11
+ id: string;
12
+ name: string;
13
+ raw: Readonly<Record<string, unknown>>;
14
+ };
15
+ type FrameProps = ChartSize & {
16
+ options?: ChartOptions;
17
+ state: XYLayout["state"];
18
+ legend?: ReactNode;
19
+ rows?: readonly ChartRow[];
20
+ focusedValue?: string;
21
+ children: (size: {
22
+ width: number;
23
+ height: number;
24
+ clipId: string;
25
+ }) => ReactNode;
26
+ };
27
+ export declare function ChartFrame({ width, height, loading, options, state, legend, rows, focusedValue, children, }: FrameProps): import("react").JSX.Element;
28
+ export declare function Legend({ items, onToggle, }: {
29
+ onToggle?: (id: string) => void;
30
+ items: readonly {
31
+ id: string;
32
+ name: string;
33
+ color: string;
34
+ visible: boolean;
35
+ }[];
36
+ }): import("react").JSX.Element | null;
37
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { VizInteractionProps } from "./interaction.js";
2
+ import type { HeatmapInput } from "@duskmoon-dev/visualization-core";
3
+ import type { ChartSize } from "./ChartFrame.js";
4
+ export declare function DmVizHeatmap({ chart, selection, defaultSelection, onEvent, ...size }: ChartSize & Pick<VizInteractionProps, "selection" | "defaultSelection" | "onEvent"> & {
5
+ chart: HeatmapInput;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { MapInput, NetworkInput } from "@duskmoon-dev/visualization-core";
2
+ import type { ChartSize } from "./ChartFrame.js";
3
+ import type { VizInteractionProps } from "./interaction.js";
4
+ type SceneProps = ChartSize & Omit<VizInteractionProps, "hiddenSeriesIds">;
5
+ export declare function DmVizNetworkGraph(props: SceneProps & {
6
+ chart: NetworkInput;
7
+ }): import("react").JSX.Element;
8
+ export declare function DmVizMapChart(props: SceneProps & {
9
+ chart: MapInput;
10
+ }): import("react").JSX.Element;
11
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { VizInteractionProps } from "./interaction.js";
2
+ import type { BarInput, LineInput, ScatterInput } from "@duskmoon-dev/visualization-core";
3
+ import type { ChartSize } from "./ChartFrame.js";
4
+ export declare function DmVizLineChart(props: ChartSize & VizInteractionProps & {
5
+ chart: LineInput;
6
+ }): import("react").JSX.Element;
7
+ export declare function DmVizBarChart(props: ChartSize & VizInteractionProps & {
8
+ chart: BarInput;
9
+ }): import("react").JSX.Element;
10
+ export declare function DmVizScatterChart(props: ChartSize & VizInteractionProps & {
11
+ chart: ScatterInput;
12
+ }): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ export type { BarInput, HeatmapInput, LineInput, ScatterInput, } from "@duskmoon-dev/visualization-core";
2
+ export type { ChartSize } from "./ChartFrame.js";
3
+ export { DmVizBarChart, DmVizLineChart, DmVizScatterChart } from "./XYChart.js";
4
+ export { DmVizHeatmap } from "./Heatmap.js";
5
+ export type { VizEvent, VizTarget, VizViewport, } from "@duskmoon-dev/visualization-core";
6
+ export type { VizInteractionProps } from "./interaction.js";
7
+ export type { MapInput, MapFeature, MapGeometry, NetworkInput, NetworkNode, NetworkEdge, } from "@duskmoon-dev/visualization-core";
8
+ export { DmVizMapChart, DmVizNetworkGraph } from "./SceneChart.js";