@opendata-ai/openchart-engine 6.27.2 → 6.28.4

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,6 +1,6 @@
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, TileMapEncoding, TileMapPalette, LegendConfig, ThemeConfig, DarkMode, MarkType, MarkDef, DataRow, Encoding, ChromeText, Annotation, LabelConfig, Display, ColumnConfig, GraphSpec, GraphEncoding, GraphLayoutConfig, NodeOverride, SankeyEncoding, SankeyNodeAlign, SankeyLinkColor, VizSpec, ScaleType, EncodingChannel, Rect, LayoutStrategy, Mark, BinTransform, CalculateTransform, ConditionalValueDef, FilterPredicate, TimeUnitTransform, Transform } from '@opendata-ai/openchart-core';
3
- export { ChartLayout, ChartSpec, CompileOptions, CompileTableOptions, GraphLayout, GraphSpec, LayerSpec, SankeyLayout, SankeySpec, TableLayout, TableSpec, TileMapLayout, TileMapSpec, VizSpec } 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, VizSpec, ScaleType, EncodingChannel, Rect, LayoutStrategy, Mark, BinTransform, CalculateTransform, ConditionalValueDef, FilterPredicate, TimeUnitTransform, Transform } from '@opendata-ai/openchart-core';
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
 
6
6
  /**
@@ -182,6 +182,19 @@ declare function compileSankey(spec: unknown, options: CompileOptions): _opendat
182
182
  * @throws Error if spec is invalid or not a tilemap type.
183
183
  */
184
184
  declare function compileTileMap(spec: unknown, options: CompileOptions): _opendata_ai_openchart_core.TileMapLayout;
185
+ /**
186
+ * Compile a barlist spec into a BarListLayout.
187
+ *
188
+ * Takes a raw barlist spec, validates, normalizes, resolves theme and chrome,
189
+ * computes row layout with proportional bars, builds tooltips, and returns
190
+ * a BarListLayout ready for rendering.
191
+ *
192
+ * @param spec - Raw barlist spec (validated and normalized internally).
193
+ * @param options - Compile options (width, height, theme, darkMode).
194
+ * @returns BarListLayout with computed positions and visual properties.
195
+ * @throws Error if spec is invalid or not a barlist type.
196
+ */
197
+ declare function compileBarList(spec: unknown, options: CompileOptions): _opendata_ai_openchart_core.BarListLayout;
185
198
 
186
199
  /**
187
200
  * Animation resolver: normalizes AnimationSpec into fully resolved config.
@@ -202,6 +215,25 @@ declare function resolveAnimation(spec: AnimationSpec | undefined): ResolvedAnim
202
215
  */
203
216
  declare function clampStaggerDelay(delay: number, elementCount: number): number;
204
217
 
218
+ /**
219
+ * Internal normalized barlist spec type used by the compilation pipeline.
220
+ */
221
+
222
+ interface NormalizedBarListSpec {
223
+ type: 'barlist';
224
+ data: DataRow[];
225
+ encoding: BarListEncoding;
226
+ barHeight: number;
227
+ cornerRadius: number | 'pill';
228
+ maxItems: number;
229
+ chrome: NormalizedChrome;
230
+ theme: ThemeConfig;
231
+ darkMode: DarkMode;
232
+ watermark: boolean;
233
+ animation?: AnimationSpec;
234
+ valueFormat?: string;
235
+ }
236
+
205
237
  /**
206
238
  * Internal normalized tilemap spec type used by the compilation pipeline.
207
239
  *
@@ -270,8 +302,8 @@ interface NormalizedChartSpec {
270
302
  encoding: Encoding;
271
303
  chrome: NormalizedChrome;
272
304
  annotations: Annotation[];
273
- /** Normalized label configuration with defaults applied. density, format, and prefix are always set; offsets stays optional. */
274
- labels: Required<Pick<LabelConfig, 'density' | 'format' | 'prefix'>> & Pick<LabelConfig, 'offsets'>;
305
+ /** Normalized label configuration with defaults applied. density, format, and prefix are always set; offsets and color stay optional. */
306
+ labels: Required<Pick<LabelConfig, 'density' | 'format' | 'prefix'>> & Pick<LabelConfig, 'offsets' | 'color'>;
275
307
  /** Legend configuration (position override). */
276
308
  legend?: LegendConfig;
277
309
  responsive: boolean;
@@ -326,7 +358,7 @@ interface NormalizedGraphSpec {
326
358
  watermark: boolean;
327
359
  }
328
360
  /** Discriminated union of all normalized spec types. */
329
- type NormalizedSpec = NormalizedChartSpec | NormalizedTableSpec | NormalizedGraphSpec | NormalizedSankeySpec | NormalizedTileMapSpec;
361
+ type NormalizedSpec = NormalizedChartSpec | NormalizedTableSpec | NormalizedGraphSpec | NormalizedSankeySpec | NormalizedTileMapSpec | NormalizedBarListSpec;
330
362
  /** Machine-readable error code for programmatic handling. */
331
363
  type ValidationErrorCode = 'MISSING_FIELD' | 'INVALID_TYPE' | 'INVALID_VALUE' | 'ENCODING_MISMATCH' | 'DATA_FIELD_MISSING' | 'EMPTY_DATA';
332
364
  /** A single validation error with context. */
@@ -642,4 +674,4 @@ declare function runTimeUnit(data: DataRow[], transform: TimeUnitTransform): Dat
642
674
  */
643
675
  declare function runTransforms(data: DataRow[], transforms: Transform[]): DataRow[];
644
676
 
645
- export { type ChartRenderer, type CompileResult, type CompiledGraphEdge, type CompiledGraphNode, type GraphCompilation, type NormalizedChartSpec, type NormalizedChrome, type NormalizedGraphSpec, type NormalizedSankeySpec, type NormalizedSpec, type NormalizedTableSpec, type NormalizedTileMapSpec, type SimulationConfig, type ValidationError, type ValidationErrorCode, type ValidationResult, clampStaggerDelay, clearRenderers, compile, compileChart, compileGraph, compileLayer, compileSankey, compileTable, compileTileMap, evaluatePredicate, getChartRenderer, isConditionalValueDef, normalizeSpec, registerChartRenderer, resolveAnimation, resolveConditionalValue, runBin, runCalculate, runFilter, runTimeUnit, runTransforms, validateSpec };
677
+ export { 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 SimulationConfig, type ValidationError, type ValidationErrorCode, type ValidationResult, clampStaggerDelay, clearRenderers, compile, compileBarList, compileChart, compileGraph, compileLayer, compileSankey, compileTable, compileTileMap, evaluatePredicate, getChartRenderer, isConditionalValueDef, normalizeSpec, registerChartRenderer, resolveAnimation, resolveConditionalValue, runBin, runCalculate, runFilter, runTimeUnit, runTransforms, validateSpec };