@opendata-ai/openchart-engine 8.9.1 → 9.0.0-rc.2
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 +362 -186
- package/dist/index.js +26610 -20522
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _opendata_ai_openchart_core from '@opendata-ai/openchart-core';
|
|
2
|
-
import { AnimationEase, LegendLayout, ResolvedChrome, TooltipContent, A11yMetadata, ResolvedTheme, LegendEntry, CompileOptions,
|
|
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';
|
|
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
|
+
import { Series } from 'd3-shape';
|
|
4
5
|
import { ScaleLinear, ScaleTime, ScaleLogarithmic, ScalePower, ScaleSymLog, ScaleBand, ScalePoint, ScaleOrdinal, ScaleQuantile, ScaleQuantize, ScaleThreshold } from 'd3-scale';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -226,6 +227,19 @@ interface GraphCompilation {
|
|
|
226
227
|
*/
|
|
227
228
|
declare const MAX_3D_NODES = 2000;
|
|
228
229
|
|
|
230
|
+
/**
|
|
231
|
+
* Main compile API: the public entry points for the engine.
|
|
232
|
+
*
|
|
233
|
+
* Pipeline for charts (see ./compile/chart.ts for the phases):
|
|
234
|
+
* validate spec -> normalize -> resolve theme -> dark mode adapt ->
|
|
235
|
+
* filter data -> resolveLayoutPlan (measure real labels) ->
|
|
236
|
+
* compute dimensions (with plan) -> placeLegend ->
|
|
237
|
+
* compute scales -> compute axes (with pinned ticks) -> compute gridlines ->
|
|
238
|
+
* get chart renderer -> compute marks -> compute a11y -> return ChartLayout
|
|
239
|
+
*
|
|
240
|
+
* Table compiler handles full data pipeline (sort, search, pagination, visual enhancements).
|
|
241
|
+
*/
|
|
242
|
+
|
|
229
243
|
/**
|
|
230
244
|
* Compile a chart spec into a ChartLayout.
|
|
231
245
|
*
|
|
@@ -279,7 +293,7 @@ declare function compileGraph(spec: unknown, options: CompileOptions): GraphComp
|
|
|
279
293
|
* @returns SankeyLayout with computed positions and visual properties.
|
|
280
294
|
* @throws Error if spec is invalid or not a sankey type.
|
|
281
295
|
*/
|
|
282
|
-
declare function compileSankey(spec: unknown, options: CompileOptions):
|
|
296
|
+
declare function compileSankey(spec: unknown, options: CompileOptions): SankeyLayout;
|
|
283
297
|
/**
|
|
284
298
|
* Compile a tilemap spec into a TileMapLayout.
|
|
285
299
|
*
|
|
@@ -292,7 +306,7 @@ declare function compileSankey(spec: unknown, options: CompileOptions): _opendat
|
|
|
292
306
|
* @returns TileMapLayout with computed positions and visual properties.
|
|
293
307
|
* @throws Error if spec is invalid or not a tilemap type.
|
|
294
308
|
*/
|
|
295
|
-
declare function compileTileMap(spec: unknown, options: CompileOptions):
|
|
309
|
+
declare function compileTileMap(spec: unknown, options: CompileOptions): TileMapLayout;
|
|
296
310
|
/**
|
|
297
311
|
* Compile a map spec into a GeoMapLayout.
|
|
298
312
|
*
|
|
@@ -305,7 +319,7 @@ declare function compileTileMap(spec: unknown, options: CompileOptions): _openda
|
|
|
305
319
|
* @returns GeoMapLayout with computed positions and visual properties.
|
|
306
320
|
* @throws Error if spec is invalid or not a map type.
|
|
307
321
|
*/
|
|
308
|
-
declare function compileGeoMap(spec: unknown, options: CompileOptions):
|
|
322
|
+
declare function compileGeoMap(spec: unknown, options: CompileOptions): GeoMapLayout;
|
|
309
323
|
/**
|
|
310
324
|
* Compile a barlist spec into a BarListLayout.
|
|
311
325
|
*
|
|
@@ -318,103 +332,18 @@ declare function compileGeoMap(spec: unknown, options: CompileOptions): _opendat
|
|
|
318
332
|
* @returns BarListLayout with computed positions and visual properties.
|
|
319
333
|
* @throws Error if spec is invalid or not a barlist type.
|
|
320
334
|
*/
|
|
321
|
-
declare function compileBarList(spec: unknown, options: CompileOptions):
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Graph compilation pipeline.
|
|
325
|
-
*
|
|
326
|
-
* Takes a raw graph spec (unknown shape), validates, normalizes, resolves
|
|
327
|
-
* encoding channels to visual properties, assigns communities, builds
|
|
328
|
-
* legend/tooltips/a11y, and returns a GraphCompilation.
|
|
329
|
-
*
|
|
330
|
-
* The pipeline mirrors compileChart's structure:
|
|
331
|
-
* validate -> normalize -> resolve theme -> resolve visuals ->
|
|
332
|
-
* community assignment -> legend -> tooltips -> a11y -> return
|
|
333
|
-
*
|
|
334
|
-
* Key difference from charts: the output does NOT include x/y positions.
|
|
335
|
-
* The force simulation in the adapter handles layout at runtime.
|
|
336
|
-
*/
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Build a tooltip for a single edge, on demand.
|
|
340
|
-
*
|
|
341
|
-
* Construction is LAZY (called for the one hovered edge), not an eager O(E)
|
|
342
|
-
* descriptor map — edges outnumber nodes 5–10× and an eager map on every
|
|
343
|
-
* compile (including updateVisuals) would be pure bloat. Shows source → target
|
|
344
|
-
* and all non-structural data fields.
|
|
345
|
-
*/
|
|
346
|
-
declare function buildEdgeTooltip(edge: CompiledGraphEdge): TooltipContent;
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* Animation resolver: normalizes AnimationSpec into fully resolved config.
|
|
350
|
-
*
|
|
351
|
-
* Handles the shorthand forms:
|
|
352
|
-
* - true -> all three phases with defaults
|
|
353
|
-
* - { enter: { duration: 800 } } -> merge with defaults per phase
|
|
354
|
-
* - false/undefined -> undefined (no animation)
|
|
355
|
-
*
|
|
356
|
-
* Each phase resolves independently:
|
|
357
|
-
* - true/config-object -> resolved phase merged onto that phase's defaults
|
|
358
|
-
* - false -> phase absent
|
|
359
|
-
* - undefined -> phase present with defaults (animation: {} behaves like true)
|
|
360
|
-
*
|
|
361
|
-
* Returns undefined only when ALL phases resolve absent.
|
|
362
|
-
*/
|
|
363
|
-
|
|
364
|
-
/** Default values for entrance animation. */
|
|
365
|
-
declare const ENTER_DEFAULTS: ResolvedAnimationPhase;
|
|
366
|
-
/** Default values for update (data transition) animation. */
|
|
367
|
-
declare const UPDATE_DEFAULTS: ResolvedAnimationPhase;
|
|
368
|
-
/** Default values for exit animation. */
|
|
369
|
-
declare const EXIT_DEFAULTS: ResolvedAnimationPhase;
|
|
370
|
-
/**
|
|
371
|
-
* Resolve an AnimationSpec into a fully resolved config with all defaults filled.
|
|
372
|
-
* Returns undefined if animation is disabled (false or omitted).
|
|
373
|
-
*/
|
|
374
|
-
declare function resolveAnimation(spec: AnimationSpec | undefined): ResolvedAnimation | undefined;
|
|
375
|
-
/**
|
|
376
|
-
* Clamp stagger delay so total stagger time doesn't exceed MAX_TOTAL_STAGGER_MS.
|
|
377
|
-
*/
|
|
378
|
-
declare function clampStaggerDelay(delay: number, elementCount: number): number;
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Mark key utilities for data-update transitions.
|
|
382
|
-
*
|
|
383
|
-
* Keys uniquely identify marks across data updates so the renderer can
|
|
384
|
-
* match old marks to new marks and animate the difference. Each chart
|
|
385
|
-
* type stamps keys during its compute phase; these helpers provide the
|
|
386
|
-
* shared serialization and deduplication logic.
|
|
387
|
-
*/
|
|
388
|
-
/**
|
|
389
|
-
* Serialize a datum value into a stable key fragment.
|
|
390
|
-
* - Date -> epoch ms string (avoids locale-dependent Date.toString)
|
|
391
|
-
* - number/string/boolean -> String(v)
|
|
392
|
-
* - null/undefined -> null sentinel
|
|
393
|
-
*/
|
|
394
|
-
declare function serializeKeyValue(v: unknown): string;
|
|
395
|
-
declare function dedupeKeys(keys: string[]): string[];
|
|
335
|
+
declare function compileBarList(spec: unknown, options: CompileOptions): BarListLayout;
|
|
396
336
|
|
|
397
|
-
/**
|
|
398
|
-
* Curve interpolation mapping and path builders.
|
|
399
|
-
*
|
|
400
|
-
* Maps Vega-Lite-style interpolation strings to d3-shape curve factories.
|
|
401
|
-
* Used by both line and area chart computations.
|
|
402
|
-
*
|
|
403
|
-
* Also exports pure path-builder helpers (`buildLinePath`, `buildAreaPath`)
|
|
404
|
-
* so downstream consumers (e.g. transition interpolators) can reconstruct
|
|
405
|
-
* SVG paths from point arrays without pulling in chart-specific code.
|
|
406
|
-
*/
|
|
337
|
+
/** Shared area pivot/offset semantics for domain measurement and mark geometry. */
|
|
407
338
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
*/
|
|
417
|
-
declare function buildAreaPath(topPoints: Point[], bottomPoints: Point[], interpolate?: string): string;
|
|
339
|
+
interface AreaStackGeometry {
|
|
340
|
+
stackedData: Series<Record<string, unknown>, string>[];
|
|
341
|
+
rowsByXSeries: Map<string, DataRow>;
|
|
342
|
+
missingBoundaries: Set<string>;
|
|
343
|
+
extent: [number, number];
|
|
344
|
+
}
|
|
345
|
+
/** Created per compilation; never retained by a module or an authored input. */
|
|
346
|
+
type AreaStackCache = WeakMap<DataRow[], Map<string, AreaStackGeometry>>;
|
|
418
347
|
|
|
419
348
|
/**
|
|
420
349
|
* Internal normalized barlist spec type used by the compilation pipeline.
|
|
@@ -429,27 +358,30 @@ interface NormalizedBarListSpec {
|
|
|
429
358
|
maxItems: number;
|
|
430
359
|
chrome: NormalizedChrome;
|
|
431
360
|
theme: ThemeConfig;
|
|
432
|
-
darkMode: DarkMode;
|
|
433
361
|
watermark: boolean;
|
|
434
362
|
animation?: AnimationSpec;
|
|
435
|
-
valueFormat?: string;
|
|
436
363
|
}
|
|
437
364
|
|
|
438
365
|
interface NormalizedGeoMapSpec {
|
|
439
366
|
type: 'map';
|
|
440
|
-
geo: Required<
|
|
367
|
+
geo: Required<Pick<GeoMapGeo, 'features' | 'idField' | 'focus'>> & Omit<GeoMapGeo, 'features' | 'idField' | 'focus'> & {
|
|
441
368
|
projection?: GeoMapProjection;
|
|
369
|
+
zoom?: GeoMapGeo['zoom'];
|
|
442
370
|
};
|
|
443
371
|
data: Record<string, unknown>[];
|
|
444
372
|
encoding: GeoMapEncoding;
|
|
445
373
|
chrome: NormalizedChrome;
|
|
446
374
|
legend?: LegendConfig;
|
|
447
375
|
theme: ThemeConfig;
|
|
448
|
-
darkMode: DarkMode;
|
|
449
376
|
watermark: boolean;
|
|
450
377
|
animation?: AnimationSpec;
|
|
451
|
-
valueFormat?: string;
|
|
452
378
|
points?: GeoMapPointsLayer;
|
|
379
|
+
fields?: Record<string, FieldMetadata>;
|
|
380
|
+
callouts?: GeoCallout[];
|
|
381
|
+
colorKey?: {
|
|
382
|
+
activeValue?: boolean;
|
|
383
|
+
distribution?: boolean;
|
|
384
|
+
};
|
|
453
385
|
}
|
|
454
386
|
|
|
455
387
|
/**
|
|
@@ -475,10 +407,8 @@ interface NormalizedSankeySpec {
|
|
|
475
407
|
chrome: NormalizedChrome;
|
|
476
408
|
legend?: LegendConfig;
|
|
477
409
|
theme: ThemeConfig;
|
|
478
|
-
darkMode: DarkMode;
|
|
479
410
|
watermark: boolean;
|
|
480
411
|
animation?: AnimationSpec;
|
|
481
|
-
valueFormat?: string;
|
|
482
412
|
linkOpacity?: number;
|
|
483
413
|
other?: number | {
|
|
484
414
|
threshold: number;
|
|
@@ -503,7 +433,6 @@ interface NormalizedTileMapSpec {
|
|
|
503
433
|
chrome: NormalizedChrome;
|
|
504
434
|
legend?: LegendConfig;
|
|
505
435
|
theme: ThemeConfig;
|
|
506
|
-
darkMode: DarkMode;
|
|
507
436
|
watermark: boolean;
|
|
508
437
|
animation?: AnimationSpec;
|
|
509
438
|
valueFormat?: string;
|
|
@@ -549,13 +478,24 @@ interface UserExplicit {
|
|
|
549
478
|
/** True if user wrote `crosshair`. */
|
|
550
479
|
crosshair: boolean;
|
|
551
480
|
}
|
|
481
|
+
/** Internal renderer configuration: sugar can change the mark type while
|
|
482
|
+
* retaining visual options. Keep this wide shape outside the authored contract. */
|
|
483
|
+
type UnionKeys<T> = T extends unknown ? keyof T : never;
|
|
484
|
+
type UnionValue<T, K extends PropertyKey> = T extends unknown ? K extends keyof T ? T[K] : never : never;
|
|
485
|
+
type NormalizedMarkDef = {
|
|
486
|
+
type: MarkType;
|
|
487
|
+
} & {
|
|
488
|
+
[K in Exclude<UnionKeys<MarkDef>, 'type'>]?: UnionValue<MarkDef, K>;
|
|
489
|
+
};
|
|
552
490
|
/** A ChartSpec with all optional fields filled with sensible defaults. */
|
|
553
491
|
interface NormalizedChartSpec {
|
|
554
492
|
/** Resolved mark type string (extracted from spec.mark). */
|
|
555
493
|
markType: MarkType;
|
|
556
494
|
/** Resolved mark definition with defaults filled in. */
|
|
557
|
-
markDef:
|
|
495
|
+
markDef: NormalizedMarkDef;
|
|
558
496
|
data: DataRow[];
|
|
497
|
+
/** @internal Compile-local stack reuse; never authored or emitted in a layout. */
|
|
498
|
+
areaStackCache?: AreaStackCache;
|
|
559
499
|
encoding: Encoding;
|
|
560
500
|
chrome: NormalizedChrome;
|
|
561
501
|
/**
|
|
@@ -564,7 +504,7 @@ interface NormalizedChartSpec {
|
|
|
564
504
|
* `'subtract'` (default) shrinks the plot to fit chrome. Carried through from
|
|
565
505
|
* the spec so the layout pipeline can honor it.
|
|
566
506
|
*/
|
|
567
|
-
chromeLayout
|
|
507
|
+
chromeLayout: 'subtract' | 'grow' | 'notes';
|
|
568
508
|
/** Optional KPI metric cells, passed through unchanged. */
|
|
569
509
|
metrics?: _opendata_ai_openchart_core.Metric[];
|
|
570
510
|
/**
|
|
@@ -576,7 +516,7 @@ interface NormalizedChartSpec {
|
|
|
576
516
|
youDrawIt?: _opendata_ai_openchart_core.YouDrawItConfig;
|
|
577
517
|
annotations: Annotation[];
|
|
578
518
|
/** Normalized label configuration with defaults applied. density, format, and prefix are always set; offsets and color stay optional. */
|
|
579
|
-
labels: Required<Pick<LabelConfig, 'density' | 'format' | 'prefix'>> & Pick<LabelConfig, '
|
|
519
|
+
labels: Required<Pick<LabelConfig, 'density' | 'format' | 'prefix'>> & Pick<LabelConfig, 'color' | 'fontSize' | 'suffix' | 'placement'>;
|
|
580
520
|
/** Legend configuration (position override). */
|
|
581
521
|
legend?: LegendConfig;
|
|
582
522
|
/** Right-side endpoint labels column config (multi-series line/area only). */
|
|
@@ -586,7 +526,6 @@ interface NormalizedChartSpec {
|
|
|
586
526
|
autoThin: boolean;
|
|
587
527
|
compactAnnotationLimit?: number | null;
|
|
588
528
|
theme: ThemeConfig;
|
|
589
|
-
darkMode: DarkMode;
|
|
590
529
|
/** Whether the OpenData watermark is enabled. */
|
|
591
530
|
watermark: boolean;
|
|
592
531
|
/** Series names to hide from rendering. */
|
|
@@ -620,7 +559,6 @@ interface NormalizedTableSpec {
|
|
|
620
559
|
rowKey?: string;
|
|
621
560
|
chrome: NormalizedChrome;
|
|
622
561
|
theme: ThemeConfig;
|
|
623
|
-
darkMode: DarkMode;
|
|
624
562
|
watermark: boolean;
|
|
625
563
|
search: boolean;
|
|
626
564
|
pagination: boolean | {
|
|
@@ -634,7 +572,6 @@ interface NormalizedTableSpec {
|
|
|
634
572
|
label: string;
|
|
635
573
|
};
|
|
636
574
|
/** Mirrors `density === 'condensed'` for back-compat. */
|
|
637
|
-
compact: boolean;
|
|
638
575
|
responsive: boolean;
|
|
639
576
|
animation?: AnimationSpec;
|
|
640
577
|
}
|
|
@@ -654,7 +591,6 @@ interface NormalizedGraphSpec {
|
|
|
654
591
|
chrome: NormalizedChrome;
|
|
655
592
|
annotations: Annotation[];
|
|
656
593
|
theme: ThemeConfig;
|
|
657
|
-
darkMode: DarkMode;
|
|
658
594
|
watermark: boolean;
|
|
659
595
|
animation?: GraphAnimationSpec;
|
|
660
596
|
interaction?: GraphInteractionConfig;
|
|
@@ -673,8 +609,11 @@ type ValidationErrorCode = 'MISSING_FIELD' | 'INVALID_TYPE' | 'INVALID_VALUE' |
|
|
|
673
609
|
interface ValidationError {
|
|
674
610
|
/** Error message describing what's wrong. */
|
|
675
611
|
message: string;
|
|
676
|
-
/**
|
|
677
|
-
|
|
612
|
+
/**
|
|
613
|
+
* Root-relative RFC 6901 JSON Pointer to the problematic value, e.g.
|
|
614
|
+
* `/encoding/x/field` or `/layer/1/data/0/value`. The root is `''`.
|
|
615
|
+
*/
|
|
616
|
+
path: string;
|
|
678
617
|
/** Machine-readable error code for programmatic handling. */
|
|
679
618
|
code: ValidationErrorCode;
|
|
680
619
|
/** Actionable suggestion for fixing the error. */
|
|
@@ -682,8 +621,6 @@ interface ValidationError {
|
|
|
682
621
|
}
|
|
683
622
|
/** Result of spec validation. */
|
|
684
623
|
interface ValidationResult {
|
|
685
|
-
/** Advisory authored-option warnings; incompatible options remain accepted in 8.x. */
|
|
686
|
-
warnings?: string[];
|
|
687
624
|
/** Whether the spec is valid. */
|
|
688
625
|
valid: boolean;
|
|
689
626
|
/** Validation errors (empty if valid). */
|
|
@@ -699,63 +636,6 @@ interface CompileResult {
|
|
|
699
636
|
warnings: string[];
|
|
700
637
|
}
|
|
701
638
|
|
|
702
|
-
/** Continuous D3 scales (linear, time, log, pow, sqrt, symlog) that support .ticks() and .nice(). */
|
|
703
|
-
type D3ContinuousScale = ScaleLinear<number, number> | ScaleTime<number, number> | ScaleLogarithmic<number, number> | ScalePower<number, number> | ScaleSymLog<number, number>;
|
|
704
|
-
/** Discretizing D3 scales (quantile, quantize, threshold). */
|
|
705
|
-
type D3DiscretizingScale = ScaleQuantile<number> | ScaleQuantize<number> | ScaleThreshold<number, number>;
|
|
706
|
-
/** Categorical D3 scales (band, point, ordinal) that support .domain() as string[]. */
|
|
707
|
-
type D3CategoricalScale = ScaleBand<string> | ScalePoint<string> | ScaleOrdinal<string, string>;
|
|
708
|
-
/** Union of all D3 scale types used by the engine. */
|
|
709
|
-
type D3Scale = D3ContinuousScale | D3CategoricalScale | D3DiscretizingScale;
|
|
710
|
-
/** All resolved scale type identifiers. */
|
|
711
|
-
type ResolvedScaleType = ScaleType | 'sequential';
|
|
712
|
-
/**
|
|
713
|
-
* A resolved scale wrapping a d3 scale with type metadata.
|
|
714
|
-
* We need to carry the scale type around so axes and marks know
|
|
715
|
-
* how to interpret the domain/range. Consumers use the `type` discriminant
|
|
716
|
-
* to determine which D3 methods are available on the scale.
|
|
717
|
-
*/
|
|
718
|
-
interface ResolvedScale {
|
|
719
|
-
/** The d3 scale function. Maps domain value -> pixel position or color. */
|
|
720
|
-
scale: D3Scale;
|
|
721
|
-
/** The scale type for downstream use. */
|
|
722
|
-
type: ResolvedScaleType;
|
|
723
|
-
/** The encoding channel this scale was derived from. */
|
|
724
|
-
channel: EncodingChannel;
|
|
725
|
-
/** Per-field formatting context (extent, allIntegers) from the ORIGINAL data. */
|
|
726
|
-
formatContext?: FieldFormatContext;
|
|
727
|
-
}
|
|
728
|
-
/** All resolved scales for a chart. */
|
|
729
|
-
interface ResolvedScales {
|
|
730
|
-
x?: ResolvedScale;
|
|
731
|
-
y?: ResolvedScale;
|
|
732
|
-
color?: ResolvedScale;
|
|
733
|
-
size?: ResolvedScale;
|
|
734
|
-
/** Default color for single-series charts (first categorical palette color or markDef.fill gradient). */
|
|
735
|
-
defaultColor?: string | _opendata_ai_openchart_core.GradientDef;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
/**
|
|
739
|
-
* Pie / donut chart mark computation.
|
|
740
|
-
*
|
|
741
|
-
* Uses d3.pie() for angle calculation and d3.arc() for SVG path
|
|
742
|
-
* generation. Supports sorting by value (largest first), small-slice
|
|
743
|
-
* grouping into "Other", and donut variant with inner radius.
|
|
744
|
-
*/
|
|
745
|
-
|
|
746
|
-
/**
|
|
747
|
-
* Rebuild the SVG path for an arc from its resolved geometry. Used by the
|
|
748
|
-
* vanilla transition driver to interpolate arc marks per frame; must stay in
|
|
749
|
-
* lockstep with the `arcGenerator` below or the tween's final frame won't
|
|
750
|
-
* match the rendered mark.
|
|
751
|
-
*/
|
|
752
|
-
declare function buildArcPath(geom: {
|
|
753
|
-
innerRadius: number;
|
|
754
|
-
outerRadius: number;
|
|
755
|
-
startAngle: number;
|
|
756
|
-
endAngle: number;
|
|
757
|
-
}): string;
|
|
758
|
-
|
|
759
639
|
/** Default font size for annotation labels. */
|
|
760
640
|
declare const DEFAULT_ANNOTATION_FONT_SIZE = 13;
|
|
761
641
|
/** Default line height multiplier for annotation text. */
|
|
@@ -837,7 +717,8 @@ declare function automaticControlPoint(from: {
|
|
|
837
717
|
x: number;
|
|
838
718
|
y: number;
|
|
839
719
|
};
|
|
840
|
-
|
|
720
|
+
type Connector = NonNullable<ResolvedLabel['connector']>;
|
|
721
|
+
declare function refreshConnector(connector: Connector, bounds: Rect, markerRadius: number, keepVisible?: boolean): ResolvedLabel['connector'];
|
|
841
722
|
|
|
842
723
|
/**
|
|
843
724
|
* Annotation placement engine: typed obstacles, candidate generation,
|
|
@@ -849,21 +730,209 @@ interface PlacementObstacle extends Rect {
|
|
|
849
730
|
kind: ObstacleKind;
|
|
850
731
|
}
|
|
851
732
|
|
|
733
|
+
/** A vertical outside label measured for the top lane. */
|
|
734
|
+
interface ReferenceLaneLabel {
|
|
735
|
+
/** Index of the annotation in the spec's annotation list. */
|
|
736
|
+
index: number;
|
|
737
|
+
width: number;
|
|
738
|
+
height: number;
|
|
739
|
+
}
|
|
740
|
+
/** An admitted top-lane row, positioned by the distance from its top to the plot top. */
|
|
741
|
+
interface ReferenceLaneSlot {
|
|
742
|
+
members: number[];
|
|
743
|
+
above: number;
|
|
744
|
+
}
|
|
852
745
|
interface ReferenceReserve {
|
|
853
746
|
right: number;
|
|
747
|
+
/** Height reserved above the plot for the top lane. */
|
|
854
748
|
top: number;
|
|
855
749
|
labelWidth: number;
|
|
750
|
+
/** Vertical outside labels, measured at `labelWidth`, in source order. */
|
|
751
|
+
labels: ReferenceLaneLabel[];
|
|
752
|
+
/**
|
|
753
|
+
* Admitted top-lane rows. A vertical outside label in no row places inside
|
|
754
|
+
* the plot. Placement reads these; it never re-derives the lane.
|
|
755
|
+
*/
|
|
756
|
+
rows: ReferenceLaneSlot[];
|
|
757
|
+
/** Whether any top-lane row was admitted. */
|
|
758
|
+
topLane?: boolean;
|
|
856
759
|
}
|
|
857
760
|
interface ReferenceLanes {
|
|
858
761
|
rightLabels?: ResolvedAnnotation[];
|
|
859
|
-
|
|
762
|
+
/** A lane overflowed once already; one warning per compile covers every label. */
|
|
763
|
+
topOverflow?: boolean;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
type BarLabelPlacement = 'adaptive' | 'inside' | 'outside' | 'column' | 'suppress';
|
|
767
|
+
interface BarLabelPlan {
|
|
768
|
+
placement: BarLabelPlacement;
|
|
769
|
+
reserveLeft: number;
|
|
770
|
+
reserveRight: number;
|
|
771
|
+
reserveTop: number;
|
|
772
|
+
reserveBottom: number;
|
|
773
|
+
columnWidth: number;
|
|
774
|
+
fallback?: 'column-to-outside' | 'labels-suppressed';
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* Root (chrome, axes, legend) theme of a layer, shared by layer compilation and
|
|
779
|
+
* host text measurement. Like every other root property, the layer's value wins
|
|
780
|
+
* whole and the first leaf's is the fallback. Leaf marks are themed separately:
|
|
781
|
+
* each leaf's theme deep-merges over the layer theme for its own marks.
|
|
782
|
+
*/
|
|
783
|
+
declare function resolveLayerTheme(layerSpec: LayerSpec, primary?: ChartSpec): _opendata_ai_openchart_core.ThemeConfig | undefined;
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Graph compilation pipeline.
|
|
787
|
+
*
|
|
788
|
+
* Takes a raw graph spec (unknown shape), validates, normalizes, resolves
|
|
789
|
+
* encoding channels to visual properties, assigns communities, builds
|
|
790
|
+
* legend/tooltips/a11y, and returns a GraphCompilation.
|
|
791
|
+
*
|
|
792
|
+
* The pipeline mirrors compileChart's structure:
|
|
793
|
+
* validate -> normalize -> resolve theme -> resolve visuals ->
|
|
794
|
+
* community assignment -> legend -> tooltips -> a11y -> return
|
|
795
|
+
*
|
|
796
|
+
* Key difference from charts: the output does NOT include x/y positions.
|
|
797
|
+
* The force simulation in the adapter handles layout at runtime.
|
|
798
|
+
*/
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Build a tooltip for a single edge, on demand.
|
|
802
|
+
*
|
|
803
|
+
* Construction is LAZY (called for the one hovered edge), not an eager O(E)
|
|
804
|
+
* descriptor map — edges outnumber nodes 5–10× and an eager map on every
|
|
805
|
+
* compile (including graph updates) would be pure bloat. Shows source → target
|
|
806
|
+
* and all non-structural data fields.
|
|
807
|
+
*/
|
|
808
|
+
declare function buildEdgeTooltip(edge: CompiledGraphEdge): TooltipContent;
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Animation resolver: normalizes AnimationSpec into fully resolved config.
|
|
812
|
+
*
|
|
813
|
+
* Handles the shorthand forms:
|
|
814
|
+
* - true -> all three phases with defaults
|
|
815
|
+
* - { enter: { duration: 800 } } -> merge with defaults per phase
|
|
816
|
+
* - false/undefined -> undefined (no animation)
|
|
817
|
+
*
|
|
818
|
+
* Each phase resolves independently:
|
|
819
|
+
* - true/config-object -> resolved phase merged onto that phase's defaults
|
|
820
|
+
* - false -> phase absent
|
|
821
|
+
* - undefined -> phase present with defaults (animation: {} behaves like true)
|
|
822
|
+
*
|
|
823
|
+
* Returns undefined only when ALL phases resolve absent.
|
|
824
|
+
*/
|
|
825
|
+
|
|
826
|
+
/** Default values for entrance animation. */
|
|
827
|
+
declare const ENTER_DEFAULTS: ResolvedAnimationPhase;
|
|
828
|
+
/** Default values for update (data transition) animation. */
|
|
829
|
+
declare const UPDATE_DEFAULTS: ResolvedAnimationPhase;
|
|
830
|
+
/** Default values for exit animation. */
|
|
831
|
+
declare const EXIT_DEFAULTS: ResolvedAnimationPhase;
|
|
832
|
+
/**
|
|
833
|
+
* Resolve an AnimationSpec into a fully resolved config with all defaults filled.
|
|
834
|
+
* Returns undefined if animation is disabled (false or omitted).
|
|
835
|
+
*/
|
|
836
|
+
declare function resolveAnimation(spec: AnimationSpec | undefined): ResolvedAnimation | undefined;
|
|
837
|
+
/**
|
|
838
|
+
* Clamp stagger delay so total stagger time doesn't exceed MAX_TOTAL_STAGGER_MS.
|
|
839
|
+
*/
|
|
840
|
+
declare function clampStaggerDelay(delay: number, elementCount: number): number;
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* Mark key utilities for data-update transitions.
|
|
844
|
+
*
|
|
845
|
+
* Keys uniquely identify marks across data updates so the renderer can
|
|
846
|
+
* match old marks to new marks and animate the difference. Each chart
|
|
847
|
+
* type stamps keys during its compute phase; these helpers provide the
|
|
848
|
+
* shared serialization and deduplication logic.
|
|
849
|
+
*/
|
|
850
|
+
/**
|
|
851
|
+
* Serialize a datum value into a stable key fragment.
|
|
852
|
+
* - Date -> epoch ms string (avoids locale-dependent Date.toString)
|
|
853
|
+
* - number/string/boolean -> String(v)
|
|
854
|
+
* - null/undefined -> null sentinel
|
|
855
|
+
*/
|
|
856
|
+
declare function serializeKeyValue(v: unknown): string;
|
|
857
|
+
declare function dedupeKeys(keys: string[]): string[];
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* Build an SVG path string from an array of points using d3 line generator.
|
|
861
|
+
* Accepts an optional interpolation string (defaults to 'monotone').
|
|
862
|
+
*/
|
|
863
|
+
declare function buildLinePath(points: Point[], interpolate?: string): string;
|
|
864
|
+
/**
|
|
865
|
+
* Build an SVG path string for a filled area from top and bottom point arrays.
|
|
866
|
+
* Accepts an optional interpolation string (defaults to 'monotone').
|
|
867
|
+
*/
|
|
868
|
+
declare function buildAreaPath(topPoints: Point[], bottomPoints: Point[], interpolate?: string): string;
|
|
869
|
+
|
|
870
|
+
/** Continuous D3 scales (linear, time, log, pow, sqrt, symlog) that support .ticks() and .nice(). */
|
|
871
|
+
type D3ContinuousScale = ScaleLinear<number, number> | ScaleTime<number, number> | ScaleLogarithmic<number, number> | ScalePower<number, number> | ScaleSymLog<number, number>;
|
|
872
|
+
/** Discretizing D3 scales (quantile, quantize, threshold). */
|
|
873
|
+
type D3DiscretizingScale = ScaleQuantile<number> | ScaleQuantize<number> | ScaleThreshold<number, number>;
|
|
874
|
+
/** Categorical D3 scales (band, point, ordinal) that support .domain() as string[]. */
|
|
875
|
+
type D3CategoricalScale = ScaleBand<string> | ScalePoint<string> | ScaleOrdinal<string, string>;
|
|
876
|
+
/** Union of all D3 scale types used by the engine. */
|
|
877
|
+
type D3Scale = D3ContinuousScale | D3CategoricalScale | D3DiscretizingScale;
|
|
878
|
+
/** All resolved scale type identifiers. */
|
|
879
|
+
type ResolvedScaleType = ScaleType | 'sequential';
|
|
880
|
+
/**
|
|
881
|
+
* A resolved scale wrapping a d3 scale with type metadata.
|
|
882
|
+
* We need to carry the scale type around so axes and marks know
|
|
883
|
+
* how to interpret the domain/range. Consumers use the `type` discriminant
|
|
884
|
+
* to determine which D3 methods are available on the scale.
|
|
885
|
+
*/
|
|
886
|
+
interface ResolvedScale {
|
|
887
|
+
/** The d3 scale function. Maps domain value -> pixel position or color. */
|
|
888
|
+
scale: D3Scale;
|
|
889
|
+
/** The scale type for downstream use. */
|
|
890
|
+
type: ResolvedScaleType;
|
|
891
|
+
/** The encoding channel this scale was derived from. */
|
|
892
|
+
channel: EncodingChannel;
|
|
893
|
+
/** Per-field formatting context (extent, allIntegers) from the ORIGINAL data. */
|
|
894
|
+
formatContext?: FieldFormatContext;
|
|
860
895
|
}
|
|
896
|
+
/** All resolved scales for a chart. */
|
|
897
|
+
interface ResolvedScales {
|
|
898
|
+
x?: ResolvedScale;
|
|
899
|
+
y?: ResolvedScale;
|
|
900
|
+
color?: ResolvedScale;
|
|
901
|
+
size?: ResolvedScale;
|
|
902
|
+
/** Default color for single-series charts (first categorical palette color or markDef.fill gradient). */
|
|
903
|
+
defaultColor?: string | _opendata_ai_openchart_core.GradientDef;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* Pie / donut chart mark computation.
|
|
908
|
+
*
|
|
909
|
+
* Uses d3.pie() for angle calculation and d3.arc() for SVG path
|
|
910
|
+
* generation. Supports sorting by value (largest first), small-slice
|
|
911
|
+
* grouping into "Other", and donut variant with inner radius.
|
|
912
|
+
*/
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* Rebuild the SVG path for an arc from its resolved geometry. Used by the
|
|
916
|
+
* vanilla transition driver to interpolate arc marks per frame; must stay in
|
|
917
|
+
* lockstep with the `arcGenerator` below or the tween's final frame won't
|
|
918
|
+
* match the rendered mark.
|
|
919
|
+
*/
|
|
920
|
+
declare function buildArcPath(geom: {
|
|
921
|
+
innerRadius: number;
|
|
922
|
+
outerRadius: number;
|
|
923
|
+
startAngle: number;
|
|
924
|
+
endAngle: number;
|
|
925
|
+
}): string;
|
|
861
926
|
|
|
862
927
|
interface AnnotationContext {
|
|
863
928
|
scales: ResolvedScales;
|
|
864
929
|
chartArea: Rect;
|
|
865
930
|
referenceContainer?: Rect;
|
|
866
931
|
referenceLanes?: ReferenceLanes;
|
|
932
|
+
/**
|
|
933
|
+
* Outside reference lanes resolved by the figure budget, the only source of
|
|
934
|
+
* the reserve. Without one, outside labels place inside the plot.
|
|
935
|
+
*/
|
|
867
936
|
referenceReserve?: ReferenceReserve;
|
|
868
937
|
strategy: LayoutStrategy;
|
|
869
938
|
isDark: boolean;
|
|
@@ -875,6 +944,8 @@ interface AnnotationContext {
|
|
|
875
944
|
measure: AnnotationMeasureTextFn;
|
|
876
945
|
/** Theme font stack, so annotation text is measured and rendered in the same face. */
|
|
877
946
|
fontFamily?: string;
|
|
947
|
+
padding?: number;
|
|
948
|
+
smallFontSize?: number;
|
|
878
949
|
colors?: _opendata_ai_openchart_core.ThemeColors;
|
|
879
950
|
debugPlacement?: boolean;
|
|
880
951
|
onWarn?: (message: string) => void;
|
|
@@ -886,6 +957,13 @@ interface AnnotationContext {
|
|
|
886
957
|
* the title/subtitle. Defaults to the plain SVG clamp margin.
|
|
887
958
|
*/
|
|
888
959
|
topBound?: number;
|
|
960
|
+
/** Endpoint markers drawn on data points (see `adoptPointMarker`). */
|
|
961
|
+
pointMarkers?: ReadonlyArray<{
|
|
962
|
+
x: number;
|
|
963
|
+
y: number;
|
|
964
|
+
fill: string;
|
|
965
|
+
stroke: string;
|
|
966
|
+
}>;
|
|
889
967
|
}
|
|
890
968
|
|
|
891
969
|
/**
|
|
@@ -919,8 +997,13 @@ declare function parseAnnotationSpans(line: string): RichSpan[];
|
|
|
919
997
|
* @returns A NormalizedSpec with all optionals filled.
|
|
920
998
|
*/
|
|
921
999
|
declare function normalizeSpec(spec: VizSpec, warnings?: string[]): NormalizedSpec;
|
|
1000
|
+
/**
|
|
1001
|
+
* Recursively flatten a LayerSpec into leaf ChartSpecs.
|
|
1002
|
+
* Merges parent data, encoding, and transforms down to children.
|
|
1003
|
+
*/
|
|
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[];
|
|
922
1005
|
|
|
923
|
-
/**
|
|
1006
|
+
/** Validate authored mark contracts before any sugar transformation. */
|
|
924
1007
|
declare function validateSpec(spec: unknown): ValidationResult;
|
|
925
1008
|
|
|
926
1009
|
/**
|
|
@@ -938,9 +1021,7 @@ declare function validateSpec(spec: unknown): ValidationResult;
|
|
|
938
1021
|
* @returns CompileResult with the normalized spec and any warnings.
|
|
939
1022
|
* @throws Error if the spec is invalid.
|
|
940
1023
|
*/
|
|
941
|
-
declare function compile(spec: unknown
|
|
942
|
-
markOptionWarnings?: boolean;
|
|
943
|
-
}): CompileResult;
|
|
1024
|
+
declare function compile(spec: unknown): CompileResult;
|
|
944
1025
|
|
|
945
1026
|
/**
|
|
946
1027
|
* Resolve which backend paints a chart's point marks: SVG (one `<circle>` per
|
|
@@ -973,7 +1054,7 @@ declare const AUTO_CANVAS_THRESHOLD = 1000;
|
|
|
973
1054
|
* full container width (used by geometry gates that must key off the
|
|
974
1055
|
* container, not the derived plot width). Returns an array of marks to render.
|
|
975
1056
|
*/
|
|
976
|
-
type ChartRenderer = (spec: NormalizedChartSpec, scales: ResolvedScales, chartArea: Rect, strategy: LayoutStrategy, theme: ResolvedTheme, containerWidth: number) => Mark[];
|
|
1057
|
+
type ChartRenderer = (spec: NormalizedChartSpec, scales: ResolvedScales, chartArea: Rect, strategy: LayoutStrategy, theme: ResolvedTheme, containerWidth: number, labelPlan?: BarLabelPlan, measureText?: MeasureTextFn) => Mark[];
|
|
977
1058
|
/**
|
|
978
1059
|
* Register a chart renderer for a specific chart type.
|
|
979
1060
|
*
|
|
@@ -1201,8 +1282,46 @@ interface ObservationComparison {
|
|
|
1201
1282
|
declare function compareObservations(before: number, after: number, a: FieldMetadata, b: FieldMetadata): ObservationComparison | null;
|
|
1202
1283
|
declare function linkedEntityKeys(row: DataRow, source: DatasetBinding, target: DatasetBinding): string[];
|
|
1203
1284
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1285
|
+
interface AppliedSpecPatch {
|
|
1286
|
+
spec: VizSpec;
|
|
1287
|
+
/** Undoes the patch; its precondition is the patched document. */
|
|
1288
|
+
inverse: SpecPatch;
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* Apply a patch atomically through `applyEditTransaction`. Throws when the
|
|
1292
|
+
* document changed since the patch was produced or any operation is invalid;
|
|
1293
|
+
* the input spec is never mutated.
|
|
1294
|
+
*/
|
|
1295
|
+
declare function applySpecPatch(spec: VizSpec, patch: SpecPatch): AppliedSpecPatch;
|
|
1296
|
+
|
|
1297
|
+
interface ReaderPanelIndex {
|
|
1298
|
+
scope: ReaderPanelScope;
|
|
1299
|
+
area: Rect;
|
|
1300
|
+
slices: ReaderSlice[];
|
|
1301
|
+
positions: number[];
|
|
1302
|
+
}
|
|
1303
|
+
interface ReaderSliceIndex {
|
|
1304
|
+
supported: boolean;
|
|
1305
|
+
panels: ReaderPanelIndex[];
|
|
1306
|
+
diagnostics: DesignDiagnostic[];
|
|
1307
|
+
revision: string;
|
|
1308
|
+
/** Source identity inventory keeps filtered rows distinct from deletions. */
|
|
1309
|
+
sourceObservationKeys: ReadonlySet<string>;
|
|
1310
|
+
sourceObservationData: ReadonlyMap<string, DataRow>;
|
|
1311
|
+
byKey: ReadonlyMap<string, ReaderSlice>;
|
|
1312
|
+
bindingKey: string;
|
|
1313
|
+
}
|
|
1314
|
+
declare function readerDomainValue(value: unknown): ReaderDomainValue | null;
|
|
1315
|
+
declare function compareReaderValues(before: ReaderComparisonOperand, after: ReaderComparisonOperand, options?: {
|
|
1316
|
+
allowNegativeRelative?: boolean;
|
|
1317
|
+
}): ReaderComparisonResult;
|
|
1318
|
+
declare function buildReaderSliceIndex(source: ChartSpec | LayerSpec, layout: ChartLayout, options: ReaderSliceIndexOptions): ReaderSliceIndex;
|
|
1319
|
+
declare function nearestReaderSlice(index: ReaderSliceIndex, pixelX: number, panelId?: string): ReaderSlice | null;
|
|
1320
|
+
declare function readerSliceByKey(index: ReaderSliceIndex, key: string): ReaderSlice | null;
|
|
1321
|
+
declare function reconcileReaderSlices(selection: ReaderSliceSelection, next: ReaderSliceIndex, options: {
|
|
1322
|
+
dataReplaced: boolean;
|
|
1323
|
+
visibleObservationKeys?: ReadonlySet<string>;
|
|
1324
|
+
}): ReaderSliceSelection;
|
|
1206
1325
|
|
|
1207
1326
|
interface RecommendationRoles {
|
|
1208
1327
|
measure?: string;
|
|
@@ -1219,6 +1338,58 @@ interface RecommendationResult {
|
|
|
1219
1338
|
/** Deterministic suggestions require an explicit question and field roles. No aggregation is inferred. */
|
|
1220
1339
|
declare function recommendCompositions(data: DataRow[], question: DesignQuestion, roles: RecommendationRoles): RecommendationResult;
|
|
1221
1340
|
|
|
1341
|
+
/** Marker coordinates use the actual key mapping: discrete classes or raw gradient position. */
|
|
1342
|
+
declare function geoColorKeyPosition(key: GeoColorKeyLayout, value: unknown): {
|
|
1343
|
+
x?: number;
|
|
1344
|
+
y?: number;
|
|
1345
|
+
category?: string;
|
|
1346
|
+
outside: boolean;
|
|
1347
|
+
missing: boolean;
|
|
1348
|
+
};
|
|
1349
|
+
|
|
1350
|
+
/** Stateless settle/export layout. Measurements and authored inventory arrive precompiled. */
|
|
1351
|
+
declare function resolveGeoOverlay(input: GeoLabelsInput, affine: GeoLabelAffine): GeoLabelOverlay;
|
|
1352
|
+
|
|
1353
|
+
/** Destination-layout map observations; no renderer or DOM joins. */
|
|
1354
|
+
|
|
1355
|
+
interface GeoReaderRecord {
|
|
1356
|
+
observation: GeoReaderObservation;
|
|
1357
|
+
name: string;
|
|
1358
|
+
valueLabel: string;
|
|
1359
|
+
valueStatus: 'value' | 'missing' | 'ambiguous';
|
|
1360
|
+
unit?: string;
|
|
1361
|
+
identityStatus: 'persistent' | 'ephemeral' | 'ambiguous';
|
|
1362
|
+
primary?: {
|
|
1363
|
+
channel: 'color' | 'size';
|
|
1364
|
+
field: string;
|
|
1365
|
+
value: number | undefined;
|
|
1366
|
+
metadata?: FieldMetadata;
|
|
1367
|
+
};
|
|
1368
|
+
color?: {
|
|
1369
|
+
field: string;
|
|
1370
|
+
value: unknown;
|
|
1371
|
+
};
|
|
1372
|
+
fields: Array<{
|
|
1373
|
+
label: string;
|
|
1374
|
+
value: string;
|
|
1375
|
+
}>;
|
|
1376
|
+
point?: {
|
|
1377
|
+
cx: number;
|
|
1378
|
+
cy: number;
|
|
1379
|
+
r: number;
|
|
1380
|
+
};
|
|
1381
|
+
viewIds?: string[];
|
|
1382
|
+
}
|
|
1383
|
+
interface GeoReaderIndex {
|
|
1384
|
+
records: GeoReaderRecord[];
|
|
1385
|
+
byObservation: Map<string, GeoReaderRecord>;
|
|
1386
|
+
diagnostics: DesignDiagnostic[];
|
|
1387
|
+
}
|
|
1388
|
+
declare function buildGeoReaderIndex(spec: GeoMapSpec, layout: GeoMapLayout): GeoReaderIndex;
|
|
1389
|
+
declare function queryGeoReaderRecords(index: GeoReaderIndex, query: string, rank?: 'ascending' | 'descending', kind?: 'feature' | 'point'): Array<GeoReaderRecord & {
|
|
1390
|
+
rank?: number;
|
|
1391
|
+
}>;
|
|
1392
|
+
|
|
1222
1393
|
/** A documented authored-spec change made by migrateSpecV8. */
|
|
1223
1394
|
interface SpecRepair {
|
|
1224
1395
|
path: string;
|
|
@@ -1231,9 +1402,14 @@ interface SpecRepair {
|
|
|
1231
1402
|
* Legacy end-of-line labels become endpoint labels; their manual offsets are
|
|
1232
1403
|
* reported as lost repairs because the two placement models are different.
|
|
1233
1404
|
*/
|
|
1234
|
-
declare function migrateSpecV8<T>(input: T
|
|
1405
|
+
declare function migrateSpecV8<T>(input: T, options?: {
|
|
1406
|
+
styling?: 'v8' | 'v9';
|
|
1407
|
+
}): {
|
|
1235
1408
|
spec: T;
|
|
1236
1409
|
repairs: SpecRepair[];
|
|
1237
1410
|
};
|
|
1238
1411
|
|
|
1239
|
-
|
|
1412
|
+
/** Author order and supplementary fields survive; formatted text never decides identity. */
|
|
1413
|
+
declare function sharedTooltipFields(content: TooltipContent): TooltipField[];
|
|
1414
|
+
|
|
1415
|
+
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 };
|