@kepler.gl/types 3.1.0-alpha.3 → 3.1.0-alpha.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/datasets.d.ts CHANGED
@@ -13,3 +13,14 @@ export type ZoomStopsConfig = {
13
13
  enabled?: boolean;
14
14
  stops: ZoomStops | null;
15
15
  };
16
+
17
+ export type DatasetAttribution = {
18
+ title: string;
19
+ url: string | null;
20
+ };
21
+
22
+ export type AttributionWithStyle = DatasetAttribution & {
23
+ logoUrl: string;
24
+ height?: number;
25
+ bottom?: number;
26
+ };
package/layers.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  // Copyright contributors to the kepler.gl project
3
3
 
4
- import {HexColor} from './types';
4
+ import {HexColor, RGBColor, RGBAColor} from './types';
5
5
 
6
6
  export type LayerBaseConfig = {
7
- dataId: string | null;
7
+ dataId: string;
8
8
  label: string;
9
9
  color: RGBColor;
10
10
 
@@ -26,7 +26,13 @@ export type LayerBaseConfig = {
26
26
  domain?: [number, number] | null;
27
27
  };
28
28
 
29
+ // for aggregate layer, aggregatedBins is returned for custom color scale
30
+ aggregatedBins?: AggregatedBin[];
31
+
29
32
  columnMode?: string;
33
+ heightField?: VisualChannelField;
34
+ heightDomain?: VisualChannelDomain;
35
+ heightScale?: string;
30
36
  };
31
37
 
32
38
  /**
@@ -64,6 +70,9 @@ export type SupportedColumnMode = {
64
70
  hasHelp?: boolean;
65
71
  };
66
72
 
73
+ export type VisualChannelField = Field | null;
74
+ export type VisualChannelScale = keyof typeof SCALE_TYPES;
75
+
67
76
  export type LayerColorConfig = {
68
77
  colorField: VisualChannelField;
69
78
  colorDomain: VisualChannelDomain;
@@ -169,7 +178,7 @@ export type ColorRangeConfig = {
169
178
  colorBlindSafe: boolean;
170
179
  };
171
180
 
172
- export type ColorMap = [string[] | string | number | null, HexColor][];
181
+ export type ColorMap = [string[] | number[] | string | number | null, HexColor][];
173
182
  // Key is HexColor but as key we can use only string
174
183
  export type ColorLegends = {[key: HexColor]: string};
175
184
 
@@ -179,7 +188,7 @@ export type ColorRange = {
179
188
  category?: string;
180
189
  colors: HexColor[];
181
190
  reversed?: boolean;
182
- colorMap?: ColorMap;
191
+ colorMap?: ColorMap | null;
183
192
  colorLegends?: ColorLegends;
184
193
  };
185
194
 
@@ -392,3 +401,75 @@ export type BindedLayerCallbacks = {
392
401
  onSetLayerDomain?: (value: any) => void;
393
402
  onFilteredItemsChange?: (event: {id: string; count: number}) => void;
394
403
  };
404
+
405
+ export type VisualChannelAggregation = 'colorAggregation' | 'sizeAggregation';
406
+
407
+ export type SupportedFieldTypes =
408
+ | 'boolean'
409
+ | 'date'
410
+ | 'geojson'
411
+ | 'integer'
412
+ | 'real'
413
+ | 'string'
414
+ | 'timestamp'
415
+ | 'point'
416
+ | 'array'
417
+ | 'object'
418
+ | 'geoarrow'
419
+ | 'h3';
420
+
421
+ export type VisualChannel = {
422
+ property: string;
423
+ field: string;
424
+ scale: string;
425
+ domain: string;
426
+ range: string;
427
+ key: string;
428
+ channelScaleType: string;
429
+ nullValue?: any;
430
+ defaultMeasure?: any;
431
+ accessor?: string;
432
+ condition?: (config: any) => boolean;
433
+ defaultValue?: ((config: any) => any) | any;
434
+ getAttributeValue?: (config: any) => (d: any) => any;
435
+
436
+ // TODO: define fixed
437
+ fixed?: any;
438
+
439
+ supportedFieldTypes?: Array<SupportedFieldTypes>;
440
+
441
+ aggregation?: VisualChannelAggregation;
442
+ };
443
+
444
+ export type VisualChannels = {[key: string]: VisualChannel};
445
+
446
+ export interface KeplerLayer {
447
+ id: string;
448
+ meta: Record<string, any>;
449
+ visConfigSettings: {
450
+ [key: string]: ValueOf<LayerVisConfigSettings>;
451
+ };
452
+ config: LayerBaseConfig;
453
+
454
+ get type(): string | null;
455
+ get supportedDatasetTypes(): string[] | null;
456
+
457
+ getColorScale(
458
+ colorScale: string,
459
+ colorDomain: VisualChannelDomain,
460
+ colorRange: ColorRange
461
+ ): GetVisChannelScaleReturnType;
462
+ }
463
+
464
+ export type VisualChannelDomain = number[] | string[];
465
+
466
+ export type GetVisChannelScaleReturnType = {
467
+ (z: number): any;
468
+ byZoom?: boolean;
469
+ } | null;
470
+
471
+ export type AggregatedBin = {
472
+ i: number;
473
+ value: number;
474
+ counts: number;
475
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kepler.gl/types",
3
3
  "author": "Shan He <shan@uber.com>",
4
- "version": "3.1.0-alpha.3",
4
+ "version": "3.1.0-alpha.5",
5
5
  "description": "kepler.gl types used by kepler.gl components, actions and reducers",
6
6
  "license": "MIT",
7
7
  "types": "index.d.ts",
package/reducers.d.ts CHANGED
@@ -260,6 +260,17 @@ export type AnimationConfig = {
260
260
  hideControl?: boolean;
261
261
  };
262
262
 
263
+ export type FilterAnimationConfig = Pick<
264
+ TimeRangeFilter,
265
+ | 'dataId'
266
+ | 'value'
267
+ | 'animationWindow'
268
+ | 'speed'
269
+ | 'syncedWithLayerTimeline'
270
+ | 'syncTimelineMode'
271
+ | 'timezone'
272
+ >;
273
+
263
274
  export type Timeline = {
264
275
  domain: [number, number] | null;
265
276
  value: number | [number, number];
@@ -344,6 +355,8 @@ export type CustomStyleType =
344
355
  // boolean for backwards compatability with previous map configs
345
356
  | boolean;
346
357
 
358
+ export type BaseMapColorModes = 'NONE' | 'DARK' | 'LIGHT';
359
+
347
360
  export type BaseMapStyle = {
348
361
  id: string;
349
362
  label: string;
@@ -353,7 +366,7 @@ export type BaseMapStyle = {
353
366
  layerGroups: LayerGroup[];
354
367
  accessToken?: string;
355
368
  custom?: CustomStyleType;
356
- colorMode?: BASE_MAP_COLOR_MODES;
369
+ colorMode?: BaseMapColorModes;
357
370
  complimentaryStyleId?: string;
358
371
  };
359
372
 
package/schemas.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  import {RGBColor, Merge, RequireFrom} from './types';
5
5
 
6
- import {Filter, TooltipInfo, AnimationConfig, SplitMap, Feature} from './reducers';
6
+ import {Filter, InteractionConfig, AnimationConfig, SplitMap, Feature} from './reducers';
7
7
 
8
8
  import {LayerTextLabel} from './layers';
9
9
 
@@ -30,16 +30,16 @@ export type MinSavedFilter = RequireFrom<SavedFilter, 'dataId' | 'id' | 'name' |
30
30
  export type ParsedFilter = SavedFilter | MinSavedFilter;
31
31
 
32
32
  export type SavedInteractionConfig = {
33
- tooltip: TooltipInfo['config'] & {
33
+ tooltip: InteractionConfig['tooltip']['config'] & {
34
34
  enabled: boolean;
35
35
  };
36
- geocoder: TooltipInfo['geocoder'] & {
36
+ geocoder: {
37
37
  enabled: boolean;
38
38
  };
39
- brush: TooltipInfo['brush'] & {
39
+ brush: InteractionConfig['brush']['config'] & {
40
40
  enabled: boolean;
41
41
  };
42
- coordinate: TooltipInfo['coordinate'] & {
42
+ coordinate: {
43
43
  enabled: boolean;
44
44
  };
45
45
  };
@@ -133,6 +133,18 @@ export type ParsedVisState = {
133
133
  animationConfig?: Partial<SavedAnimationConfig>;
134
134
  };
135
135
 
136
+ export type ParsedUiState = {
137
+ mapControls: {
138
+ mapLegend: {
139
+ active: boolean;
140
+ settings: {
141
+ position: string;
142
+ contentHeight: number;
143
+ };
144
+ };
145
+ };
146
+ };
147
+
136
148
  export type SavedMapState = {
137
149
  bearing: number;
138
150
  dragRotate: boolean;
@@ -200,6 +212,7 @@ export type ParsedConfig = {
200
212
  visState?: ParsedVisState;
201
213
  mapState?: ParsedMapState;
202
214
  mapStyle?: ParsedMapStyle;
215
+ uiState?: ParsedUiState;
203
216
  };
204
217
 
205
218
  export type SavedField = {