@opendata-ai/openchart-core 8.0.0-rc.2 → 8.0.0-rc.20

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.
Files changed (82) hide show
  1. package/dist/index.d.ts +490 -25
  2. package/dist/index.js +57 -19
  3. package/dist/index.js.map +1 -1
  4. package/dist/styles.css +1 -1
  5. package/dist/styles.css.map +1 -1
  6. package/package.json +1 -2
  7. package/schema/chart.schema.json +485 -35
  8. package/schema/table.schema.json +35 -1
  9. package/schema/vizspec.schema.json +1305 -120
  10. package/src/accessibility/__tests__/alt-text.test.ts +0 -110
  11. package/src/accessibility/__tests__/aria.test.ts +0 -125
  12. package/src/accessibility/alt-text.ts +0 -155
  13. package/src/accessibility/aria.ts +0 -75
  14. package/src/accessibility/index.ts +0 -6
  15. package/src/colors/__tests__/colorblind.test.ts +0 -75
  16. package/src/colors/__tests__/contrast.test.ts +0 -119
  17. package/src/colors/__tests__/palettes.test.ts +0 -74
  18. package/src/colors/colorblind.ts +0 -131
  19. package/src/colors/contrast.ts +0 -143
  20. package/src/colors/index.ts +0 -36
  21. package/src/colors/palettes.ts +0 -206
  22. package/src/helpers/__tests__/deep-merge.test.ts +0 -54
  23. package/src/helpers/__tests__/spec-builders.test.ts +0 -338
  24. package/src/helpers/deep-merge.ts +0 -29
  25. package/src/helpers/spec-builders.ts +0 -479
  26. package/src/index.ts +0 -215
  27. package/src/labels/__tests__/collision.test.ts +0 -310
  28. package/src/labels/collision.ts +0 -249
  29. package/src/labels/index.ts +0 -13
  30. package/src/layout/__tests__/chrome.test.ts +0 -208
  31. package/src/layout/__tests__/text-measure.test.ts +0 -57
  32. package/src/layout/chrome.ts +0 -470
  33. package/src/layout/index.ts +0 -18
  34. package/src/layout/text-measure.ts +0 -404
  35. package/src/layout/text-wrap.ts +0 -93
  36. package/src/locale/__tests__/format.test.ts +0 -606
  37. package/src/locale/format.ts +0 -459
  38. package/src/locale/index.ts +0 -21
  39. package/src/responsive/__tests__/breakpoints.test.ts +0 -146
  40. package/src/responsive/__tests__/metrics.test.ts +0 -52
  41. package/src/responsive/breakpoints.ts +0 -172
  42. package/src/responsive/index.ts +0 -53
  43. package/src/responsive/metrics.ts +0 -299
  44. package/src/schema/__tests__/generated-artifacts.test.ts +0 -42
  45. package/src/schema/__tests__/schema.test.ts +0 -179
  46. package/src/styles/__tests__/reduced-motion-selectors.test.ts +0 -28
  47. package/src/styles/animation.css +0 -199
  48. package/src/styles/base.css +0 -102
  49. package/src/styles/chrome.css +0 -174
  50. package/src/styles/dark.css +0 -44
  51. package/src/styles/graph.css +0 -135
  52. package/src/styles/index.css +0 -28
  53. package/src/styles/keyframes.css +0 -135
  54. package/src/styles/legend.css +0 -18
  55. package/src/styles/reduced-motion.css +0 -67
  56. package/src/styles/series-search.css +0 -153
  57. package/src/styles/sparkline.css +0 -16
  58. package/src/styles/table-animation.css +0 -93
  59. package/src/styles/table.css +0 -398
  60. package/src/styles/token-definitions.ts +0 -199
  61. package/src/styles/tokens.css +0 -156
  62. package/src/styles/tooltip.css +0 -126
  63. package/src/styles/you-draw-it.css +0 -126
  64. package/src/theme/__tests__/dark-mode.test.ts +0 -232
  65. package/src/theme/__tests__/defaults.test.ts +0 -73
  66. package/src/theme/__tests__/resolve.test.ts +0 -277
  67. package/src/theme/dark-mode.ts +0 -258
  68. package/src/theme/defaults.ts +0 -110
  69. package/src/theme/index.ts +0 -8
  70. package/src/theme/presets.ts +0 -64
  71. package/src/theme/resolve.ts +0 -312
  72. package/src/types/__tests__/encoding.test.ts +0 -368
  73. package/src/types/__tests__/gradient.test.ts +0 -95
  74. package/src/types/__tests__/spec.test.ts +0 -499
  75. package/src/types/encoding.ts +0 -280
  76. package/src/types/events.ts +0 -154
  77. package/src/types/index.ts +0 -287
  78. package/src/types/layout.ts +0 -1966
  79. package/src/types/schema-roots.ts +0 -32
  80. package/src/types/spec.ts +0 -2867
  81. package/src/types/table.ts +0 -108
  82. package/src/types/theme.ts +0 -209
package/dist/index.d.ts CHANGED
@@ -31,8 +31,13 @@ declare const HEIGHT_SHORT_MAX = 350;
31
31
  declare function getHeightClass(height: number): HeightClass;
32
32
  /** Label display mode at a given breakpoint. */
33
33
  type LabelMode = 'all' | 'important' | 'none';
34
- /** Legend position at a given breakpoint. */
35
- type LegendPosition = 'top' | 'right' | 'bottom' | 'bottom-right' | 'inline';
34
+ /**
35
+ * Legend position at a given breakpoint. `'top-left'` is a map-only overlay
36
+ * position: the legend floats inside the map area's top-left corner (with its
37
+ * own backdrop) instead of reserving a block of figure height. Charts treat
38
+ * it as the default position.
39
+ */
40
+ type LegendPosition = 'top' | 'top-left' | 'right' | 'bottom' | 'bottom-right' | 'inline';
36
41
  /** Annotation position strategy. */
37
42
  type AnnotationPosition = 'inline' | 'tooltip-only';
38
43
  /** Axis label density (controls tick count reduction). */
@@ -427,6 +432,29 @@ declare function isGradientDef(value: unknown): value is GradientDef;
427
432
  * overlays that need a flat color.
428
433
  */
429
434
  declare function getRepresentativeColor(fill: string | GradientDef): string;
435
+ /**
436
+ * Configuration for the scatter regression trend line. Passed as the object
437
+ * form of `MarkDef.trendline`.
438
+ */
439
+ interface TrendlineConfig {
440
+ /**
441
+ * Stacking order relative to the point marks. `'below'` (default) draws the
442
+ * line behind the dots; `'above'` draws it on top so it stays visible over a
443
+ * dense cloud.
444
+ */
445
+ layer?: 'above' | 'below';
446
+ /**
447
+ * Stroke color. Defaults to the theme's high-contrast text color so the line
448
+ * reads on both light and dark grounds. Set an explicit CSS color to override.
449
+ */
450
+ stroke?: string;
451
+ /**
452
+ * Stroke width in pixels. Defaults to 1.5. Over a dense cloud with `layer:
453
+ * 'above'`, a heavier line (e.g. 2.5) stays legible where the thin default
454
+ * disappears into the dots.
455
+ */
456
+ strokeWidth?: number;
457
+ }
430
458
  /**
431
459
  * Mark definition object with visual properties.
432
460
  *
@@ -496,8 +524,13 @@ interface MarkDef {
496
524
  * suppress it when the chart already carries its own reference line (e.g. a
497
525
  * manual x=y diagonal in a separate layer), which would otherwise produce
498
526
  * two competing diagonals.
527
+ *
528
+ * Pass an object to control stacking order: the line renders `below` the
529
+ * points by default, but a dense scatter (thousands of overlapping dots)
530
+ * fully occludes a line drawn underneath, so `{ layer: 'above' }` lifts the
531
+ * reference line over the cloud.
499
532
  */
500
- trendline?: boolean;
533
+ trendline?: boolean | TrendlineConfig;
501
534
  /**
502
535
  * Horizontal pixel offset from the data anchor. Only meaningful when `type`
503
536
  * is `'text'`. Use it to lift a label clear of the mark it annotates instead
@@ -530,6 +563,25 @@ interface MarkDef {
530
563
  * - `'none'` (default): solid fills only.
531
564
  */
532
565
  fillPattern?: 'auto' | 'none';
566
+ /**
567
+ * Rendering backend for point marks. High-cardinality scatter plots draw
568
+ * thousands of SVG circles, which is what makes their entrance and update
569
+ * transitions stutter; a canvas layer draws the same dots in a handful of
570
+ * batched paint calls.
571
+ *
572
+ * - `'auto'` (default): canvas above 1,000 compiled point marks, SVG below.
573
+ * - `'svg'`: always SVG, whatever the point count.
574
+ * - `'canvas'`: always canvas, whatever the point count.
575
+ *
576
+ * Canvas mode trades per-mark keyboard focus and edit-mode point selection
577
+ * (the screen-reader data table still carries every row), and draws the
578
+ * trendline above the dots even when `trendline.layer` is `'below'`.
579
+ * Tooltips, hover, and click callbacks work the same in both modes.
580
+ *
581
+ * Ignored with a console warning for non-point marks, and for faceted,
582
+ * layered, and sparkline charts.
583
+ */
584
+ render?: 'auto' | 'svg' | 'canvas';
533
585
  /**
534
586
  * Visual style for range marks. Only meaningful when `type` is `'range'`.
535
587
  * - 'dumbbell' (default): a dot at each end joined by a connector line.
@@ -963,6 +1015,20 @@ interface Encoding<TData extends DataRow = DataRow> {
963
1015
  * per-panel axes.
964
1016
  */
965
1017
  facet?: FacetChannel<TData>;
1018
+ /**
1019
+ * Row facet channel: partitions data into vertically-stacked panels.
1020
+ * Each unique value of the row field produces one panel, arranged in a
1021
+ * single column. Shares the x-axis scale by default; y-axis is independent.
1022
+ * Mutually exclusive with `facet` and `column`.
1023
+ */
1024
+ row?: FacetChannel<TData>;
1025
+ /**
1026
+ * Column facet channel: partitions data into side-by-side panels.
1027
+ * Each unique value of the column field produces one panel, arranged in a
1028
+ * single row. Shares the y-axis scale by default; x-axis is independent.
1029
+ * Mutually exclusive with `facet` and `row`.
1030
+ */
1031
+ column?: FacetChannel<TData>;
966
1032
  }
967
1033
  /** Encoding channel for graph nodes and edges. */
968
1034
  interface GraphEncodingChannel {
@@ -972,13 +1038,40 @@ interface GraphEncodingChannel {
972
1038
  type?: FieldType;
973
1039
  /** Scale configuration. Auto-derived from data if omitted. */
974
1040
  scale?: ScaleConfig;
1041
+ /**
1042
+ * Category ordering for the color domain and legend. Graph channels default
1043
+ * `'ascending'` (VL-aligned, deterministic); `string[]` pins an explicit
1044
+ * order; `null` keeps data order.
1045
+ *
1046
+ * NOTE: chart encoding channels keep data-order — this graph default is a
1047
+ * deliberate divergence this release (see docs/migrating-v8.md).
1048
+ */
1049
+ sort?: 'ascending' | 'descending' | null | string[];
1050
+ /**
1051
+ * Category values to emphasize on load; the rest dim. Mirrors the chart
1052
+ * `encoding.color.highlight` value list. Distinct from the `highlight()`
1053
+ * runtime verb and `interaction.hover.mode`.
1054
+ */
1055
+ highlight?: string | string[];
975
1056
  }
976
1057
  /** Graph-specific encoding mapping visual properties to node/edge data fields. */
977
1058
  interface GraphEncoding {
978
1059
  /** Color mapping for nodes. */
979
1060
  nodeColor?: GraphEncodingChannel;
980
- /** Size mapping for nodes. */
1061
+ /**
1062
+ * Size mapping for nodes. `scale.type` defaults to `'sqrt'` (area-perceptual,
1063
+ * today's behavior); set `scale.type: 'linear'` for a linear radius ramp.
1064
+ * `scale.range` sets the pixel radius extent (default `[3, 12]`).
1065
+ */
981
1066
  nodeSize?: GraphEncodingChannel;
1067
+ /**
1068
+ * Opacity mapping for nodes (VL opacity channel). Quantitative fields map
1069
+ * linearly to `[0.25, 1]`; `scale.range` overrides.
1070
+ *
1071
+ * NOTE: there is deliberately no `edgeOpacity` channel — edge alpha is owned
1072
+ * by the interaction alpha-tier machinery (hover dimming, search).
1073
+ */
1074
+ nodeOpacity?: GraphEncodingChannel;
982
1075
  /** Color mapping for edges. */
983
1076
  edgeColor?: GraphEncodingChannel;
984
1077
  /** Width mapping for edges. */
@@ -987,6 +1080,13 @@ interface GraphEncoding {
987
1080
  edgeStyle?: GraphEncodingChannel;
988
1081
  /** Label field for nodes. */
989
1082
  nodeLabel?: GraphEncodingChannel;
1083
+ /**
1084
+ * Label priority mapping for nodes. Maps a quantitative field to a 0-1
1085
+ * priority range; higher values are shown first as the user zooms in.
1086
+ * Omit to use the default degree-based priority.
1087
+ * `nodeOverrides[id].alwaysShowLabel` still wins as the hard override.
1088
+ */
1089
+ nodeLabelPriority?: GraphEncodingChannel;
990
1090
  }
991
1091
  /** Layout algorithm for graph visualization. */
992
1092
  interface GraphLayoutConfig {
@@ -1007,6 +1107,31 @@ interface GraphLayoutConfig {
1007
1107
  linkStrength?: number;
1008
1108
  /** Whether to apply center force (default true). */
1009
1109
  centerForce?: boolean;
1110
+ /**
1111
+ * Deterministic layout seed. Same spec + seed ⇒ identical settled layout
1112
+ * within a given execution path (worker vs sync parity is not guaranteed).
1113
+ */
1114
+ seed?: number;
1115
+ /**
1116
+ * Repulsion preset (plain-language, no d3 jargon):
1117
+ * `gentle`/`balanced`/`energetic` → chargeStrength −150/−300/−600 and
1118
+ * velocityDecay 0.5/0.4/0.3. A raw `chargeStrength` wins over the preset.
1119
+ */
1120
+ energy?: 'gentle' | 'balanced' | 'energetic';
1121
+ /**
1122
+ * Settle-speed preset: `quick`/`balanced`/`thorough` → alphaDecay
1123
+ * 0.05/0.0228/0.01. Higher = faster cool-down, less final refinement.
1124
+ */
1125
+ settle?: 'quick' | 'balanced' | 'thorough';
1126
+ /**
1127
+ * Headless settle ticks run before the first paint. `true` → 100 ticks under
1128
+ * a 250ms budget; a number sets an explicit tick count; `false` disables.
1129
+ *
1130
+ * Lives in `layout`, NOT `animation`, on purpose: warmup *reduces* motion, so
1131
+ * it must survive `animation: false` (opt-out consumers get less settling
1132
+ * chaos, not more).
1133
+ */
1134
+ warmup?: boolean | number;
1010
1135
  }
1011
1136
  /** Style overrides for a chrome text element. */
1012
1137
  interface ChromeTextStyle {
@@ -1018,6 +1143,14 @@ interface ChromeTextStyle {
1018
1143
  fontFamily?: string;
1019
1144
  /** Text color (CSS color string). */
1020
1145
  color?: string;
1146
+ /**
1147
+ * Maximum number of lines this chrome text may wrap to. Additional lines are
1148
+ * dropped and the last kept line is truncated with an ellipsis. Bounds the
1149
+ * chrome's contribution to layout height at any container width. Applies
1150
+ * whether the font size comes from the theme default or an explicit override.
1151
+ * Caps height only, not horizontal overflow of a single unbreakable word.
1152
+ */
1153
+ maxLines?: number;
1021
1154
  }
1022
1155
  /** A chrome text element with optional style overrides. */
1023
1156
  interface ChromeText {
@@ -1608,6 +1741,20 @@ interface AnimationPhaseConfig {
1608
1741
  /** Stagger config. true = defaults, false = no stagger. Default: true for enter. */
1609
1742
  stagger?: AnimationStagger | boolean;
1610
1743
  }
1744
+ /**
1745
+ * Data-update phase config. Adds `maxMarks` on top of the shared phase
1746
+ * options; the cap is meaningless for enter/exit, which animate via CSS.
1747
+ */
1748
+ interface UpdatePhaseConfig extends AnimationPhaseConfig {
1749
+ /**
1750
+ * Maximum mark count that still runs a tweened data-update transition.
1751
+ * Default: 500. Above the cap the chart swaps instantly instead, because
1752
+ * per-frame SVG attribute writes on thousands of elements drop frames on
1753
+ * low-end devices. Raise it deliberately when the audience is desktop-heavy
1754
+ * and you have measured the frame budget.
1755
+ */
1756
+ maxMarks?: number;
1757
+ }
1611
1758
  /**
1612
1759
  * Full animation config object. Structured as enter/update/exit phases
1613
1760
  * following Vega's encoding set model.
@@ -1616,7 +1763,7 @@ interface AnimationConfig {
1616
1763
  /** Entrance animation when chart first renders. */
1617
1764
  enter?: AnimationPhaseConfig | boolean;
1618
1765
  /** Transition animation when data updates. */
1619
- update?: AnimationPhaseConfig | boolean;
1766
+ update?: UpdatePhaseConfig | boolean;
1620
1767
  /** Exit animation when marks are removed. */
1621
1768
  exit?: AnimationPhaseConfig | boolean;
1622
1769
  /** Delay before annotations animate in (ms after marks). Default: 200. */
@@ -1871,6 +2018,20 @@ interface BaseChartSpec<TData extends DataRow = DataRow> {
1871
2018
  transform?: Transform[];
1872
2019
  /** Editorial chrome (title, subtitle, source, etc.). */
1873
2020
  chrome?: Chrome;
2021
+ /**
2022
+ * How chrome height interacts with the container height budget.
2023
+ *
2024
+ * - `'subtract'` (default): the container height is fixed and chrome text
2025
+ * (title/subtitle/source) is subtracted from it, shrinking the plot. This
2026
+ * is the historical behavior.
2027
+ * - `'grow'`: the container height is treated as the *plot* budget, and the
2028
+ * rendered SVG grows taller by the measured chrome height. The plot keeps
2029
+ * its full budget (minus axis/padding overhead) regardless of how many
2030
+ * lines the title wraps to.
2031
+ *
2032
+ * `'grow'` is a no-op for faceted specs in this version.
2033
+ */
2034
+ chromeLayout?: 'subtract' | 'grow';
1874
2035
  /**
1875
2036
  * Top-level title sugar (Vega-Lite aligned). Expanded into `chrome.title`
1876
2037
  * (and `chrome.subtitle` for the object form). `chrome.title` wins when
@@ -1937,7 +2098,12 @@ interface BaseChartSpec<TData extends DataRow = DataRow> {
1937
2098
  darkMode?: DarkMode;
1938
2099
  /** Whether to show the tryOpenData.ai watermark. Defaults to true. */
1939
2100
  watermark?: boolean;
1940
- /** Series names to hide from rendering. Hidden series remain in the legend but are visually dimmed. */
2101
+ /**
2102
+ * Series names to hide from rendering by default. This is the authored
2103
+ * persistence target for legend visibility. Runtime legend toggles
2104
+ * (legend-toggle edit events) layer on top of this via ephemeral runtime
2105
+ * sets but never modify it.
2106
+ */
1941
2107
  hiddenSeries?: string[];
1942
2108
  /** Per-series visual overrides, keyed by series name (the color field value). */
1943
2109
  seriesStyles?: Record<string, SeriesStyle>;
@@ -2190,6 +2356,70 @@ interface NodeOverride {
2190
2356
  /** Force label to always show regardless of zoom/priority. */
2191
2357
  alwaysShowLabel?: boolean;
2192
2358
  }
2359
+ /**
2360
+ * Per-phase and per-behavior motion config for a graph.
2361
+ *
2362
+ * DEFAULT-ON semantics (deliberately different from charts, which are opt-in):
2363
+ * omit `animation` → the resolver returns full defaults; `animation: false` →
2364
+ * no choreography (but `layout.warmup` still applies); a per-phase `false`
2365
+ * disables just that phase. Graphs are default-on because physics motion
2366
+ * already exists on load and choreography reduces the chaos.
2367
+ */
2368
+ interface GraphAnimationConfig {
2369
+ /** Node/edge reveal on first render. Default `{ duration: 500, ease: 'smooth', stagger: true }`. */
2370
+ enter?: AnimationPhaseConfig | boolean;
2371
+ /** Data-update enter-fade for newly added marks. Default `{ duration: 300, ease: 'smooth' }`. */
2372
+ update?: AnimationPhaseConfig | boolean;
2373
+ /** Ghost fade-out for removed marks. Default `{ duration: 300, ease: 'smooth' }`. */
2374
+ exit?: AnimationPhaseConfig | boolean;
2375
+ /** Camera flight easing. Default duration `'auto'` (derived from the zoom distance). */
2376
+ camera?: {
2377
+ duration?: number;
2378
+ ease?: AnimationEase;
2379
+ } | boolean;
2380
+ /** Hover emphasis crossfade. Default `{ duration: 150, ease: 'smooth' }`. */
2381
+ hover?: {
2382
+ duration?: number;
2383
+ ease?: AnimationEase;
2384
+ } | boolean;
2385
+ }
2386
+ /**
2387
+ * Graph motion spec.
2388
+ * - omitted → full defaults (default-ON)
2389
+ * - `false` → no choreography (warmup still applies)
2390
+ * - object → per-phase control
2391
+ *
2392
+ * `prefers-reduced-motion` is always respected regardless of this value.
2393
+ */
2394
+ type GraphAnimationSpec = boolean | GraphAnimationConfig;
2395
+ /** Interaction behavior for a graph (hover mode, select-fly, opt-in physics). */
2396
+ interface GraphInteractionConfig {
2397
+ /**
2398
+ * Hover emphasis behavior. `neighbors` (default) lights the hovered node and
2399
+ * its adjacency; `category` lights same-category nodes; `node` lights only the
2400
+ * hovered node; `none` disables. `dimOpacity` (default 0.15) is the node dim
2401
+ * tier. Named `mode` (not `highlight`) to avoid colliding with the three other
2402
+ * meanings of "highlight" (the encoding value list, the `highlight()` verb).
2403
+ */
2404
+ hover?: {
2405
+ mode?: 'neighbors' | 'category' | 'node' | 'none';
2406
+ dimOpacity?: number;
2407
+ };
2408
+ /** Selecting a node flies the camera to it. Default `false`. */
2409
+ select?: {
2410
+ flyTo?: boolean;
2411
+ };
2412
+ /**
2413
+ * Opt-in cursor repulsion (nodes drift away from the pointer). Disabled under
2414
+ * `prefers-reduced-motion` and above the node-count gate.
2415
+ */
2416
+ cursorRepulsion?: boolean | {
2417
+ radius?: number;
2418
+ strength?: number;
2419
+ };
2420
+ /** Opt-in springy node drag (user-initiated; no reduced-motion gate). */
2421
+ springyDrag?: boolean;
2422
+ }
2193
2423
  interface GraphSpec {
2194
2424
  /** Discriminant: always "graph". */
2195
2425
  type: 'graph';
@@ -2211,6 +2441,21 @@ interface GraphSpec {
2211
2441
  theme?: ThemeConfig;
2212
2442
  /** Dark mode behavior. */
2213
2443
  darkMode?: DarkMode;
2444
+ /**
2445
+ * Motion configuration. DEFAULT-ON: omit for full defaults, `false` to opt
2446
+ * out of choreography (layout warmup still applies).
2447
+ */
2448
+ animation?: GraphAnimationSpec;
2449
+ /** Interaction behavior (hover mode, select-fly, opt-in physics). */
2450
+ interaction?: GraphInteractionConfig;
2451
+ /**
2452
+ * Built-in legend. Interactive by default. Set `false` if you render your own
2453
+ * legend, so the built-in filter UI doesn't compete with it.
2454
+ */
2455
+ legend?: boolean | {
2456
+ interactive?: boolean;
2457
+ counts?: boolean;
2458
+ };
2214
2459
  /** Whether to show the tryOpenData.ai watermark. Defaults to true. */
2215
2460
  watermark?: boolean;
2216
2461
  }
@@ -2265,7 +2510,16 @@ interface LayerSpec<TData extends DataRow = DataRow> {
2265
2510
  height?: number;
2266
2511
  /** Accepted for Vega-Lite compatibility and ignored (with a compile warning). */
2267
2512
  $schema?: string;
2268
- /** Annotations on the layered view. */
2513
+ /**
2514
+ * Annotations for the layered chart. When present, these are the
2515
+ * annotations rendered and available for editing. When absent, falls back
2516
+ * to the first leaf layer's annotations. Annotations on second and later
2517
+ * leaf layers are not rendered.
2518
+ *
2519
+ * For edit persistence: the `data-annotation-index` stamped on each
2520
+ * rendered annotation maps to this array (or the first leaf's if this is
2521
+ * unset). Place annotations here for reliable index-based edit matching.
2522
+ */
2269
2523
  annotations?: Annotation[];
2270
2524
  /** Label display configuration. `false` disables all labels, `true` uses defaults. */
2271
2525
  labels?: LabelSpec;
@@ -2281,7 +2535,12 @@ interface LayerSpec<TData extends DataRow = DataRow> {
2281
2535
  watermark?: boolean;
2282
2536
  /** Resolution strategy for shared scales/axes/legends. */
2283
2537
  resolve?: ResolveConfig;
2284
- /** Hidden series names. */
2538
+ /**
2539
+ * Series names to hide from rendering by default. This is the authored
2540
+ * persistence target for legend visibility. Runtime legend toggles
2541
+ * (legend-toggle edit events) layer on top of this via ephemeral runtime
2542
+ * sets but never modify it.
2543
+ */
2285
2544
  hiddenSeries?: string[];
2286
2545
  /** Endpoint labels column, inherited by child layers that don't set their own. */
2287
2546
  endpointLabels?: boolean | EndpointLabelsConfig;
@@ -2424,9 +2683,21 @@ interface TileMapSpec {
2424
2683
  /** Supported map projections. */
2425
2684
  type MapProjection = 'albersUsa' | 'mercator' | 'equalEarth' | 'identity';
2426
2685
  /** Focus target for map camera: feature id(s) to zoom/pan to. */
2686
+ /**
2687
+ * Fit the point layer's cluster. `true` fits every point; `{ field, value }`
2688
+ * fits only the points whose data row has `row[field] === value` (e.g. only the
2689
+ * campuses rated "F"), which lets a story pan between sub-clusters.
2690
+ */
2691
+ type MapPointsFocus = true | {
2692
+ field: string;
2693
+ value: string | number;
2694
+ };
2427
2695
  type MapFocus = string | number | Array<string | number> | {
2428
2696
  features: string | number | Array<string | number>;
2429
2697
  padding?: number;
2698
+ } | {
2699
+ points: MapPointsFocus;
2700
+ padding?: number;
2430
2701
  };
2431
2702
  /** Geo configuration for map specs. */
2432
2703
  interface MapGeo {
@@ -2436,18 +2707,44 @@ interface MapGeo {
2436
2707
  idField?: string;
2437
2708
  /** Map projection. Defaults to 'albersUsa'. */
2438
2709
  projection?: MapProjection;
2439
- /** Focus on specific feature(s). null clears focus from a prior story step. */
2710
+ /**
2711
+ * Focus the camera. A feature id (or array) fits those features; `{ features, padding }`
2712
+ * adds breathing room; `{ points: true, padding }` fits the points layer's cluster
2713
+ * instead of any feature (use when points occupy a small part of a large feature, so
2714
+ * fitting the feature would leave the cluster small and off-center);
2715
+ * `{ points: { field, value }, padding }` fits only the matching point subset, so a
2716
+ * story can pan between sub-clusters. null clears focus from a prior story step.
2717
+ */
2440
2718
  focus?: MapFocus | null;
2441
2719
  }
2442
2720
  /** Encoding channels specific to map visualizations. */
2443
2721
  interface MapEncoding {
2444
- /** Join key field in the data (required). Maps data rows to geo features via geo.idField. */
2445
- key: EncodingChannel;
2446
- /** Color encoding (required, quantitative or nominal). Drives fill color of features. */
2447
- color: EncodingChannel;
2722
+ /** Join key field in the data. Required for choropleth; optional in basemap-only mode (points layer with empty data). */
2723
+ key?: EncodingChannel;
2724
+ /** Color encoding (quantitative or nominal). Drives fill color of features. Optional when a points layer is present (basemap-only mode). */
2725
+ color?: EncodingChannel;
2448
2726
  /** Tooltip encoding (optional). */
2449
2727
  tooltip?: EncodingChannel | EncodingChannel[];
2450
2728
  }
2729
+ /** Point/symbol layer rendered above choropleth features. */
2730
+ interface MapPointsLayer {
2731
+ /** Tabular data for the points. Independent of the choropleth data join. */
2732
+ data: DataRow[];
2733
+ /** Field holding longitude (x coordinate). */
2734
+ longitude: EncodingChannel;
2735
+ /** Field holding latitude (y coordinate). */
2736
+ latitude: EncodingChannel;
2737
+ /** Optional quantitative size encoding. Area-proportional: r proportional to sqrt(value). No size legend is rendered in v1; explain the scale in chrome.subtitle if needed. */
2738
+ size?: EncodingChannel;
2739
+ /** Optional color encoding (nominal or quantitative). Independent scale from choropleth. */
2740
+ color?: EncodingChannel;
2741
+ /** Tooltip channel(s), same shape as MapEncoding.tooltip. */
2742
+ tooltip?: EncodingChannel | EncodingChannel[];
2743
+ /** Stable id for event callbacks. Data-update transitions for points are not yet supported. */
2744
+ key?: EncodingChannel;
2745
+ /** Fill opacity for point circles. Default 0.65. Range 0-1. */
2746
+ opacity?: number;
2747
+ }
2451
2748
  interface MapSpec {
2452
2749
  /** Discriminant: always "map". */
2453
2750
  type: 'map';
@@ -2467,6 +2764,8 @@ interface MapSpec {
2467
2764
  darkMode?: DarkMode;
2468
2765
  /** Whether to show the tryOpenData.ai watermark. Defaults to true. */
2469
2766
  watermark?: boolean;
2767
+ /** Optional point/symbol layer rendered above choropleth features. */
2768
+ points?: MapPointsLayer;
2470
2769
  /** Animation configuration for entrance animations. */
2471
2770
  animation?: AnimationSpec;
2472
2771
  /**
@@ -2556,7 +2855,9 @@ type SankeySpecWithoutData = Omit<SankeySpec, 'data'>;
2556
2855
  /** TileMap spec without runtime data, for persistence/storage. */
2557
2856
  type TileMapSpecWithoutData = Omit<TileMapSpec, 'data'>;
2558
2857
  /** Map spec without runtime data, for persistence/storage. */
2559
- type MapSpecWithoutData = Omit<MapSpec, 'data'>;
2858
+ type MapSpecWithoutData = Omit<MapSpec, 'data' | 'points'> & {
2859
+ points?: Omit<MapPointsLayer, 'data'>;
2860
+ };
2560
2861
  /** BarList spec without runtime data, for persistence/storage. */
2561
2862
  type BarListSpecWithoutData = Omit<BarListSpec, 'data'>;
2562
2863
  /** Union of data-stripped spec types for persistence/storage. */
@@ -2900,26 +3201,36 @@ type ElementRef = {
2900
3201
  type: 'annotation';
2901
3202
  index: number;
2902
3203
  id?: string;
3204
+ /** RFC 6901 JSON Pointer to the edited property in the spec. */
3205
+ path?: string;
2903
3206
  } | {
2904
3207
  type: 'chrome';
2905
3208
  key: ChromeKey;
3209
+ /** RFC 6901 JSON Pointer to the edited property in the spec. */
3210
+ path?: string;
2906
3211
  } | {
2907
3212
  type: 'series-label';
2908
3213
  series: string;
3214
+ /** RFC 6901 JSON Pointer to the edited property in the spec. */
3215
+ path?: string;
2909
3216
  } | {
2910
3217
  type: 'legend';
3218
+ /** RFC 6901 JSON Pointer to the edited property in the spec. */
3219
+ path?: string;
2911
3220
  } | {
2912
3221
  type: 'legend-entry';
2913
3222
  series: string;
2914
3223
  index: number;
3224
+ /** RFC 6901 JSON Pointer to the edited property in the spec. */
3225
+ path?: string;
2915
3226
  };
2916
3227
  /** Helper constructors for ergonomic ElementRef creation. */
2917
3228
  declare const elementRef: {
2918
- readonly annotation: (index: number, id?: string) => ElementRef;
2919
- readonly chrome: (key: ChromeKey) => ElementRef;
2920
- readonly seriesLabel: (series: string) => ElementRef;
2921
- readonly legend: () => ElementRef;
2922
- readonly legendEntry: (series: string, index: number) => ElementRef;
3229
+ readonly annotation: (index: number, id?: string, path?: string) => ElementRef;
3230
+ readonly chrome: (key: ChromeKey, path?: string) => ElementRef;
3231
+ readonly seriesLabel: (series: string, path?: string) => ElementRef;
3232
+ readonly legend: (path?: string) => ElementRef;
3233
+ readonly legendEntry: (series: string, index: number, path?: string) => ElementRef;
2923
3234
  };
2924
3235
  /**
2925
3236
  * Discriminated union of all element edit events.
@@ -2934,21 +3245,31 @@ declare const elementRef: {
2934
3245
  */
2935
3246
  type ElementEdit = {
2936
3247
  type: 'annotation';
3248
+ element: ElementRef;
2937
3249
  annotation: TextAnnotation;
2938
3250
  offset: AnnotationOffset;
2939
3251
  } | {
2940
3252
  type: 'annotation-connector';
3253
+ element: ElementRef;
2941
3254
  annotation: TextAnnotation;
2942
3255
  endpoint: 'from' | 'to';
2943
3256
  offset: AnnotationOffset;
2944
3257
  } | {
2945
3258
  type: 'range-label';
3259
+ element: ElementRef;
2946
3260
  annotation: RangeAnnotation;
2947
3261
  labelOffset: AnnotationOffset;
2948
3262
  } | {
2949
3263
  type: 'refline-label';
3264
+ element: ElementRef;
2950
3265
  annotation: RefLineAnnotation;
2951
3266
  labelOffset: AnnotationOffset;
3267
+ } | {
3268
+ type: 'annotation-anchor';
3269
+ element: ElementRef;
3270
+ annotation: TextAnnotation;
3271
+ x: string | number;
3272
+ y: string | number;
2952
3273
  } | {
2953
3274
  type: 'chrome';
2954
3275
  key: ChromeKey;
@@ -2961,10 +3282,21 @@ type ElementEdit = {
2961
3282
  } | {
2962
3283
  type: 'legend';
2963
3284
  offset: AnnotationOffset;
2964
- } | {
3285
+ }
3286
+ /**
3287
+ * Transient legend visibility toggle. Reports the same runtime show/hide
3288
+ * a reader triggers; not persisted by openchart. To author default-hidden
3289
+ * series, set `spec.hiddenSeries` directly. Hosts building spec
3290
+ * persistence should generally not write legend-toggle edits back into
3291
+ * the authored spec. `hidden: true` means the series was just hidden.
3292
+ */
3293
+ | {
2965
3294
  type: 'legend-toggle';
2966
3295
  series: string;
2967
3296
  hidden: boolean;
3297
+ } | {
3298
+ type: 'add';
3299
+ annotation: TextAnnotation;
2968
3300
  } | {
2969
3301
  type: 'delete';
2970
3302
  element: ElementRef;
@@ -3000,6 +3332,14 @@ interface MarkEvent {
3000
3332
  * or ChartProps (React component) to receive interaction callbacks.
3001
3333
  */
3002
3334
  interface ChartEventHandlers {
3335
+ /**
3336
+ * Explicitly enable or disable edit interactions (drag, select, keyboard
3337
+ * delete/edit). When true, the interaction layer is wired even without
3338
+ * onEdit. When false, all edit interactions are suppressed even when
3339
+ * onEdit is provided. When omitted, each interaction block uses its
3340
+ * existing callback-presence gate.
3341
+ */
3342
+ editable?: boolean;
3003
3343
  /** Called when a data mark is clicked. */
3004
3344
  onMarkClick?: (event: MarkEvent) => void;
3005
3345
  /** Called when the mouse enters a data mark. */
@@ -3096,6 +3436,12 @@ interface ResolvedChromeElement {
3096
3436
  y: number;
3097
3437
  /** Maximum width for line wrapping. */
3098
3438
  maxWidth: number;
3439
+ /**
3440
+ * Maximum wrapped lines. When set, the renderer caps the wrapped output to
3441
+ * this many lines and truncates the last kept line with an ellipsis. The
3442
+ * layout height reserved for this element already reflects the cap.
3443
+ */
3444
+ maxLines?: number;
3099
3445
  /** Computed text style. */
3100
3446
  style: TextStyle;
3101
3447
  }
@@ -3590,6 +3936,11 @@ interface ResolvedLabel {
3590
3936
  to: Point;
3591
3937
  /** Actual data point the connector is calling out. Renderer uses this for the endpoint marker. */
3592
3938
  endpoint?: Point;
3939
+ /** Author's from-end nudge, re-applied on every geometry rebuild (mirrors `endpoint` for `to`). */
3940
+ fromOffset?: {
3941
+ dx: number;
3942
+ dy: number;
3943
+ };
3593
3944
  /** Connector line color. */
3594
3945
  stroke: string;
3595
3946
  /** Connector style: straight line, curved arrow, or vertical drop-line through the data point. */
@@ -3699,6 +4050,8 @@ interface LegendEntry {
3699
4050
  active?: boolean;
3700
4051
  /** True for overflow indicator entries ("+N more"). Not interactive. */
3701
4052
  overflow?: boolean;
4053
+ /** Node/edge count for this category (graph legends). Additive; undefined elsewhere. */
4054
+ count?: number;
3702
4055
  }
3703
4056
  /** The encoding channel a legend keys. */
3704
4057
  type LegendChannel = 'color' | 'size';
@@ -3715,8 +4068,9 @@ interface BaseLegendLayout {
3715
4068
  * read them silently pick whichever comes first.
3716
4069
  */
3717
4070
  channel?: LegendChannel;
3718
- /** Where the legend is positioned relative to the chart area. */
3719
- position: 'top' | 'right' | 'bottom' | 'bottom-right' | 'inline';
4071
+ /** Where the legend is positioned relative to the chart area. `'top-left'`
4072
+ * is a map-only overlay position (floats inside the map area). */
4073
+ position: 'top' | 'top-left' | 'right' | 'bottom' | 'bottom-right' | 'inline';
3720
4074
  /** Bounding box for the legend (pixel coordinates). */
3721
4075
  bounds: Rect;
3722
4076
  /** Entry label style. */
@@ -3936,6 +4290,12 @@ interface A11yMetadata {
3936
4290
  altText: string;
3937
4291
  /** Tabular data fallback for screen readers. Each inner array is a row. */
3938
4292
  dataTableFallback: unknown[][];
4293
+ /**
4294
+ * True row count of the underlying data. Only set when `dataTableFallback`
4295
+ * was truncated, so its presence is the signal that rows are missing and the
4296
+ * caption should name the total.
4297
+ */
4298
+ totalRows?: number;
3939
4299
  /** ARIA role for the visualization root element. */
3940
4300
  role: string;
3941
4301
  /** Whether the visualization is keyboard-navigable. */
@@ -3958,6 +4318,12 @@ interface ResolvedAnimationPhase {
3958
4318
  staggerDelay: number;
3959
4319
  /** Stagger ordering. */
3960
4320
  staggerOrder: 'index' | 'value' | 'reverse';
4321
+ /**
4322
+ * Author-set cap on the mark count that still runs a tweened data-update
4323
+ * transition (update phase only). Present only when explicitly set on the
4324
+ * spec — the renderer supplies the default so it can vary by render mode.
4325
+ */
4326
+ maxMarks?: number;
3961
4327
  }
3962
4328
  /** Resolved animation config. A phase is present iff that phase is enabled. */
3963
4329
  interface ResolvedAnimation {
@@ -4046,6 +4412,23 @@ interface YouDrawItYInvert {
4046
4412
  /** Data value at the bottom pixel. */
4047
4413
  bottomData: number;
4048
4414
  }
4415
+ /**
4416
+ * Scale inversion anchors serialized from the engine so the vanilla layer
4417
+ * can convert pixel positions to data-space values without holding d3
4418
+ * scale objects. Generalizes the YouDrawItYInvert pattern to both axes.
4419
+ */
4420
+ interface ScaleInvert {
4421
+ /** For continuous scales: two reference pixel-to-data anchor points. */
4422
+ topPixel: number;
4423
+ bottomPixel: number;
4424
+ topData: number;
4425
+ bottomData: number;
4426
+ /** Scale type so the vanilla layer applies the correct inverse transform. */
4427
+ scaleType?: 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time';
4428
+ /** For band/point scales: ordered domain values and their pixel centers. */
4429
+ domain?: (string | number)[];
4430
+ positions?: number[];
4431
+ }
4049
4432
  /**
4050
4433
  * Resolved geometry and config for the "you draw it" interactive format
4051
4434
  * (`youDrawIt`). The vanilla adapter uses this to render the hatched drawing
@@ -4098,6 +4481,7 @@ interface FacetPanelLayout {
4098
4481
  y: number;
4099
4482
  fontSize: number;
4100
4483
  fontWeight: number;
4484
+ textAnchor?: 'start' | 'middle' | 'end';
4101
4485
  };
4102
4486
  }
4103
4487
  /** Layout for a faceted (small-multiples) chart. */
@@ -4110,6 +4494,8 @@ interface FacetLayout {
4110
4494
  columns: number;
4111
4495
  /** Whether scales are shared across panels. */
4112
4496
  sharedScales: boolean;
4497
+ /** How panels are arranged: 'row' (vertical stack), 'column' (horizontal), 'wrap' (grid). */
4498
+ direction: 'row' | 'column' | 'wrap';
4113
4499
  }
4114
4500
  /**
4115
4501
  * ChartLayout: the complete engine output for chart visualizations.
@@ -4184,8 +4570,22 @@ interface ChartLayout {
4184
4570
  crosshair: boolean;
4185
4571
  /** Real text measurement function from the adapter (for accurate SVG text wrapping). */
4186
4572
  measureText?: MeasureTextFn;
4573
+ /** Scale inversion anchors for the x axis. Used by anchor drag to convert pixel to data-space. */
4574
+ xInvert?: ScaleInvert;
4575
+ /** Scale inversion anchors for the y axis. Used by anchor drag to convert pixel to data-space. */
4576
+ yInvert?: ScaleInvert;
4187
4577
  /** Faceted (small-multiples) layout. When present, renderers iterate panels instead of using top-level marks/axes. */
4188
4578
  facet?: FacetLayout;
4579
+ /**
4580
+ * Resolved rendering backend for point marks. Absent means `'svg'`.
4581
+ *
4582
+ * ADVISORY metadata only: it tells the mount and export layers that a canvas
4583
+ * mark layer is worth creating for this layout. The SVG renderer keys solely
4584
+ * on its own `canvasMarks` render option and never reads this field, so a
4585
+ * server-side or export render of a canvas-mode layout still produces
4586
+ * full-fidelity SVG.
4587
+ */
4588
+ markRenderMode?: 'svg' | 'canvas';
4189
4589
  }
4190
4590
  /** A resolved column definition with computed properties. */
4191
4591
  interface ResolvedColumn {
@@ -4642,6 +5042,32 @@ interface MapFeatureMark {
4642
5042
  /** Centroid in map-local coordinates. */
4643
5043
  centroid: [number, number];
4644
5044
  }
5045
+ /** A resolved map point mark with projected coordinates and visual properties. */
5046
+ interface MapPointMark {
5047
+ type: 'map-point';
5048
+ /** Projected center x in map-local coordinates. */
5049
+ cx: number;
5050
+ /** Projected center y in map-local coordinates. */
5051
+ cy: number;
5052
+ /** Radius in pixels (base radius before camera counter-scaling). */
5053
+ r: number;
5054
+ /** CSS fill color. */
5055
+ fill: string;
5056
+ /** CSS stroke color. */
5057
+ stroke: string;
5058
+ /** Stroke width in px. */
5059
+ strokeWidth: number;
5060
+ /** Fill opacity (0-1). */
5061
+ fillOpacity: number;
5062
+ /** Stable key for events. */
5063
+ key: string;
5064
+ /** Original data row. */
5065
+ data: Record<string, unknown>;
5066
+ /** Accessibility attributes. */
5067
+ aria: MarkAria;
5068
+ /** Index for stagger animation ordering. */
5069
+ animationIndex: number;
5070
+ }
4645
5071
  /** Border paths for the map (interior borders and coastline/outline). */
4646
5072
  interface MapBorders {
4647
5073
  /** SVG path `d` for interior borders between features. */
@@ -4669,6 +5095,12 @@ interface MapLayout {
4669
5095
  features: MapFeatureMark[];
4670
5096
  /** Border paths (interior mesh and outline). */
4671
5097
  borders: MapBorders;
5098
+ /** Resolved point marks for the symbol layer (empty array if no points layer). */
5099
+ pointMarks: MapPointMark[];
5100
+ /** Categorical legend for the point color channel (null if no point color). */
5101
+ pointCategoricalLegend: CategoricalLegendLayout | null;
5102
+ /** Continuous legend for the point color channel (null if no point color). */
5103
+ pointContinuousLegend: ContinuousLegendLayout | null;
4672
5104
  /** Continuous color legend for quantitative mode (null if hidden or categorical). */
4673
5105
  continuousLegend: ContinuousLegendLayout | null;
4674
5106
  /** Categorical swatch legend for nominal mode (null if hidden or quantitative). */
@@ -4788,6 +5220,14 @@ interface CompileOptions {
4788
5220
  width: number;
4789
5221
  /** Total available height in pixels. */
4790
5222
  height: number;
5223
+ /**
5224
+ * How chrome height interacts with the height budget. Mirrors the spec-level
5225
+ * `chromeLayout`; the engine reads whichever is set (spec wins).
5226
+ *
5227
+ * - `'subtract'` (default): `height` is the fixed total; chrome shrinks the plot.
5228
+ * - `'grow'`: `height` is the plot budget; the SVG grows by the chrome height.
5229
+ */
5230
+ chromeLayout?: 'subtract' | 'grow';
4791
5231
  /** Theme overrides. */
4792
5232
  theme?: ThemeConfig;
4793
5233
  /**
@@ -4846,6 +5286,13 @@ interface CompileOptions {
4846
5286
  * different area than the one the axes are rendered in.
4847
5287
  */
4848
5288
  frozenChartArea?: Rect;
5289
+ /**
5290
+ * Marks this compile as one leaf (or the primary spec) of a multi-leaf layer.
5291
+ * Set by compileLayer; callers should not set it. Only consumer today is the
5292
+ * canvas mark-layer resolution, which refuses canvas mode for layered charts
5293
+ * because the layer layout concatenates marks from several compiles.
5294
+ */
5295
+ layered?: boolean;
4849
5296
  }
4850
5297
  /** Extended compile options for table visualizations. */
4851
5298
  interface CompileTableOptions extends CompileOptions {
@@ -5366,12 +5813,20 @@ declare function computeXAxisExtentFromLabels(input: XAxisExtentInput): number;
5366
5813
  */
5367
5814
  declare function maxRotatedLabelWidth(tickAngle: number, tickFontSize: number): number;
5368
5815
  /**
5369
- * Truncate a rotated tick label with an ellipsis so it fits inside the capped
5370
- * reservation. Returns the label unchanged when it already fits.
5816
+ * Truncate a label with an ellipsis so it fits inside an explicit pixel budget.
5817
+ * Returns the label unchanged when it already fits.
5371
5818
  *
5372
5819
  * Binary-search on character count against the real measure function, so it
5373
5820
  * respects proportional fonts rather than assuming a fixed character width.
5374
5821
  */
5822
+ declare function truncateToWidth(label: string, budget: number, fontSize: number, fontWeight: number, measure?: (text: string, fontSize: number, fontWeight?: number) => number): string;
5823
+ /**
5824
+ * Truncate a rotated tick label with an ellipsis so it fits inside the capped
5825
+ * reservation. Returns the label unchanged when it already fits.
5826
+ *
5827
+ * Delegates to `truncateToWidth` with the budget derived from the rotation
5828
+ * geometry, so the binary-search stays in one place.
5829
+ */
5375
5830
  declare function truncateRotatedLabel(label: string, tickAngle: number, tickFontSize: number, tickFontWeight: number, measure?: (text: string, fontSize: number, fontWeight?: number) => number): string;
5376
5831
 
5377
5832
  /**
@@ -5548,12 +6003,22 @@ declare function buildTemporalFormatter(formatStr: string | undefined): ((value:
5548
6003
  * @param data - The data array.
5549
6004
  */
5550
6005
  declare function generateAltText(spec: ChartSpec, data: DataRow[]): string;
6006
+ /**
6007
+ * Maximum number of data rows in the screen-reader table. A 50k-point scatter
6008
+ * would otherwise put 50k hidden rows in the DOM.
6009
+ */
6010
+ declare const MAX_SR_TABLE_ROWS = 1000;
5551
6011
  /**
5552
6012
  * Generate a tabular data fallback for screen readers.
5553
6013
  *
5554
6014
  * Returns a 2D array where the first row is headers and subsequent
5555
6015
  * rows are data values. Only includes fields referenced in the encoding.
5556
6016
  *
6017
+ * Data rows are capped at MAX_SR_TABLE_ROWS (the header row does not count
6018
+ * against the cap). SCOPE: this caps the chart compile path only. Graph,
6019
+ * sankey, tilemap and map build their `dataTableFallback` independently and
6020
+ * stay uncapped.
6021
+ *
5557
6022
  * @param spec - The chart spec.
5558
6023
  * @param data - The data array.
5559
6024
  */
@@ -5806,4 +6271,4 @@ declare const CSS_TOKEN_ROOT_SELECTORS: readonly string[];
5806
6271
  declare const CSS_TOKENS: readonly CssTokenDef[];
5807
6272
  declare function cssTokenDefault(name: string, mode: 'light' | 'dark'): string;
5808
6273
 
5809
- export { type A11yConfig, type A11yMetadata, ACHROMATIC_RAMP, AXIS_TITLE_GAP, AXIS_TITLE_OFFSET_COMPACT, AXIS_TITLE_OFFSET_DEFAULT, AXIS_TITLE_TRAILING_PAD, type AggregateOp, type AggregateTransform, type AnimationConfig, type AnimationEase, type AnimationPhaseConfig, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationFootnote, type AnnotationOffset, type AnnotationPosition, type ArcEncoding, type ArcMark, type AreaEncoding, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, BREAKPOINT_COMPACT_MAX, BREAKPOINT_MEDIUM_MAX, type BarColumnConfig, type BarEncoding, type BarListEncoding, type BarListLayout, type BarListRowMark, type BarListSpec, type BarListSpecWithoutData, type BarTableCell, type BaseLegendLayout, type BeeswarmEncoding, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_PALETTE, COMPACT_WIDTH, CSS_TOKENS, CSS_TOKEN_ROOT_SELECTORS, type CalculateExpression, type CalculateTransform, type CalendarEncoding, type CategoricalLegendLayout, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type Chrome, type ChromeDefaults, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ChromeThemeOverride, type CircleEncoding, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type CompileWarning, type Condition, type ConditionalValueDef, type ConnectorConfig, type ConnectorType, type ContinuousLegendBin, type ContinuousLegendLayout, type ContinuousLegendTick, type CssTokenDef, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DateGranularity, type Display, type DivergingPalette, EXTENDED_OFFSET_STRATEGIES, type ElementEdit, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type EndpointLabelContent, type EndpointLabelEntry, type EndpointLabelsConfig, type EndpointLabelsLayout, FOOTNOTE_LINE_HEIGHT, type FacetChannel, type FacetLayout, type FacetPanelLayout, type FieldFormatContext, type FieldPredicate, type FieldRef, type FieldType, type FillPatternType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, GRAPH_ENCODING_RULES, type GradientColorStop, type GradientDef, type GradientLegendLayout, type GradientStop, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphSpec, type GraphSpecWithoutData, type Gridline, HEIGHT_CRAMPED_MAX, HEIGHT_SHORT_MAX, HPAD_COMPACT_FRACTION, HPAD_COMPACT_MIN, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type ImageColumnConfig, type ImageTableCell, LABEL_GAP_COMPACT, LABEL_GAP_DEFAULT, LABEL_GAP_NARROW_MAX, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LabelSpec, type LayerSpec, type LayoutStrategy, type LegendChannel, type LegendConfig, type LegendEntry, type LegendEntryPosition, type LegendLayout, type LegendPosition, type LineEncoding, type LineMark, type LinearGradient, type LogicalAnd, type LogicalNot, type LogicalOr, type LollipopEncoding, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, MAX_LEFT_LABEL_FRACTION_COMPACT, MAX_LEFT_LABEL_FRACTION_DEFAULT, MAX_LEFT_LABEL_FRACTION_MEDIUM, MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX, type MapBorders, type MapEncoding, type MapFeatureMark, type MapFocus, type MapFocusLayout, type MapGeo, type MapLayout, type MapProjection, type MapSpec, type MapSpecWithoutData, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkType, type MeasureTextFn, type Metric, NARROW_VIEWPORT_MAX, type NodeOverride, type NumberFormatter, OFFSET_STRATEGIES, type OffsetStrategy, type PaginationState, type ParliamentEncoding, type Point, type PointEncoding, type PointMark, type RadialGradient, type RangeAnnotation, type RangeEncoding, type Rect, type RectEncoding, type RectMark, type RefLineAnnotation, type RelativeTimeRef, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnimationPhase, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedColumn, type ResolvedFillPattern, type ResolvedLabel, type ResolvedMetricBar, type ResolvedMetricCell, type ResolvedSeriesSearch, type ResolvedTheme, type ResolvedYouDrawIt, type ResponsiveConfig, type RuleMarkLayout, SEQUENTIAL_PALETTES, SUPPORTED_SCHEME_NAMES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecWithoutData, type ScaleConfig, type ScaleType, type SequentialPalette, type SeriesSearchConfig, type SeriesStrategy, type SeriesStyle, type SizeLegendCircle, type SizeLegendLayout, type SortByField, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type StoredVizSpec, TICK_LABEL_OFFSET, TICK_LINE_HEIGHT_FACTOR, TOP_PAD_EXTRA_NARROW, TOP_PAD_NARROW_MAX, type TableBuilderOptions, type TableCell, type TableCellBase, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TextAnnotation, type TextEncoding, type TextMarkLayout, type TextStyle, type TextTableCell, type Theme, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeSpacing, type TickEncoding, type TickMarkLayout, type TileMapBuilderOptions, type TileMapEncoding, type TileMapLayout, type TileMapPalette, type TileMapSpec, type TileMapSpecWithoutData, type TileMapTileMark, type TimeUnit, type TimeUnitTransform, type TokenValue, type TooltipContent, type TooltipField, type Transform, type ValueDef, type VizSpec, type WaffleEncoding, type WindowFieldDef, type WindowOp, type WindowSortField, type WindowTransform, type XAxisExtentInput, X_AXIS_BAND_HEIGHT, X_AXIS_ROTATED_EXTENT_CAP, X_AXIS_TITLE_BAND, X_AXIS_TITLE_BAND_ROTATED, type YouDrawItConfig, type YouDrawItSample, type YouDrawItYInvert, abbreviateNumber, adaptColorForDarkMode, adaptForLightLineStroke, adaptTheme, areaChart, axisTitleOffset, barChart, buildCompactStepFormatter, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, columnChart, computeChrome, computeFieldFormatContext, computeLabelBounds, computeXAxisExtentFromLabels, contrastRatio, cssTokenDefault, dataTable, deepMergeSpec, defaultNumberFormatter, detectCollision, donutChart, dotChart, editorial, elementRef, essay, estimateTextWidth, findAccessibleColor, footnoteBandHeight, formatCurrency, formatDate, formatNumber, formatOrdinal, formatPercent, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, heuristicMeasure, inferFieldType, isAxislessMark, isBarListSpec, isChartSpec, isConditionalDef, isEncodingChannel, isGradientDef, isGraphSpec, isLayerSpec, isMapSpec, isOpaqueColor, isRangeAnnotation, isRefLineAnnotation, isSankeySpec, isTableSpec, isTextAnnotation, isTileMapSpec, isValueDef, isYearContext, lineChart, maxRotatedLabelWidth, meetsAA, overlapArea, pickLabelColor, pieChart, resolveCollisions, resolveMarkDef, resolveMarkType, resolveMeasurer, resolveNumberFormatter, resolveSchemeName, resolveTheme, scatterChart, simulateColorBlindness, textAscent, tileMap, truncateRotatedLabel, wire, wrapText };
6274
+ export { type A11yConfig, type A11yMetadata, ACHROMATIC_RAMP, AXIS_TITLE_GAP, AXIS_TITLE_OFFSET_COMPACT, AXIS_TITLE_OFFSET_DEFAULT, AXIS_TITLE_TRAILING_PAD, type AggregateOp, type AggregateTransform, type AnimationConfig, type AnimationEase, type AnimationPhaseConfig, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationFootnote, type AnnotationOffset, type AnnotationPosition, type ArcEncoding, type ArcMark, type AreaEncoding, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, BREAKPOINT_COMPACT_MAX, BREAKPOINT_MEDIUM_MAX, type BarColumnConfig, type BarEncoding, type BarListEncoding, type BarListLayout, type BarListRowMark, type BarListSpec, type BarListSpecWithoutData, type BarTableCell, type BaseLegendLayout, type BeeswarmEncoding, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_PALETTE, COMPACT_WIDTH, CSS_TOKENS, CSS_TOKEN_ROOT_SELECTORS, type CalculateExpression, type CalculateTransform, type CalendarEncoding, type CategoricalLegendLayout, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type Chrome, type ChromeDefaults, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ChromeThemeOverride, type CircleEncoding, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type CompileWarning, type Condition, type ConditionalValueDef, type ConnectorConfig, type ConnectorType, type ContinuousLegendBin, type ContinuousLegendLayout, type ContinuousLegendTick, type CssTokenDef, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DateGranularity, type Display, type DivergingPalette, EXTENDED_OFFSET_STRATEGIES, type ElementEdit, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type EndpointLabelContent, type EndpointLabelEntry, type EndpointLabelsConfig, type EndpointLabelsLayout, FOOTNOTE_LINE_HEIGHT, type FacetChannel, type FacetLayout, type FacetPanelLayout, type FieldFormatContext, type FieldPredicate, type FieldRef, type FieldType, type FillPatternType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, GRAPH_ENCODING_RULES, type GradientColorStop, type GradientDef, type GradientLegendLayout, type GradientStop, type GraphAnimationConfig, type GraphAnimationSpec, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphInteractionConfig, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphSpec, type GraphSpecWithoutData, type Gridline, HEIGHT_CRAMPED_MAX, HEIGHT_SHORT_MAX, HPAD_COMPACT_FRACTION, HPAD_COMPACT_MIN, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type ImageColumnConfig, type ImageTableCell, LABEL_GAP_COMPACT, LABEL_GAP_DEFAULT, LABEL_GAP_NARROW_MAX, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LabelSpec, type LayerSpec, type LayoutStrategy, type LegendChannel, type LegendConfig, type LegendEntry, type LegendEntryPosition, type LegendLayout, type LegendPosition, type LineEncoding, type LineMark, type LinearGradient, type LogicalAnd, type LogicalNot, type LogicalOr, type LollipopEncoding, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, MAX_LEFT_LABEL_FRACTION_COMPACT, MAX_LEFT_LABEL_FRACTION_DEFAULT, MAX_LEFT_LABEL_FRACTION_MEDIUM, MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX, MAX_SR_TABLE_ROWS, type MapBorders, type MapEncoding, type MapFeatureMark, type MapFocus, type MapFocusLayout, type MapGeo, type MapLayout, type MapPointMark, type MapPointsLayer, type MapProjection, type MapSpec, type MapSpecWithoutData, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkType, type MeasureTextFn, type Metric, NARROW_VIEWPORT_MAX, type NodeOverride, type NumberFormatter, OFFSET_STRATEGIES, type OffsetStrategy, type PaginationState, type ParliamentEncoding, type Point, type PointEncoding, type PointMark, type RadialGradient, type RangeAnnotation, type RangeEncoding, type Rect, type RectEncoding, type RectMark, type RefLineAnnotation, type RelativeTimeRef, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnimationPhase, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedColumn, type ResolvedFillPattern, type ResolvedLabel, type ResolvedMetricBar, type ResolvedMetricCell, type ResolvedSeriesSearch, type ResolvedTheme, type ResolvedYouDrawIt, type ResponsiveConfig, type RuleMarkLayout, SEQUENTIAL_PALETTES, SUPPORTED_SCHEME_NAMES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecWithoutData, type ScaleConfig, type ScaleInvert, type ScaleType, type SequentialPalette, type SeriesSearchConfig, type SeriesStrategy, type SeriesStyle, type SizeLegendCircle, type SizeLegendLayout, type SortByField, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type StoredVizSpec, TICK_LABEL_OFFSET, TICK_LINE_HEIGHT_FACTOR, TOP_PAD_EXTRA_NARROW, TOP_PAD_NARROW_MAX, type TableBuilderOptions, type TableCell, type TableCellBase, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TextAnnotation, type TextEncoding, type TextMarkLayout, type TextStyle, type TextTableCell, type Theme, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeSpacing, type TickEncoding, type TickMarkLayout, type TileMapBuilderOptions, type TileMapEncoding, type TileMapLayout, type TileMapPalette, type TileMapSpec, type TileMapSpecWithoutData, type TileMapTileMark, type TimeUnit, type TimeUnitTransform, type TokenValue, type TooltipContent, type TooltipField, type Transform, type UpdatePhaseConfig, type ValueDef, type VizSpec, type WaffleEncoding, type WindowFieldDef, type WindowOp, type WindowSortField, type WindowTransform, type XAxisExtentInput, X_AXIS_BAND_HEIGHT, X_AXIS_ROTATED_EXTENT_CAP, X_AXIS_TITLE_BAND, X_AXIS_TITLE_BAND_ROTATED, type YouDrawItConfig, type YouDrawItSample, type YouDrawItYInvert, abbreviateNumber, adaptColorForDarkMode, adaptForLightLineStroke, adaptTheme, areaChart, axisTitleOffset, barChart, buildCompactStepFormatter, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, columnChart, computeChrome, computeFieldFormatContext, computeLabelBounds, computeXAxisExtentFromLabels, contrastRatio, cssTokenDefault, dataTable, deepMergeSpec, defaultNumberFormatter, detectCollision, donutChart, dotChart, editorial, elementRef, essay, estimateTextWidth, findAccessibleColor, footnoteBandHeight, formatCurrency, formatDate, formatNumber, formatOrdinal, formatPercent, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, heuristicMeasure, inferFieldType, isAxislessMark, isBarListSpec, isChartSpec, isConditionalDef, isEncodingChannel, isGradientDef, isGraphSpec, isLayerSpec, isMapSpec, isOpaqueColor, isRangeAnnotation, isRefLineAnnotation, isSankeySpec, isTableSpec, isTextAnnotation, isTileMapSpec, isValueDef, isYearContext, lineChart, maxRotatedLabelWidth, meetsAA, overlapArea, pickLabelColor, pieChart, resolveCollisions, resolveMarkDef, resolveMarkType, resolveMeasurer, resolveNumberFormatter, resolveSchemeName, resolveTheme, scatterChart, simulateColorBlindness, textAscent, tileMap, truncateRotatedLabel, truncateToWidth, wire, wrapText };