@opendata-ai/openchart-engine 7.6.1 → 7.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/index.d.ts +13 -0
  2. package/dist/index.js +1037 -187
  3. package/dist/index.js.map +1 -1
  4. package/package.json +2 -2
  5. package/src/__test-fixtures__/specs.ts +6 -0
  6. package/src/__tests__/__snapshots__/compile-snapshot.test.ts.snap +16 -0
  7. package/src/__tests__/axes.test.ts +3 -2
  8. package/src/__tests__/facet.test.ts +215 -0
  9. package/src/annotations/__tests__/compute.test.ts +18 -0
  10. package/src/annotations/__tests__/thinning.test.ts +137 -0
  11. package/src/annotations/compute.ts +3 -1
  12. package/src/annotations/thinning.ts +116 -0
  13. package/src/barlist/compile-barlist.ts +1 -0
  14. package/src/charts/bar/labels.ts +1 -0
  15. package/src/charts/column/labels.ts +1 -0
  16. package/src/charts/dot/labels.ts +1 -0
  17. package/src/charts/line/area.ts +16 -2
  18. package/src/charts/line/compute.ts +17 -10
  19. package/src/charts/pie/labels.ts +1 -0
  20. package/src/compile/__tests__/color-scale-range.test.ts +80 -1
  21. package/src/compile/color-scale-range.ts +44 -2
  22. package/src/compile.ts +314 -5
  23. package/src/compiler/__tests__/normalize-highlight.test.ts +103 -0
  24. package/src/compiler/__tests__/validate-highlight.test.ts +112 -0
  25. package/src/compiler/normalize.ts +67 -2
  26. package/src/compiler/types.ts +10 -0
  27. package/src/compiler/validate.ts +79 -0
  28. package/src/endpoint-labels/__tests__/compute.test.ts +57 -0
  29. package/src/endpoint-labels/compute.ts +179 -5
  30. package/src/endpoint-labels/predict.ts +17 -0
  31. package/src/layout/__tests__/scales-highlight.test.ts +192 -0
  32. package/src/layout/axes.ts +8 -2
  33. package/src/layout/dimensions.ts +6 -1
  34. package/src/layout/facet.ts +80 -0
  35. package/src/layout/plan.ts +16 -0
  36. package/src/legend/__tests__/redundancy.test.ts +108 -0
  37. package/src/legend/__tests__/suppression.test.ts +72 -0
  38. package/src/legend/compute.ts +18 -0
  39. package/src/legend/suppression.ts +27 -6
  40. package/src/tilemap/__tests__/compile-tilemap.test.ts +210 -0
  41. package/src/tilemap/compile-tilemap.ts +379 -117
  42. package/src/tilemap/types.ts +1 -0
package/dist/index.d.ts CHANGED
@@ -236,6 +236,7 @@ interface NormalizedTileMapSpec {
236
236
  data: Record<string, unknown>[];
237
237
  encoding: TileMapEncoding;
238
238
  palette: TileMapPalette;
239
+ colors?: Record<string, string>;
239
240
  chrome: NormalizedChrome;
240
241
  legend?: LegendConfig;
241
242
  theme: ThemeConfig;
@@ -304,6 +305,8 @@ interface NormalizedChartSpec {
304
305
  /** Right-side endpoint labels column config (multi-series line/area only). */
305
306
  endpointLabels?: boolean | _opendata_ai_openchart_core.EndpointLabelsConfig;
306
307
  responsive: boolean;
308
+ /** Whether auto-thinning of annotations at narrow widths is enabled. Resolved from `responsive.autoThin`. */
309
+ autoThin: boolean;
307
310
  theme: ThemeConfig;
308
311
  darkMode: DarkMode;
309
312
  /** Whether the tryOpenData.ai watermark is enabled. */
@@ -314,12 +317,20 @@ interface NormalizedChartSpec {
314
317
  seriesStyles: Record<string, _opendata_ai_openchart_core.SeriesStyle>;
315
318
  /** Display mode controlling chrome/axes/legend stripping. Defaults to `'full'`. */
316
319
  display: Display;
320
+ /** Resolve configuration for independent/shared scales in faceted charts. */
321
+ resolve?: _opendata_ai_openchart_core.ResolveConfig;
317
322
  /**
318
323
  * Which top-level fields the user explicitly set. Populated by compileChart
319
324
  * from the raw expanded spec before normalization. NormalizeChartSpec runs
320
325
  * with a default-empty descriptor; compileChart overwrites it post-normalize.
321
326
  */
322
327
  userExplicit: UserExplicit;
328
+ /**
329
+ * Series values to visually emphasize. Non-highlighted series are muted to
330
+ * a neutral gray. Normalized from `encoding.color.highlight` (always an
331
+ * array; empty when no highlight is active).
332
+ */
333
+ highlight: string[];
323
334
  }
324
335
  /** A TableSpec with all optional fields filled with sensible defaults. */
325
336
  interface NormalizedTableSpec {
@@ -496,6 +507,8 @@ interface AnnotationContext {
496
507
  };
497
508
  measure: AnnotationMeasureTextFn;
498
509
  debugPlacement?: boolean;
510
+ /** When true, annotations that overlap are demoted to footnote markers instead of being hidden. */
511
+ autoThin?: boolean;
499
512
  }
500
513
 
501
514
  /**