kepler.gl 3.1.9 → 3.1.10

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 (66) hide show
  1. package/README.md +21 -21
  2. package/dist/src/components/src/common/link-renderer.d.ts +6 -2
  3. package/dist/src/components/src/index.d.ts +1 -0
  4. package/dist/src/components/src/map-container.d.ts +1 -0
  5. package/dist/src/components/src/plot-container.d.ts +1 -0
  6. package/dist/src/components/src/side-panel/layer-manager.d.ts +1 -0
  7. package/dist/src/duckdb/src/index.d.ts +1 -0
  8. package/dist/src/duckdb/src/processors/data-processor.d.ts +8 -0
  9. package/dist/src/utils/src/data-utils.d.ts +1 -0
  10. package/package.json +2 -2
  11. package/src/actions/package.json +8 -8
  12. package/src/ai-assistant/package.json +7 -7
  13. package/src/cloud-providers/package.json +2 -2
  14. package/src/common-utils/package.json +3 -3
  15. package/src/components/dist/common/link-renderer.d.ts +6 -2
  16. package/src/components/dist/common/link-renderer.js +1 -1
  17. package/src/components/dist/index.d.ts +1 -0
  18. package/src/components/dist/index.js +44 -1
  19. package/src/components/dist/map-container.d.ts +1 -0
  20. package/src/components/dist/map-container.js +2 -1
  21. package/src/components/dist/plot-container.d.ts +1 -0
  22. package/src/components/dist/plot-container.js +7 -4
  23. package/src/components/dist/side-panel/layer-manager.d.ts +1 -0
  24. package/src/components/dist/side-panel/layer-manager.js +5 -3
  25. package/src/components/dist/side-panel/layer-panel/color-scale-selector.js +16 -9
  26. package/src/components/package.json +16 -16
  27. package/src/components/src/common/link-renderer.tsx +7 -2
  28. package/src/components/src/index.ts +8 -0
  29. package/src/components/src/map-container.tsx +4 -0
  30. package/src/components/src/plot-container.tsx +9 -3
  31. package/src/components/src/side-panel/layer-manager.tsx +4 -2
  32. package/src/components/src/side-panel/layer-panel/color-scale-selector.tsx +22 -9
  33. package/src/constants/dist/default-settings.js +2 -2
  34. package/src/constants/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/e4/a7/04d0f645deb094cab21e70c2457f3b87750bee1dfea9b3ad1d4f746ae10ff013d960af8a46b1f87a10409989d6a352c21e29a8784a161a84f83a310955e2 +1 -0
  35. package/src/constants/node_modules/.cache/terser-webpack-plugin/index-v5/b2/5f/6daa692cacd1234803d6a5abefef0c49aae2d1403e4d8e53140088950a04 +2 -0
  36. package/src/constants/package.json +2 -2
  37. package/src/constants/umd/keplergl.min.js +1 -1
  38. package/src/deckgl-arrow-layers/package.json +2 -2
  39. package/src/deckgl-layers/package.json +4 -4
  40. package/src/duckdb/dist/index.d.ts +1 -0
  41. package/src/duckdb/dist/index.js +24 -2
  42. package/src/duckdb/dist/processors/data-processor.d.ts +8 -0
  43. package/src/duckdb/dist/processors/data-processor.js +23 -1
  44. package/src/duckdb/package.json +6 -6
  45. package/src/duckdb/src/index.ts +5 -0
  46. package/src/duckdb/src/processors/data-processor.ts +25 -1
  47. package/src/effects/package.json +5 -5
  48. package/src/layers/package.json +9 -9
  49. package/src/localization/package.json +1 -1
  50. package/src/processors/package.json +7 -7
  51. package/src/reducers/package.json +16 -16
  52. package/src/schemas/package.json +7 -7
  53. package/src/styles/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/41/e3/d873c0efff87c4438d34d09be942ff6877947926c2309949e1eea8a58722c9ebf1e9451b44f62996d3590f398318e2fd17f19613445810226c8354b7d746 +1 -0
  54. package/src/styles/node_modules/.cache/terser-webpack-plugin/index-v5/9d/95/efc8c9f0bdd09b105646cf5e34b067e621726ceeb296771ff7da9e2e03b4 +2 -0
  55. package/src/styles/package.json +2 -2
  56. package/src/styles/umd/keplergl.min.js +1 -1
  57. package/src/table/package.json +5 -5
  58. package/src/tasks/package.json +2 -2
  59. package/src/types/package.json +1 -1
  60. package/src/utils/dist/data-scale-utils.js +35 -16
  61. package/src/utils/dist/data-utils.d.ts +1 -0
  62. package/src/utils/dist/data-utils.js +2 -1
  63. package/src/utils/package.json +4 -4
  64. package/src/utils/src/data-scale-utils.ts +34 -21
  65. package/src/utils/src/data-utils.ts +1 -0
  66. package/umd/keplergl.min.js +1027 -1027
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kepler.gl/utils",
3
3
  "author": "Shan He <shan@uber.com>",
4
- "version": "3.1.9",
4
+ "version": "3.1.10",
5
5
  "description": "kepler.gl constants used by kepler.gl components, actions and reducers",
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",
@@ -31,9 +31,9 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@deck.gl/core": "^8.9.27",
34
- "@kepler.gl/common-utils": "3.1.9",
35
- "@kepler.gl/constants": "3.1.9",
36
- "@kepler.gl/types": "3.1.9",
34
+ "@kepler.gl/common-utils": "3.1.10",
35
+ "@kepler.gl/constants": "3.1.10",
36
+ "@kepler.gl/types": "3.1.10",
37
37
  "@loaders.gl/arrow": "^4.3.2",
38
38
  "@luma.gl/constants": "^8.5.20",
39
39
  "@luma.gl/core": "^8.5.20",
@@ -382,31 +382,44 @@ export function getCategoricalColorMap(
382
382
  colors: string[],
383
383
  domain: (string | number | string[] | number[] | null)[]
384
384
  ): any {
385
- // colorMap: [string | string[], hexstring]
386
- const colorToUniqueValues = {};
387
- const uniqueValues = unique(domain).filter(notNullorUndefined).sort();
388
- // each unique value assign to a color, the rest unique values assign to last color
389
- const lastColor = colors[colors.length - 1];
390
- for (let i = 0; i < uniqueValues.length; ++i) {
391
- if (i < colors.length) {
392
- colorToUniqueValues[colors[i]] = uniqueValues[i];
393
- } else {
394
- colorToUniqueValues[lastColor] = [
395
- ...(Array.isArray(colorToUniqueValues[lastColor])
396
- ? colorToUniqueValues[lastColor]
397
- : [colorToUniqueValues[lastColor]]),
398
- uniqueValues[i]
399
- ];
400
- }
385
+ const uniqueValues = unique(domain).sort();
386
+ const colorMap = colors.map(color => [null, color]);
387
+
388
+ if (colors.length === 0 || uniqueValues.length === 0) {
389
+ return colorMap;
401
390
  }
402
391
 
403
- const colorMap = colors.map(color => {
404
- if (color in colorToUniqueValues) {
405
- return [colorToUniqueValues[color], color];
392
+ const lastIndex = colors.length - 1;
393
+ const assignCount = Math.min(lastIndex, uniqueValues.length);
394
+
395
+ // Assign first values one-to-one up to the penultimate color (if any)
396
+ for (let i = 0; i < assignCount; i++) {
397
+ // @ts-ignore tuple
398
+ colorMap[i][0] = uniqueValues[i];
399
+ }
400
+
401
+ if (uniqueValues.length > colors.length) {
402
+ // Aggregate the rest (including the value that would have gone to last color)
403
+ // Build aggregated array incrementally to match legacy behavior
404
+ const aggregatedValues: any[] = [];
405
+ for (let i = lastIndex; i < uniqueValues.length; i++) {
406
+ const value = uniqueValues[i];
407
+ if (Array.isArray(value)) {
408
+ // Spread array elements to match legacy flattening behavior
409
+ aggregatedValues.push(...(value as any[]));
410
+ } else {
411
+ aggregatedValues.push(value);
412
+ }
406
413
  }
407
- return [null, color];
408
- });
414
+ // @ts-ignore tuple
415
+ colorMap[lastIndex][0] = aggregatedValues;
416
+ } else if (uniqueValues.length === colors.length) {
417
+ // Exactly one per color
418
+ // @ts-ignore tuple
419
+ colorMap[lastIndex][0] = uniqueValues[lastIndex];
420
+ }
409
421
 
422
+ // @ts-ignore tuple
410
423
  return colorMap;
411
424
  }
412
425
 
@@ -76,6 +76,7 @@ export function validateCoordinate(value: number, minValue: number, maxValue: nu
76
76
 
77
77
  /**
78
78
  * simple getting unique values of an array
79
+ * Note: filters out null and undefined values
79
80
  *
80
81
  * @param values
81
82
  * @returns unique values