@opendata-ai/openchart-engine 6.28.4 → 6.28.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -11280,15 +11280,6 @@ function formatValueForSearch(value2, column) {
11280
11280
 
11281
11281
  // src/tables/heatmap.ts
11282
11282
  import { adaptColorForDarkMode as adaptColorForDarkMode2 } from "@opendata-ai/openchart-core";
11283
- function relativeLuminance(hex2) {
11284
- const m = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hex2);
11285
- if (!m) return 0;
11286
- const [r, g, b] = [m[1], m[2], m[3]].map((c) => {
11287
- const v = Number.parseInt(c, 16) / 255;
11288
- return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
11289
- });
11290
- return 0.2126 * r + 0.7152 * g + 0.0722 * b;
11291
- }
11292
11283
  function interpolatorFromStops(stops) {
11293
11284
  if (stops.length === 0) return () => "#ffffff";
11294
11285
  if (stops.length === 1) return () => stops[0];
@@ -11341,19 +11332,7 @@ function computeHeatmapColors(data, column, theme, darkMode) {
11341
11332
  if (darkMode) {
11342
11333
  const lightBg = "#ffffff";
11343
11334
  const darkBg = theme.colors.background;
11344
- const originalStops = stops;
11345
11335
  stops = stops.map((c) => adaptColorForDarkMode2(c, lightBg, darkBg));
11346
- if (originalStops.length >= 2) {
11347
- const origDirection = Math.sign(
11348
- relativeLuminance(originalStops[originalStops.length - 1]) - relativeLuminance(originalStops[0])
11349
- );
11350
- const adaptedDirection = Math.sign(
11351
- relativeLuminance(stops[stops.length - 1]) - relativeLuminance(stops[0])
11352
- );
11353
- if (origDirection !== 0 && adaptedDirection !== 0 && origDirection !== adaptedDirection) {
11354
- stops = stops.slice().reverse();
11355
- }
11356
- }
11357
11336
  }
11358
11337
  const interpolator = interpolatorFromStops(stops);
11359
11338
  const scale = sequential(interpolator).domain(domain).clamp(true);