@opendata-ai/openchart-engine 9.0.0-rc.1 → 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 +26 -3
- package/dist/index.js +1383 -307
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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,
|
|
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 {
|
|
@@ -997,6 +1015,11 @@ declare function parseAnnotationSpans(line: string): RichSpan[];
|
|
|
997
1015
|
* @returns A NormalizedSpec with all optionals filled.
|
|
998
1016
|
*/
|
|
999
1017
|
declare function normalizeSpec(spec: VizSpec, warnings?: string[]): NormalizedSpec;
|
|
1018
|
+
/**
|
|
1019
|
+
* Recursively flatten a LayerSpec into leaf ChartSpecs.
|
|
1020
|
+
* Merges parent data, encoding, and transforms down to children.
|
|
1021
|
+
*/
|
|
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[];
|
|
1000
1023
|
|
|
1001
1024
|
/** Validate authored mark contracts before any sugar transformation. */
|
|
1002
1025
|
declare function validateSpec(spec: unknown): ValidationResult;
|
|
@@ -1407,4 +1430,4 @@ declare function migrateSpecV8<T>(input: T, options?: {
|
|
|
1407
1430
|
/** Author order and supplementary fields survive; formatted text never decides identity. */
|
|
1408
1431
|
declare function sharedTooltipFields(content: TooltipContent): TooltipField[];
|
|
1409
1432
|
|
|
1410
|
-
export { ARROWHEAD_LENGTH, AUTO_CANVAS_THRESHOLD, type AnnotationContext, type AnnotationEditContext, type AnnotationMeasureTextFn, type AppliedSpecPatch, type ArrowheadPoints, BOLD_SPAN_FONT_WEIGHT, type ChartRenderer, type CompileResult, type CompiledGraphEdge, type CompiledGraphNode, DEFAULT_ANNOTATION_FONT_SIZE, DEFAULT_LINE_HEIGHT, ENTER_DEFAULTS, EXIT_DEFAULTS, type GeoReaderIndex, type GeoReaderRecord, type GraphCompilation, MAX_3D_NODES, type NormalizedBarListSpec, type NormalizedChartSpec, type NormalizedChrome, type NormalizedGeoMapSpec, type NormalizedGraphSpec, type NormalizedSankeySpec, type NormalizedSpec, type NormalizedTableSpec, type NormalizedTileMapSpec, type ObservationComparison, type ObstacleKind, type PlacementObstacle, type ReaderPanelIndex, type ReaderSliceIndex, type RecommendationResult, type RecommendationRoles, type RichSpan, type SimulationConfig, type SpecRepair, UPDATE_DEFAULTS, type ValidationError, type ValidationErrorCode, type ValidationResult, applySpecPatch, automaticControlPoint, buildArcPath, buildAreaPath, buildEdgeTooltip, buildGeoReaderIndex, buildLinePath, buildReaderSliceIndex, clampStaggerDelay, clearRenderers, compareObservations, compareReaderValues, compile, compileBarList, compileChart, compileGeoMap, compileGraph, compileLayer, compileSankey, compileTable, compileTileMap, computeArrowheadPoints, createAnnotationEditContext, dedupeKeys, diagnoseChart, evaluatePredicate, facetMinHeight, geoColorKeyPosition, getChartRenderer, heuristicMeasure, interpolateAnnotationGeometry, inverseLabelPlacement, isConditionalValueDef, legendGap, linkedEntityKeys, migrateSpecV8, nearestReaderSlice, normalizeSpec, observationKey, parseAnnotationSpans, previewAnnotationMove, previewConnectorBend, previewConnectorOffset, queryGeoReaderRecords, readerDomainValue, readerSliceByKey, recommendCompositions, reconcileReaderSelection, reconcileReaderSlices, refreshConnector, registerChartRenderer, resolveAnimation, resolveConditionalValue, resolveGeoOverlay, resolveLayerTheme, resolveObservationIdentities, runBin, runCalculate, runFilter, runTimeUnit, runTransforms, serializeKeyValue, sharedTooltipFields, validateSpec };
|
|
1433
|
+
export { ARROWHEAD_LENGTH, AUTO_CANVAS_THRESHOLD, type AnnotationContext, type AnnotationEditContext, type AnnotationMeasureTextFn, type AppliedSpecPatch, type ArrowheadPoints, BOLD_SPAN_FONT_WEIGHT, type ChartRenderer, type CompileResult, type CompiledGraphEdge, type CompiledGraphNode, DEFAULT_ANNOTATION_FONT_SIZE, DEFAULT_LINE_HEIGHT, ENTER_DEFAULTS, EXIT_DEFAULTS, type GeoReaderIndex, type GeoReaderRecord, type GraphCompilation, MAX_3D_NODES, type NormalizedBarListSpec, type NormalizedChartSpec, type NormalizedChrome, type NormalizedGeoMapSpec, type NormalizedGraphSpec, type NormalizedSankeySpec, type NormalizedSpec, type NormalizedTableSpec, type NormalizedTileMapSpec, type ObservationComparison, type ObstacleKind, type PlacementObstacle, type ReaderPanelIndex, type ReaderSliceIndex, type RecommendationResult, type RecommendationRoles, type RichSpan, type SimulationConfig, type SpecRepair, UPDATE_DEFAULTS, type ValidationError, type ValidationErrorCode, type ValidationResult, applySpecPatch, automaticControlPoint, buildArcPath, buildAreaPath, buildEdgeTooltip, buildGeoReaderIndex, buildLinePath, buildReaderSliceIndex, clampStaggerDelay, clearRenderers, compareObservations, compareReaderValues, compile, compileBarList, compileChart, compileGeoMap, compileGraph, compileLayer, compileSankey, compileTable, compileTileMap, computeArrowheadPoints, createAnnotationEditContext, dedupeKeys, diagnoseChart, evaluatePredicate, facetMinHeight, flattenLayers, geoColorKeyPosition, getChartRenderer, heuristicMeasure, interpolateAnnotationGeometry, inverseLabelPlacement, isConditionalValueDef, legendGap, linkedEntityKeys, migrateSpecV8, nearestReaderSlice, normalizeSpec, observationKey, parseAnnotationSpans, previewAnnotationMove, previewConnectorBend, previewConnectorOffset, queryGeoReaderRecords, readerDomainValue, readerSliceByKey, recommendCompositions, reconcileReaderSelection, reconcileReaderSlices, refreshConnector, registerChartRenderer, resolveAnimation, resolveConditionalValue, resolveGeoOverlay, resolveLayerTheme, resolveObservationIdentities, runBin, runCalculate, runFilter, runTimeUnit, runTransforms, serializeKeyValue, sharedTooltipFields, validateSpec };
|