@opendata-ai/openchart-core 2.7.0 → 2.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendata-ai/openchart-core",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "Types, theme, colors, accessibility, and utilities for openchart",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Riley Hilliard",
@@ -79,6 +79,7 @@ export type {
79
79
  AnnotationOffset,
80
80
  AxisConfig,
81
81
  ChartSpec,
82
+ ChartSpecOverride,
82
83
  ChartSpecWithoutData,
83
84
  ChartType,
84
85
  Chrome,
package/src/types/spec.ts CHANGED
@@ -8,8 +8,8 @@
8
8
  * with editorial extensions for chrome, annotations, responsive, and dark mode.
9
9
  */
10
10
 
11
- // Re-import for use in LegendConfig (avoids circular by importing from sibling)
12
- import type { LegendPosition } from '../responsive/breakpoints';
11
+ // Re-import for use in LegendConfig and overrides (avoids circular by importing from sibling)
12
+ import type { Breakpoint, LegendPosition } from '../responsive/breakpoints';
13
13
  import type { ColumnConfig } from './table';
14
14
 
15
15
  // ---------------------------------------------------------------------------
@@ -395,6 +395,8 @@ export interface LegendConfig {
395
395
  position?: LegendPosition;
396
396
  /** Pixel offset for fine-tuning legend position. */
397
397
  offset?: AnnotationOffset;
398
+ /** Whether to show the legend. Defaults to true. Set to false to hide. */
399
+ show?: boolean;
398
400
  }
399
401
 
400
402
  // ---------------------------------------------------------------------------
@@ -416,6 +418,24 @@ export interface SeriesStyle {
416
418
  opacity?: number;
417
419
  }
418
420
 
421
+ /**
422
+ * Breakpoint-conditional overrides for chart specs.
423
+ *
424
+ * Allows specifying different chrome, labels, legend, or annotations
425
+ * per breakpoint. Merged shallowly into the base spec at compile time
426
+ * when the container matches the breakpoint.
427
+ */
428
+ export interface ChartSpecOverride {
429
+ /** Override editorial chrome at this breakpoint. */
430
+ chrome?: Chrome;
431
+ /** Override label configuration at this breakpoint. */
432
+ labels?: LabelConfig;
433
+ /** Override legend configuration at this breakpoint. */
434
+ legend?: LegendConfig;
435
+ /** Override annotations at this breakpoint. */
436
+ annotations?: Annotation[];
437
+ }
438
+
419
439
  /**
420
440
  * Chart specification: the primary input for standard chart types.
421
441
  *
@@ -448,6 +468,12 @@ export interface ChartSpec {
448
468
  hiddenSeries?: string[];
449
469
  /** Per-series visual overrides, keyed by series name (the color field value). */
450
470
  seriesStyles?: Record<string, SeriesStyle>;
471
+ /**
472
+ * Breakpoint-conditional overrides. Keys are breakpoint names.
473
+ * At compile time, if the container matches a breakpoint, its overrides
474
+ * are shallow-merged into the spec before layout computation.
475
+ */
476
+ overrides?: Partial<Record<Breakpoint, ChartSpecOverride>>;
451
477
  }
452
478
 
453
479
  /**