@carto/api-client 0.5.15-alpha.raster-3 → 0.5.15-alpha.raster-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/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "homepage": "https://github.com/CartoDB/carto-api-client#readme",
9
9
  "author": "Don McCurdy <donmccurdy@carto.com>",
10
10
  "packageManager": "yarn@4.3.1",
11
- "version": "0.5.15-alpha.raster-3",
11
+ "version": "0.5.15-alpha.raster-5",
12
12
  "license": "MIT",
13
13
  "publishConfig": {
14
14
  "access": "public"
@@ -112,7 +112,7 @@
112
112
  "@vitest/coverage-istanbul": "^3.0.9",
113
113
  "@webcomponents/webcomponentsjs": "^2.8.0",
114
114
  "concurrently": "^9.1.2",
115
- "echarts": "^5.6.0",
115
+ "echarts": "^6.0.0",
116
116
  "eslint": "^9.22.0",
117
117
  "lit": "^3.2.1",
118
118
  "lit-analyzer": "^2.0.3",
@@ -124,7 +124,7 @@
124
124
  "thenby": "^1.3.4",
125
125
  "tinybench": "^4.0.1",
126
126
  "tsup": "^8.3.6",
127
- "typescript": "~5.8.2",
127
+ "typescript": "~5.9.2",
128
128
  "typescript-eslint": "^8.26.1",
129
129
  "vite": "^7.0.0",
130
130
  "vitest": "3.2.4"
@@ -344,26 +344,27 @@ export function getColorAccessor(
344
344
  } {
345
345
  const {scale, domain} = calculateLayerScale(
346
346
  colorColumn || name,
347
- scaleType,
347
+ colorColumn ? 'identity' : scaleType,
348
348
  range,
349
349
  data
350
350
  );
351
351
  const alpha = opacityToAlpha(opacity);
352
352
 
353
- let accessorKeys = getAccessorKeys(name, aggregation);
353
+ let accessorKeys = getAccessorKeys(colorColumn || name, aggregation);
354
354
  const accessor = (properties: any) => {
355
355
  if (!(accessorKeys[0] in properties)) {
356
356
  accessorKeys = findAccessorKey(accessorKeys, properties);
357
357
  }
358
358
  const propertyValue = properties[accessorKeys[0]];
359
- const [r, g, b] = scale(propertyValue);
360
- return [r, g, b, propertyValue === null ? 0 : alpha];
359
+ const scaled = scale(propertyValue);
360
+ const rgb = typeof scaled === 'string' ? hexToRGB(scaled) : scaled;
361
+ return [...rgb, propertyValue === null ? 0 : alpha];
361
362
  };
362
363
  return {
363
364
  accessor: normalizeAccessor(accessor, data),
364
365
  scaleDomain: scale.domain(),
365
366
  domain,
366
- range: scale.range().map(rgbToHex),
367
+ range: (scale.range() || []).map(rgbToHex),
367
368
  };
368
369
  }
369
370
 
@@ -379,9 +380,9 @@ export function calculateLayerScale(
379
380
  const {colors} = range;
380
381
 
381
382
  if (scaleType === 'custom') {
383
+ domain = calculateDomain(data, name, scaleType, colors.length);
384
+ const [min, max] = domain as number[];
382
385
  if (range.uiCustomScaleType === 'logarithmic') {
383
- domain = calculateDomain(data, name, scaleType, colors.length);
384
- const [min, max] = domain as number[];
385
386
  scaleDomain = getLog10ScaleSteps({
386
387
  min,
387
388
  max,
@@ -391,8 +392,9 @@ export function calculateLayerScale(
391
392
  scaleColor = colors;
392
393
  } else if (range.colorMap) {
393
394
  const {colorMap} = range;
395
+ scaleDomain = [];
394
396
  colorMap.forEach(([value, color]) => {
395
- (domain as string[]).push(value);
397
+ (scaleDomain as number[]).push(Number(value));
396
398
  scaleColor.push(color);
397
399
  });
398
400
  }