@opendata-ai/openchart-engine 7.8.0 → 7.9.1

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _opendata_ai_openchart_core from '@opendata-ai/openchart-core';
2
- import { LegendLayout, ResolvedChrome, TooltipContent, A11yMetadata, ResolvedTheme, CompileOptions, ChartLayout, LayerSpec, CompileTableOptions, TableLayout, AnimationSpec, ResolvedAnimation, DataRow, BarListEncoding, ThemeConfig, DarkMode, TileMapEncoding, TileMapPalette, LegendConfig, MarkType, MarkDef, Encoding, ChromeText, Annotation, LabelConfig, Display, ColumnConfig, GraphSpec, GraphEncoding, GraphLayoutConfig, NodeOverride, SankeyEncoding, SankeyNodeAlign, SankeyLinkColor, ScaleType, EncodingChannel, Rect, LayoutStrategy, VizSpec, Mark, BinTransform, CalculateTransform, ConditionalValueDef, FilterPredicate, TimeUnitTransform, Transform } from '@opendata-ai/openchart-core';
2
+ import { LegendLayout, ResolvedChrome, TooltipContent, A11yMetadata, ResolvedTheme, CompileOptions, ChartLayout, LayerSpec, CompileTableOptions, TableLayout, ResolvedAnimationPhase, AnimationSpec, ResolvedAnimation, Point, DataRow, BarListEncoding, ThemeConfig, DarkMode, TileMapEncoding, TileMapPalette, LegendConfig, MarkType, MarkDef, Encoding, ChromeText, Annotation, LabelConfig, Display, ColumnConfig, GraphSpec, GraphEncoding, GraphLayoutConfig, NodeOverride, SankeyEncoding, SankeyNodeAlign, SankeyLinkColor, ScaleType, EncodingChannel, Rect, LayoutStrategy, VizSpec, Mark, BinTransform, CalculateTransform, ConditionalValueDef, FilterPredicate, TimeUnitTransform, Transform } from '@opendata-ai/openchart-core';
3
3
  export { BarListLayout, BarListSpec, ChartLayout, ChartSpec, CompileOptions, CompileTableOptions, GraphLayout, GraphSpec, LayerSpec, SankeyLayout, SankeySpec, TableLayout, TableSpec, TileMapLayout, TileMapSpec, VizSpec } from '@opendata-ai/openchart-core';
4
4
  import { ScaleLinear, ScaleTime, ScaleLogarithmic, ScalePower, ScaleSymLog, ScaleBand, ScalePoint, ScaleOrdinal, ScaleQuantile, ScaleQuantize, ScaleThreshold } from 'd3-scale';
5
5
 
@@ -189,11 +189,24 @@ declare function compileBarList(spec: unknown, options: CompileOptions): _openda
189
189
  * Animation resolver: normalizes AnimationSpec into fully resolved config.
190
190
  *
191
191
  * Handles the shorthand forms:
192
- * - true -> { enter: true } -> full defaults
193
- * - { enter: { duration: 800 } } -> merge with defaults
192
+ * - true -> all three phases with defaults
193
+ * - { enter: { duration: 800 } } -> merge with defaults per phase
194
194
  * - false/undefined -> undefined (no animation)
195
+ *
196
+ * Each phase resolves independently:
197
+ * - true/config-object -> resolved phase merged onto that phase's defaults
198
+ * - false -> phase absent
199
+ * - undefined -> phase present with defaults (animation: {} behaves like true)
200
+ *
201
+ * Returns undefined only when ALL phases resolve absent.
195
202
  */
196
203
 
204
+ /** Default values for entrance animation. */
205
+ declare const ENTER_DEFAULTS: ResolvedAnimationPhase;
206
+ /** Default values for update (data transition) animation. */
207
+ declare const UPDATE_DEFAULTS: ResolvedAnimationPhase;
208
+ /** Default values for exit animation. */
209
+ declare const EXIT_DEFAULTS: ResolvedAnimationPhase;
197
210
  /**
198
211
  * Resolve an AnimationSpec into a fully resolved config with all defaults filled.
199
212
  * Returns undefined if animation is disabled (false or omitted).
@@ -204,6 +217,52 @@ declare function resolveAnimation(spec: AnimationSpec | undefined): ResolvedAnim
204
217
  */
205
218
  declare function clampStaggerDelay(delay: number, elementCount: number): number;
206
219
 
220
+ /**
221
+ * Mark key utilities for data-update transitions.
222
+ *
223
+ * Keys uniquely identify marks across data updates so the renderer can
224
+ * match old marks to new marks and animate the difference. Each chart
225
+ * type stamps keys during its compute phase; these helpers provide the
226
+ * shared serialization and deduplication logic.
227
+ */
228
+ /**
229
+ * Serialize a datum value into a stable key fragment.
230
+ * - Date -> epoch ms string (avoids locale-dependent Date.toString)
231
+ * - number/string/boolean -> String(v)
232
+ * - null/undefined -> null sentinel
233
+ */
234
+ declare function serializeKeyValue(v: unknown): string;
235
+ /**
236
+ * Append occurrence suffixes to duplicate keys, in order.
237
+ *
238
+ * Only keys that appear more than once get suffixed. Unique keys pass
239
+ * through unchanged so keys remain human-readable when possible.
240
+ * Uses SOH (\x01) as separator to avoid collisions with real data values.
241
+ */
242
+ declare function dedupeKeys(keys: string[]): string[];
243
+
244
+ /**
245
+ * Curve interpolation mapping and path builders.
246
+ *
247
+ * Maps Vega-Lite-style interpolation strings to d3-shape curve factories.
248
+ * Used by both line and area chart computations.
249
+ *
250
+ * Also exports pure path-builder helpers (`buildLinePath`, `buildAreaPath`)
251
+ * so downstream consumers (e.g. transition interpolators) can reconstruct
252
+ * SVG paths from point arrays without pulling in chart-specific code.
253
+ */
254
+
255
+ /**
256
+ * Build an SVG path string from an array of points using d3 line generator.
257
+ * Accepts an optional interpolation string (defaults to 'monotone').
258
+ */
259
+ declare function buildLinePath(points: Point[], interpolate?: string): string;
260
+ /**
261
+ * Build an SVG path string for a filled area from top and bottom point arrays.
262
+ * Accepts an optional interpolation string (defaults to 'monotone').
263
+ */
264
+ declare function buildAreaPath(topPoints: Point[], bottomPoints: Point[], interpolate?: string): string;
265
+
207
266
  /**
208
267
  * Internal normalized barlist spec type used by the compilation pipeline.
209
268
  */
@@ -733,4 +792,4 @@ declare function runTimeUnit(data: DataRow[], transform: TimeUnitTransform): Dat
733
792
  */
734
793
  declare function runTransforms(data: DataRow[], transforms: Transform[]): DataRow[];
735
794
 
736
- export { type AnnotationContext, type AnnotationMeasureTextFn, type ChartRenderer, type CompileResult, type CompiledGraphEdge, type CompiledGraphNode, type GraphCompilation, type NormalizedBarListSpec, type NormalizedChartSpec, type NormalizedChrome, type NormalizedGraphSpec, type NormalizedSankeySpec, type NormalizedSpec, type NormalizedTableSpec, type NormalizedTileMapSpec, type ObstacleKind, type PlacementObstacle, type SimulationConfig, type ValidationError, type ValidationErrorCode, type ValidationResult, clampStaggerDelay, clearRenderers, compile, compileBarList, compileChart, compileGraph, compileLayer, compileSankey, compileTable, compileTileMap, evaluatePredicate, getChartRenderer, heuristicMeasure, isConditionalValueDef, normalizeSpec, registerChartRenderer, resolveAnimation, resolveConditionalValue, runBin, runCalculate, runFilter, runTimeUnit, runTransforms, validateSpec };
795
+ export { type AnnotationContext, type AnnotationMeasureTextFn, type ChartRenderer, type CompileResult, type CompiledGraphEdge, type CompiledGraphNode, ENTER_DEFAULTS, EXIT_DEFAULTS, type GraphCompilation, type NormalizedBarListSpec, type NormalizedChartSpec, type NormalizedChrome, type NormalizedGraphSpec, type NormalizedSankeySpec, type NormalizedSpec, type NormalizedTableSpec, type NormalizedTileMapSpec, type ObstacleKind, type PlacementObstacle, type SimulationConfig, UPDATE_DEFAULTS, type ValidationError, type ValidationErrorCode, type ValidationResult, buildAreaPath, buildLinePath, clampStaggerDelay, clearRenderers, compile, compileBarList, compileChart, compileGraph, compileLayer, compileSankey, compileTable, compileTileMap, dedupeKeys, evaluatePredicate, getChartRenderer, heuristicMeasure, isConditionalValueDef, normalizeSpec, registerChartRenderer, resolveAnimation, resolveConditionalValue, runBin, runCalculate, runFilter, runTimeUnit, runTransforms, serializeKeyValue, validateSpec };