@opendata-ai/openchart-engine 9.6.0 → 9.7.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,6 +1,6 @@
1
1
  import * as _opendata_ai_openchart_core from '@opendata-ai/openchart-core';
2
- import { DataRow, GeoMapGeo, GeoMapProjection, GeoMapEncoding, LegendConfig, ThemeConfig, AnimationSpec, GeoMapPointsLayer, FieldMetadata, GeoCallout, RaceSpec, RaceMarkDef, RaceEncoding, EncodingChannel, RacePlayback, SankeyEncoding, SankeyNodeAlign, SankeyLinkColor, TileMapEncoding, TileMapPalette, MarkType, MarkDef, Encoding, ChromeText, Annotation, LabelConfig, Display, ColumnConfig, TableDensity, SortState, GraphSpec, GraphEncoding, GraphLayoutConfig, NodeOverride, GraphAnimationSpec, GraphInteractionConfig, BarListEncoding, BarListSpec, LayerSpec, ChartSpec, VizSpec, AnimationEase, SpringConfig, LegendLayout, ResolvedChrome, TooltipContent, A11yMetadata, ResolvedTheme, LegendEntry, RaceFrame, RaceLayout, RaceGeometry, CompileOptions, CompileWarning, BarListLayout, ChartLayout, GeoMapLayout, SankeyLayout, CompileTableOptions, TableLayout, TileMapLayout, ResolvedLabel, Rect, ResolvedAnnotation, ScaleType, FieldFormatContext, PlaybackPeriodPosition, PlaybackTimingConfig, LayoutStrategy, Mark, Point, TextMarkLayout, ResolvedAnimationPhase, ResolvedAnimation, MeasureTextFn, 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
- export { A11yDescriptionConfig, AnnotationPlacementTool, BarListLayout, BarListSpec, ChartLayout, ChartSpec, CompileOptions, CompileTableOptions, GeoMapLayout, GeoMapSpec, GraphLayout, GraphSpec, LayerSpec, MAX_TOTAL_STAGGER_MS, SankeyLayout, SankeySpec, TableLayout, TableSpec, TileMapLayout, TileMapSpec, TimeTickInterval, TimeTickStep, VizSpec, clampStaggerDelay } from '@opendata-ai/openchart-core';
2
+ import { DataRow, GeoMapGeo, GeoMapProjection, GeoMapEncoding, LegendConfig, ThemeConfig, AnimationSpec, GeoMapPointsLayer, FieldMetadata, GeoCallout, RaceSpec, RaceMarkDef, RaceEncoding, EncodingChannel, SupportedLocale, RacePlayback, SankeyEncoding, SankeyNodeAlign, SankeyLinkColor, TileMapEncoding, TileMapPalette, MarkType, MarkDef, Encoding, ChromeText, Annotation, LabelConfig, Display, ColumnConfig, TableDensity, SortState, GraphSpec, GraphEncoding, GraphLayoutConfig, NodeOverride, GraphAnimationSpec, GraphInteractionConfig, BarListEncoding, BarListSpec, LayerSpec, ChartSpec, VizSpec, AnimationEase, SpringConfig, LegendLayout, ResolvedChrome, TooltipContent, A11yMetadata, ResolvedTheme, LegendEntry, RaceFrame, RaceLayout, RaceGeometry, CompileOptions, CompileWarning, BarListLayout, ChartLayout, GeoMapLayout, SankeyLayout, CompileTableOptions, TableLayout, TileMapLayout, ResolvedLabel, Rect, ResolvedAnnotation, ScaleType, FieldFormatContext, PlaybackPeriodPosition, PlaybackTimingConfig, LayoutStrategy, Mark, Point, TextMarkLayout, ResolvedAnimationPhase, ResolvedAnimation, MeasureTextFn, 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
+ export { A11yDescriptionConfig, AnnotationPlacementTool, BarListLayout, BarListSpec, ChartLayout, ChartSpec, ChromeTextAlign, CompileOptions, CompileTableOptions, GeoMapLayout, GeoMapSpec, GraphLayout, GraphSpec, LayerSpec, LogoPosition, MAX_TOTAL_STAGGER_MS, ResolvedChromeLogo, SUPPORTED_LOCALES, SankeyLayout, SankeySpec, SupportedLocale, TableLayout, TableSpec, ThemeLogo, TileMapLayout, TileMapSpec, TimeTickInterval, TimeTickStep, VizSpec, clampStaggerDelay, isSafeLogoSource, isSupportedLocale, matchLocale } 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';
6
6
 
@@ -26,6 +26,8 @@ interface NormalizedGeoMapSpec {
26
26
  chrome: NormalizedChrome;
27
27
  legend?: LegendConfig;
28
28
  theme: ThemeConfig;
29
+ /** Authored formatting locale, resolved at compilation. */
30
+ locale?: string;
29
31
  watermark: boolean;
30
32
  animation?: AnimationSpec;
31
33
  points?: GeoMapPointsLayer;
@@ -129,6 +131,8 @@ interface RaceColorAssignment {
129
131
  readonly byPaletteSize: ReadonlyMap<number, readonly (number | string)[]>;
130
132
  }
131
133
  interface RaceModel {
134
+ /** Locale resolved during preparation for all model formatting. */
135
+ locale: SupportedLocale;
132
136
  spec: NormalizedRaceSpec;
133
137
  /** Authored watermark setting, before normalization supplies a default. */
134
138
  specWatermark?: boolean;
@@ -166,6 +170,8 @@ interface NormalizedSankeySpec {
166
170
  chrome: NormalizedChrome;
167
171
  legend?: LegendConfig;
168
172
  theme: ThemeConfig;
173
+ /** Authored formatting locale, resolved at compilation. */
174
+ locale?: string;
169
175
  watermark: boolean;
170
176
  animation?: AnimationSpec;
171
177
  linkOpacity?: number;
@@ -192,6 +198,8 @@ interface NormalizedTileMapSpec {
192
198
  chrome: NormalizedChrome;
193
199
  legend?: LegendConfig;
194
200
  theme: ThemeConfig;
201
+ /** Authored formatting locale, resolved at compilation. */
202
+ locale?: string;
195
203
  watermark: boolean;
196
204
  animation?: AnimationSpec;
197
205
  valueFormat?: string;
@@ -199,6 +207,8 @@ interface NormalizedTileMapSpec {
199
207
 
200
208
  /** Chrome with all string values normalized to ChromeText objects. */
201
209
  interface NormalizedChrome {
210
+ /** Authored theme-logo visibility override. */
211
+ logo?: boolean;
202
212
  eyebrow?: ChromeText;
203
213
  title?: ChromeText;
204
214
  subtitle?: ChromeText;
@@ -290,6 +300,8 @@ interface NormalizedChartSpec {
290
300
  autoThin: boolean;
291
301
  compactAnnotationLimit?: number | null;
292
302
  theme: ThemeConfig;
303
+ /** Authored formatting locale, resolved at compilation. */
304
+ locale?: string;
293
305
  /** Whether the OpenChart watermark is enabled. */
294
306
  watermark: boolean;
295
307
  /** Series names to hide from rendering. */
@@ -324,6 +336,8 @@ interface NormalizedTableSpec {
324
336
  a11y?: _opendata_ai_openchart_core.A11yDescriptionConfig;
325
337
  chrome: NormalizedChrome;
326
338
  theme: ThemeConfig;
339
+ /** Authored formatting locale, resolved at compilation. */
340
+ locale?: string;
327
341
  watermark: boolean;
328
342
  search: boolean;
329
343
  pagination: boolean | {
@@ -356,6 +370,8 @@ interface NormalizedGraphSpec {
356
370
  chrome: NormalizedChrome;
357
371
  annotations: Annotation[];
358
372
  theme: ThemeConfig;
373
+ /** Authored formatting locale, resolved at compilation. */
374
+ locale?: string;
359
375
  watermark: boolean;
360
376
  animation?: GraphAnimationSpec;
361
377
  interaction?: GraphInteractionConfig;
@@ -419,6 +435,8 @@ interface NormalizedBarListSpec {
419
435
  a11y?: BarListSpec['a11y'];
420
436
  chrome: NormalizedChrome;
421
437
  theme: ThemeConfig;
438
+ /** Authored formatting locale, resolved at compilation. */
439
+ locale?: string;
422
440
  watermark: boolean;
423
441
  animation?: AnimationSpec;
424
442
  }
@@ -708,7 +726,7 @@ declare function layoutRace(model: RaceModel, options: CompileOptions & {
708
726
  }): RaceLayout;
709
727
 
710
728
  /**
711
- * Validate and prepare the size-independent race model.
729
+ * Validate and prepare the size-independent race model, including its resolved formatting locale.
712
730
  * @throws {Error} Aggregated spec validation errors or a non-race spec.
713
731
  * @throws {RaceDataError} Duplicate rows, too few periods, or no finite values.
714
732
  * @throws {RangeError} The step multiplied by the period intervals overflows.
@@ -716,6 +734,7 @@ declare function layoutRace(model: RaceModel, options: CompileOptions & {
716
734
  declare function prepareRace(spec: unknown, options: {
717
735
  onWarn?: (w: CompileWarning) => void;
718
736
  previousModel?: RaceModel;
737
+ theme?: ThemeConfig;
719
738
  }): RaceModel;
720
739
 
721
740
  /**
@@ -1038,7 +1057,7 @@ declare function resolveLayerTheme(layerSpec: LayerSpec, primary?: ChartSpec): _
1038
1057
  * compile (including graph updates) would be pure bloat. Shows source → target
1039
1058
  * and all non-structural data fields.
1040
1059
  */
1041
- declare function buildEdgeTooltip(edge: CompiledGraphEdge): TooltipContent;
1060
+ declare function buildEdgeTooltip(edge: CompiledGraphEdge, locale?: string): TooltipContent;
1042
1061
 
1043
1062
  /**
1044
1063
  * Name labels for the points `playback.labels` lists. Each is its own text mark beside the
@@ -1437,7 +1456,7 @@ declare const PERIOD_LABEL_KEY = "oc-playback-period";
1437
1456
  * Automatic labels use years if all dates are January 1, months if all dates are
1438
1457
  * the first of a month, and days otherwise.
1439
1458
  */
1440
- declare function formatPeriodLabels(periods: PlaybackPeriod[], time: EncodingChannel): string[];
1459
+ declare function formatPeriodLabels(periods: PlaybackPeriod[], time: EncodingChannel, locale?: string): string[];
1441
1460
 
1442
1461
  /**
1443
1462
  * Whether a raw spec sets `encoding.time` (any non-null value, so a malformed channel still