@opendata-ai/openchart-engine 9.0.0-rc.2 → 9.0.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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _opendata_ai_openchart_core from '@opendata-ai/openchart-core';
2
- import { AnimationEase, LegendLayout, ResolvedChrome, TooltipContent, A11yMetadata, ResolvedTheme, LegendEntry, CompileOptions, BarListLayout, ChartLayout, GeoMapLayout, LayerSpec, SankeyLayout, CompileTableOptions, TableLayout, TileMapLayout, DataRow, BarListEncoding, ThemeConfig, AnimationSpec, GeoMapGeo, GeoMapProjection, GeoMapEncoding, LegendConfig, GeoMapPointsLayer, FieldMetadata, GeoCallout, SankeyEncoding, SankeyNodeAlign, SankeyLinkColor, TileMapEncoding, TileMapPalette, MarkType, MarkDef, Encoding, ChromeText, Annotation, LabelConfig, Display, ColumnConfig, TableDensity, SortState, GraphSpec, GraphEncoding, GraphLayoutConfig, NodeOverride, GraphAnimationSpec, GraphInteractionConfig, ResolvedLabel, Rect, ResolvedAnnotation, ChartSpec, ResolvedAnimationPhase, ResolvedAnimation, Point, ScaleType, EncodingChannel, FieldFormatContext, LayoutStrategy, VizSpec, MeasureTextFn, Mark, BinTransform, CalculateTransform, ConditionalValueDef, FilterPredicate, TimeUnitTransform, Transform, ElementRef, TextAnnotation, DesignDiagnostic, DatasetBinding, ReaderSelection, ObservationIdentity, SpecPatch, ReaderPanelScope, ReaderSlice, ReaderSliceIndexOptions, ReaderComparisonOperand, ReaderComparisonResult, ReaderDomainValue, ReaderSliceSelection, CompositionRecommendation, DesignQuestion, GeoColorKeyLayout, GeoLabelsInput, GeoLabelAffine, GeoLabelOverlay, GeoReaderObservation, GeoMapSpec, TooltipField } from '@opendata-ai/openchart-core';
2
+ import { AnimationEase, LegendLayout, ResolvedChrome, TooltipContent, A11yMetadata, ResolvedTheme, LegendEntry, CompileOptions, BarListLayout, ChartLayout, GeoMapLayout, LayerSpec, SankeyLayout, CompileTableOptions, TableLayout, TileMapLayout, DataRow, BarListEncoding, BarListSpec, ThemeConfig, AnimationSpec, GeoMapGeo, GeoMapProjection, GeoMapEncoding, LegendConfig, GeoMapPointsLayer, FieldMetadata, GeoCallout, SankeyEncoding, SankeyNodeAlign, SankeyLinkColor, TileMapEncoding, TileMapPalette, MarkType, MarkDef, Encoding, ChromeText, Annotation, LabelConfig, Display, ColumnConfig, TableDensity, SortState, GraphSpec, GraphEncoding, GraphLayoutConfig, NodeOverride, GraphAnimationSpec, GraphInteractionConfig, ResolvedLabel, Rect, ResolvedAnnotation, ChartSpec, ResolvedAnimationPhase, ResolvedAnimation, Point, EncodingChannel, ScaleType, FieldFormatContext, LayoutStrategy, VizSpec, MeasureTextFn, Mark, BinTransform, CalculateTransform, ConditionalValueDef, FilterPredicate, TimeUnitTransform, Transform, ElementRef, TextAnnotation, DesignDiagnostic, DatasetBinding, ReaderSelection, ObservationIdentity, SpecPatch, ReaderPanelScope, ReaderSlice, ReaderSliceIndexOptions, ReaderComparisonOperand, ReaderComparisonResult, ReaderDomainValue, ReaderSliceSelection, CompositionRecommendation, DesignQuestion, GeoColorKeyLayout, GeoLabelsInput, GeoLabelAffine, GeoLabelOverlay, GeoReaderObservation, GeoMapSpec, TooltipField } from '@opendata-ai/openchart-core';
3
3
  export { BarListLayout, BarListSpec, ChartLayout, ChartSpec, CompileOptions, CompileTableOptions, GeoMapLayout, GeoMapSpec, GraphLayout, GraphSpec, LayerSpec, SankeyLayout, SankeySpec, TableLayout, TableSpec, TileMapLayout, TileMapSpec, VizSpec } from '@opendata-ai/openchart-core';
4
4
  import { Series } from 'd3-shape';
5
5
  import { ScaleLinear, ScaleTime, ScaleLogarithmic, ScalePower, ScaleSymLog, ScaleBand, ScalePoint, ScaleOrdinal, ScaleQuantile, ScaleQuantize, ScaleThreshold } from 'd3-scale';
@@ -356,6 +356,11 @@ interface NormalizedBarListSpec {
356
356
  barHeight: number;
357
357
  cornerRadius: number | 'pill';
358
358
  maxItems: number;
359
+ sort: 'descending' | 'ascending' | null;
360
+ height?: BarListSpec['height'];
361
+ annotations?: BarListSpec['annotations'];
362
+ labels?: BarListSpec['labels'];
363
+ a11y?: BarListSpec['a11y'];
359
364
  chrome: NormalizedChrome;
360
365
  theme: ThemeConfig;
361
366
  watermark: boolean;
@@ -491,6 +496,11 @@ type NormalizedMarkDef = {
491
496
  interface NormalizedChartSpec {
492
497
  /** Resolved mark type string (extracted from spec.mark). */
493
498
  markType: MarkType;
499
+ /** Original authored mark before histogram/density sugar. */
500
+ sourceMarkType?: MarkType;
501
+ /** Compile-local mark warnings, emitted once after geometry computation. */
502
+ markWarnings?: string[];
503
+ frame?: _opendata_ai_openchart_core.FrameConfig;
494
504
  /** Resolved mark definition with defaults filled in. */
495
505
  markDef: NormalizedMarkDef;
496
506
  data: DataRow[];
@@ -516,7 +526,7 @@ interface NormalizedChartSpec {
516
526
  youDrawIt?: _opendata_ai_openchart_core.YouDrawItConfig;
517
527
  annotations: Annotation[];
518
528
  /** Normalized label configuration with defaults applied. density, format, and prefix are always set; offsets and color stay optional. */
519
- labels: Required<Pick<LabelConfig, 'density' | 'format' | 'prefix'>> & Pick<LabelConfig, 'color' | 'fontSize' | 'suffix' | 'placement'>;
529
+ labels: Required<Pick<LabelConfig, 'density' | 'format' | 'prefix'>> & Pick<LabelConfig, 'color' | 'fontSize' | 'suffix' | 'placement' | 'content'>;
520
530
  /** Legend configuration (position override). */
521
531
  legend?: LegendConfig;
522
532
  /** Right-side endpoint labels column config (multi-series line/area only). */
@@ -867,6 +877,13 @@ declare function buildLinePath(points: Point[], interpolate?: string): string;
867
877
  */
868
878
  declare function buildAreaPath(topPoints: Point[], bottomPoints: Point[], interpolate?: string): string;
869
879
 
880
+ type TemporalInterval = NonNullable<EncodingChannel['interval']>;
881
+ interface ResolvedTemporalInterval {
882
+ value: TemporalInterval;
883
+ offset(date: Date): Date;
884
+ warnings: string[];
885
+ }
886
+
870
887
  /** Continuous D3 scales (linear, time, log, pow, sqrt, symlog) that support .ticks() and .nice(). */
871
888
  type D3ContinuousScale = ScaleLinear<number, number> | ScaleTime<number, number> | ScaleLogarithmic<number, number> | ScalePower<number, number> | ScaleSymLog<number, number>;
872
889
  /** Discretizing D3 scales (quantile, quantize, threshold). */
@@ -892,6 +909,7 @@ interface ResolvedScale {
892
909
  channel: EncodingChannel;
893
910
  /** Per-field formatting context (extent, allIntegers) from the ORIGINAL data. */
894
911
  formatContext?: FieldFormatContext;
912
+ temporalInterval?: ResolvedTemporalInterval;
895
913
  }
896
914
  /** All resolved scales for a chart. */
897
915
  interface ResolvedScales {
@@ -1001,7 +1019,7 @@ declare function normalizeSpec(spec: VizSpec, warnings?: string[]): NormalizedSp
1001
1019
  * Recursively flatten a LayerSpec into leaf ChartSpecs.
1002
1020
  * Merges parent data, encoding, and transforms down to children.
1003
1021
  */
1004
- declare function flattenLayers(spec: LayerSpec, parentData?: DataRow[], parentEncoding?: Encoding, parentTransforms?: _opendata_ai_openchart_core.Transform[], parentWatermark?: boolean, parentEndpointLabels?: boolean | _opendata_ai_openchart_core.EndpointLabelsConfig): ChartSpec[];
1022
+ declare function flattenLayers(spec: LayerSpec, parentData?: DataRow[], parentEncoding?: Encoding, parentTransforms?: _opendata_ai_openchart_core.Transform[], parentWatermark?: boolean, parentEndpointLabels?: boolean | _opendata_ai_openchart_core.EndpointLabelsConfig, parentFigure?: Pick<LayerSpec, 'display' | 'a11y' | 'frame' | 'labels'>): ChartSpec[];
1005
1023
 
1006
1024
  /** Validate authored mark contracts before any sugar transformation. */
1007
1025
  declare function validateSpec(spec: unknown): ValidationResult;