@carto/kepler.gl 0.0.85 → 0.0.86-alpha.deck9.1-2

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.
@@ -189,7 +189,7 @@ export default class PointLayer extends Layer {
189
189
  formatLayerData(datasets: any, oldLayerData: any): {};
190
190
  updateLayerMeta(dataContainer: any): void;
191
191
  isLayerHovered(objectInfo: any): boolean;
192
- renderLayer(opts: any): (import("@deck.gl/carto")._PointLabelLayer<any, {}> | IconLayer<any, {
192
+ renderLayer(opts: any): (import("@deck.gl/carto").PointLabelLayer<any, {}> | IconLayer<any, {
193
193
  id: `${string}-icon`;
194
194
  data: any;
195
195
  getColor: any;
@@ -268,5 +268,5 @@ export default class PointLayer extends Layer {
268
268
  resizeQuality: string;
269
269
  };
270
270
  };
271
- }>)[] | (import("@deck.gl/carto")._PointLabelLayer<any, {}> | ScatterplotLayer<any, {}>)[];
271
+ }>)[] | (import("@deck.gl/carto").PointLabelLayer<any, {}> | ScatterplotLayer<any, {}>)[];
272
272
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@carto/kepler.gl",
3
3
  "author": "CARTO",
4
4
  "homepage": "https://github.com/CartoDB/carto-kepler#readme",
5
- "version": "0.0.85",
5
+ "version": "0.0.86-alpha.deck9.1-2",
6
6
  "description": "kepler.gl is a webgl based application to visualize large scale location data in the browser",
7
7
  "license": "MIT",
8
8
  "type": "commonjs",
@@ -218,15 +218,15 @@
218
218
  "@babel/register": "^7.12.1",
219
219
  "@babel/runtime": "^7.12.1",
220
220
  "@babel/traverse": "^7.12.1",
221
- "@deck.gl/aggregation-layers": "^9.0.30",
222
- "@deck.gl/carto": "^9.0.30",
223
- "@deck.gl/core": "^9.0.30",
224
- "@deck.gl/extensions": "^9.0.30",
225
- "@deck.gl/geo-layers": "^9.0.30",
226
- "@deck.gl/layers": "^9.0.30",
227
- "@deck.gl/mesh-layers": "^9.0.30",
228
- "@deck.gl/react": "^9.0.30",
229
- "@deck.gl/test-utils": "^9.0.30",
221
+ "@deck.gl/aggregation-layers": "^9.1.2",
222
+ "@deck.gl/carto": "^9.1.2",
223
+ "@deck.gl/core": "^9.1.2",
224
+ "@deck.gl/extensions": "^9.1.2",
225
+ "@deck.gl/geo-layers": "^9.1.2",
226
+ "@deck.gl/layers": "^9.1.2",
227
+ "@deck.gl/mesh-layers": "^9.1.2",
228
+ "@deck.gl/react": "^9.1.2",
229
+ "@deck.gl/test-utils": "^9.1.2",
230
230
  "@loaders.gl/core": "^4.2.5",
231
231
  "@loaders.gl/csv": "^4.2.5",
232
232
  "@loaders.gl/gltf": "^4.2.5",
@@ -306,22 +306,22 @@
306
306
  "tough-cookie": "4.0.0"
307
307
  },
308
308
  "peerDependencies": {
309
- "@deck.gl/aggregation-layers": "^9.0.30",
310
- "@deck.gl/carto": "^9.0.30",
311
- "@deck.gl/core": "^9.0.30",
312
- "@deck.gl/extensions": "^9.0.30",
313
- "@deck.gl/geo-layers": "^9.0.30",
314
- "@deck.gl/layers": "^9.0.30",
315
- "@deck.gl/mesh-layers": "^9.0.30",
316
- "@deck.gl/react": "^9.0.30",
309
+ "@deck.gl/aggregation-layers": "^9.1.2",
310
+ "@deck.gl/carto": "^9.1.2",
311
+ "@deck.gl/core": "^9.1.2",
312
+ "@deck.gl/extensions": "^9.1.2",
313
+ "@deck.gl/geo-layers": "^9.1.2",
314
+ "@deck.gl/layers": "^9.1.2",
315
+ "@deck.gl/mesh-layers": "^9.1.2",
316
+ "@deck.gl/react": "^9.1.2",
317
317
  "@loaders.gl/core": "^4.2.5",
318
318
  "@loaders.gl/csv": "^4.2.5",
319
319
  "@loaders.gl/gltf": "^4.2.5",
320
320
  "@loaders.gl/json": "^4.2.5",
321
321
  "@loaders.gl/loader-utils": "^4.2.5",
322
- "@luma.gl/constants": "^9.0.27",
323
- "@luma.gl/core": "^9.0.27",
324
- "@luma.gl/webgl": "^9.0.27",
322
+ "@luma.gl/constants": "^9.1.2",
323
+ "@luma.gl/core": "^9.1.2",
324
+ "@luma.gl/webgl": "^9.1.2",
325
325
  "react": ">=16.3",
326
326
  "react-dom": ">=16.3",
327
327
  "styled-components": "^4.x || ^5.x"
@@ -18,7 +18,7 @@
18
18
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  // THE SOFTWARE.
20
20
 
21
- import {CPUGridLayer} from '@deck.gl/aggregation-layers';
21
+ import {GridLayer} from '@deck.gl/aggregation-layers';
22
22
  import CPUAggregator, {AggregationType, getAggregatedData} from '../layer-utils/cpu-aggregator';
23
23
 
24
24
  export const gridAggregation: AggregationType = {
@@ -44,7 +44,7 @@ export const gridAggregation: AggregationType = {
44
44
  };
45
45
 
46
46
  // @ts-expect-error
47
- export default class ScaleEnhancedGridLayer extends CPUGridLayer<any> {
47
+ export default class ScaleEnhancedGridLayer extends GridLayer<any> {
48
48
  static defaultProps = {
49
49
  // Avoid state changes by marking the callback as compare: false
50
50
  onSetColorDomain: {type: 'function', optional: true, compare: false}
@@ -19,12 +19,19 @@
19
19
  // THE SOFTWARE.
20
20
 
21
21
  /* eslint-disable guard-for-in */
22
- import {AGGREGATION_OPERATION, _BinSorter as BinSorter} from '@deck.gl/aggregation-layers';
22
+ import type {AggregationOperation} from '@deck.gl/aggregation-layers';
23
+ /* @ts-expect-error BinSorter has been removed in deck.gl 9.1 so this entire file will no longer work */
24
+ import {_BinSorter as BinSorter} from '@deck.gl/aggregation-layers';
23
25
  import {console as Console} from 'global/window';
24
26
 
25
27
  import {aggregate} from '../../utils/aggregate-utils';
26
- import {AGGREGATION_TYPES, SCALE_FUNC, SCALE_TYPES, UNKNOWN_COLOR} from '../../constants/default-settings';
27
- import {RGBAColor} from '../../reducers';
28
+ import {
29
+ AGGREGATION_TYPES,
30
+ SCALE_FUNC,
31
+ SCALE_TYPES,
32
+ UNKNOWN_COLOR
33
+ } from '../../constants/default-settings';
34
+ import {RGBAColor, ValueOf} from '../../reducers';
28
35
 
29
36
  export type UpdaterType = (this: CPUAggregator, step, props, dimensionUpdater) => void;
30
37
  export type BindedUpdaterType = () => void;
@@ -76,20 +83,23 @@ export type AggregationType = {
76
83
  updateSteps: AggregationUpdateStepsType[];
77
84
  };
78
85
 
79
- export const DECK_AGGREGATION_MAP = {
80
- [AGGREGATION_OPERATION.SUM]: AGGREGATION_TYPES.sum,
81
- [AGGREGATION_OPERATION.MEAN]: AGGREGATION_TYPES.average,
82
- [AGGREGATION_OPERATION.MIN]: AGGREGATION_TYPES.minimum,
83
- [AGGREGATION_OPERATION.MAX]: AGGREGATION_TYPES.maximum
86
+ export const DECK_AGGREGATION_MAP: Partial<Record<
87
+ AggregationOperation,
88
+ ValueOf<typeof AGGREGATION_TYPES>
89
+ >> = {
90
+ SUM: AGGREGATION_TYPES.sum,
91
+ MEAN: AGGREGATION_TYPES.average,
92
+ MIN: AGGREGATION_TYPES.minimum,
93
+ MAX: AGGREGATION_TYPES.maximum
84
94
  };
85
95
 
86
96
  export function getValueFunc(aggregation, accessor) {
87
- if (!aggregation || !AGGREGATION_OPERATION[aggregation.toUpperCase()]) {
97
+ const op: AggregationOperation = aggregation.toUpperCase();
98
+ if (!aggregation || !DECK_AGGREGATION_MAP[aggregation.toUpperCase()]) {
88
99
  Console.warn(`Aggregation ${aggregation} is not supported`);
89
100
  }
90
101
 
91
- const op = AGGREGATION_OPERATION[aggregation.toUpperCase()] || AGGREGATION_OPERATION.SUM;
92
- const keplerOp = DECK_AGGREGATION_MAP[op];
102
+ const keplerOp = DECK_AGGREGATION_MAP[op || 'SUM'];
93
103
 
94
104
  return pts => aggregate(pts.map(accessor), keplerOp);
95
105
  }
@@ -22,7 +22,7 @@ import {console as Console} from 'global/window';
22
22
  import keymirror from 'keymirror';
23
23
  import {CollisionFilterExtension, DataFilterExtension} from '@deck.gl/extensions';
24
24
  import {COORDINATE_SYSTEM, Layer as DeckLayer} from '@deck.gl/core';
25
- import {_PointLabelLayer as PointLabelLayer} from '@deck.gl/carto';
25
+ import {PointLabelLayer} from '@deck.gl/carto';
26
26
  import DefaultLayerIcon from './default-layer-icon';
27
27
  import {diffUpdateTriggers} from './layer-update';
28
28
  import {rgb} from 'd3-color';
@@ -56,7 +56,12 @@ import {generateHashId, isPlainObject} from 'utils/utils';
56
56
  import {getLatLngBounds, notNullorUndefined} from 'utils/data-utils';
57
57
  import {getSampleData} from 'utils/table-utils/data-container-utils';
58
58
 
59
- import {hexToRgb, getColorGroupByName, reverseColorRange, checkColorOrFallback} from 'utils/color-utils';
59
+ import {
60
+ hexToRgb,
61
+ getColorGroupByName,
62
+ reverseColorRange,
63
+ checkColorOrFallback
64
+ } from 'utils/color-utils';
60
65
  import {getMaskExtensionProps} from 'utils/layer-utils';
61
66
  import {scaleOrdinal} from 'd3-scale';
62
67
 
@@ -473,10 +478,12 @@ class Layer {
473
478
  ): LayerBaseConfig & Partial<LayerColorConfig & LayerSizeConfig> {
474
479
  return {
475
480
  dataId: props.dataId || null,
476
- ...{visibilityByZoom: {
477
- min: (props as any).visibilityByZoom?.min || ZOOM_LEVEL_LIMITS.min,
478
- max: (props as any).visibilityByZoom?.max || ZOOM_LEVEL_LIMITS.max
479
- }}, // TODO: Clean up
481
+ ...{
482
+ visibilityByZoom: {
483
+ min: (props as any).visibilityByZoom?.min || ZOOM_LEVEL_LIMITS.min,
484
+ max: (props as any).visibilityByZoom?.max || ZOOM_LEVEL_LIMITS.max
485
+ }
486
+ }, // TODO: Clean up
480
487
  label: props.label || DEFAULT_LAYER_LABEL,
481
488
  color: props.color || colorMaker.next().value,
482
489
  columns: props.columns || {},
@@ -940,7 +947,7 @@ class Layer {
940
947
  newColorMap[newColorMap.length - 1][0] = prevValue + step;
941
948
 
942
949
  for (const [i, color] of unassignedColors.entries()) {
943
- const value = i === unassignedColors.length - 1 ? null : prevValue + (step * (i + 2));
950
+ const value = i === unassignedColors.length - 1 ? null : prevValue + step * (i + 2);
944
951
  newColorMap.push([value, color]);
945
952
  }
946
953
  }
@@ -1140,7 +1147,7 @@ class Layer {
1140
1147
 
1141
1148
  // for `count` aggregation, we domain is actually `[0, Infinity]` so it doesn't make sense
1142
1149
  // to use it, so skip specyfying this domains
1143
- const domainIsInfinite = domain && (domain[0] === 0 && domain[1] === Infinity);
1150
+ const domainIsInfinite = domain && domain[0] === 0 && domain[1] === Infinity;
1144
1151
  const scaleFactory = SCALE_FUNC[fixed ? 'linear' : scale];
1145
1152
  // @ts-ignore d3-scale type
1146
1153
  let result = scaleFactory();
@@ -1542,7 +1549,7 @@ class Layer {
1542
1549
  const {radiusField, sizeField, visConfig} = this.config as any;
1543
1550
  const {radiusRange, radius} = visConfig;
1544
1551
  const field = radiusField || sizeField;
1545
- return Math.ceil((field && radiusRange ? radiusRange[1] : radius));
1552
+ return Math.ceil(field && radiusRange ? radiusRange[1] : radius);
1546
1553
  }
1547
1554
 
1548
1555
  shouldCalculateLayerData(props: string[]) {
@@ -1701,7 +1708,7 @@ class Layer {
1701
1708
 
1702
1709
  return d => {
1703
1710
  const wantedUrl =
1704
- (typeof iconUrlAccessor === 'function') ? iconUrlAccessor(d) : iconUrlAccessor;
1711
+ typeof iconUrlAccessor === 'function' ? iconUrlAccessor(d) : iconUrlAccessor;
1705
1712
  const iconOk = Boolean(wantedUrl);
1706
1713
  mask = iconOk ? mask : true;
1707
1714
  const url = iconOk ? wantedUrl : FALLBACK_ICON;