aliencharts 0.1.4 → 0.3.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/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import type { MouseEvent as ReactMouseEvent, ReactElement } from "react";
2
-
3
1
  export type NumericArray =
4
2
  | number[]
5
3
  | Float32Array
@@ -35,6 +33,34 @@ export class LineSeries {
35
33
  name: string;
36
34
  color: string;
37
35
  maxLevels: number;
36
+ readonly type: "line";
37
+ readonly length: number;
38
+ rawX: Float64Array;
39
+ rawY: Float32Array;
40
+
41
+ append(xValues: NumericArray, yValues: NumericArray): void;
42
+ getVisiblePoints(
43
+ xMin: number,
44
+ xMax: number,
45
+ pixelWidth: number,
46
+ ): VisibleSeriesPoints;
47
+ }
48
+
49
+ export type BarOrientation = "vertical" | "horizontal";
50
+
51
+ export interface BarSeriesOptions extends SeriesOptions {
52
+ orientation?: BarOrientation;
53
+ }
54
+
55
+ export class BarSeries {
56
+ constructor(options: BarSeriesOptions);
57
+
58
+ id: string;
59
+ name: string;
60
+ color: string;
61
+ maxLevels: number;
62
+ readonly type: "bar";
63
+ readonly orientation: BarOrientation;
38
64
  readonly length: number;
39
65
  rawX: Float64Array;
40
66
  rawY: Float32Array;
@@ -50,7 +76,9 @@ export class LineSeries {
50
76
  export interface Chart {
51
77
  id: string;
52
78
  title: string;
53
- series: LineSeries[];
79
+ series: LineSeries[] | BarSeries[];
80
+ categories?: Array<string | ChartCategory>;
81
+ xAxisLabel?: string;
54
82
  pinned?: boolean;
55
83
  yRange?: {
56
84
  min: number;
@@ -59,6 +87,11 @@ export interface Chart {
59
87
  [key: string]: unknown;
60
88
  }
61
89
 
90
+ export interface ChartCategory {
91
+ value: number;
92
+ label: string;
93
+ }
94
+
62
95
  export interface DataPoint {
63
96
  x: number;
64
97
  y: number;
@@ -105,8 +138,8 @@ export interface TopMarker<T = unknown> {
105
138
 
106
139
  export interface ChartContextMenuPayload {
107
140
  chart: Chart;
108
- event: ReactMouseEvent<HTMLDivElement>;
109
- point: DataPoint;
141
+ event: MouseEvent;
142
+ point: DataPoint | null;
110
143
  }
111
144
 
112
145
  export interface CreateDrawingIdPayload {
@@ -114,11 +147,9 @@ export interface CreateDrawingIdPayload {
114
147
  type: DrawingTool;
115
148
  }
116
149
 
117
- export interface ChartGridProps {
150
+ export interface ChartGridOptions {
118
151
  charts: Chart[];
119
152
  columns?: number;
120
- className?: string;
121
- dataRevision?: number;
122
153
  initialVisiblePoints?: number | null;
123
154
  backgroundColor?: string;
124
155
  antialiasLines?: boolean;
@@ -133,7 +164,6 @@ export interface ChartGridProps {
133
164
  showTooltips?: boolean;
134
165
  followLatest?: boolean;
135
166
  followVisibleLatest?: boolean;
136
- jumpToLatestRevision?: number;
137
167
  drawings?: Drawing[];
138
168
  onDrawingsChange?: (drawings: Drawing[]) => void;
139
169
  activeDrawingTool?: DrawingTool | null;
@@ -165,6 +195,8 @@ export interface MockChartsOptions {
165
195
  pointCount?: number;
166
196
  }
167
197
 
168
- export function ChartGrid(props: ChartGridProps): ReactElement;
198
+ export function createLineSeries(options: SeriesOptions): LineSeries;
199
+ /** @deprecated Use createLineSeries for explicit line-series naming. */
169
200
  export function createSeries(options: SeriesOptions): LineSeries;
201
+ export function createBarSeries(options: BarSeriesOptions): BarSeries;
170
202
  export function createMockCharts(options?: MockChartsOptions): Chart[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aliencharts",
3
- "version": "0.1.4",
3
+ "version": "0.3.0",
4
4
  "description": "WebGL chart renderer for multi-metric dashboards, built for ease of use and high performance.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,39 +22,55 @@
22
22
  "bugs": {
23
23
  "url": "https://github.com/FarangLab/aliencharts/issues"
24
24
  },
25
- "main": "./dist/index.cjs",
26
25
  "module": "./dist/index.js",
27
26
  "types": "./index.d.ts",
28
27
  "exports": {
29
28
  ".": {
30
29
  "types": "./index.d.ts",
31
- "import": "./dist/index.js",
32
- "require": "./dist/index.cjs"
30
+ "import": "./dist/index.js"
31
+ },
32
+ "./vanilla": {
33
+ "types": "./vanilla.d.ts",
34
+ "import": "./dist/vanilla.js"
35
+ },
36
+ "./react": {
37
+ "types": "./react.d.ts",
38
+ "import": "./dist/react.js"
33
39
  },
34
40
  "./styles.css": "./dist/aliencharts.css"
35
41
  },
36
42
  "files": [
37
43
  "dist",
38
44
  "assets",
39
- "index.d.ts"
45
+ "index.d.ts",
46
+ "vanilla.d.ts",
47
+ "react.d.ts",
48
+ "THIRD_PARTY_NOTICES.md"
40
49
  ],
41
50
  "sideEffects": [
42
51
  "**/*.css"
43
52
  ],
44
53
  "scripts": {
45
54
  "build": "node build.js && tailwindcss -i src/styles.css -o dist/aliencharts.css --minify",
55
+ "examples": "vite --host 127.0.0.1 --port 4178",
56
+ "test": "npm run build && playwright test",
46
57
  "prepublishOnly": "npm run build"
47
58
  },
48
59
  "peerDependencies": {
49
- "react": ">=18",
50
- "react-dom": ">=18"
60
+ "react": ">=18"
51
61
  },
52
- "dependencies": {
53
- "@phosphor-icons/react": "^2.1.10"
62
+ "peerDependenciesMeta": {
63
+ "react": {
64
+ "optional": true
65
+ }
54
66
  },
55
67
  "devDependencies": {
68
+ "@playwright/test": "^1.61.1",
56
69
  "@tailwindcss/cli": "^4.3.2",
57
70
  "esbuild": "^0.28.1",
58
- "tailwindcss": "^4.3.2"
71
+ "react": "^19.2.3",
72
+ "react-dom": "^19.2.8",
73
+ "tailwindcss": "^4.3.2",
74
+ "vite": "^8.1.5"
59
75
  }
60
76
  }
package/react.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ export * from "./index.js";
2
+
3
+ import type {
4
+ ForwardRefExoticComponent,
5
+ RefAttributes,
6
+ } from "react";
7
+ import type { ChartGridOptions } from "./index.js";
8
+
9
+ export interface ChartGridProps extends ChartGridOptions {
10
+ className?: string;
11
+ dataRevision?: number;
12
+ }
13
+
14
+ export interface ChartGridHandle {
15
+ invalidate(): void;
16
+ jumpToLatest(chartId?: string): void;
17
+ scrollToTop(options?: ScrollToOptions): void;
18
+ }
19
+
20
+ export const ChartGrid: ForwardRefExoticComponent<
21
+ ChartGridProps & RefAttributes<ChartGridHandle>
22
+ >;
package/vanilla.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ export * from "./index.js";
2
+
3
+ import type { Chart, ChartGridOptions } from "./index.js";
4
+
5
+ export interface ChartGridController {
6
+ setOptions(options: Partial<ChartGridOptions>): void;
7
+ setCharts(charts: Chart[]): void;
8
+ invalidate(): void;
9
+ jumpToLatest(chartId?: string): void;
10
+ scrollToTop(options?: ScrollToOptions): void;
11
+ destroy(): void;
12
+ }
13
+
14
+ export function createChartGrid(
15
+ container: HTMLElement,
16
+ options: ChartGridOptions,
17
+ ): ChartGridController;