@carto/api-client 0.5.5-alpha.0 → 0.5.6-alpha.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.
@@ -3169,9 +3169,9 @@ function compare(x, y) {
3169
3169
  for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;
3170
3170
  return k == l ? 0 : k > l ^ a ? 1 : -1;
3171
3171
  }
3172
- function intCheck(n, min3, max3, name) {
3173
- if (n < min3 || n > max3 || n !== mathfloor(n)) {
3174
- throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min3 || n > max3 ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
3172
+ function intCheck(n, min2, max2, name) {
3173
+ if (n < min2 || n > max2 || n !== mathfloor(n)) {
3174
+ throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min2 || n > max2 ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
3175
3175
  }
3176
3176
  }
3177
3177
  function isOdd(n) {
@@ -6263,7 +6263,10 @@ var WidgetRemoteSource = class extends WidgetSource {
6263
6263
  spatialFiltersMode,
6264
6264
  ...params
6265
6265
  } = options;
6266
- const { column, operation: operation2, operationColumn } = params;
6266
+ const { column, operation: operation2, operationColumn, operationExp } = params;
6267
+ if (operation2 === "custom") {
6268
+ assert2(operationExp, "operationExp is required for custom operation");
6269
+ }
6267
6270
  return executeModel({
6268
6271
  model: "category",
6269
6272
  source: {
@@ -6274,6 +6277,7 @@ var WidgetRemoteSource = class extends WidgetSource {
6274
6277
  params: {
6275
6278
  column,
6276
6279
  operation: operation2,
6280
+ operationExp,
6277
6281
  operationColumn: operationColumn || column
6278
6282
  },
6279
6283
  opts: { signal, headers: this.props.headers }
@@ -6319,6 +6323,9 @@ var WidgetRemoteSource = class extends WidgetSource {
6319
6323
  ...params
6320
6324
  } = options;
6321
6325
  const { column, operation: operation2 } = params;
6326
+ if (operation2 === "custom") {
6327
+ assert2(operationExp, "operationExp is required for custom operation");
6328
+ }
6322
6329
  return executeModel({
6323
6330
  model: "formula",
6324
6331
  source: {
@@ -6457,12 +6464,16 @@ var WidgetRemoteSource = class extends WidgetSource {
6457
6464
  operationColumn,
6458
6465
  joinOperation,
6459
6466
  operation: operation2,
6467
+ operationExp,
6460
6468
  stepSize,
6461
6469
  stepMultiplier,
6462
6470
  splitByCategory,
6463
6471
  splitByCategoryLimit,
6464
6472
  splitByCategoryValues
6465
6473
  } = params;
6474
+ if (operation2 === "custom") {
6475
+ assert2(operationExp, "operationExp is required for custom operation");
6476
+ }
6466
6477
  return executeModel({
6467
6478
  model: "timeseries",
6468
6479
  source: {
@@ -6477,6 +6488,7 @@ var WidgetRemoteSource = class extends WidgetSource {
6477
6488
  operationColumn: operationColumn || column,
6478
6489
  joinOperation,
6479
6490
  operation: operation2,
6491
+ operationExp,
6480
6492
  splitByCategory,
6481
6493
  splitByCategoryLimit,
6482
6494
  splitByCategoryValues
@@ -6563,11 +6575,11 @@ function min(values, keys, joinOperation) {
6563
6575
  Infinity
6564
6576
  );
6565
6577
  }
6566
- let min3 = Number.POSITIVE_INFINITY;
6578
+ let min2 = Number.POSITIVE_INFINITY;
6567
6579
  for (const value of values) {
6568
- min3 = Math.min(min3, value);
6580
+ min2 = Math.min(min2, value);
6569
6581
  }
6570
- return min3;
6582
+ return min2;
6571
6583
  }
6572
6584
  function max(values, keys, joinOperation) {
6573
6585
  const normalizedKeys = normalizeKeys(keys);
@@ -6577,11 +6589,11 @@ function max(values, keys, joinOperation) {
6577
6589
  -Infinity
6578
6590
  );
6579
6591
  }
6580
- let max3 = Number.NEGATIVE_INFINITY;
6592
+ let max2 = Number.NEGATIVE_INFINITY;
6581
6593
  for (const value of values) {
6582
- max3 = Math.max(max3, value);
6594
+ max2 = Math.max(max2, value);
6583
6595
  }
6584
- return max3;
6596
+ return max2;
6585
6597
  }
6586
6598
  function normalizeKeys(keys) {
6587
6599
  return Array.isArray(keys) ? keys : typeof keys === "string" ? [keys] : void 0;
@@ -7362,6 +7374,10 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
7362
7374
  return { rows: [] };
7363
7375
  }
7364
7376
  assertColumn(this._features, column, operationColumn);
7377
+ assert2(
7378
+ operation2 !== "custom",
7379
+ "Custom operation not supported for tilesets"
7380
+ );
7365
7381
  const rows = groupValuesByDateColumn({
7366
7382
  data: filteredFeatures,
7367
7383
  valuesColumns: normalizeColumns(operationColumn || column),
@@ -8108,69 +8124,18 @@ function ascending(a, b) {
8108
8124
  return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
8109
8125
  }
8110
8126
 
8111
- // node_modules/d3-array/src/number.js
8112
- function* numbers(values, valueof) {
8113
- if (valueof === void 0) {
8114
- for (let value of values) {
8115
- if (value != null && (value = +value) >= value) {
8116
- yield value;
8117
- }
8118
- }
8119
- } else {
8120
- let index = -1;
8121
- for (let value of values) {
8122
- if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
8123
- yield value;
8124
- }
8125
- }
8126
- }
8127
- }
8128
-
8129
- // node_modules/d3-array/src/variance.js
8130
- function variance(values, valueof) {
8131
- let count = 0;
8132
- let delta;
8133
- let mean = 0;
8134
- let sum3 = 0;
8135
- if (valueof === void 0) {
8136
- for (let value of values) {
8137
- if (value != null && (value = +value) >= value) {
8138
- delta = value - mean;
8139
- mean += delta / ++count;
8140
- sum3 += delta * (value - mean);
8141
- }
8142
- }
8143
- } else {
8144
- let index = -1;
8145
- for (let value of values) {
8146
- if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
8147
- delta = value - mean;
8148
- mean += delta / ++count;
8149
- sum3 += delta * (value - mean);
8150
- }
8151
- }
8152
- }
8153
- if (count > 1) return sum3 / (count - 1);
8154
- }
8155
-
8156
- // node_modules/d3-array/src/deviation.js
8157
- function deviation(values, valueof) {
8158
- const v2 = variance(values, valueof);
8159
- return v2 ? Math.sqrt(v2) : v2;
8160
- }
8161
-
8162
8127
  // node_modules/d3-array/src/extent.js
8163
8128
  function extent(values, valueof) {
8164
- let min3;
8165
- let max3;
8129
+ let min2;
8130
+ let max2;
8166
8131
  if (valueof === void 0) {
8167
8132
  for (const value of values) {
8168
8133
  if (value != null) {
8169
- if (min3 === void 0) {
8170
- if (value >= value) min3 = max3 = value;
8134
+ if (min2 === void 0) {
8135
+ if (value >= value) min2 = max2 = value;
8171
8136
  } else {
8172
- if (min3 > value) min3 = value;
8173
- if (max3 < value) max3 = value;
8137
+ if (min2 > value) min2 = value;
8138
+ if (max2 < value) max2 = value;
8174
8139
  }
8175
8140
  }
8176
8141
  }
@@ -8178,16 +8143,16 @@ function extent(values, valueof) {
8178
8143
  let index = -1;
8179
8144
  for (let value of values) {
8180
8145
  if ((value = valueof(value, ++index, values)) != null) {
8181
- if (min3 === void 0) {
8182
- if (value >= value) min3 = max3 = value;
8146
+ if (min2 === void 0) {
8147
+ if (value >= value) min2 = max2 = value;
8183
8148
  } else {
8184
- if (min3 > value) min3 = value;
8185
- if (max3 < value) max3 = value;
8149
+ if (min2 > value) min2 = value;
8150
+ if (max2 < value) max2 = value;
8186
8151
  }
8187
8152
  }
8188
8153
  }
8189
8154
  }
8190
- return [min3, max3];
8155
+ return [min2, max2];
8191
8156
  }
8192
8157
 
8193
8158
  // node_modules/internmap/src/index.js
@@ -8309,102 +8274,6 @@ function groupSort(values, reduce, key) {
8309
8274
  return (reduce.length !== 2 ? sort(rollup(values, reduce, key), ([ak, av], [bk, bv]) => ascending(av, bv) || ascending(ak, bk)) : sort(group(values, key), ([ak, av], [bk, bv]) => reduce(av, bv) || ascending(ak, bk))).map(([key2]) => key2);
8310
8275
  }
8311
8276
 
8312
- // node_modules/d3-array/src/max.js
8313
- function max2(values, valueof) {
8314
- let max3;
8315
- if (valueof === void 0) {
8316
- for (const value of values) {
8317
- if (value != null && (max3 < value || max3 === void 0 && value >= value)) {
8318
- max3 = value;
8319
- }
8320
- }
8321
- } else {
8322
- let index = -1;
8323
- for (let value of values) {
8324
- if ((value = valueof(value, ++index, values)) != null && (max3 < value || max3 === void 0 && value >= value)) {
8325
- max3 = value;
8326
- }
8327
- }
8328
- }
8329
- return max3;
8330
- }
8331
-
8332
- // node_modules/d3-array/src/min.js
8333
- function min2(values, valueof) {
8334
- let min3;
8335
- if (valueof === void 0) {
8336
- for (const value of values) {
8337
- if (value != null && (min3 > value || min3 === void 0 && value >= value)) {
8338
- min3 = value;
8339
- }
8340
- }
8341
- } else {
8342
- let index = -1;
8343
- for (let value of values) {
8344
- if ((value = valueof(value, ++index, values)) != null && (min3 > value || min3 === void 0 && value >= value)) {
8345
- min3 = value;
8346
- }
8347
- }
8348
- }
8349
- return min3;
8350
- }
8351
-
8352
- // node_modules/d3-array/src/quickselect.js
8353
- function quickselect(array, k, left = 0, right = Infinity, compare2) {
8354
- k = Math.floor(k);
8355
- left = Math.floor(Math.max(0, left));
8356
- right = Math.floor(Math.min(array.length - 1, right));
8357
- if (!(left <= k && k <= right)) return array;
8358
- compare2 = compare2 === void 0 ? ascendingDefined : compareDefined(compare2);
8359
- while (right > left) {
8360
- if (right - left > 600) {
8361
- const n = right - left + 1;
8362
- const m = k - left + 1;
8363
- const z = Math.log(n);
8364
- const s = 0.5 * Math.exp(2 * z / 3);
8365
- const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
8366
- const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
8367
- const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
8368
- quickselect(array, k, newLeft, newRight, compare2);
8369
- }
8370
- const t = array[k];
8371
- let i = left;
8372
- let j = right;
8373
- swap(array, left, k);
8374
- if (compare2(array[right], t) > 0) swap(array, left, right);
8375
- while (i < j) {
8376
- swap(array, i, j), ++i, --j;
8377
- while (compare2(array[i], t) < 0) ++i;
8378
- while (compare2(array[j], t) > 0) --j;
8379
- }
8380
- if (compare2(array[left], t) === 0) swap(array, left, j);
8381
- else ++j, swap(array, j, right);
8382
- if (j <= k) left = j + 1;
8383
- if (k <= j) right = j - 1;
8384
- }
8385
- return array;
8386
- }
8387
- function swap(array, i, j) {
8388
- const t = array[i];
8389
- array[i] = array[j];
8390
- array[j] = t;
8391
- }
8392
-
8393
- // node_modules/d3-array/src/quantile.js
8394
- function quantile(values, p, valueof) {
8395
- values = Float64Array.from(numbers(values, valueof));
8396
- if (!(n = values.length) || isNaN(p = +p)) return;
8397
- if (p <= 0 || n < 2) return min2(values);
8398
- if (p >= 1) return max2(values);
8399
- var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max2(quickselect(values, i0).subarray(0, i0 + 1)), value1 = min2(values.subarray(i0 + 1));
8400
- return value0 + (value1 - value0) * (i - i0);
8401
- }
8402
-
8403
- // node_modules/d3-array/src/median.js
8404
- function median(values, valueof) {
8405
- return quantile(values, 0.5, valueof);
8406
- }
8407
-
8408
8277
  // node_modules/d3-color/src/define.js
8409
8278
  function define_default(constructor, factory, prototype) {
8410
8279
  constructor.prototype = factory.prototype = prototype;
@@ -8692,12 +8561,12 @@ function hslConvert(o) {
8692
8561
  if (!o) return new Hsl();
8693
8562
  if (o instanceof Hsl) return o;
8694
8563
  o = o.rgb();
8695
- var r = o.r / 255, g = o.g / 255, b = o.b / 255, min3 = Math.min(r, g, b), max3 = Math.max(r, g, b), h = NaN, s = max3 - min3, l = (max3 + min3) / 2;
8564
+ var r = o.r / 255, g = o.g / 255, b = o.b / 255, min2 = Math.min(r, g, b), max2 = Math.max(r, g, b), h = NaN, s = max2 - min2, l = (max2 + min2) / 2;
8696
8565
  if (s) {
8697
- if (r === max3) h = (g - b) / s + (g < b) * 6;
8698
- else if (g === max3) h = (b - r) / s + 2;
8566
+ if (r === max2) h = (g - b) / s + (g < b) * 6;
8567
+ else if (g === max2) h = (b - r) / s + 2;
8699
8568
  else h = (r - g) / s + 4;
8700
- s /= l < 0.5 ? max3 + min3 : 2 - max3 - min3;
8569
+ s /= l < 0.5 ? max2 + min2 : 2 - max2 - min2;
8701
8570
  h *= 60;
8702
8571
  } else {
8703
8572
  s = l > 0 && l < 1 ? 0 : h;
@@ -8845,25 +8714,11 @@ function identity2(v2) {
8845
8714
  return v2;
8846
8715
  }
8847
8716
  var UNKNOWN_COLOR = "#868d91";
8848
- var AGGREGATION = {
8849
- average: "MEAN",
8850
- maximum: "MAX",
8851
- minimum: "MIN",
8852
- sum: "SUM"
8853
- };
8854
8717
  var OPACITY_MAP = {
8855
8718
  getFillColor: "opacity",
8856
8719
  getLineColor: "strokeOpacity",
8857
8720
  getTextColor: "opacity"
8858
8721
  };
8859
- var AGGREGATION_FUNC = {
8860
- "count unique": (values, accessor) => groupSort(values, (v2) => v2.length, accessor).length,
8861
- median,
8862
- // Unfortunately mode() is only available in d3-array@3+ which is ESM only
8863
- mode: (values, accessor) => groupSort(values, (v2) => v2.length, accessor).pop(),
8864
- stddev: deviation,
8865
- variance
8866
- };
8867
8722
  var hexToRGBA = (c) => {
8868
8723
  const { r, g, b, opacity } = rgb(c);
8869
8724
  return [r, g, b, 255 * opacity];
@@ -8959,11 +8814,11 @@ function domainFromAttribute(attribute, scaleType, scaleLength) {
8959
8814
  if (scaleType === "quantile" && attribute.quantiles) {
8960
8815
  return attribute.quantiles.global ? attribute.quantiles.global[scaleLength] : attribute.quantiles[scaleLength];
8961
8816
  }
8962
- let { min: min3 } = attribute;
8963
- if (scaleType === "log" && min3 === 0) {
8964
- min3 = 1e-5;
8817
+ let { min: min2 } = attribute;
8818
+ if (scaleType === "log" && min2 === 0) {
8819
+ min2 = 1e-5;
8965
8820
  }
8966
- return [min3, attribute.max];
8821
+ return [min2, attribute.max];
8967
8822
  }
8968
8823
  function domainFromValues(values, scaleType) {
8969
8824
  if (scaleType === "ordinal" || scaleType === "point") {
@@ -9021,11 +8876,6 @@ function findAccessorKey(keys, properties) {
9021
8876
  }
9022
8877
  return keys;
9023
8878
  }
9024
- function getColorValueAccessor({ name }, colorAggregation, data) {
9025
- const aggregator = AGGREGATION_FUNC[colorAggregation];
9026
- const accessor = (values) => aggregator(values, (p) => p[name]);
9027
- return normalizeAccessor(accessor, data);
9028
- }
9029
8879
  function getColorAccessor({ name, colorColumn }, scaleType, { aggregation, range }, opacity, data) {
9030
8880
  const scale2 = calculateLayerScale(
9031
8881
  colorColumn || name,
@@ -9043,7 +8893,7 @@ function getColorAccessor({ name, colorColumn }, scaleType, { aggregation, range
9043
8893
  const { r, g, b } = rgb(scale2(propertyValue));
9044
8894
  return [r, g, b, propertyValue === null ? 0 : alpha];
9045
8895
  };
9046
- return normalizeAccessor(accessor, data);
8896
+ return { accessor: normalizeAccessor(accessor, data), scale: scale2 };
9047
8897
  }
9048
8898
  function calculateLayerScale(name, scaleType, range, data) {
9049
8899
  const scale2 = SCALE_FUNCS[scaleType]();
@@ -9130,7 +8980,7 @@ function getSizeAccessor({ name }, scaleType, aggregation, range, data) {
9130
8980
  const propertyValue = properties[accessorKeys[0]];
9131
8981
  return scale2(propertyValue);
9132
8982
  };
9133
- return normalizeAccessor(accessor, data);
8983
+ return { accessor: normalizeAccessor(accessor, data), scale: scale2 };
9134
8984
  }
9135
8985
  var FORMATS = {
9136
8986
  date: formatDate,
@@ -9147,10 +8997,10 @@ function getTextAccessor({ name, type }, data) {
9147
8997
  return normalizeAccessor(accessor, data);
9148
8998
  }
9149
8999
  function calculateClusterRadius(properties, stats, radiusRange, column) {
9150
- const { min: min3, max: max3 } = stats[column];
9000
+ const { min: min2, max: max2 } = stats[column];
9151
9001
  const value = properties[column];
9152
- if (min3 === max3) return radiusRange[1];
9153
- const normalizedValue = (value - min3) / (max3 - min3);
9002
+ if (min2 === max2) return radiusRange[1];
9003
+ const normalizedValue = (value - min2) / (max2 - min2);
9154
9004
  return radiusRange[0] + normalizedValue * (radiusRange[1] - radiusRange[0]);
9155
9005
  }
9156
9006
  function getDefaultAggregationExpColumnAliasForLayerType(layerType, provider, schema) {
@@ -9211,6 +9061,14 @@ function parseMap(json) {
9211
9061
  assert2(data, `No data loaded for dataId: ${dataId}`);
9212
9062
  const { propMap, defaultProps: defaultProps2 } = getLayerProps(type, config3, dataset);
9213
9063
  const styleProps = createStyleProps(config3, propMap);
9064
+ const { channelProps, scales } = createChannelProps(
9065
+ id,
9066
+ type,
9067
+ config3,
9068
+ visualChannels,
9069
+ data,
9070
+ dataset
9071
+ );
9214
9072
  const layer = {
9215
9073
  type,
9216
9074
  filters: isEmptyObject(filters) || isRemoteCalculationSupported(dataset) ? void 0 : filters[dataId],
@@ -9220,22 +9078,15 @@ function parseMap(json) {
9220
9078
  ...defaultProps2,
9221
9079
  ...createInteractionProps(interactionConfig),
9222
9080
  ...styleProps,
9223
- ...createChannelProps(
9224
- id,
9225
- type,
9226
- config3,
9227
- visualChannels,
9228
- data,
9229
- dataset
9230
- ),
9231
- // Must come after style
9081
+ ...channelProps,
9232
9082
  ...createParametersProp(
9233
9083
  layerBlending,
9234
9084
  styleProps.parameters || {}
9235
9085
  ),
9236
9086
  // Must come after style
9237
9087
  ...createLoadOptions(token)
9238
- }
9088
+ },
9089
+ scales
9239
9090
  };
9240
9091
  return layer;
9241
9092
  } catch (e) {
@@ -9302,69 +9153,47 @@ function createStyleProps(config2, mapping) {
9302
9153
  result.highlightColor = config2.visConfig.enable3d ? [255, 255, 255, 60] : [252, 242, 26, 255];
9303
9154
  return result;
9304
9155
  }
9305
- function createChannelProps(id, type, config2, visualChannels, data, dataset) {
9156
+ function domainAndRangeFromScale(scale2) {
9157
+ return {
9158
+ domain: scale2.domain(),
9159
+ range: scale2.range()
9160
+ };
9161
+ }
9162
+ function createChannelProps(id, layerType, config2, visualChannels, data, dataset) {
9306
9163
  const {
9307
9164
  colorField,
9308
9165
  colorScale,
9309
9166
  radiusField,
9310
9167
  radiusScale,
9311
- sizeField,
9312
- sizeScale,
9313
9168
  strokeColorField,
9314
9169
  strokeColorScale,
9315
9170
  weightField
9316
9171
  } = visualChannels;
9317
- let { heightField, heightScale } = visualChannels;
9318
- if (type === "hexagonId") {
9319
- heightField = sizeField;
9320
- heightScale = sizeScale;
9321
- }
9172
+ const { heightField, heightScale } = visualChannels;
9322
9173
  const { textLabel, visConfig } = config2;
9323
9174
  const result = {};
9324
- if (type === "grid" || type === "hexagon") {
9325
- result.colorScaleType = colorScale;
9326
- if (colorField) {
9327
- const { colorAggregation } = config2.visConfig;
9328
- if (!AGGREGATION[colorAggregation]) {
9329
- result.getColorValue = getColorValueAccessor(
9330
- colorField,
9331
- colorAggregation,
9332
- data
9333
- );
9334
- } else {
9335
- result.getColorWeight = (d) => d[colorField.name];
9336
- }
9337
- }
9338
- } else if (colorField) {
9175
+ const scales = {};
9176
+ if (colorField) {
9339
9177
  const { colorAggregation: aggregation, colorRange: range } = visConfig;
9340
- result.getFillColor = getColorAccessor(
9178
+ const { accessor, scale: scale2 } = getColorAccessor(
9341
9179
  colorField,
9342
- // @ts-ignore
9343
9180
  colorScale,
9344
9181
  { aggregation, range },
9345
9182
  visConfig.opacity,
9346
9183
  data
9347
9184
  );
9185
+ result.getFillColor = accessor;
9186
+ scales.fillColor = {
9187
+ field: colorField,
9188
+ type: colorScale,
9189
+ ...domainAndRangeFromScale(scale2)
9190
+ };
9191
+ } else if (visConfig.filled) {
9192
+ scales.fillColor = {};
9348
9193
  }
9349
- if (type === "point") {
9350
- const altitude = config2.columns?.altitude;
9351
- if (altitude) {
9352
- result.dataTransform = (data2) => {
9353
- data2.features.forEach(
9354
- ({ geometry, properties }) => {
9355
- const { type: type2, coordinates } = geometry;
9356
- if (type2 === "Point") {
9357
- coordinates[2] = properties[altitude];
9358
- }
9359
- }
9360
- );
9361
- return data2;
9362
- };
9363
- }
9364
- }
9365
- if (type === "clusterTile") {
9194
+ if (layerType === "clusterTile") {
9366
9195
  const aggregationExpAlias = getDefaultAggregationExpColumnAliasForLayerType(
9367
- type,
9196
+ layerType,
9368
9197
  dataset.providerId,
9369
9198
  data.schema
9370
9199
  );
@@ -9403,49 +9232,67 @@ function createChannelProps(id, type, config2, visualChannels, data, dataset) {
9403
9232
  return calculateClusterTextFontSize(radius);
9404
9233
  };
9405
9234
  }
9406
- if (radiusField || sizeField) {
9407
- result.getPointRadius = getSizeAccessor(
9408
- // @ts-ignore
9409
- radiusField || sizeField,
9410
- // @ts-ignore
9411
- radiusScale || sizeScale,
9235
+ if (radiusField) {
9236
+ const { accessor, scale: scale2 } = getSizeAccessor(
9237
+ radiusField,
9238
+ radiusScale,
9412
9239
  visConfig.sizeAggregation,
9413
9240
  visConfig.radiusRange || visConfig.sizeRange,
9414
9241
  data
9415
9242
  );
9243
+ result.getPointRadius = accessor;
9244
+ scales.pointRadius = {
9245
+ field: radiusField,
9246
+ type: radiusScale || "identity",
9247
+ ...domainAndRangeFromScale(scale2)
9248
+ };
9416
9249
  }
9417
9250
  if (strokeColorField) {
9418
- const fallbackOpacity = type === "point" ? visConfig.opacity : 1;
9419
- const opacity = visConfig.strokeOpacity !== void 0 ? visConfig.strokeOpacity : fallbackOpacity;
9251
+ const opacity = visConfig.strokeOpacity !== void 0 ? visConfig.strokeOpacity : 1;
9420
9252
  const { strokeColorAggregation: aggregation, strokeColorRange: range } = visConfig;
9421
- result.getLineColor = getColorAccessor(
9253
+ const { accessor, scale: scale2 } = getColorAccessor(
9422
9254
  strokeColorField,
9423
- // @ts-ignore
9424
9255
  strokeColorScale,
9425
- // @ts-ignore
9426
9256
  { aggregation, range },
9427
9257
  opacity,
9428
9258
  data
9429
9259
  );
9260
+ result.getLineColor = accessor;
9261
+ scales.lineColor = {
9262
+ field: strokeColorField,
9263
+ type: strokeColorScale,
9264
+ ...domainAndRangeFromScale(scale2)
9265
+ };
9430
9266
  }
9431
9267
  if (heightField && visConfig.enable3d) {
9432
- result.getElevation = getSizeAccessor(
9268
+ const { accessor, scale: scale2 } = getSizeAccessor(
9433
9269
  heightField,
9434
- // @ts-ignore
9435
9270
  heightScale,
9436
9271
  visConfig.heightAggregation,
9437
9272
  visConfig.heightRange || visConfig.sizeRange,
9438
9273
  data
9439
9274
  );
9275
+ result.getElevation = accessor;
9276
+ scales.elevation = {
9277
+ field: heightField,
9278
+ type: heightScale || "identity",
9279
+ ...domainAndRangeFromScale(scale2)
9280
+ };
9440
9281
  }
9441
9282
  if (weightField) {
9442
- result.getWeight = getSizeAccessor(
9283
+ const { accessor, scale: scale2 } = getSizeAccessor(
9443
9284
  weightField,
9444
9285
  void 0,
9445
9286
  visConfig.weightAggregation,
9446
9287
  void 0,
9447
9288
  data
9448
9289
  );
9290
+ result.getWeight = accessor;
9291
+ scales.weight = {
9292
+ field: weightField,
9293
+ type: "identity",
9294
+ ...domainAndRangeFromScale(scale2)
9295
+ };
9449
9296
  }
9450
9297
  if (visConfig.customMarkers) {
9451
9298
  const maxIconSize = getMaxMarkerSize(visConfig, visualChannels);
@@ -9483,17 +9330,16 @@ function createChannelProps(id, type, config2, visualChannels, data, dataset) {
9483
9330
  result.getIconSize = getPointRadius;
9484
9331
  }
9485
9332
  if (visualChannels.rotationField) {
9486
- result.getIconAngle = negateAccessor(
9487
- getSizeAccessor(
9488
- visualChannels.rotationField,
9489
- void 0,
9490
- null,
9491
- void 0,
9492
- data
9493
- )
9333
+ const { accessor } = getSizeAccessor(
9334
+ visualChannels.rotationField,
9335
+ void 0,
9336
+ null,
9337
+ void 0,
9338
+ data
9494
9339
  );
9340
+ result.getIconAngle = negateAccessor(accessor);
9495
9341
  }
9496
- } else if (type === "point" || type === "tileset") {
9342
+ } else if (layerType === "tileset") {
9497
9343
  result.pointType = "circle";
9498
9344
  }
9499
9345
  if (textLabel && textLabel.length && textLabel[0].field) {
@@ -9536,7 +9382,7 @@ function createChannelProps(id, type, config2, visualChannels, data, dataset) {
9536
9382
  }
9537
9383
  };
9538
9384
  }
9539
- return result;
9385
+ return { channelProps: result, scales };
9540
9386
  }
9541
9387
  function createLoadOptions(accessToken) {
9542
9388
  return {
@@ -10101,7 +9947,6 @@ function _getHexagonResolution(viewport, tileSize) {
10101
9947
  );
10102
9948
  }
10103
9949
  export {
10104
- AGGREGATION,
10105
9950
  ApiVersion,
10106
9951
  basemap_styles_default as BASEMAP,
10107
9952
  CartoAPIError,
@@ -10151,7 +9996,6 @@ export {
10151
9996
  getApplicableFilters,
10152
9997
  getClient,
10153
9998
  getColorAccessor,
10154
- getColorValueAccessor,
10155
9999
  getColumnNameFromGeoColumn,
10156
10000
  getDataFilterExtensionProps,
10157
10001
  getDefaultAggregationExpColumnAliasForLayerType,