@kepler.gl/types 3.0.0-alpha.0 → 3.0.0-alpha.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.
package/actions.d.ts CHANGED
@@ -1,4 +1,7 @@
1
- import {SavedMap, ParsedConfig} from './schemas';
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright contributors to the kepler.gl project
3
+
4
+ import {SavedMap, ParsedConfig, SavedConfigV1, MinSavedConfigV1} from './schemas';
2
5
 
3
6
  /** EXPORT_FILE_TO_CLOUD */
4
7
  export type MapData = {
@@ -42,9 +45,11 @@ export type ProtoDataset = {
42
45
  type?: string;
43
46
  format?: string;
44
47
  displayName?: string;
48
+ analyzerType?: string;
45
49
  id?: string;
46
50
  }[];
47
51
  rows: any[][];
52
+ cols?: any[];
48
53
  };
49
54
 
50
55
  // table-injected metadata
@@ -58,6 +63,7 @@ export type AddDataToMapOptions = {
58
63
  readOnly?: boolean;
59
64
  keepExistingConfig?: boolean;
60
65
  autoCreateLayers?: boolean;
66
+ autoCreateTooltips?: boolean;
61
67
  };
62
68
 
63
69
  export type AddDataToMapPayload = {
@@ -67,6 +73,6 @@ export type AddDataToMapPayload = {
67
73
  // as the field is called `datasets`
68
74
  datasets: ProtoDataset[] | ProtoDataset;
69
75
  options?: AddDataToMapOptions;
70
- config?: ParsedConfig;
76
+ config?: ParsedConfig | SavedConfigV1 | MinSavedConfigV1;
71
77
  info?: Partial<MapInfo>;
72
78
  };
@@ -0,0 +1,33 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright contributors to the kepler.gl project
3
+
4
+ export type TimeLabelFormat = {
5
+ id: string;
6
+ format: string | null;
7
+ type: string;
8
+ label: string;
9
+ };
10
+
11
+ type TooltipFields = {
12
+ format?: string;
13
+ id?: string;
14
+ name?: string;
15
+ fieldIdx?: number;
16
+ type?: string;
17
+ displayFormat?: string;
18
+ displayName: string;
19
+ };
20
+
21
+ export type ColMetaProps = {
22
+ colIdx: number;
23
+ name: string;
24
+ displayName: string;
25
+ type: string;
26
+ format?: string;
27
+ columnStats?: any;
28
+ displayFormat?: string;
29
+ };
30
+
31
+ export type ColMeta = {
32
+ [key: string]: ColMetaProps;
33
+ };
package/effects.d.ts ADDED
@@ -0,0 +1,49 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright contributors to the kepler.gl project
3
+
4
+ type EffectParameterDescription = {
5
+ name: string;
6
+ type?: 'number' | 'array' | 'color';
7
+ label?: string | false | (string | false)[];
8
+ min: number;
9
+ max: number;
10
+ defaultValue?: number | number[];
11
+ };
12
+
13
+ export type EffectDescription = {
14
+ type: string;
15
+ name: string;
16
+ parameters: EffectParameterDescription[];
17
+ };
18
+
19
+ export type EffectUpdateProps = {
20
+ isEnabled: boolean;
21
+ isConfigActive: boolean;
22
+ isJsonEditorActive: boolean;
23
+ // effect specific parameters for a deck.gl effect (uniforms)
24
+ parameters: {[key: string]: any};
25
+ };
26
+
27
+ export type EffectProps = EffectUpdateProps & {
28
+ id: string;
29
+ type: string;
30
+ };
31
+
32
+ export type EffectPropsPartial = Partial<EffectProps>;
33
+
34
+ export interface Effect {
35
+ id: string;
36
+ type: string;
37
+ isEnabled: boolean;
38
+ isConfigActive: boolean;
39
+ isJsonEditorActive: boolean;
40
+ // effect specific parameters for a deck.gl effect (uniforms)
41
+ parameters: {[key: string]: any};
42
+ deckEffect: any;
43
+ _uiConfig: EffectParameterDescription[];
44
+
45
+ getDefaultProps(props: Partial<EffectProps>): EffectProps;
46
+ setProps(props: Partial<EffectProps>): void;
47
+ isValidToSave(): boolean;
48
+ getParameterDescriptions(): EffectParameterDescription[];
49
+ }
package/index.d.ts CHANGED
@@ -1,5 +1,10 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright contributors to the kepler.gl project
3
+
1
4
  export * from './layers';
2
5
  export * from './reducers';
3
6
  export * from './actions';
4
7
  export * from './schemas';
5
8
  export * from './types';
9
+ export * from './components';
10
+ export * from './effects';
package/layers.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright contributors to the kepler.gl project
3
+
1
4
  export type LayerBaseConfig = {
2
5
  dataId: string | null;
3
6
  label: string;
@@ -68,6 +71,7 @@ export type Field = {
68
71
  valueAccessor(v: {index: number}): any;
69
72
  filterProps?: any;
70
73
  metadata?: any;
74
+ displayFormat?: string;
71
75
  };
72
76
 
73
77
  export type FieldPair = {
@@ -84,10 +88,14 @@ export type FieldPair = {
84
88
  export type LayerTextLabel = {
85
89
  field: Field | null;
86
90
  color: RGBColor;
91
+ background: boolean;
87
92
  size: number;
88
93
  offset: [number, number];
89
94
  anchor: string;
90
95
  alignment: string;
96
+ outlineWidth: number;
97
+ outlineColor: RGBAColor;
98
+ backgroundColor: RGBAColor;
91
99
  };
92
100
 
93
101
  export type ColorUI = {
@@ -204,6 +212,7 @@ export type LayerVisConfigSettings = {
204
212
  wireframe: VisConfigBoolean;
205
213
  weight: VisConfigNumber;
206
214
  heatmapRadius: VisConfigNumber;
215
+ darkBaseMapEnabled: VisConfigBoolean;
207
216
  };
208
217
 
209
218
  // TODO: Move this to individual layers
@@ -244,6 +253,7 @@ export type LayerVisConfig = {
244
253
  // extruded: boolean;
245
254
  // wireframe: boolean;
246
255
  // weight: number;
256
+ // scenegraph: VisConfig;
247
257
  };
248
258
 
249
259
  export type TextConfigSelect = {
@@ -263,6 +273,7 @@ export type TextConfigNumber = {
263
273
  };
264
274
  export type LayerTextConfig = {
265
275
  fontSize: TextConfigNumber;
276
+ outlineWidth: TextConfigNumber;
266
277
  textAnchor: TextConfigSelect;
267
278
  textAlignment: TextConfigSelect;
268
279
  };
package/package.json CHANGED
@@ -1,39 +1,39 @@
1
1
  {
2
- "name": "@kepler.gl/types",
3
- "author": "Shan He <shan@uber.com>",
4
- "version": "3.0.0-alpha.0",
5
- "description": "kepler.gl types used by kepler.gl components, actions and reducers",
6
- "license": "MIT",
7
- "types": "index.d.ts",
8
- "keywords": [
9
- "babel",
10
- "es6",
11
- "react",
12
- "webgl",
13
- "visualization",
14
- "deck.gl"
15
- ],
16
- "repository": {
17
- "type": "git",
18
- "url": "https://github.com/keplergl/kepler.gl.git"
19
- },
20
- "scripts": {
21
- "prepublish": " ",
22
- "stab": " "
23
- },
24
- "nyc": {
25
- "sourceMap": false,
26
- "instrument": false
27
- },
28
- "engines": {
29
- "node": ">=12.0.0"
30
- },
31
- "maintainers": [
32
- "Shan He <heshan0131@gmail.com>",
33
- "Giuseppe Macri <gmacri@uber.com>"
34
- ],
35
- "volta": {
36
- "node": "12.22.0",
37
- "yarn": "1.22.17"
38
- }
2
+ "name": "@kepler.gl/types",
3
+ "author": "Shan He <shan@uber.com>",
4
+ "version": "3.0.0-alpha.2",
5
+ "description": "kepler.gl types used by kepler.gl components, actions and reducers",
6
+ "license": "MIT",
7
+ "types": "index.d.ts",
8
+ "keywords": [
9
+ "babel",
10
+ "es6",
11
+ "react",
12
+ "webgl",
13
+ "visualization",
14
+ "deck.gl"
15
+ ],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/keplergl/kepler.gl.git"
19
+ },
20
+ "scripts": {
21
+ "prepublish": " ",
22
+ "stab": " "
23
+ },
24
+ "nyc": {
25
+ "sourceMap": false,
26
+ "instrument": false
27
+ },
28
+ "engines": {
29
+ "node": ">=18.18.2"
30
+ },
31
+ "maintainers": [
32
+ "Shan He <heshan0131@gmail.com>",
33
+ "Giuseppe Macri <gmacri@uber.com>"
34
+ ],
35
+ "volta": {
36
+ "node": "18.18.2",
37
+ "yarn": "1.22.17"
38
+ }
39
39
  }
package/reducers.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright contributors to the kepler.gl project
3
+
1
4
  import {Field, Millisecond} from './types';
2
5
 
3
6
  export type MapState = {
@@ -9,9 +12,21 @@ export type MapState = {
9
12
  dragRotate: boolean;
10
13
  width: number;
11
14
  height: number;
12
- isSplit: boolean;
15
+ minZoom?: number;
16
+ maxZoom?: number;
17
+ maxBounds?: Bounds;
13
18
  initialState?: any;
14
19
  scale?: number;
20
+
21
+ // the following 4 properties assist with split viewports that can optionally have (un)synced viewports and zooms
22
+ /** Is the application split into 2 maps? */
23
+ isSplit: boolean;
24
+ /** Are the 2 split maps having synced viewports? */
25
+ isViewportSynced: boolean;
26
+ /** If split, are the zooms locked to each other or independent? */
27
+ isZoomLocked: boolean;
28
+ /** An array of either 0 or 2 Viewport objects (index 0 for left map; index 1 for right map) */
29
+ splitMapViewports: Viewport[];
15
30
  };
16
31
 
17
32
  export type Bounds = [number, number, number, number];
@@ -61,15 +76,18 @@ export type LineChart = {
61
76
  xDomain: [number, number];
62
77
  };
63
78
 
79
+ type FilterViewType = 'side' | 'enlarged' | 'minified';
80
+
64
81
  export type FilterBase<L extends LineChart> = {
65
82
  dataId: string[];
66
83
  id: string;
84
+ enabled: boolean;
67
85
 
68
86
  freeze: boolean;
69
87
 
70
88
  // time range filter specific
71
89
  fixedDomain: boolean;
72
- enlarged: boolean;
90
+ view: FilterViewType;
73
91
  isAnimating: boolean;
74
92
  speed: number;
75
93
  showTimeDisplay?: boolean;
@@ -113,10 +131,11 @@ export type SelectFilter = FilterBase<LineChart> &
113
131
 
114
132
  export type MultiSelectFilter = FilterBase<LineChart> &
115
133
  MultiSelectFieldDomain & {
116
- type: 'range';
134
+ type: 'multiSelect';
117
135
  fieldType: 'string' | 'date';
118
136
  value: string[];
119
137
  };
138
+
120
139
  export type TimeRangeFilter = FilterBase<LineChart> &
121
140
  TimeRangeFieldDomain & {
122
141
  type: 'timeRange';
@@ -152,6 +171,12 @@ export type Feature = {
152
171
  type: string;
153
172
  coordinates: any;
154
173
  };
174
+ type?: string;
175
+ };
176
+ export type FeatureSelectionContext = {
177
+ rightClick: boolean;
178
+ position: {x: number; y: number};
179
+ mapIndex?: number;
155
180
  };
156
181
  export type FeatureValue = {
157
182
  id: string;
@@ -167,28 +192,50 @@ export type Editor = {
167
192
  mode: string;
168
193
  features: Feature[];
169
194
  selectedFeature: any;
195
+ selectionContext?: FeatureSelectionContext;
170
196
  visible: boolean;
171
197
  };
172
198
 
173
199
  export type SplitMapLayers = {[key: string]: boolean};
174
200
  export type SplitMap = {
201
+ id?: string;
175
202
  layers: SplitMapLayers;
176
203
  };
204
+
205
+ /** See "Locale aware formats" at https://momentjs.com/docs/#/parsing/string-format/ */
206
+ export type AnimationConfigTimeFormat = 'L' | 'L LT' | 'L LTS';
207
+
177
208
  export type AnimationConfig = {
178
209
  domain: number[] | null;
179
210
  currentTime: number | null;
180
211
  speed: number;
212
+ duration?: number | null;
181
213
  isAnimating?: boolean;
214
+ timeSteps?: null | number[];
182
215
  // auto generated based on time domain
183
- defaultTimeFormat?: string | null;
216
+ defaultTimeFormat: AnimationTimeFormat | null;
184
217
  // custom ui input
185
- timeFormat?: string | null;
218
+ timeFormat?: AnimationTimeFormat | null;
186
219
  // custom ui input
187
220
  timezone?: string | null;
188
221
  // hide or show control
189
222
  hideControl?: boolean;
190
223
  };
191
224
 
225
+ export type Timeline = {
226
+ domain: [number, number] | null;
227
+ value: number | [number, number];
228
+ speed: number;
229
+ isAnimating: boolean;
230
+ step?: null | number;
231
+ timeSteps?: null | number[];
232
+ defaultTimeFormat?: null | string;
233
+ timeFormat?: null | string;
234
+ timezone?: null | string;
235
+ animationWindow?: null | Filter['animationWindow'];
236
+ marks?: null | number[];
237
+ } & Record<string, any>;
238
+
192
239
  export type BaseInteraction = {
193
240
  label: string;
194
241
  enabled: boolean;
@@ -252,6 +299,12 @@ export type LayerGroup = {
252
299
  defaultVisibility: boolean;
253
300
  };
254
301
 
302
+ export type CustomStyleType =
303
+ | 'LOCAL'
304
+ | 'MANAGED'
305
+ // boolean for backwards compatability with previous map configs
306
+ | boolean;
307
+
255
308
  export type BaseMapStyle = {
256
309
  id: string;
257
310
  label: string;
@@ -260,7 +313,9 @@ export type BaseMapStyle = {
260
313
  style?: Object;
261
314
  layerGroups: LayerGroup[];
262
315
  accessToken?: string;
263
- custom?: boolean;
316
+ custom?: CustomStyleType;
317
+ colorMode?: BASE_MAP_COLOR_MODES;
318
+ complimentaryStyleId?: string;
264
319
  };
265
320
 
266
321
  export declare type ExportImage = {
@@ -302,19 +357,20 @@ export type ExportMap = {
302
357
  format: 'HTML' | 'JSON';
303
358
  };
304
359
 
305
- export type MapControl = {
360
+ export type MapControlItem = {
306
361
  show: boolean;
307
362
  active: boolean;
308
363
  disableClose?: boolean;
309
364
  activeMapIndex?: number;
310
365
  };
311
366
  export type MapControls = {
312
- visibleLayers?: MapControl;
313
- mapLegend?: MapControl;
314
- toggle3d?: MapControl;
315
- splitMap?: MapControl;
316
- mapDraw?: MapControl;
317
- mapLocale?: MapControl;
367
+ visibleLayers?: MapControlItem;
368
+ mapLegend?: MapControlItem;
369
+ toggle3d?: MapControlItem;
370
+ splitMap?: MapControlItem;
371
+ mapDraw?: MapControlItem;
372
+ mapLocale?: MapControlItem;
373
+ effect?: MapControlItem;
318
374
  };
319
375
 
320
376
  export type LoadFiles = {
@@ -332,11 +388,11 @@ export type Notifications = {
332
388
 
333
389
  export type Locale = string;
334
390
 
335
- export type LayerPanelListView = 'list' | 'sortByDataset';
391
+ export type PanelListView = string;
336
392
 
337
393
  export type UiState = {
338
394
  readOnly: boolean;
339
- activeSidePanel: string;
395
+ activeSidePanel: string | null;
340
396
  currentModal: string | null;
341
397
  datasetKeyToRemove: string | null;
342
398
  visibleDropdown: string | null;
@@ -354,7 +410,12 @@ export type UiState = {
354
410
  loadFiles: LoadFiles;
355
411
  // Locale of the UI
356
412
  locale: Locale;
357
- layerPanelListView: LayerPanelListView;
413
+ // view layers by list or dataset
414
+ layerPanelListView: PanelListView;
415
+ // view filters by list or dataset
416
+ filterPanelListView: PanelListView;
417
+ // side panel close button visibility
418
+ isSidePanelCloseButtonVisible: boolean | null;
358
419
  };
359
420
 
360
421
  /** Width of viewport */
@@ -375,6 +436,12 @@ export type Viewport = {
375
436
  longitude?: number;
376
437
  /** Whether to enable drag and rotate map into perspective viewport */
377
438
  dragRotate?: boolean;
439
+ /** Minimum allowed viewport zoom */
440
+ minZoom?: number;
441
+ /** Maximum allowed viewport zoom */
442
+ maxZoom?: number;
443
+ /** Maximum geographical bounds, pan/zoom operations are constrained within those bounds */
444
+ maxBounds?: Bounds;
378
445
  };
379
446
 
380
447
  export type MapStyles = {
@@ -386,6 +453,7 @@ export type VisibleLayerGroups = {
386
453
  };
387
454
 
388
455
  export type InputStyle = {
456
+ id?: string | null;
389
457
  accessToken: string | null;
390
458
  error: boolean;
391
459
  isValid: boolean;
@@ -393,7 +461,8 @@ export type InputStyle = {
393
461
  style: any | null;
394
462
  url: string | null;
395
463
  icon: string | null;
396
- custom: boolean;
464
+ custom: CustomStyleType;
465
+ uploadedFile: File | null;
397
466
  };
398
467
 
399
468
  export type FilterRecord = {
@@ -409,3 +478,57 @@ export type FilterDatasetOpt = {
409
478
  // ignore filter for domain calculation
410
479
  ignoreDomain?: boolean;
411
480
  };
481
+
482
+ /* DUPLICATES OF FILTER TYPES ABOVE, REMOVE ONCE TYPES ABOVE ARE FIXED */
483
+
484
+ type FilterBaseOmitRedudant = Omit<FilterBase<LineChart>, 'type' | 'domain'>;
485
+
486
+ export type TypedRangeFilter = FilterBaseOmitRedudant &
487
+ RangeFieldDomain & {
488
+ type: 'range';
489
+ fieldType: 'real' | 'integer';
490
+ value: [number, number];
491
+ fixedDomain: true;
492
+ typeOptions: ['range'];
493
+ };
494
+
495
+ export type TypedSelectFilter = FilterBaseOmitRedudant &
496
+ SelectFieldDomain & {
497
+ type: 'select';
498
+ fieldType: 'boolean';
499
+ value: boolean;
500
+ };
501
+
502
+ export type TypedMultiSelectFilter = FilterBaseOmitRedudant &
503
+ MultiSelectFieldDomain & {
504
+ type: 'multiSelect';
505
+ fieldType: 'string' | 'date';
506
+ value: string[];
507
+ };
508
+
509
+ export type TypedTimeRangeFilter = FilterBaseOmitRedudant &
510
+ TimeRangeFieldDomain & {
511
+ type: 'timeRange';
512
+ fieldType: 'timestamp';
513
+ fixedDomain: true;
514
+ value: [number, number];
515
+ bins?: Object;
516
+ plotType: {
517
+ [key: string]: any;
518
+ };
519
+ animationWindow: string;
520
+ };
521
+
522
+ export type TypedPolygonFilter = FilterBaseOmitRedudant & {
523
+ layerId: string[];
524
+ type: 'polygon';
525
+ fixedDomain: true;
526
+ value: Feature;
527
+ };
528
+
529
+ export type TypedFilter =
530
+ | TypedRangeFilter
531
+ | TypedTimeRangeFilter
532
+ | TypedSelectFilter
533
+ | TypedMultiSelectFilter
534
+ | TypedPolygonFilter;
package/schemas.d.ts CHANGED
@@ -1,6 +1,16 @@
1
- import {RGBColor, Merge, RGBAColor} from './types';
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright contributors to the kepler.gl project
2
3
 
3
- import {Filter, TooltipInfo, InteractionConfig, AnimationConfig, SplitMap} from './reducers';
4
+ import {RGBColor, Merge, RGBAColor, RequireFrom} from './types';
5
+
6
+ import {
7
+ Filter,
8
+ TooltipInfo,
9
+ InteractionConfig,
10
+ AnimationConfig,
11
+ SplitMap,
12
+ Feature
13
+ } from './reducers';
4
14
 
5
15
  import {LayerTextLabel} from './layers';
6
16
 
@@ -10,7 +20,9 @@ export type SavedFilter = {
10
20
  name: Filter['name'];
11
21
  type: Filter['type'];
12
22
  value: Filter['value'];
13
- enlarged: Filter['enlarged'];
23
+ // deprecated
24
+ enlarged?: Filter['enlarged'];
25
+ view?: Filter['view'];
14
26
  plotType: Filter['plotType'];
15
27
  yAxis: {
16
28
  name: string;
@@ -19,8 +31,8 @@ export type SavedFilter = {
19
31
  speed: Filter['speed'];
20
32
  layerId: Filter['layerId'];
21
33
  };
22
-
23
- export type ParsedFilter = Partial<SavedFilter>;
34
+ export type MinSavedFilter = RequireFrom<SavedFilter, 'dataId' | 'id' | 'name' | 'type' | 'value'>;
35
+ export type ParsedFilter = SavedFilter | MinSavedFilter;
24
36
 
25
37
  export type SavedInteractionConfig = {
26
38
  tooltip: TooltipInfo['config'] & {
@@ -54,38 +66,73 @@ export type SavedLayer = {
54
66
  [key: string]: string;
55
67
  };
56
68
  isVisible: boolean;
57
- visConfig: object;
69
+ visConfig: Record<string, any>;
58
70
  hidden: boolean;
59
71
  textLabel: Merge<LayerTextLabel, {field: {name: string; type: string} | null}>;
60
72
  };
61
73
  visualChannels: SavedVisualChannels;
62
74
  };
75
+ export type MinSavedLayerConfig = RequireFrom<SavedLayer['config'], 'dataId' | 'columns'>;
76
+ export type MinSavedLayer = {
77
+ id: string;
78
+ type: string;
79
+ config: MinSavedLayerConfig;
80
+ visualChannels?: SavedVisualChannels;
81
+ };
82
+ export type ParsedLayer = SavedLayer | MinSavedLayer;
63
83
 
64
- export type ParsedLayer = {
65
- id?: string;
66
- type?: string;
67
- config?: Partial<SavedLayer['config']>;
84
+ export type ParsedEffect = {
85
+ id: string;
86
+ type: string;
87
+ isEnabled: boolean;
88
+ parameters: Record<string, number | [number, number] | {value: number}>;
68
89
  };
69
90
 
91
+ export type SavedEffect = ParsedEffect;
92
+
70
93
  export type SavedAnimationConfig = {
71
94
  currentTime: AnimationConfig['currentTime'];
72
95
  speed: AnimationConfig['speed'];
73
96
  };
74
97
 
98
+ export type SavedEditor = {
99
+ features: Feature[];
100
+ visible: boolean;
101
+ };
102
+
75
103
  export type SavedVisState = {
76
104
  filters: SavedFilter[];
77
105
  layers: SavedLayer[];
106
+ effects: SavedEffect[];
78
107
  interactionConfig: SavedInteractionConfig;
79
108
  layerBlending: string;
109
+ overlayBlending?: string;
80
110
  splitMaps: SplitMap[];
81
111
  animationConfig: SavedAnimationConfig;
112
+ editor?: SavedEditor;
113
+ };
114
+
115
+ // Min saved config can be passed to addDataToMap
116
+ export type MinSavedVisStateV1 = {
117
+ filters?: MinSavedFilter[];
118
+ layers?: MinSavedLayer[];
119
+ effects?: SavedEffect[];
120
+ interactionConfig?: Partial<SavedInteractionConfig>;
121
+ layerBlending?: string;
122
+ overlayBlending?: string;
123
+ splitMaps?: SplitMap[];
124
+ animationConfig?: SavedAnimationConfig;
125
+ editor?: SavedEditor;
82
126
  };
83
127
 
84
128
  export type ParsedVisState = {
85
129
  layers?: ParsedLayer[];
130
+ effects?: ParsedEffect[];
86
131
  filters?: ParsedFilter[];
132
+ effects?: ParsedEffect[];
87
133
  interactionConfig?: Partial<SavedInteractionConfig>;
88
134
  layerBlending?: string;
135
+ overlayBlending?: string;
89
136
  splitMaps?: SplitMap[];
90
137
  animationConfig?: Partial<SavedAnimationConfig>;
91
138
  };
@@ -100,13 +147,17 @@ export type SavedMapState = {
100
147
  isSplit: boolean;
101
148
  };
102
149
 
150
+ export type SavedMapStateV1 = SavedMapState;
151
+ export type MinSavedMapStateV1 = Partial<SavedMapState>;
152
+ export type ParsedMapState = Partial<SavedMapState>;
153
+
103
154
  export type SavedLayerGroups = {
104
155
  [key: string]: boolean;
105
156
  };
106
157
 
107
158
  export type SavedCustomMapStyle = {
108
159
  [key: string]: {
109
- accessToken: string;
160
+ accessToken?: string;
110
161
  custom: boolean;
111
162
  icon: string;
112
163
  id: string;
@@ -123,6 +174,11 @@ export type SavedMapStyle = {
123
174
  mapStyles: SavedCustomMapStyle;
124
175
  };
125
176
 
177
+ export type SavedMapStyleV1 = SavedMapStyle;
178
+ export type MinSavedMapStyleV1 = Partial<SavedMapStyleV1>;
179
+
180
+ export type ParsedMapStyle = Partial<SavedMapStyleV1>;
181
+
126
182
  /** Schema for v1 saved configuration */
127
183
  export type SavedConfigV1 = {
128
184
  version: 'v1';
@@ -133,12 +189,21 @@ export type SavedConfigV1 = {
133
189
  };
134
190
  };
135
191
 
192
+ // supported by addDataToMap
193
+ export type MinSavedConfigV1 = {
194
+ version: 'v1';
195
+ config: {
196
+ visState?: MinSavedVisStateV1;
197
+ mapState?: MinSavedMapStateV1;
198
+ mapStyle?: MinSavedMapStyleV1;
199
+ };
200
+ };
201
+
136
202
  /** Schema for a parsed configuration ("normalized" across versions) */
137
203
  export type ParsedConfig = {
138
- version: string;
139
204
  visState?: ParsedVisState;
140
- mapState?: Partial<SavedMapState>;
141
- mapStyle?: Partial<SavedMapStyle>;
205
+ mapState?: ParsedMapState;
206
+ mapStyle?: ParsedMapStyle;
142
207
  };
143
208
 
144
209
  export type SavedField = {
package/types.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright contributors to the kepler.gl project
3
+
1
4
  export type RGBColor = [number, number, number];
2
5
  export type RGBAColor = [number, number, number, number];
3
6
  export type HexColor = string; // this is the best typescript can do at the moment
@@ -9,6 +12,8 @@ export type Merge<A, B> = {[K in keyof A]: K extends keyof B ? B[K] : A[K]} & B
9
12
  ? {[K in keyof O]: O[K]}
10
13
  : never;
11
14
 
15
+ export type RequireFrom<T, K extends keyof T> = Merge<Required<Pick<T, K>>, Partial<Omit<T, K>>>;
16
+
12
17
  export type Entries<T> = {
13
18
  [K in keyof T]: [K, T[K]];
14
19
  }[keyof T][];
@@ -21,4 +26,10 @@ export type RowData = {
21
26
  [key: string]: string | null;
22
27
  }[];
23
28
 
24
- export type ProcessorResult = {fields: Field[]; rows: any[][]} | null;
29
+ export type ProcessorResult = {
30
+ info?: any;
31
+ fields: Field[];
32
+ rows: any[][];
33
+ cols?: any[];
34
+ metadata?: any;
35
+ } | null;