@internetstiftelsen/charts 0.0.1 → 0.0.3

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 ADDED
@@ -0,0 +1,417 @@
1
+ # Chart Library
2
+
3
+ A framework-agnostic, composable charting library built on D3.js with TypeScript.
4
+
5
+ ## Features
6
+
7
+ - **Framework Agnostic**: Core library has zero framework dependencies - works with vanilla JS, React, Vue, Svelte, or any other framework
8
+ - **Flexible Scale System**: Support for band, linear, time, and logarithmic scales
9
+ - **Composable Architecture**: Build charts by composing components (lines, axes, grids, tooltips, legends, titles)
10
+ - **Layout-Driven Design**: Components self-measure and automatically adjust chart dimensions
11
+ - **Automatic Resize**: Built-in ResizeObserver handles responsive behavior automatically
12
+ - **Type Safe**: Written in TypeScript with comprehensive type definitions
13
+ - **Data Validation**: Built-in validation with helpful error messages
14
+ - **Performance Optimized**: Data caching and minimized redundant calculations
15
+ - **Automatic Color Assignment**: Smart color palette system with sensible defaults
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install @internetstiftelsen/charts
21
+ ```
22
+
23
+ ## Quick Start
24
+
25
+ ### Vanilla JavaScript
26
+
27
+ ```javascript
28
+ import { XYChart } from '@internetstiftelsen/charts/xy-chart';
29
+ import { Line } from '@internetstiftelsen/charts/line';
30
+ import { Bar } from '@internetstiftelsen/charts/bar';
31
+ import { XAxis } from '@internetstiftelsen/charts/x-axis';
32
+ import { YAxis } from '@internetstiftelsen/charts/y-axis';
33
+ import { Grid } from '@internetstiftelsen/charts/grid';
34
+ import { Tooltip } from '@internetstiftelsen/charts/tooltip';
35
+ import { Legend } from '@internetstiftelsen/charts/legend';
36
+
37
+ // Your data
38
+ const data = [
39
+ { date: '2010', revenue: 100, expenses: 80 },
40
+ { date: '2011', revenue: 150, expenses: 90 },
41
+ { date: '2012', revenue: 200, expenses: 110 },
42
+ { date: '2013', revenue: 250, expenses: 130 },
43
+ ];
44
+
45
+ // Create chart
46
+ const chart = new XYChart({ data });
47
+
48
+ // Add components
49
+ chart
50
+ .addChild(new Title({ text: 'Revenue vs Expenses' }))
51
+ .addChild(new Grid({ horizontal: true, vertical: false }))
52
+ .addChild(new XAxis({ dataKey: 'date' }))
53
+ .addChild(new YAxis())
54
+ .addChild(
55
+ new Tooltip({
56
+ formatter: (dataKey, value) => `<strong>${dataKey}</strong>: $${value}k`,
57
+ })
58
+ )
59
+ .addChild(new Legend({ position: 'bottom' }))
60
+ .addChild(new Line({ dataKey: 'revenue' })) // Auto-assigned color
61
+ .addChild(new Line({ dataKey: 'expenses' })); // Auto-assigned color
62
+
63
+ // Render to DOM (automatically resizes with container)
64
+ chart.render('#chart-container');
65
+
66
+ // Later: update with new data
67
+ chart.update(newData);
68
+
69
+ // Clean up when done
70
+ chart.destroy();
71
+ ```
72
+
73
+ ### With React (Demo Wrapper)
74
+
75
+ ```jsx
76
+ import { useRef, useEffect } from 'react';
77
+ import { XYChart, Line, Bar, XAxis, YAxis, Grid, Tooltip, Legend } from './charts';
78
+
79
+ function Chart({ data }) {
80
+ const containerRef = useRef(null);
81
+ const chartRef = useRef(null);
82
+
83
+ useEffect(() => {
84
+ if (containerRef.current) {
85
+ // Create chart
86
+ const chart = new XYChart({ data });
87
+
88
+ chart
89
+ .addChild(new Grid({ horizontal: true }))
90
+ .addChild(new XAxis({ dataKey: 'column' }))
91
+ .addChild(new YAxis())
92
+ .addChild(new Tooltip())
93
+ .addChild(new Legend({ position: 'bottom' }))
94
+ .addChild(new Line({ dataKey: 'value1' }))
95
+ .addChild(new Line({ dataKey: 'value2' }));
96
+
97
+ chart.render(containerRef.current);
98
+ chartRef.current = chart;
99
+
100
+ return () => {
101
+ chart.destroy();
102
+ };
103
+ }
104
+ }, []);
105
+
106
+ // Update when data changes
107
+ useEffect(() => {
108
+ if (chartRef.current && data) {
109
+ chartRef.current.update(data);
110
+ }
111
+ }, [data]);
112
+
113
+ return <div ref={containerRef} />;
114
+ }
115
+ ```
116
+
117
+ ## API Reference
118
+
119
+ ### XYChart
120
+
121
+ The main chart class for creating XY-coordinate charts (line, bar, or mixed).
122
+
123
+ #### Constructor
124
+
125
+ ```typescript
126
+ new XYChart(config: XYChartConfig)
127
+ ```
128
+
129
+ **Config Options:**
130
+
131
+ - `data: DataItem[]` - Array of data objects (required)
132
+ - `theme?: Partial<ChartTheme>` - Theme customization
133
+ - `width: number` - Chart max-width in pixels (default: 928)
134
+ - `height: number` - Chart height in pixels (default: 600)
135
+ - `margins: { top, right, bottom, left }` - Base margins around plot area (default: { top: 20, right: 20, bottom: 30, left: 40 })
136
+ - `colorPalette: string[]` - Array of colors for auto-assignment
137
+ - `gridColor: string` - Grid line color (default: '#e0e0e0')
138
+ - `axis: { fontFamily, fontSize }` - Axis text styling
139
+ - `scales?: AxisScaleConfig` - Scale configuration
140
+ - `x?: { type: 'band' | 'linear' | 'time' | 'log', domain?: any[], padding?: number, nice?: boolean }`
141
+ - `y?: { type: 'band' | 'linear' | 'time' | 'log', domain?: any[], padding?: number, nice?: boolean }`
142
+
143
+ #### Methods
144
+
145
+ **`addChild(component: ChartComponent): this`**
146
+ Adds a component to the chart (chainable).
147
+
148
+ **`render(target: string): HTMLElement`**
149
+ Renders the chart to a DOM element specified by CSS selector. Automatically sets up resize handling.
150
+
151
+ **`update(data: DataItem[]): void`**
152
+ Updates the chart with new data and re-renders.
153
+
154
+ **`destroy(): void`**
155
+ Cleans up all resources, removes resize observer, and clears the chart from the DOM.
156
+
157
+ ### Components
158
+
159
+ #### Line
160
+
161
+ Renders a line series on the chart.
162
+
163
+ ```typescript
164
+ new Line({
165
+ dataKey: string, // Key in data objects for Y values (required)
166
+ stroke? : string, // Line color (auto-assigned if omitted)
167
+ strokeWidth? : number, // Line width in pixels (default: 2)
168
+ })
169
+ ```
170
+
171
+ #### Bar
172
+
173
+ Renders a bar series on the chart.
174
+
175
+ ```typescript
176
+ new Bar({
177
+ dataKey: string, // Key in data objects for Y values (required)
178
+ fill? : string, // Bar color (auto-assigned if omitted)
179
+ })
180
+ ```
181
+
182
+ #### XAxis
183
+
184
+ Renders the X axis.
185
+
186
+ ```typescript
187
+ new XAxis({
188
+ dataKey? : string, // Key in data objects for X values (auto-detected if omitted)
189
+ })
190
+ ```
191
+
192
+ #### YAxis
193
+
194
+ Renders the Y axis.
195
+
196
+ ```typescript
197
+ new YAxis({
198
+ tickFormat?: string | null, // D3 format specifier (e.g., 's' for SI-prefix like "35k"). Default: null (no formatting)
199
+ })
200
+ ```
201
+
202
+ **Examples:**
203
+ ```javascript
204
+ new YAxis() // Shows raw numbers: 35000
205
+ new YAxis({ tickFormat: 's' }) // Shows SI-prefix: 35k
206
+ new YAxis({ tickFormat: '$,' }) // Shows formatted: $35,000
207
+ ```
208
+
209
+ #### Grid
210
+
211
+ Renders grid lines.
212
+
213
+ ```typescript
214
+ new Grid({
215
+ horizontal? : boolean, // Show horizontal lines (default: true)
216
+ vertical? : boolean, // Show vertical lines (default: true)
217
+ })
218
+ ```
219
+
220
+ #### Tooltip
221
+
222
+ Renders interactive tooltips on hover.
223
+
224
+ ```typescript
225
+ new Tooltip({
226
+ formatter? : (dataKey: string, value: any, data: DataItem) => string
227
+ })
228
+ ```
229
+
230
+ **Example formatter:**
231
+
232
+ ```javascript
233
+ new Tooltip({
234
+ formatter: (dataKey, value, data) =>
235
+ `<strong>${dataKey}</strong><br/>Value: ${value}<br/>Date: ${data.date}`
236
+ })
237
+ ```
238
+
239
+ #### Legend
240
+
241
+ Renders a legend for the chart.
242
+
243
+ ```typescript
244
+ new Legend({
245
+ position?: 'bottom', // Position (currently only 'bottom' supported)
246
+ marginTop?: number, // Space above legend (default: 20)
247
+ marginBottom?: number, // Space below legend (default: 10)
248
+ })
249
+ ```
250
+
251
+ #### Title
252
+
253
+ Renders a title for the chart.
254
+
255
+ ```typescript
256
+ new Title({
257
+ text: string, // Title text (required)
258
+ fontSize?: number, // Font size in pixels (default: 18)
259
+ fontWeight?: string, // Font weight (default: 'bold')
260
+ align?: 'left' | 'center' | 'right', // Alignment (default: 'center')
261
+ marginTop?: number, // Space above title (default: 10)
262
+ marginBottom?: number, // Space below title (default: 15)
263
+ })
264
+ ```
265
+
266
+ ## Advanced Usage
267
+
268
+ ### Custom Scale Types
269
+
270
+ Use time scales for temporal data:
271
+
272
+ ```javascript
273
+ const chart = new XYChart({
274
+ data: [
275
+ { date: new Date('2024-01-01'), value: 100 },
276
+ { date: new Date('2024-01-02'), value: 150 },
277
+ ],
278
+ scales: {
279
+ x: { type: 'time', nice: true },
280
+ y: { type: 'linear', nice: true },
281
+ },
282
+ });
283
+ ```
284
+
285
+ Use logarithmic scales for exponential data:
286
+
287
+ ```javascript
288
+ const chart = new XYChart({
289
+ data: [
290
+ { x: 1, y: 10 },
291
+ { x: 2, y: 100 },
292
+ { x: 3, y: 1000 },
293
+ ],
294
+ scales: {
295
+ y: { type: 'log', domain: [1, 10000] },
296
+ },
297
+ });
298
+ ```
299
+
300
+ ### Custom Theming
301
+
302
+ ```javascript
303
+ const chart = new XYChart({
304
+ data,
305
+ theme: {
306
+ width: 1200, // Max-width (chart won't exceed this)
307
+ height: 600,
308
+ margins: {
309
+ top: 30,
310
+ right: 30,
311
+ bottom: 40,
312
+ left: 60,
313
+ },
314
+ colorPalette: ['#ff6b6b', '#4ecdc4', '#45b7d1', '#f7b731'],
315
+ gridColor: '#333333',
316
+ axis: {
317
+ fontFamily: 'Inter, sans-serif',
318
+ fontSize: '12',
319
+ },
320
+ },
321
+ });
322
+ ```
323
+
324
+ ### Manual Color Assignment
325
+
326
+ ```javascript
327
+ chart
328
+ .addChild(new Line({ dataKey: 'revenue', stroke: '#00ff00' }))
329
+ .addChild(new Line({ dataKey: 'expenses', stroke: '#ff0000' }));
330
+ ```
331
+
332
+ ### Responsive Charts
333
+
334
+ Charts automatically resize with their container using ResizeObserver. The chart width adapts to the container up to the `theme.width` (which acts as max-width).
335
+
336
+ ```javascript
337
+ // Container width: 500px → Chart width: 500px
338
+ // Container width: 1200px → Chart width: 928px (theme default max-width)
339
+
340
+ // Custom max-width
341
+ const chart = new XYChart({
342
+ data,
343
+ theme: { width: 1200 }, // Chart won't exceed 1200px
344
+ });
345
+ ```
346
+
347
+ **No manual resize calls needed** - the chart automatically responds to container size changes!
348
+
349
+ ## Data Validation
350
+
351
+ The library includes built-in validation with helpful error messages:
352
+
353
+ ```javascript
354
+ // Empty data
355
+ new XYChart({ data: [] });
356
+ // Error: Data array cannot be empty
357
+
358
+ // Missing dataKey
359
+ new Line({ dataKey: 'nonexistent' });
360
+ // Error: Line: dataKey "nonexistent" not found in data items at indices: 0, 1, 2
361
+
362
+ // Invalid numeric data
363
+ new Line({ dataKey: 'textField' });
364
+ // Error: Line: No valid numeric values found for dataKey "textField"
365
+ ```
366
+
367
+ ## Browser Support
368
+
369
+ Modern browsers with ES6+ support. Uses D3.js v7.
370
+
371
+ ## TypeScript
372
+
373
+ Full TypeScript support included:
374
+
375
+ ```typescript
376
+ import type { DataItem, ChartTheme, LineConfig } from './charts/types';
377
+
378
+ const data: DataItem[] = [
379
+ { x: 1, y: 100 },
380
+ { x: 2, y: 200 },
381
+ ];
382
+
383
+ const config: LineConfig = {
384
+ dataKey: 'y',
385
+ stroke: '#8884d8',
386
+ strokeWidth: 2,
387
+ };
388
+ ```
389
+
390
+ ## Architecture
391
+
392
+ The library follows a composable, layout-driven design:
393
+
394
+ - **BaseChart**: Abstract base class providing common functionality (lifecycle, rendering, validation)
395
+ - **XYChart**: Concrete implementation for XY-coordinate charts (lines, bars, or mixed)
396
+ - **LayoutManager**: Calculates component positions and plot area dimensions (D3 margin convention)
397
+ - **LayoutAwareComponent**: Interface for self-measuring components (Title, Legend, Axes)
398
+ - **Components**: Modular components that implement `ChartComponent` or `LayoutAwareComponent`
399
+ - **Validation**: Centralized validation layer with `ChartValidator`
400
+ - **Scales**: Flexible scale factory supporting multiple D3 scale types
401
+
402
+ Key principles:
403
+ - **Layout-driven**: Components report their space requirements, plot area adjusts automatically
404
+ - **Separation of concerns**: Only the plot area (grid) scales; UI elements stay fixed size
405
+ - **D3 conventions**: Follows D3's margin convention pattern for clean, predictable layouts
406
+
407
+ This architecture makes it easy to add new chart types or series (Area, Scatter, etc.) by extending BaseChart or implementing new series components.
408
+
409
+ ## Performance
410
+
411
+ - **Data Caching**: Sorted data is cached to avoid redundant sorting operations
412
+ - **Smart Re-rendering**: Only re-renders when necessary (data updates or container resize)
413
+ - **Automatic Cleanup**: ResizeObserver and tooltips properly cleaned up on destroy
414
+ - **Minimal DOM Manipulation**: Uses D3's efficient data binding
415
+ - **SVG Optimization**: Clean SVG generation with proper cleanup
416
+ - **Small Bundle**: ~105 KB gzipped (including D3)
417
+ - **Small Bundle**: ~105 KB gzipped (including D3)
package/bar.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Selection } from 'd3';
2
- import type { BarConfig, DataItem, ScaleType, Orientation } from './types';
3
- import type { ChartComponent } from '@/lib/chart-interface';
2
+ import type { BarConfig, DataItem, ScaleType, Orientation } from './types.js';
3
+ import type { ChartComponent } from './chart-interface.js';
4
4
  export declare class Bar implements ChartComponent {
5
5
  readonly type: "bar";
6
6
  readonly dataKey: string;
package/base-chart.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { type Selection } from 'd3';
2
- import type { DataItem, ChartTheme, AxisScaleConfig } from './types';
3
- import type { ChartComponent } from '@/lib/chart-interface';
4
- import type { XAxis } from './x-axis';
5
- import type { YAxis } from './y-axis';
6
- import type { Grid } from './grid';
7
- import type { Tooltip } from './tooltip';
8
- import type { Legend } from './legend';
9
- import type { Title } from './title';
10
- import { LayoutManager, type PlotAreaBounds } from './layout-manager';
2
+ import type { DataItem, ChartTheme, AxisScaleConfig } from './types.js';
3
+ import type { ChartComponent } from './chart-interface.js';
4
+ import type { XAxis } from './x-axis.js';
5
+ import type { YAxis } from './y-axis.js';
6
+ import type { Grid } from './grid.js';
7
+ import type { Tooltip } from './tooltip.js';
8
+ import type { Legend } from './legend.js';
9
+ import type { Title } from './title.js';
10
+ import { LayoutManager, type PlotAreaBounds } from './layout-manager.js';
11
11
  export type BaseChartConfig = {
12
12
  data: DataItem[];
13
13
  theme?: Partial<ChartTheme>;
package/base-chart.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { create } from 'd3';
2
- import { defaultTheme } from './theme';
3
- import { ChartValidator } from './validation';
4
- import { LayoutManager } from './layout-manager';
2
+ import { defaultTheme } from './theme.js';
3
+ import { ChartValidator } from './validation.js';
4
+ import { LayoutManager } from './layout-manager.js';
5
5
  /**
6
6
  * Base chart class that provides common functionality for all chart types
7
7
  */
package/grid.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type Selection } from 'd3';
2
- import type { GridConfig, ChartTheme } from './types';
3
- import type { ChartComponent } from '@/lib/chart-interface';
2
+ import type { GridConfig, ChartTheme } from './types.js';
3
+ import type { ChartComponent } from './chart-interface.js';
4
4
  export declare class Grid implements ChartComponent {
5
5
  readonly type: "grid";
6
6
  readonly horizontal: boolean;
@@ -1,5 +1,5 @@
1
- import type { LayoutAwareComponent } from './chart-interface';
2
- import type { ChartTheme } from './types';
1
+ import type { LayoutAwareComponent } from './chart-interface.js';
2
+ import type { ChartTheme } from './types.js';
3
3
  export type PlotAreaBounds = {
4
4
  left: number;
5
5
  right: number;
package/legend.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { type Selection } from 'd3';
2
- import type { LegendConfig, ChartTheme } from './types';
3
- import type { Line } from './line';
4
- import type { Bar } from './bar';
5
- import type { LayoutAwareComponent, ComponentSpace } from '@/lib/chart-interface';
2
+ import type { LegendConfig, ChartTheme } from './types.js';
3
+ import type { Line } from './line.js';
4
+ import type { Bar } from './bar.js';
5
+ import type { LayoutAwareComponent, ComponentSpace } from './chart-interface.js';
6
6
  export declare class Legend implements LayoutAwareComponent {
7
7
  readonly type: "legend";
8
8
  readonly position: LegendConfig['position'];
package/legend.js CHANGED
@@ -1,5 +1,4 @@
1
- import {} from 'd3';
2
- import { getSeriesColor } from './types';
1
+ import { getSeriesColor } from './types.js';
3
2
  export class Legend {
4
3
  constructor(config) {
5
4
  Object.defineProperty(this, "type", {
package/line.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type Selection } from 'd3';
2
- import type { LineConfig, DataItem, ScaleType } from './types';
3
- import type { ChartComponent } from '@/lib/chart-interface';
2
+ import type { LineConfig, DataItem, ScaleType } from './types.js';
3
+ import type { ChartComponent } from './chart-interface.js';
4
4
  export declare class Line implements ChartComponent {
5
5
  readonly type: "line";
6
6
  readonly dataKey: string;
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
- "version": "0.0.1",
2
+ "version": "0.0.3",
3
3
  "name": "@internetstiftelsen/charts",
4
4
  "type": "module",
5
+ "sideEffects": false,
5
6
  "exports": {
6
7
  "./*": {
7
8
  "types": "./*.d.ts",
@@ -10,7 +11,8 @@
10
11
  },
11
12
  "files": [
12
13
  "*.js",
13
- "*.d.ts"
14
+ "*.d.ts",
15
+ "README.md"
14
16
  ],
15
17
  "scripts": {
16
18
  "dev": "vite",
@@ -18,7 +20,7 @@
18
20
  "lint": "eslint .",
19
21
  "preview": "vite preview",
20
22
  "build:lib": "tsc --project tsconfig.lib.json && tsc-alias --project tsconfig.lib.json",
21
- "prepub": "rm -rf dist && npm run build:lib && cp package.json dist",
23
+ "prepub": "rm -rf dist && npm run build:lib && cp package.json dist && cp README.md dist",
22
24
  "pub": "npm run prepub && cd dist && npm publish --access public"
23
25
  },
24
26
  "dependencies": {
package/theme.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { type ChartTheme } from '@/lib/types';
1
+ import { type ChartTheme } from './types.js';
2
2
  export declare const defaultTheme: ChartTheme;
package/theme.js CHANGED
@@ -1,4 +1,3 @@
1
- import {} from '@/lib/types';
2
1
  export const defaultTheme = {
3
2
  width: 928,
4
3
  height: 600,
package/title.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type Selection } from 'd3';
2
- import type { TitleConfig, ChartTheme } from './types';
3
- import type { LayoutAwareComponent, ComponentSpace } from './chart-interface';
2
+ import type { TitleConfig, ChartTheme } from './types.js';
3
+ import type { LayoutAwareComponent, ComponentSpace } from './chart-interface.js';
4
4
  export declare class Title implements LayoutAwareComponent {
5
5
  readonly type: "title";
6
6
  readonly text: string;
package/title.js CHANGED
@@ -1,4 +1,3 @@
1
- import {} from 'd3';
2
1
  export class Title {
3
2
  constructor(config) {
4
3
  Object.defineProperty(this, "type", {
package/tooltip.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { type Selection } from 'd3';
2
- import type { TooltipConfig, DataItem, ChartTheme } from './types';
3
- import type { ChartComponent } from '@/lib/chart-interface';
4
- import type { Line } from './line';
5
- import type { Bar } from './bar';
6
- import type { PlotAreaBounds } from './layout-manager';
2
+ import type { TooltipConfig, DataItem, ChartTheme } from './types.js';
3
+ import type { ChartComponent } from './chart-interface.js';
4
+ import type { Line } from './line.js';
5
+ import type { Bar } from './bar.js';
6
+ import type { PlotAreaBounds } from './layout-manager.js';
7
7
  export declare class Tooltip implements ChartComponent {
8
8
  readonly type: "tooltip";
9
9
  readonly formatter?: (dataKey: string, value: any, data: DataItem) => string;
package/tooltip.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { pointer, select } from 'd3';
2
- import { getSeriesColor } from './types';
2
+ import { getSeriesColor } from './types.js';
3
3
  export class Tooltip {
4
4
  constructor(config) {
5
5
  Object.defineProperty(this, "type", {
package/validation.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DataItem } from './types';
1
+ import type { DataItem } from './types.js';
2
2
  export declare class ChartValidationError extends Error {
3
3
  constructor(message: string);
4
4
  }
package/x-axis.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type Selection } from 'd3';
2
- import type { XAxisConfig, ChartTheme } from './types';
3
- import type { LayoutAwareComponent, ComponentSpace } from '@/lib/chart-interface';
2
+ import type { XAxisConfig, ChartTheme } from './types.js';
3
+ import type { LayoutAwareComponent, ComponentSpace } from './chart-interface.js';
4
4
  export declare class XAxis implements LayoutAwareComponent {
5
5
  readonly type: "xAxis";
6
6
  readonly dataKey?: string;
package/xy-chart.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { BaseChart, type BaseChartConfig } from './base-chart';
2
- import type { ChartComponent } from '@/lib/chart-interface';
1
+ import { BaseChart, type BaseChartConfig } from './base-chart.js';
2
+ import type { ChartComponent } from './chart-interface.js';
3
3
  export type XYChartConfig = BaseChartConfig;
4
4
  export declare class XYChart extends BaseChart {
5
5
  private readonly series;
package/xy-chart.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { max, min, scaleBand, scaleLinear, scaleTime, scaleLog, } from 'd3';
2
- import { getSeriesColor } from './types';
3
- import { BaseChart } from './base-chart';
4
- import { ChartValidator } from './validation';
2
+ import { getSeriesColor } from './types.js';
3
+ import { BaseChart } from './base-chart.js';
4
+ import { ChartValidator } from './validation.js';
5
5
  export class XYChart extends BaseChart {
6
6
  constructor(config) {
7
7
  super(config);
package/y-axis.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type Selection } from 'd3';
2
- import type { ChartTheme, YAxisConfig } from './types';
3
- import type { LayoutAwareComponent, ComponentSpace } from '@/lib/chart-interface';
2
+ import type { ChartTheme, YAxisConfig } from './types.js';
3
+ import type { LayoutAwareComponent, ComponentSpace } from './chart-interface.js';
4
4
  export declare class YAxis implements LayoutAwareComponent {
5
5
  readonly type: "yAxis";
6
6
  private readonly tickPadding;