@opendata-ai/openchart-core 8.0.0-rc.12 → 8.0.0-rc.3

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 +22 -196
  2. package/dist/index.js +18 -54
  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 +2 -1
  7. package/schema/chart.schema.json +2 -143
  8. package/schema/table.schema.json +0 -4
  9. package/schema/vizspec.schema.json +29 -397
  10. package/src/accessibility/__tests__/alt-text.test.ts +110 -0
  11. package/src/accessibility/__tests__/aria.test.ts +125 -0
  12. package/src/accessibility/alt-text.ts +155 -0
  13. package/src/accessibility/aria.ts +75 -0
  14. package/src/accessibility/index.ts +6 -0
  15. package/src/colors/__tests__/colorblind.test.ts +75 -0
  16. package/src/colors/__tests__/contrast.test.ts +119 -0
  17. package/src/colors/__tests__/palettes.test.ts +74 -0
  18. package/src/colors/colorblind.ts +131 -0
  19. package/src/colors/contrast.ts +143 -0
  20. package/src/colors/index.ts +36 -0
  21. package/src/colors/palettes.ts +206 -0
  22. package/src/helpers/__tests__/deep-merge.test.ts +54 -0
  23. package/src/helpers/__tests__/spec-builders.test.ts +338 -0
  24. package/src/helpers/deep-merge.ts +29 -0
  25. package/src/helpers/spec-builders.ts +479 -0
  26. package/src/index.ts +215 -0
  27. package/src/labels/__tests__/collision.test.ts +310 -0
  28. package/src/labels/collision.ts +249 -0
  29. package/src/labels/index.ts +13 -0
  30. package/src/layout/__tests__/chrome.test.ts +208 -0
  31. package/src/layout/__tests__/text-measure.test.ts +57 -0
  32. package/src/layout/chrome.ts +470 -0
  33. package/src/layout/index.ts +18 -0
  34. package/src/layout/text-measure.ts +404 -0
  35. package/src/layout/text-wrap.ts +93 -0
  36. package/src/locale/__tests__/format.test.ts +606 -0
  37. package/src/locale/format.ts +459 -0
  38. package/src/locale/index.ts +21 -0
  39. package/src/responsive/__tests__/breakpoints.test.ts +146 -0
  40. package/src/responsive/__tests__/metrics.test.ts +52 -0
  41. package/src/responsive/breakpoints.ts +172 -0
  42. package/src/responsive/index.ts +53 -0
  43. package/src/responsive/metrics.ts +299 -0
  44. package/src/schema/__tests__/generated-artifacts.test.ts +42 -0
  45. package/src/schema/__tests__/schema.test.ts +179 -0
  46. package/src/styles/__tests__/reduced-motion-selectors.test.ts +28 -0
  47. package/src/styles/animation.css +207 -0
  48. package/src/styles/base.css +102 -0
  49. package/src/styles/chrome.css +174 -0
  50. package/src/styles/dark.css +44 -0
  51. package/src/styles/graph.css +135 -0
  52. package/src/styles/index.css +28 -0
  53. package/src/styles/keyframes.css +135 -0
  54. package/src/styles/legend.css +18 -0
  55. package/src/styles/reduced-motion.css +67 -0
  56. package/src/styles/series-search.css +153 -0
  57. package/src/styles/sparkline.css +16 -0
  58. package/src/styles/table-animation.css +93 -0
  59. package/src/styles/table.css +398 -0
  60. package/src/styles/token-definitions.ts +199 -0
  61. package/src/styles/tokens.css +156 -0
  62. package/src/styles/tooltip.css +126 -0
  63. package/src/styles/you-draw-it.css +126 -0
  64. package/src/theme/__tests__/dark-mode.test.ts +232 -0
  65. package/src/theme/__tests__/defaults.test.ts +73 -0
  66. package/src/theme/__tests__/resolve.test.ts +277 -0
  67. package/src/theme/dark-mode.ts +258 -0
  68. package/src/theme/defaults.ts +110 -0
  69. package/src/theme/index.ts +8 -0
  70. package/src/theme/presets.ts +64 -0
  71. package/src/theme/resolve.ts +312 -0
  72. package/src/types/__tests__/encoding.test.ts +368 -0
  73. package/src/types/__tests__/gradient.test.ts +95 -0
  74. package/src/types/__tests__/spec.test.ts +499 -0
  75. package/src/types/encoding.ts +280 -0
  76. package/src/types/events.ts +154 -0
  77. package/src/types/index.ts +289 -0
  78. package/src/types/layout.ts +1997 -0
  79. package/src/types/schema-roots.ts +32 -0
  80. package/src/types/spec.ts +2889 -0
  81. package/src/types/table.ts +108 -0
  82. package/src/types/theme.ts +209 -0
package/dist/index.d.ts CHANGED
@@ -31,13 +31,8 @@ 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
- /**
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';
34
+ /** Legend position at a given breakpoint. */
35
+ type LegendPosition = 'top' | 'right' | 'bottom' | 'bottom-right' | 'inline';
41
36
  /** Annotation position strategy. */
42
37
  type AnnotationPosition = 'inline' | 'tooltip-only';
43
38
  /** Axis label density (controls tick count reduction). */
@@ -968,20 +963,6 @@ interface Encoding<TData extends DataRow = DataRow> {
968
963
  * per-panel axes.
969
964
  */
970
965
  facet?: FacetChannel<TData>;
971
- /**
972
- * Row facet channel: partitions data into vertically-stacked panels.
973
- * Each unique value of the row field produces one panel, arranged in a
974
- * single column. Shares the x-axis scale by default; y-axis is independent.
975
- * Mutually exclusive with `facet` and `column`.
976
- */
977
- row?: FacetChannel<TData>;
978
- /**
979
- * Column facet channel: partitions data into side-by-side panels.
980
- * Each unique value of the column field produces one panel, arranged in a
981
- * single row. Shares the y-axis scale by default; x-axis is independent.
982
- * Mutually exclusive with `facet` and `row`.
983
- */
984
- column?: FacetChannel<TData>;
985
966
  }
986
967
  /** Encoding channel for graph nodes and edges. */
987
968
  interface GraphEncodingChannel {
@@ -1037,14 +1018,6 @@ interface ChromeTextStyle {
1037
1018
  fontFamily?: string;
1038
1019
  /** Text color (CSS color string). */
1039
1020
  color?: string;
1040
- /**
1041
- * Maximum number of lines this chrome text may wrap to. Additional lines are
1042
- * dropped and the last kept line is truncated with an ellipsis. Bounds the
1043
- * chrome's contribution to layout height at any container width. Applies
1044
- * whether the font size comes from the theme default or an explicit override.
1045
- * Caps height only, not horizontal overflow of a single unbreakable word.
1046
- */
1047
- maxLines?: number;
1048
1021
  }
1049
1022
  /** A chrome text element with optional style overrides. */
1050
1023
  interface ChromeText {
@@ -1898,20 +1871,6 @@ interface BaseChartSpec<TData extends DataRow = DataRow> {
1898
1871
  transform?: Transform[];
1899
1872
  /** Editorial chrome (title, subtitle, source, etc.). */
1900
1873
  chrome?: Chrome;
1901
- /**
1902
- * How chrome height interacts with the container height budget.
1903
- *
1904
- * - `'subtract'` (default): the container height is fixed and chrome text
1905
- * (title/subtitle/source) is subtracted from it, shrinking the plot. This
1906
- * is the historical behavior.
1907
- * - `'grow'`: the container height is treated as the *plot* budget, and the
1908
- * rendered SVG grows taller by the measured chrome height. The plot keeps
1909
- * its full budget (minus axis/padding overhead) regardless of how many
1910
- * lines the title wraps to.
1911
- *
1912
- * `'grow'` is a no-op for faceted specs in this version.
1913
- */
1914
- chromeLayout?: 'subtract' | 'grow';
1915
1874
  /**
1916
1875
  * Top-level title sugar (Vega-Lite aligned). Expanded into `chrome.title`
1917
1876
  * (and `chrome.subtitle` for the object form). `chrome.title` wins when
@@ -1978,12 +1937,7 @@ interface BaseChartSpec<TData extends DataRow = DataRow> {
1978
1937
  darkMode?: DarkMode;
1979
1938
  /** Whether to show the tryOpenData.ai watermark. Defaults to true. */
1980
1939
  watermark?: boolean;
1981
- /**
1982
- * Series names to hide from rendering by default. This is the authored
1983
- * persistence target for legend visibility. Runtime legend toggles
1984
- * (legend-toggle edit events) layer on top of this via ephemeral runtime
1985
- * sets but never modify it.
1986
- */
1940
+ /** Series names to hide from rendering. Hidden series remain in the legend but are visually dimmed. */
1987
1941
  hiddenSeries?: string[];
1988
1942
  /** Per-series visual overrides, keyed by series name (the color field value). */
1989
1943
  seriesStyles?: Record<string, SeriesStyle>;
@@ -2311,16 +2265,7 @@ interface LayerSpec<TData extends DataRow = DataRow> {
2311
2265
  height?: number;
2312
2266
  /** Accepted for Vega-Lite compatibility and ignored (with a compile warning). */
2313
2267
  $schema?: string;
2314
- /**
2315
- * Annotations for the layered chart. When present, these are the
2316
- * annotations rendered and available for editing. When absent, falls back
2317
- * to the first leaf layer's annotations. Annotations on second and later
2318
- * leaf layers are not rendered.
2319
- *
2320
- * For edit persistence: the `data-annotation-index` stamped on each
2321
- * rendered annotation maps to this array (or the first leaf's if this is
2322
- * unset). Place annotations here for reliable index-based edit matching.
2323
- */
2268
+ /** Annotations on the layered view. */
2324
2269
  annotations?: Annotation[];
2325
2270
  /** Label display configuration. `false` disables all labels, `true` uses defaults. */
2326
2271
  labels?: LabelSpec;
@@ -2336,12 +2281,7 @@ interface LayerSpec<TData extends DataRow = DataRow> {
2336
2281
  watermark?: boolean;
2337
2282
  /** Resolution strategy for shared scales/axes/legends. */
2338
2283
  resolve?: ResolveConfig;
2339
- /**
2340
- * Series names to hide from rendering by default. This is the authored
2341
- * persistence target for legend visibility. Runtime legend toggles
2342
- * (legend-toggle edit events) layer on top of this via ephemeral runtime
2343
- * sets but never modify it.
2344
- */
2284
+ /** Hidden series names. */
2345
2285
  hiddenSeries?: string[];
2346
2286
  /** Endpoint labels column, inherited by child layers that don't set their own. */
2347
2287
  endpointLabels?: boolean | EndpointLabelsConfig;
@@ -2484,21 +2424,9 @@ interface TileMapSpec {
2484
2424
  /** Supported map projections. */
2485
2425
  type MapProjection = 'albersUsa' | 'mercator' | 'equalEarth' | 'identity';
2486
2426
  /** Focus target for map camera: feature id(s) to zoom/pan to. */
2487
- /**
2488
- * Fit the point layer's cluster. `true` fits every point; `{ field, value }`
2489
- * fits only the points whose data row has `row[field] === value` (e.g. only the
2490
- * campuses rated "F"), which lets a story pan between sub-clusters.
2491
- */
2492
- type MapPointsFocus = true | {
2493
- field: string;
2494
- value: string | number;
2495
- };
2496
2427
  type MapFocus = string | number | Array<string | number> | {
2497
2428
  features: string | number | Array<string | number>;
2498
2429
  padding?: number;
2499
- } | {
2500
- points: MapPointsFocus;
2501
- padding?: number;
2502
2430
  };
2503
2431
  /** Geo configuration for map specs. */
2504
2432
  interface MapGeo {
@@ -2508,20 +2436,13 @@ interface MapGeo {
2508
2436
  idField?: string;
2509
2437
  /** Map projection. Defaults to 'albersUsa'. */
2510
2438
  projection?: MapProjection;
2511
- /**
2512
- * Focus the camera. A feature id (or array) fits those features; `{ features, padding }`
2513
- * adds breathing room; `{ points: true, padding }` fits the points layer's cluster
2514
- * instead of any feature (use when points occupy a small part of a large feature, so
2515
- * fitting the feature would leave the cluster small and off-center);
2516
- * `{ points: { field, value }, padding }` fits only the matching point subset, so a
2517
- * story can pan between sub-clusters. null clears focus from a prior story step.
2518
- */
2439
+ /** Focus on specific feature(s). null clears focus from a prior story step. */
2519
2440
  focus?: MapFocus | null;
2520
2441
  }
2521
2442
  /** Encoding channels specific to map visualizations. */
2522
2443
  interface MapEncoding {
2523
- /** Join key field in the data. Required for choropleth; optional in basemap-only mode (points layer with empty data). */
2524
- key?: EncodingChannel;
2444
+ /** Join key field in the data (required). Maps data rows to geo features via geo.idField. */
2445
+ key: EncodingChannel;
2525
2446
  /** Color encoding (quantitative or nominal). Drives fill color of features. Optional when a points layer is present (basemap-only mode). */
2526
2447
  color?: EncodingChannel;
2527
2448
  /** Tooltip encoding (optional). */
@@ -2535,16 +2456,14 @@ interface MapPointsLayer {
2535
2456
  longitude: EncodingChannel;
2536
2457
  /** Field holding latitude (y coordinate). */
2537
2458
  latitude: EncodingChannel;
2538
- /** 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. */
2459
+ /** Optional quantitative size encoding. Area-proportional: r proportional to sqrt(value). */
2539
2460
  size?: EncodingChannel;
2540
2461
  /** Optional color encoding (nominal or quantitative). Independent scale from choropleth. */
2541
2462
  color?: EncodingChannel;
2542
2463
  /** Tooltip channel(s), same shape as MapEncoding.tooltip. */
2543
2464
  tooltip?: EncodingChannel | EncodingChannel[];
2544
- /** Stable id for event callbacks. Data-update transitions for points are not yet supported. */
2465
+ /** Stable id field for transitions and event callbacks. */
2545
2466
  key?: EncodingChannel;
2546
- /** Fill opacity for point circles. Default 0.65. Range 0-1. */
2547
- opacity?: number;
2548
2467
  }
2549
2468
  interface MapSpec {
2550
2469
  /** Discriminant: always "map". */
@@ -3002,36 +2921,26 @@ type ElementRef = {
3002
2921
  type: 'annotation';
3003
2922
  index: number;
3004
2923
  id?: string;
3005
- /** RFC 6901 JSON Pointer to the edited property in the spec. */
3006
- path?: string;
3007
2924
  } | {
3008
2925
  type: 'chrome';
3009
2926
  key: ChromeKey;
3010
- /** RFC 6901 JSON Pointer to the edited property in the spec. */
3011
- path?: string;
3012
2927
  } | {
3013
2928
  type: 'series-label';
3014
2929
  series: string;
3015
- /** RFC 6901 JSON Pointer to the edited property in the spec. */
3016
- path?: string;
3017
2930
  } | {
3018
2931
  type: 'legend';
3019
- /** RFC 6901 JSON Pointer to the edited property in the spec. */
3020
- path?: string;
3021
2932
  } | {
3022
2933
  type: 'legend-entry';
3023
2934
  series: string;
3024
2935
  index: number;
3025
- /** RFC 6901 JSON Pointer to the edited property in the spec. */
3026
- path?: string;
3027
2936
  };
3028
2937
  /** Helper constructors for ergonomic ElementRef creation. */
3029
2938
  declare const elementRef: {
3030
- readonly annotation: (index: number, id?: string, path?: string) => ElementRef;
3031
- readonly chrome: (key: ChromeKey, path?: string) => ElementRef;
3032
- readonly seriesLabel: (series: string, path?: string) => ElementRef;
3033
- readonly legend: (path?: string) => ElementRef;
3034
- readonly legendEntry: (series: string, index: number, path?: string) => ElementRef;
2939
+ readonly annotation: (index: number, id?: string) => ElementRef;
2940
+ readonly chrome: (key: ChromeKey) => ElementRef;
2941
+ readonly seriesLabel: (series: string) => ElementRef;
2942
+ readonly legend: () => ElementRef;
2943
+ readonly legendEntry: (series: string, index: number) => ElementRef;
3035
2944
  };
3036
2945
  /**
3037
2946
  * Discriminated union of all element edit events.
@@ -3046,31 +2955,21 @@ declare const elementRef: {
3046
2955
  */
3047
2956
  type ElementEdit = {
3048
2957
  type: 'annotation';
3049
- element: ElementRef;
3050
2958
  annotation: TextAnnotation;
3051
2959
  offset: AnnotationOffset;
3052
2960
  } | {
3053
2961
  type: 'annotation-connector';
3054
- element: ElementRef;
3055
2962
  annotation: TextAnnotation;
3056
2963
  endpoint: 'from' | 'to';
3057
2964
  offset: AnnotationOffset;
3058
2965
  } | {
3059
2966
  type: 'range-label';
3060
- element: ElementRef;
3061
2967
  annotation: RangeAnnotation;
3062
2968
  labelOffset: AnnotationOffset;
3063
2969
  } | {
3064
2970
  type: 'refline-label';
3065
- element: ElementRef;
3066
2971
  annotation: RefLineAnnotation;
3067
2972
  labelOffset: AnnotationOffset;
3068
- } | {
3069
- type: 'annotation-anchor';
3070
- element: ElementRef;
3071
- annotation: TextAnnotation;
3072
- x: string | number;
3073
- y: string | number;
3074
2973
  } | {
3075
2974
  type: 'chrome';
3076
2975
  key: ChromeKey;
@@ -3083,21 +2982,10 @@ type ElementEdit = {
3083
2982
  } | {
3084
2983
  type: 'legend';
3085
2984
  offset: AnnotationOffset;
3086
- }
3087
- /**
3088
- * Transient legend visibility toggle. Reports the same runtime show/hide
3089
- * a reader triggers; not persisted by openchart. To author default-hidden
3090
- * series, set `spec.hiddenSeries` directly. Hosts building spec
3091
- * persistence should generally not write legend-toggle edits back into
3092
- * the authored spec. `hidden: true` means the series was just hidden.
3093
- */
3094
- | {
2985
+ } | {
3095
2986
  type: 'legend-toggle';
3096
2987
  series: string;
3097
2988
  hidden: boolean;
3098
- } | {
3099
- type: 'add';
3100
- annotation: TextAnnotation;
3101
2989
  } | {
3102
2990
  type: 'delete';
3103
2991
  element: ElementRef;
@@ -3133,14 +3021,6 @@ interface MarkEvent {
3133
3021
  * or ChartProps (React component) to receive interaction callbacks.
3134
3022
  */
3135
3023
  interface ChartEventHandlers {
3136
- /**
3137
- * Explicitly enable or disable edit interactions (drag, select, keyboard
3138
- * delete/edit). When true, the interaction layer is wired even without
3139
- * onEdit. When false, all edit interactions are suppressed even when
3140
- * onEdit is provided. When omitted, each interaction block uses its
3141
- * existing callback-presence gate.
3142
- */
3143
- editable?: boolean;
3144
3024
  /** Called when a data mark is clicked. */
3145
3025
  onMarkClick?: (event: MarkEvent) => void;
3146
3026
  /** Called when the mouse enters a data mark. */
@@ -3237,12 +3117,6 @@ interface ResolvedChromeElement {
3237
3117
  y: number;
3238
3118
  /** Maximum width for line wrapping. */
3239
3119
  maxWidth: number;
3240
- /**
3241
- * Maximum wrapped lines. When set, the renderer caps the wrapped output to
3242
- * this many lines and truncates the last kept line with an ellipsis. The
3243
- * layout height reserved for this element already reflects the cap.
3244
- */
3245
- maxLines?: number;
3246
3120
  /** Computed text style. */
3247
3121
  style: TextStyle;
3248
3122
  }
@@ -3737,11 +3611,6 @@ interface ResolvedLabel {
3737
3611
  to: Point;
3738
3612
  /** Actual data point the connector is calling out. Renderer uses this for the endpoint marker. */
3739
3613
  endpoint?: Point;
3740
- /** Author's from-end nudge, re-applied on every geometry rebuild (mirrors `endpoint` for `to`). */
3741
- fromOffset?: {
3742
- dx: number;
3743
- dy: number;
3744
- };
3745
3614
  /** Connector line color. */
3746
3615
  stroke: string;
3747
3616
  /** Connector style: straight line, curved arrow, or vertical drop-line through the data point. */
@@ -3867,9 +3736,8 @@ interface BaseLegendLayout {
3867
3736
  * read them silently pick whichever comes first.
3868
3737
  */
3869
3738
  channel?: LegendChannel;
3870
- /** Where the legend is positioned relative to the chart area. `'top-left'`
3871
- * is a map-only overlay position (floats inside the map area). */
3872
- position: 'top' | 'top-left' | 'right' | 'bottom' | 'bottom-right' | 'inline';
3739
+ /** Where the legend is positioned relative to the chart area. */
3740
+ position: 'top' | 'right' | 'bottom' | 'bottom-right' | 'inline';
3873
3741
  /** Bounding box for the legend (pixel coordinates). */
3874
3742
  bounds: Rect;
3875
3743
  /** Entry label style. */
@@ -4199,23 +4067,6 @@ interface YouDrawItYInvert {
4199
4067
  /** Data value at the bottom pixel. */
4200
4068
  bottomData: number;
4201
4069
  }
4202
- /**
4203
- * Scale inversion anchors serialized from the engine so the vanilla layer
4204
- * can convert pixel positions to data-space values without holding d3
4205
- * scale objects. Generalizes the YouDrawItYInvert pattern to both axes.
4206
- */
4207
- interface ScaleInvert {
4208
- /** For continuous scales: two reference pixel-to-data anchor points. */
4209
- topPixel: number;
4210
- bottomPixel: number;
4211
- topData: number;
4212
- bottomData: number;
4213
- /** Scale type so the vanilla layer applies the correct inverse transform. */
4214
- scaleType?: 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time';
4215
- /** For band/point scales: ordered domain values and their pixel centers. */
4216
- domain?: (string | number)[];
4217
- positions?: number[];
4218
- }
4219
4070
  /**
4220
4071
  * Resolved geometry and config for the "you draw it" interactive format
4221
4072
  * (`youDrawIt`). The vanilla adapter uses this to render the hatched drawing
@@ -4268,7 +4119,6 @@ interface FacetPanelLayout {
4268
4119
  y: number;
4269
4120
  fontSize: number;
4270
4121
  fontWeight: number;
4271
- textAnchor?: 'start' | 'middle' | 'end';
4272
4122
  };
4273
4123
  }
4274
4124
  /** Layout for a faceted (small-multiples) chart. */
@@ -4281,8 +4131,6 @@ interface FacetLayout {
4281
4131
  columns: number;
4282
4132
  /** Whether scales are shared across panels. */
4283
4133
  sharedScales: boolean;
4284
- /** How panels are arranged: 'row' (vertical stack), 'column' (horizontal), 'wrap' (grid). */
4285
- direction: 'row' | 'column' | 'wrap';
4286
4134
  }
4287
4135
  /**
4288
4136
  * ChartLayout: the complete engine output for chart visualizations.
@@ -4357,10 +4205,6 @@ interface ChartLayout {
4357
4205
  crosshair: boolean;
4358
4206
  /** Real text measurement function from the adapter (for accurate SVG text wrapping). */
4359
4207
  measureText?: MeasureTextFn;
4360
- /** Scale inversion anchors for the x axis. Used by anchor drag to convert pixel to data-space. */
4361
- xInvert?: ScaleInvert;
4362
- /** Scale inversion anchors for the y axis. Used by anchor drag to convert pixel to data-space. */
4363
- yInvert?: ScaleInvert;
4364
4208
  /** Faceted (small-multiples) layout. When present, renderers iterate panels instead of using top-level marks/axes. */
4365
4209
  facet?: FacetLayout;
4366
4210
  }
@@ -4834,9 +4678,7 @@ interface MapPointMark {
4834
4678
  stroke: string;
4835
4679
  /** Stroke width in px. */
4836
4680
  strokeWidth: number;
4837
- /** Fill opacity (0-1). */
4838
- fillOpacity: number;
4839
- /** Stable key for events. */
4681
+ /** Stable key for events and transitions. */
4840
4682
  key: string;
4841
4683
  /** Original data row. */
4842
4684
  data: Record<string, unknown>;
@@ -4997,14 +4839,6 @@ interface CompileOptions {
4997
4839
  width: number;
4998
4840
  /** Total available height in pixels. */
4999
4841
  height: number;
5000
- /**
5001
- * How chrome height interacts with the height budget. Mirrors the spec-level
5002
- * `chromeLayout`; the engine reads whichever is set (spec wins).
5003
- *
5004
- * - `'subtract'` (default): `height` is the fixed total; chrome shrinks the plot.
5005
- * - `'grow'`: `height` is the plot budget; the SVG grows by the chrome height.
5006
- */
5007
- chromeLayout?: 'subtract' | 'grow';
5008
4842
  /** Theme overrides. */
5009
4843
  theme?: ThemeConfig;
5010
4844
  /**
@@ -5582,20 +5416,12 @@ declare function computeXAxisExtentFromLabels(input: XAxisExtentInput): number;
5582
5416
  * changes, the other follows.
5583
5417
  */
5584
5418
  declare function maxRotatedLabelWidth(tickAngle: number, tickFontSize: number): number;
5585
- /**
5586
- * Truncate a label with an ellipsis so it fits inside an explicit pixel budget.
5587
- * Returns the label unchanged when it already fits.
5588
- *
5589
- * Binary-search on character count against the real measure function, so it
5590
- * respects proportional fonts rather than assuming a fixed character width.
5591
- */
5592
- declare function truncateToWidth(label: string, budget: number, fontSize: number, fontWeight: number, measure?: (text: string, fontSize: number, fontWeight?: number) => number): string;
5593
5419
  /**
5594
5420
  * Truncate a rotated tick label with an ellipsis so it fits inside the capped
5595
5421
  * reservation. Returns the label unchanged when it already fits.
5596
5422
  *
5597
- * Delegates to `truncateToWidth` with the budget derived from the rotation
5598
- * geometry, so the binary-search stays in one place.
5423
+ * Binary-search on character count against the real measure function, so it
5424
+ * respects proportional fonts rather than assuming a fixed character width.
5599
5425
  */
5600
5426
  declare function truncateRotatedLabel(label: string, tickAngle: number, tickFontSize: number, tickFontWeight: number, measure?: (text: string, fontSize: number, fontWeight?: number) => number): string;
5601
5427
 
@@ -6031,4 +5857,4 @@ declare const CSS_TOKEN_ROOT_SELECTORS: readonly string[];
6031
5857
  declare const CSS_TOKENS: readonly CssTokenDef[];
6032
5858
  declare function cssTokenDefault(name: string, mode: 'light' | 'dark'): string;
6033
5859
 
6034
- 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 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 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 };
5860
+ 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 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 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 };
package/dist/index.js CHANGED
@@ -187,31 +187,14 @@ var GRAPH_ENCODING_RULES = {
187
187
 
188
188
  // src/types/events.ts
189
189
  var elementRef = {
190
- annotation: (index, id, path) => ({
191
- type: "annotation",
192
- index,
193
- ...id !== void 0 ? { id } : {},
194
- ...path !== void 0 ? { path } : {}
195
- }),
196
- chrome: (key, path) => ({
197
- type: "chrome",
198
- key,
199
- ...path !== void 0 ? { path } : {}
200
- }),
201
- seriesLabel: (series, path) => ({
202
- type: "series-label",
203
- series,
204
- ...path !== void 0 ? { path } : {}
205
- }),
206
- legend: (path) => ({
207
- type: "legend",
208
- ...path !== void 0 ? { path } : {}
209
- }),
210
- legendEntry: (series, index, path) => ({
190
+ annotation: (index, id) => ({ type: "annotation", index, id }),
191
+ chrome: (key) => ({ type: "chrome", key }),
192
+ seriesLabel: (series) => ({ type: "series-label", series }),
193
+ legend: () => ({ type: "legend" }),
194
+ legendEntry: (series, index) => ({
211
195
  type: "legend-entry",
212
196
  series,
213
- index,
214
- ...path !== void 0 ? { path } : {}
197
+ index
215
198
  })
216
199
  };
217
200
 
@@ -1371,16 +1354,17 @@ function maxRotatedLabelWidth(tickAngle, tickFontSize) {
1371
1354
  const usable = X_AXIS_ROTATED_EXTENT_CAP - lineHeight * Math.cos(angleRad) - AXIS_TO_LABEL_GAP;
1372
1355
  return Math.max(0, usable / sin);
1373
1356
  }
1374
- function truncateToWidth(label, budget, fontSize, fontWeight, measure = estimateTextWidth) {
1357
+ function truncateRotatedLabel(label, tickAngle, tickFontSize, tickFontWeight, measure = estimateTextWidth) {
1358
+ const budget = maxRotatedLabelWidth(tickAngle, tickFontSize);
1375
1359
  if (!Number.isFinite(budget)) return label;
1376
- if (measure(label, fontSize, fontWeight) <= budget) return label;
1360
+ if (measure(label, tickFontSize, tickFontWeight) <= budget) return label;
1377
1361
  const ELLIPSIS = "\u2026";
1378
1362
  let lo = 0;
1379
1363
  let hi = label.length;
1380
1364
  while (lo < hi) {
1381
1365
  const mid = Math.ceil((lo + hi) / 2);
1382
1366
  const candidate = label.slice(0, mid) + ELLIPSIS;
1383
- if (measure(candidate, fontSize, fontWeight) <= budget) {
1367
+ if (measure(candidate, tickFontSize, tickFontWeight) <= budget) {
1384
1368
  lo = mid;
1385
1369
  } else {
1386
1370
  hi = mid - 1;
@@ -1388,10 +1372,6 @@ function truncateToWidth(label, budget, fontSize, fontWeight, measure = estimate
1388
1372
  }
1389
1373
  return lo > 0 ? label.slice(0, lo).trimEnd() + ELLIPSIS : ELLIPSIS;
1390
1374
  }
1391
- function truncateRotatedLabel(label, tickAngle, tickFontSize, tickFontWeight, measure = estimateTextWidth) {
1392
- const budget = maxRotatedLabelWidth(tickAngle, tickFontSize);
1393
- return truncateToWidth(label, budget, tickFontSize, tickFontWeight, measure);
1394
- }
1395
1375
 
1396
1376
  // src/theme/defaults.ts
1397
1377
  var DEFAULT_THEME = {
@@ -1887,14 +1867,13 @@ function buildTextStyle(defaults, fontFamily, textColor, width, overrides) {
1887
1867
  textAnchor: "start"
1888
1868
  };
1889
1869
  }
1890
- function estimateLineCount(text, style, maxWidth, measureText, maxLines) {
1870
+ function estimateLineCount(text, style, maxWidth, measureText) {
1891
1871
  if (maxWidth <= 0) return 1;
1892
1872
  const segments = text.split("\n");
1893
1873
  if (segments.length > 1) {
1894
- const count = segments.reduce((total, segment) => {
1874
+ return segments.reduce((total, segment) => {
1895
1875
  return total + (segment.length === 0 ? 1 : estimateLineCount(segment, style, maxWidth, measureText));
1896
1876
  }, 0);
1897
- return maxLines != null ? Math.min(count, maxLines) : count;
1898
1877
  }
1899
1878
  if (measureText) {
1900
1879
  const textWidth = measureText(text, style.fontSize, style.fontWeight).width;
@@ -1912,7 +1891,7 @@ function estimateLineCount(text, style, maxWidth, measureText, maxLines) {
1912
1891
  current2 = candidate;
1913
1892
  }
1914
1893
  }
1915
- return maxLines != null ? Math.min(lines2, maxLines) : lines2;
1894
+ return lines2;
1916
1895
  }
1917
1896
  const charWidth = estimateCharWidth(style.fontSize, style.fontWeight);
1918
1897
  const maxChars = Math.floor(maxWidth / charWidth);
@@ -1929,7 +1908,7 @@ function estimateLineCount(text, style, maxWidth, measureText, maxLines) {
1929
1908
  current = candidate;
1930
1909
  }
1931
1910
  }
1932
- return maxLines != null ? Math.min(lines, maxLines) : lines;
1911
+ return lines;
1933
1912
  }
1934
1913
  var FOOTNOTE_LINE_HEIGHT = 1.3;
1935
1914
  var FOOTNOTE_BAND_GAP = 4;
@@ -1957,14 +1936,12 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
1957
1936
  width,
1958
1937
  eyebrowNorm.style
1959
1938
  );
1960
- const maxLines = eyebrowNorm.style?.maxLines;
1961
- const lineCount = estimateLineCount(eyebrowNorm.text, style, maxWidth, measureText, maxLines);
1939
+ const lineCount = estimateLineCount(eyebrowNorm.text, style, maxWidth, measureText);
1962
1940
  const element = {
1963
1941
  text: eyebrowNorm.text,
1964
1942
  x: pad2 + (eyebrowNorm.offset?.dx ?? 0),
1965
1943
  y: topY + (eyebrowNorm.offset?.dy ?? 0),
1966
1944
  maxWidth,
1967
- ...maxLines != null ? { maxLines } : {},
1968
1945
  style
1969
1946
  };
1970
1947
  topElements.eyebrow = element;
@@ -1979,14 +1956,12 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
1979
1956
  width,
1980
1957
  titleNorm.style
1981
1958
  );
1982
- const maxLines = titleNorm.style?.maxLines;
1983
- const lineCount = estimateLineCount(titleNorm.text, style, maxWidth, measureText, maxLines);
1959
+ const lineCount = estimateLineCount(titleNorm.text, style, maxWidth, measureText);
1984
1960
  const element = {
1985
1961
  text: titleNorm.text,
1986
1962
  x: pad2 + (titleNorm.offset?.dx ?? 0),
1987
1963
  y: topY + (titleNorm.offset?.dy ?? 0),
1988
1964
  maxWidth,
1989
- ...maxLines != null ? { maxLines } : {},
1990
1965
  style
1991
1966
  };
1992
1967
  topElements.title = element;
@@ -2001,14 +1976,12 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
2001
1976
  width,
2002
1977
  subtitleNorm.style
2003
1978
  );
2004
- const maxLines = subtitleNorm.style?.maxLines;
2005
- const lineCount = estimateLineCount(subtitleNorm.text, style, maxWidth, measureText, maxLines);
1979
+ const lineCount = estimateLineCount(subtitleNorm.text, style, maxWidth, measureText);
2006
1980
  const element = {
2007
1981
  text: subtitleNorm.text,
2008
1982
  x: pad2 + (subtitleNorm.offset?.dx ?? 0),
2009
1983
  y: topY + (subtitleNorm.offset?.dy ?? 0),
2010
1984
  maxWidth,
2011
- ...maxLines != null ? { maxLines } : {},
2012
1985
  style
2013
1986
  };
2014
1987
  topElements.subtitle = element;
@@ -2073,14 +2046,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
2073
2046
  width,
2074
2047
  item.norm.style
2075
2048
  );
2076
- const maxLines = item.norm.style?.maxLines;
2077
- const lineCount = estimateLineCount(
2078
- item.norm.text,
2079
- style,
2080
- bottomMaxWidth,
2081
- measureText,
2082
- maxLines
2083
- );
2049
+ const lineCount = estimateLineCount(item.norm.text, style, bottomMaxWidth, measureText);
2084
2050
  const height = estimateTextHeight(style.fontSize, lineCount, style.lineHeight);
2085
2051
  bottomElements[item.key] = {
2086
2052
  text: item.norm.text,
@@ -2088,7 +2054,6 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
2088
2054
  y: bottomHeight + (item.norm.offset?.dy ?? 0),
2089
2055
  // offset from where bottom chrome starts
2090
2056
  maxWidth: bottomMaxWidth,
2091
- ...maxLines != null ? { maxLines } : {},
2092
2057
  style
2093
2058
  };
2094
2059
  bottomHeight += height + chromeGap;
@@ -4147,7 +4112,6 @@ export {
4147
4112
  textAscent,
4148
4113
  tileMap,
4149
4114
  truncateRotatedLabel,
4150
- truncateToWidth,
4151
4115
  wire,
4152
4116
  wrapText
4153
4117
  };