@opendata-ai/openchart-core 7.7.0 → 7.9.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": "7.7.0",
3
+ "version": "7.9.0",
4
4
  "description": "Types, theme, colors, accessibility, and utilities for openchart",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Riley Hilliard",
@@ -70,6 +70,7 @@ export type {
70
70
  Rect,
71
71
  RectMark,
72
72
  ResolvedAnimation,
73
+ ResolvedAnimationPhase,
73
74
  ResolvedAnnotation,
74
75
  ResolvedChrome,
75
76
  ResolvedChromeElement,
@@ -211,11 +211,18 @@ export interface MarkAria {
211
211
  */
212
212
  export interface LineMark {
213
213
  type: 'line';
214
+ /** Stable identity key for data-update transitions. */
215
+ key?: string;
216
+ /** Per-point identity keys parallel to `points`, for data-update transitions. */
217
+ pointKeys?: string[];
214
218
  /** Ordered array of points defining the line path. */
215
219
  points: Point[];
216
220
  /** Pre-computed SVG path string (D3 monotone curve). When present, renderers
217
221
  * should use this instead of reconstructing straight M/L segments from points. */
218
222
  path?: string;
223
+ /** Curve interpolation method used to build the path. Stored so the transition
224
+ * driver can reconstruct paths from interpolated point positions. */
225
+ interpolate?: string;
219
226
  /** Stroke color. */
220
227
  stroke: string;
221
228
  /** Stroke width in pixels. */
@@ -254,6 +261,10 @@ export interface LineMark {
254
261
  */
255
262
  export interface AreaMark {
256
263
  type: 'area';
264
+ /** Stable identity key for data-update transitions. */
265
+ key?: string;
266
+ /** Per-point identity keys parallel to `topPoints`, for data-update transitions. */
267
+ pointKeys?: string[];
257
268
  /** Upper boundary points. */
258
269
  topPoints: Point[];
259
270
  /** Lower boundary points (baseline, usually y=0). */
@@ -262,6 +273,8 @@ export interface AreaMark {
262
273
  path: string;
263
274
  /** SVG path string for just the top boundary (for stroking the data line only). */
264
275
  topPath: string;
276
+ /** Curve interpolation method used to build the path. */
277
+ interpolate?: string;
265
278
  /** Fill color or gradient. */
266
279
  fill: string | GradientDef;
267
280
  /** Fill opacity. */
@@ -298,6 +311,8 @@ export interface AreaMark {
298
311
  */
299
312
  export interface RectMark {
300
313
  type: 'rect';
314
+ /** Stable identity key for data-update transitions. */
315
+ key?: string;
301
316
  /** X position. */
302
317
  x: number;
303
318
  /** Y position. */
@@ -371,6 +386,8 @@ export interface ArcMark {
371
386
  label?: ResolvedLabel;
372
387
  /** Accessibility attributes. */
373
388
  aria: MarkAria;
389
+ /** Stable identity key for data-update transitions. */
390
+ key?: string;
374
391
  /** Index for stagger animation ordering. */
375
392
  animationIndex?: number;
376
393
  }
@@ -381,6 +398,8 @@ export interface ArcMark {
381
398
  */
382
399
  export interface PointMark {
383
400
  type: 'point';
401
+ /** Stable identity key for data-update transitions. */
402
+ key?: string;
384
403
  /** Center x position. */
385
404
  cx: number;
386
405
  /** Center y position. */
@@ -413,6 +432,8 @@ export interface PointMark {
413
432
  */
414
433
  export interface TextMarkLayout {
415
434
  type: 'textMark';
435
+ /** Stable identity key for data-update transitions. */
436
+ key?: string;
416
437
  /** X position. */
417
438
  x: number;
418
439
  /** Y position. */
@@ -449,6 +470,8 @@ export interface TextMarkLayout {
449
470
  */
450
471
  export interface RuleMarkLayout {
451
472
  type: 'rule';
473
+ /** Stable identity key for data-update transitions. */
474
+ key?: string;
452
475
  /** Start x position. */
453
476
  x1: number;
454
477
  /** Start y position. */
@@ -481,6 +504,8 @@ export interface RuleMarkLayout {
481
504
  */
482
505
  export interface TickMarkLayout {
483
506
  type: 'tick';
507
+ /** Stable identity key for data-update transitions. */
508
+ key?: string;
484
509
  /** X position. */
485
510
  x: number;
486
511
  /** Y position. */
@@ -815,10 +840,8 @@ export interface A11yMetadata {
815
840
  // Animation (resolved)
816
841
  // ---------------------------------------------------------------------------
817
842
 
818
- /** Resolved entrance animation config with all defaults applied. */
819
- export interface ResolvedAnimation {
820
- /** Whether entrance animation is enabled. */
821
- enabled: boolean;
843
+ /** One fully-resolved animation phase. */
844
+ export interface ResolvedAnimationPhase {
822
845
  /** Duration in ms. */
823
846
  duration: number;
824
847
  /** Easing preset name. */
@@ -827,6 +850,16 @@ export interface ResolvedAnimation {
827
850
  staggerDelay: number;
828
851
  /** Stagger ordering. */
829
852
  staggerOrder: 'index' | 'value' | 'reverse';
853
+ }
854
+
855
+ /** Resolved animation config. A phase is present iff that phase is enabled. */
856
+ export interface ResolvedAnimation {
857
+ /** Entrance animation phase. Present when enter animation is enabled. */
858
+ enter?: ResolvedAnimationPhase;
859
+ /** Data-update transition phase. Present when update animation is enabled. */
860
+ update?: ResolvedAnimationPhase;
861
+ /** Exit animation phase. Present when exit animation is enabled. */
862
+ exit?: ResolvedAnimationPhase;
830
863
  /** Delay before annotations animate in (ms after marks). */
831
864
  annotationDelay: number;
832
865
  }
package/src/types/spec.ts CHANGED
@@ -488,6 +488,12 @@ export interface Encoding<TData extends DataRow = DataRow> {
488
488
  * Useful when you want separate lines per category but don't need the color to differ.
489
489
  */
490
490
  detail?: EncodingChannel<TData>;
491
+ /**
492
+ * Identity channel for data-update transitions. Maps a field whose value
493
+ * uniquely identifies each datum across updates. Mirrors Vega-Lite's key channel.
494
+ * Not visually encoded. Optional: charts derive sensible default keys.
495
+ */
496
+ key?: EncodingChannel<TData>;
491
497
  /**
492
498
  * Secondary x position. Used with `x` to define a horizontal span (rect marks, error bars).
493
499
  * Both `x` and `x2` must be quantitative.
@@ -1158,15 +1164,13 @@ export interface AnimationPhaseConfig {
1158
1164
  /**
1159
1165
  * Full animation config object. Structured as enter/update/exit phases
1160
1166
  * following Vega's encoding set model.
1161
- *
1162
- * v1 implements enter only. update and exit reserved for v2.
1163
1167
  */
1164
1168
  export interface AnimationConfig {
1165
1169
  /** Entrance animation when chart first renders. */
1166
1170
  enter?: AnimationPhaseConfig | boolean;
1167
- /** Transition animation when data updates. Reserved for v2. */
1171
+ /** Transition animation when data updates. */
1168
1172
  update?: AnimationPhaseConfig | boolean;
1169
- /** Exit animation when marks are removed. Reserved for v2. */
1173
+ /** Exit animation when marks are removed. */
1170
1174
  exit?: AnimationPhaseConfig | boolean;
1171
1175
  /** Delay before annotations animate in (ms after marks). Default: 200. */
1172
1176
  annotationDelay?: number;