@kepler.gl/types 3.3.0-alpha.2 → 3.3.0-alpha.21

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
@@ -3,6 +3,7 @@
3
3
 
4
4
  import {SavedMap, ParsedConfig, SavedConfigV1, MinSavedConfigV1} from './schemas';
5
5
  import type {LayerVisConfig} from './layers';
6
+ import type {ViewportPadding} from './reducers';
6
7
 
7
8
  /** EXPORT_FILE_TO_CLOUD */
8
9
  export type MapData = {
@@ -13,6 +14,8 @@ export type ExportFileOptions = {
13
14
  isPublic?: boolean;
14
15
  overwrite?: boolean;
15
16
  mapIdToOverwrite?: string | null;
17
+ /** Download name, without extension. Separate from the map title. */
18
+ fileName?: string;
16
19
  };
17
20
  export type OnErrorCallBack = (error: Error) => any;
18
21
  export type OnSuccessCallBack = (p: {
@@ -42,6 +45,20 @@ export type ProtoDatasetField = {
42
45
  id?: string;
43
46
  metadata?: Record<string, any>;
44
47
  };
48
+
49
+ export type GeoArrowBinaryData = Record<
50
+ number,
51
+ Record<
52
+ number,
53
+ {
54
+ binaryGeometries: any[];
55
+ bounds: [number, number, number, number];
56
+ featureTypes: {point: boolean; line: boolean; polygon: boolean};
57
+ meanCenters?: Array<number[] | null>;
58
+ }
59
+ >
60
+ >;
61
+
45
62
  export type ProtoDataset = {
46
63
  info: {
47
64
  id?: string;
@@ -56,6 +73,10 @@ export type ProtoDataset = {
56
73
  rows: any[][];
57
74
  cols?: any[];
58
75
  arrowTable?: arrow.Table;
76
+ /** GeoArrow chunks already converted to deck.gl binary features on workers. */
77
+ geoArrowBinaryData?: GeoArrowBinaryData;
78
+ /** Existing table in the configured DuckDB database; avoids re-importing its rows. */
79
+ duckdbTableName?: string;
59
80
  };
60
81
 
61
82
  // table-injected metadata
@@ -66,6 +87,12 @@ export type ProtoDataset = {
66
87
 
67
88
  export type AddDataToMapOptions = {
68
89
  centerMap?: boolean;
90
+ /**
91
+ * Padding in pixels applied when `centerMap` is true.
92
+ * Use this so a few points are not hidden under the side panel or other UI.
93
+ * A number applies the same padding on all sides.
94
+ */
95
+ padding?: ViewportPadding;
69
96
  readOnly?: boolean;
70
97
  keepExistingConfig?: boolean;
71
98
  autoCreateLayers?: boolean;
package/annotations.d.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  // Copyright contributors to the kepler.gl project
3
3
 
4
- import {AnnotationKind} from '@kepler.gl/constants';
4
+ import {
5
+ AnnotationKind,
6
+ AnnotationTextSide,
7
+ AnnotationTextVerticalPosition
8
+ } from '@kepler.gl/constants';
5
9
 
6
10
  export {AnnotationKind} from '@kepler.gl/constants';
7
11
  export {isAnnotationKind, isAnnotationWithArm} from '@kepler.gl/constants';
@@ -12,7 +16,8 @@ export type BaseAnnotation = {
12
16
  isVisible: boolean;
13
17
  autoSize: boolean;
14
18
  autoSizeY: boolean;
15
- anchorPoint: [number, number];
19
+ /** [lng, lat] or [lng, lat, altitudeMeters]. Missing altitude is treated as 0. */
20
+ anchorPoint: [number, number] | [number, number, number];
16
21
  label: string;
17
22
  editorState?: Record<string, any>;
18
23
  mapIndex?: number;
@@ -21,6 +26,8 @@ export type BaseAnnotation = {
21
26
  textWidth: number;
22
27
  textHeight: number;
23
28
  textVerticalAlign?: 'top' | 'middle' | 'bottom';
29
+ textSide?: AnnotationTextSide;
30
+ textVerticalPosition?: AnnotationTextVerticalPosition;
24
31
  };
25
32
 
26
33
  export type AnnotationWithArm = BaseAnnotation & {
@@ -45,6 +52,21 @@ export type CircleAnnotation = AnnotationWithArm & {
45
52
  radiusInMeters: number;
46
53
  };
47
54
 
48
- export type Annotation = TextAnnotation | PointAnnotation | ArrowAnnotation | CircleAnnotation;
55
+ export type RulerAnnotation = BaseAnnotation & {
56
+ kind: AnnotationKind.RULER;
57
+ /** Second [lng, lat] or [lng, lat, altitudeMeters] endpoint. */
58
+ endPoint: [number, number] | [number, number, number];
59
+ /** Whether the user-authored rich text is rendered at the ruler midpoint. */
60
+ showCustomText: boolean;
61
+ /** Whether the computed geodesic length is rendered at the ruler midpoint. */
62
+ showDistance: boolean;
63
+ };
64
+
65
+ export type Annotation =
66
+ | TextAnnotation
67
+ | PointAnnotation
68
+ | ArrowAnnotation
69
+ | CircleAnnotation
70
+ | RulerAnnotation;
49
71
 
50
72
  export type AnnotationPropsPartial = Partial<Annotation>;
package/camera.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright contributors to the kepler.gl project
3
+
4
+ /** A saved Mercator view, independent of viewport size and animation state. */
5
+ export type CameraSnapshot = {
6
+ longitude: number;
7
+ latitude: number;
8
+ zoom: number;
9
+ bearing: number;
10
+ pitch: number;
11
+ };
12
+
13
+ export type CameraBookmark = {
14
+ id: string;
15
+ name: string;
16
+ camera: CameraSnapshot;
17
+ };
18
+
19
+ /** Stops own their camera snapshots; there is no live bookmark reference. */
20
+ export type CameraTourStop = CameraBookmark & {
21
+ holdDurationMs: number;
22
+ /** Travel to the next stop; ignored for the final stop. */
23
+ travelDurationMs: number;
24
+ };
25
+
26
+ export type CameraTour = {
27
+ stops: CameraTourStop[];
28
+ };
package/charts.d.ts ADDED
@@ -0,0 +1,87 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright contributors to the kepler.gl project
3
+
4
+ export type ChartAggregation =
5
+ | 'count'
6
+ | 'sum'
7
+ | 'average'
8
+ | 'maximum'
9
+ | 'minimum'
10
+ | 'median'
11
+ | 'stdev'
12
+ | 'variance'
13
+ | 'p05'
14
+ | 'p25'
15
+ | 'p50'
16
+ | 'p75'
17
+ | 'p95'
18
+ | 'mode'
19
+ | 'countUnique';
20
+
21
+ export type ChartAxisField = {
22
+ name: string;
23
+ type: string;
24
+ };
25
+
26
+ export type ChartAxis = {
27
+ field: ChartAxisField | null;
28
+ aggregation: ChartAggregation | string | null;
29
+ title?: string | null;
30
+ /** Time binning period for timestamp/date axes: hour | day | week | month | year */
31
+ interval?: string | null;
32
+ };
33
+
34
+ export type ChartCrossFilter = {
35
+ enabled: boolean;
36
+ filterId: string;
37
+ fieldNames: Record<string, string>;
38
+ value: Record<string, string | number>;
39
+ };
40
+
41
+ export type BaseChartConfig = {
42
+ id: string;
43
+ title: string;
44
+ type: string;
45
+ dataId: string | null;
46
+ applyFilters: boolean;
47
+ /**
48
+ * When true, the chart stays visible on the map even if the charts panel
49
+ * control is inactive (similar to a pinned legend). Persisted in saved maps.
50
+ */
51
+ pinned?: boolean;
52
+ display: {
53
+ isConfigActive?: boolean;
54
+ isJsonEditorActive?: boolean;
55
+ };
56
+ crossFilter?: ChartCrossFilter;
57
+ };
58
+
59
+ export type DatasetChartConfig = BaseChartConfig & {
60
+ xAxis?: ChartAxis;
61
+ yAxis?: ChartAxis;
62
+ groupBy?: ChartAxis;
63
+ value?: ChartAxis;
64
+ axis?: ChartAxis;
65
+ numGroups?: number;
66
+ groupOthers?: boolean;
67
+ /** How bar/series colors are assigned. */
68
+ colorBy?: 'none' | 'category' | string;
69
+ chartDisplay: Record<string, any>;
70
+ };
71
+
72
+ export type LayerChartConfig = BaseChartConfig & {
73
+ type: 'layerChart';
74
+ layerId: string;
75
+ layerChartType: string;
76
+ axis?: ChartAxis;
77
+ xAxis?: ChartAxis;
78
+ yAxis?: ChartAxis;
79
+ chartDisplay: {
80
+ idField?: string | null;
81
+ numEntries?: number;
82
+ interval?: string;
83
+ format?: string;
84
+ };
85
+ };
86
+
87
+ export type ChartConfig = DatasetChartConfig | LayerChartConfig;
package/components.d.ts CHANGED
@@ -26,6 +26,7 @@ export type ColMetaProps = {
26
26
  format?: string;
27
27
  columnStats?: any;
28
28
  displayFormat?: string;
29
+ isLoadingStats?: boolean;
29
30
  };
30
31
 
31
32
  export type ColMeta = {
package/index.d.ts CHANGED
@@ -8,7 +8,9 @@ export * from './schemas';
8
8
  export * from './types';
9
9
  export * from './components';
10
10
  export * from './effects';
11
+ export * from './charts';
11
12
  export * from './annotations';
12
13
  export * from './datasets';
14
+ export * from './camera';
13
15
 
14
16
  export * as StacTypes from './stac';
package/layers.d.ts CHANGED
@@ -13,6 +13,8 @@ export type LayerBaseConfig = {
13
13
  isConfigActive: boolean;
14
14
  highlightColor: RGBColor | RGBAColor;
15
15
  hidden: boolean;
16
+ /** Omit from the map legend when false. Missing or true keeps the layer in the legend. */
17
+ isIncludedInLegend?: boolean;
16
18
 
17
19
  visConfig: LayerVisConfig;
18
20
  textLabel: LayerTextLabel[];
@@ -24,6 +26,10 @@ export type LayerBaseConfig = {
24
26
  animation: {
25
27
  enabled: boolean;
26
28
  domain?: [number, number] | null;
29
+ /** Discrete instants the layer can render, for layers without continuous time. */
30
+ timeSteps?: number[] | null;
31
+ startTime?: number | null;
32
+ duration?: number | null;
27
33
  };
28
34
 
29
35
  // for aggregate layer, aggregatedBins is returned for custom color scale
@@ -33,6 +39,9 @@ export type LayerBaseConfig = {
33
39
  heightField?: VisualChannelField;
34
40
  heightDomain?: VisualChannelDomain;
35
41
  heightScale?: string;
42
+ elevationOffsetField?: VisualChannelField;
43
+ elevationOffsetDomain?: VisualChannelDomain;
44
+ elevationOffsetScale?: string;
36
45
  };
37
46
 
38
47
  /**
@@ -62,11 +71,23 @@ export type EnhancedFieldPair = {
62
71
  pair: FieldPair['pair'];
63
72
  };
64
73
 
74
+ export type ColumnGroup = {
75
+ key: string;
76
+ label: string;
77
+ /** Column keys shown when this group is active (mutually exclusive with other groups). */
78
+ columns: string[];
79
+ };
80
+
65
81
  export type SupportedColumnMode = {
66
82
  key: string;
67
83
  label: string;
68
84
  requiredColumns: string[];
69
85
  optionalColumns?: string[];
86
+ /**
87
+ * Optional mutually exclusive column sets rendered as tabs
88
+ * (e.g. Lat/Lng vs GeoJSON position source).
89
+ */
90
+ columnGroups?: ColumnGroup[];
70
91
  hasHelp?: boolean;
71
92
  verifyField?: (field: Field) => boolean;
72
93
  };
@@ -90,6 +111,11 @@ export type LayerHeightConfig = {
90
111
  heightDomain: VisualChannelDomain;
91
112
  heightScale: VisualChannelScale;
92
113
  };
114
+ export type LayerElevationOffsetConfig = {
115
+ elevationOffsetField: VisualChannelField;
116
+ elevationOffsetDomain: VisualChannelDomain;
117
+ elevationOffsetScale: VisualChannelScale;
118
+ };
93
119
  export type LayerStrokeColorConfig = {
94
120
  strokeColorField: VisualChannelField;
95
121
  strokeColorDomain: VisualChannelDomain;
@@ -107,6 +133,8 @@ export type LayerRadiusConfig = {
107
133
  };
108
134
  export type LayerWeightConfig = {
109
135
  weightField: VisualChannelField;
136
+ weightDomain?: VisualChannelDomain;
137
+ weightScale?: VisualChannelScale;
110
138
  };
111
139
 
112
140
  export type IndexBy = {
@@ -169,6 +197,8 @@ export type LayerTextLabel = {
169
197
  outlineWidth: number;
170
198
  outlineColor: RGBAColor;
171
199
  backgroundColor: RGBAColor | null;
200
+ /** Hide labels that overlap other labels of the same field (GPU collision filter). */
201
+ collisionEnabled?: boolean;
172
202
  };
173
203
 
174
204
  export type ColorRangeConfig = {
@@ -236,6 +266,8 @@ export type VisConfig = {
236
266
  ) => boolean;
237
267
 
238
268
  allowCustomValue?: boolean;
269
+ /** Label for the custom-value edit button when allowCustomValue is true. */
270
+ customInputLabel?: string;
239
271
  };
240
272
 
241
273
  export type VisConfigNumber = VisConfig & {
@@ -290,6 +322,15 @@ export type VisConfigColorRange = VisConfig & {
290
322
  defaultValue: ColorRange;
291
323
  };
292
324
 
325
+ /**
326
+ * A plain JSON value whose keys are not known until runtime. The layer renders
327
+ * its own UI for it; the value is saved and restored with the rest of visConfig.
328
+ */
329
+ export type VisConfigObject = VisConfig & {
330
+ type: 'object';
331
+ defaultValue: Record<string, any>;
332
+ };
333
+
293
334
  export type LayerVisConfigTypes =
294
335
  | VisConfigBoolean
295
336
  | VisConfigNumber
@@ -298,6 +339,7 @@ export type LayerVisConfigTypes =
298
339
  | VisConfigColorSelect
299
340
  | VisConfigInput
300
341
  | VisConfigSelect
342
+ | VisConfigObject
301
343
  | VisConfigObjectSelection;
302
344
 
303
345
  export type LayerVisConfigSettings = {
@@ -311,6 +353,7 @@ export type LayerVisConfigSettings = {
311
353
  radiusRange: VisConfigRange;
312
354
  clusterRadius: VisConfigNumber;
313
355
  clusterRadiusRange: VisConfigRange;
356
+ minClusterSize: VisConfigNumber;
314
357
  opacity: VisConfigNumber;
315
358
  coverage: VisConfigNumber;
316
359
  outline: VisConfigBoolean;
@@ -327,6 +370,8 @@ export type LayerVisConfigSettings = {
327
370
  angle: VisConfigNumber;
328
371
  worldUnitSize: VisConfigNumber;
329
372
  elevationScale: VisConfigNumber;
373
+ elevationOffset: VisConfigNumber;
374
+ elevationOffsetRange: VisConfigRange;
330
375
  enableElevationZoomFactor: VisConfigBoolean;
331
376
  elevationRange: VisConfigRange;
332
377
  heightRange: VisConfigRange;
@@ -341,6 +386,8 @@ export type LayerVisConfigSettings = {
341
386
  heatmapRadius: VisConfigNumber;
342
387
  darkBaseMapEnabled: VisConfigBoolean;
343
388
  fixedHeight: VisConfigBoolean;
389
+ invertHeight: VisConfigBoolean;
390
+ fixedElevation: VisConfigBoolean;
344
391
  allowHover: VisConfigBoolean;
345
392
  showNeighborOnHover: VisConfigBoolean;
346
393
  showHighlightColor: VisConfigBoolean;
@@ -420,8 +467,10 @@ export type LayerTextConfig = {
420
467
  };
421
468
 
422
469
  export type LayerCallbacks = {
470
+ onLayerError?: (idx: number, error: Error) => void;
423
471
  onLayerHover?: (idx: number, value: any) => void;
424
472
  onSetLayerDomain?: (idx: number, value: any) => void;
473
+ onLayerVisConfigChange?: (idx: number, value: Partial<LayerVisConfig>) => void;
425
474
  onFilteredItemsChange?: (
426
475
  idx: number,
427
476
  event: {
@@ -438,18 +487,22 @@ export type LayerCallbacks = {
438
487
  ) => void;
439
488
  onRedrawNeeded?: (idx: number) => void;
440
489
  onFitBounds?: (idx: number, bounds: [number, number, number, number]) => void;
490
+ onTilesetLoadError?: (idx: number, kind: 'token' | 'generic' | null) => void;
441
491
  };
442
492
 
443
493
  export type BindedLayerCallbacks = {
494
+ onLayerError?: (error: Error) => void;
444
495
  onLayerHover?: (value: any) => void;
445
496
  onSetLayerDomain?: (value: any) => void;
497
+ onLayerVisConfigChange?: (value: Partial<LayerVisConfig>) => void;
446
498
  onFilteredItemsChange?: (event: {id: string; count: number}) => void;
447
- onWMSFeatureInfo?: (
448
- featureInfo: Array<{name: string; value: string}> | string | null,
449
- coordinate?: [number, number]
450
- ) => void;
499
+ onWMSFeatureInfo?: (props: {
500
+ featureInfo: Array<{name: string; value: string}> | string | null;
501
+ coordinate?: [number, number] | null;
502
+ }) => void;
451
503
  onRedrawNeeded?: () => void;
452
504
  onFitBounds?: (bounds: [number, number, number, number]) => void;
505
+ onTilesetLoadError?: (kind: 'token' | 'generic' | null) => void;
453
506
  };
454
507
 
455
508
  export type VisualChannelAggregation = 'colorAggregation' | 'sizeAggregation';
@@ -485,6 +538,8 @@ export type VisualChannel = {
485
538
 
486
539
  // TODO: define fixed
487
540
  fixed?: any;
541
+ // visConfig key that reverses this channel's scale output (e.g. invertHeight)
542
+ invert?: string;
488
543
 
489
544
  supportedFieldTypes?: Array<SupportedFieldTypes>;
490
545
 
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.3.0-alpha.2",
4
+ "version": "3.3.0-alpha.21",
5
5
  "description": "kepler.gl types used by kepler.gl components, actions and reducers",
6
6
  "license": "MIT",
7
7
  "types": "index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "node": ">=20"
36
36
  },
37
37
  "volta": {
38
- "node": "20.19.3",
38
+ "node": "24.21.0",
39
39
  "yarn": "4.4.0"
40
40
  },
41
41
  "packageManager": "yarn@4.4.0"
package/reducers.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  // Copyright contributors to the kepler.gl project
3
3
 
4
- import {Field, Millisecond} from './types';
5
- import {MapSplitMode} from '@kepler.gl/constants';
4
+ import {Field, Millisecond, RGBColor} from './types';
5
+ import {ColorMap, ColorRange, ColorUI} from './layers';
6
+ import {MapSplitMode, MapViewMode} from '@kepler.gl/constants';
6
7
  type MapViewState = {
7
8
  latitude: number;
8
9
  longitude: number;
@@ -29,6 +30,8 @@ export type MapState = {
29
30
  maxBounds?: Bounds;
30
31
  initialState?: any;
31
32
  scale?: number;
33
+ /** Layer rendering parameters forwarded from visState for use during layer construction in globe mode. */
34
+ layerParameters?: Record<string, string | boolean>;
32
35
 
33
36
  // the following 4 properties assist with split viewports that can optionally have (un)synced viewports and zooms
34
37
  /** Is the application split into 2 maps? */
@@ -39,6 +42,31 @@ export type MapState = {
39
42
  isZoomLocked: boolean;
40
43
  /** An array of either 0 or 2 Viewport objects (index 0 for left map; index 1 for right map) */
41
44
  splitMapViewports: Viewport[];
45
+ mapViewMode?: MapViewMode;
46
+ globe?: {
47
+ enabled: boolean;
48
+ config: {
49
+ atmosphere: boolean;
50
+ hugeHalo: boolean;
51
+ hugeHaloRadius: number;
52
+ hugeHaloOpacity: number;
53
+ azimuth: boolean;
54
+ azimuthAngle: number;
55
+ terminator: boolean;
56
+ terminatorOpacity: number;
57
+ basemap: boolean;
58
+ labels: boolean;
59
+ labelsColor: [number, number, number];
60
+ adminLines: boolean;
61
+ adminLinesColor: [number, number, number];
62
+ water: boolean;
63
+ waterColor: [number, number, number];
64
+ surfaceColor: [number, number, number];
65
+ surface: boolean;
66
+ backgroundColor: [number, number, number];
67
+ stars: boolean;
68
+ };
69
+ };
42
70
  /** The current split map mode (single, dual, swipe) */
43
71
  mapSplitMode: MapSplitMode;
44
72
  /** Swipe compare divider position as a percentage (0-100) */
@@ -47,6 +75,19 @@ export type MapState = {
47
75
 
48
76
  export type Bounds = [number, number, number, number];
49
77
 
78
+ /**
79
+ * Padding in pixels used when fitting the map viewport to bounds.
80
+ * A number applies the same padding on all sides.
81
+ */
82
+ export type ViewportPadding =
83
+ | number
84
+ | {
85
+ top?: number;
86
+ bottom?: number;
87
+ left?: number;
88
+ right?: number;
89
+ };
90
+
50
91
  export type RangeFieldDomain = {
51
92
  domain: number[];
52
93
  step: number;
@@ -85,16 +126,43 @@ export interface LineDatum {
85
126
  pct: number | null;
86
127
  }
87
128
 
129
+ export type LineChartSeries = {
130
+ lines: LineDatum[][];
131
+ markers: LineDatum[];
132
+ /** Stroke color for each line segment. Segments from one group share a color. */
133
+ colors?: string[];
134
+ /** Series name for each line segment. */
135
+ names?: string[];
136
+ };
137
+
138
+ export type LineChartGroupBy = {
139
+ fieldName: string;
140
+ numGroups: number | 'ALL';
141
+ groupOthers: boolean;
142
+ colors: string[] | null;
143
+ colorMap?: ColorMap | null;
144
+ };
145
+
146
+ export type PlotGroupBy = {
147
+ fieldName?: string;
148
+ numGroups: number | 'ALL';
149
+ groupOthers: boolean;
150
+ colorRange?: ColorRange;
151
+ colorUI?: ColorUI;
152
+ };
153
+
88
154
  export type LineChart = {
89
- series: {x: number; y: number}[];
155
+ series: {x: number; y: number}[] | LineChartSeries;
90
156
  yDomain: number[] | undefined[];
91
157
  xDomain: number[];
92
158
 
93
159
  // Is this a valid part of LineChart?
94
160
  aggregation: string;
95
- interval: string;
161
+ interval: string | number | null;
96
162
  yAxis: string;
97
- bins?: Bins;
163
+ bins?: Bins | Bin[];
164
+ /** Cache key for timeline series grouping. Null when the plot is a single series. */
165
+ groupBy?: LineChartGroupBy | null;
98
166
  };
99
167
 
100
168
  type FilterViewType = 'side' | 'enlarged' | 'minified';
@@ -103,11 +171,17 @@ export type FilterBase<L extends LineChart> = {
103
171
  dataId: string[];
104
172
  id: string;
105
173
  enabled: boolean;
174
+ /**
175
+ * When true, rows that match the filter are hidden and the rest are kept.
176
+ * Undefined is treated as false so older saved maps stay unchanged.
177
+ */
178
+ inverted?: boolean;
106
179
 
107
180
  // time range filter specific
108
181
  fixedDomain: boolean;
109
182
  view: FilterViewType;
110
183
  isAnimating: boolean;
184
+ animationWindow?: string;
111
185
  speed: number;
112
186
  showTimeDisplay?: boolean;
113
187
 
@@ -128,8 +202,14 @@ export type FilterBase<L extends LineChart> = {
128
202
  // gpu filter
129
203
  gpu: boolean;
130
204
  gpuChannel?: number[];
205
+ gpuEndChannel?: number[];
131
206
  fieldType?: string;
132
207
 
208
+ // Optional end timestamp for duration-based time filters (parallel to name/fieldIdx)
209
+ endName?: (string | null | undefined)[];
210
+ endFieldIdx?: (number | null | undefined)[];
211
+ endMappedValue?: ((number | null)[] | null | undefined)[];
212
+
133
213
  // polygon
134
214
  layerId?: string[];
135
215
  };
@@ -175,6 +255,14 @@ export type TimeRangeFilter = FilterBase<LineChart> &
175
255
  syncTimelineMode: SyncTimelineMode;
176
256
  animationWindow: string;
177
257
  invertTrendColor: boolean;
258
+ /**
259
+ * When set, a feature is visible while the playback window overlaps
260
+ * [startField, endField] rather than requiring a single timestamp in range.
261
+ */
262
+ endName?: (string | null | undefined)[];
263
+ endFieldIdx?: (number | null | undefined)[];
264
+ endMappedValue?: ((number | null)[] | null | undefined)[];
265
+ gpuEndChannel?: number[];
178
266
  };
179
267
 
180
268
  export type PolygonFilter = FilterBase<LineChart> & {
@@ -211,10 +299,14 @@ export interface TimeBins {
211
299
 
212
300
  export interface PlotType {
213
301
  interval: ValueOf<Interval>;
302
+ numericInterval?: number;
214
303
  type: ValueOf<PlotTypes>;
215
304
  aggregation: ValueOf<AggregationTypes>;
216
305
  defaultTimeFormat: string;
217
306
  colorsByDataId?: {[dataId: string]: string};
307
+ /** Categorical series split for the timeline line chart. */
308
+ groupBy?: PlotGroupBy | null;
309
+ yAxisAutoRange?: boolean;
218
310
  }
219
311
 
220
312
  export type Feature = {
@@ -289,16 +381,9 @@ export type AnimationConfig = {
289
381
  hideControl?: boolean;
290
382
  };
291
383
 
292
- export type FilterAnimationConfig = Pick<
293
- TimeRangeFilter,
294
- | 'dataId'
295
- | 'value'
296
- | 'animationWindow'
297
- | 'speed'
298
- | 'syncedWithLayerTimeline'
299
- | 'syncTimelineMode'
300
- | 'timezone'
301
- >;
384
+ export type FilterAnimationConfig = Pick<Filter, 'dataId' | 'value' | 'speed'> &
385
+ Required<Pick<Filter, 'animationWindow'>> &
386
+ Partial<Pick<TimeRangeFilter, 'syncedWithLayerTimeline' | 'syncTimelineMode' | 'timezone'>>;
302
387
 
303
388
  export type Timeline = {
304
389
  domain: [number, number] | null;
@@ -330,6 +415,7 @@ export type TooltipInfo = BaseInteraction & {
330
415
  fieldsToShow: {
331
416
  [key: string]: TooltipField[];
332
417
  };
418
+ timezone?: string | null;
333
419
  compareMode: boolean;
334
420
  compareType: CompareType;
335
421
  };
@@ -339,6 +425,7 @@ export type Geocoder = BaseInteraction & {
339
425
  position: number[] | null;
340
426
  config: {
341
427
  limitSearch: boolean;
428
+ color: RGBColor;
342
429
  };
343
430
  };
344
431
  export type Brush = BaseInteraction & {
@@ -351,20 +438,66 @@ export type Coordinate = BaseInteraction & {
351
438
  id: 'coordinate';
352
439
  position: number[] | null;
353
440
  };
441
+ export type AnnotationInteraction = BaseInteraction & {
442
+ id: 'annotation';
443
+ };
444
+ export type LegendInfo = BaseInteraction & {
445
+ id: 'legend';
446
+ config: {
447
+ hideInvisibleLayers: boolean;
448
+ };
449
+ };
450
+ /** Zoom stops for a fade envelope. Opacity is 0 outside [appear, gone]. */
451
+ export type ZoomOpacityStops = {
452
+ /** Zoom where opacity leaves 0. */
453
+ appear: number;
454
+ /** Zoom where opacity reaches the layer's full opacity. */
455
+ full: number;
456
+ /** Zoom where opacity starts falling. */
457
+ fade: number;
458
+ /** Zoom where opacity returns to 0. */
459
+ gone: number;
460
+ };
461
+ /** Layers and reserved map targets that share one zoom envelope. */
462
+ export type ZoomOpacityController = {
463
+ id: string;
464
+ layerIds: string[];
465
+ stops: ZoomOpacityStops;
466
+ };
467
+ export type ZoomOpacityInteraction = BaseInteraction & {
468
+ id: 'zoomOpacity';
469
+ config: {
470
+ controllers: ZoomOpacityController[];
471
+ };
472
+ };
354
473
  export type InteractionConfig = {
355
474
  tooltip: TooltipInfo;
475
+ legend: LegendInfo;
356
476
  geocoder: Geocoder;
357
477
  brush: Brush;
358
478
  coordinate: Coordinate;
479
+ annotation: AnnotationInteraction;
480
+ zoomOpacity: ZoomOpacityInteraction;
359
481
  };
360
482
  export type MapInfo = {
361
- title: string;
362
- description: string;
483
+ title?: string;
484
+ description?: string;
363
485
  };
486
+ /** Options captured when a file load starts and forwarded to `addDataToMap`. */
487
+ export type FileLoadingOptions = {
488
+ autoCreateLayers?: boolean;
489
+ /** Parse the files, then wait for an explicit add instead of calling `addDataToMap`. */
490
+ deferAddToMap?: boolean;
491
+ };
492
+
364
493
  export type FileLoading = {
365
- filesToLoad: FileList;
366
- onFinish: (payload: any) => any;
494
+ /** Identifies this load so a delayed finish from an older one can be ignored. */
495
+ loadId: number;
496
+ filesToLoad: FileList | File[];
497
+ companionFiles?: File[];
498
+ onFinish: (payload: any, options?: FileLoadingOptions) => any;
367
499
  fileCache: any[];
500
+ options?: FileLoadingOptions;
368
501
  };
369
502
  export type FileLoadingProgress = {
370
503
  [key: string]: {
@@ -406,6 +539,10 @@ export declare type ExportImage = {
406
539
  ratio: EXPORT_IMG_RATIOS;
407
540
  resolution: ExportResolutionOption;
408
541
  legend: boolean;
542
+ /** When true, include the charts panel in the exported image. */
543
+ charts: boolean;
544
+ /** When true, omit the basemap and preserve transparent pixels in the exported image. */
545
+ transparentBackground?: boolean;
409
546
  mapH: number;
410
547
  mapW: number;
411
548
  imageSize: {
@@ -420,6 +557,7 @@ export declare type ExportImage = {
420
557
  error: Error | false;
421
558
  center: boolean;
422
559
  escapeXhtmlForWebpack?: boolean;
560
+ fileName: string;
423
561
  };
424
562
 
425
563
  export type ExportData = {
@@ -440,6 +578,17 @@ export type ExportMap = {
440
578
  HTML: ExportHtml;
441
579
  JSON: ExportJson;
442
580
  format: 'HTML' | 'JSON';
581
+ fileName: string;
582
+ /** When false, dataset access tokens are omitted from exported HTML and JSON. */
583
+ includeLayerApiKeys: boolean;
584
+ /** Optional application name override for exported HTML and JSON. */
585
+ appName?: string;
586
+ /** Optional application website override for exported HTML and JSON. */
587
+ appWebsite?: string;
588
+ /** Optional application icon URL override for exported HTML and JSON. */
589
+ appIcon?: string;
590
+ /** Optional application name color override for exported HTML and JSON. */
591
+ appNameColor?: string;
443
592
  };
444
593
 
445
594
  export type ExportVideo = {
@@ -481,9 +630,15 @@ export type MapControls = {
481
630
  splitMap?: MapControlItem;
482
631
  mapDraw?: MapControlItem;
483
632
  mapLocale?: MapControlItem;
633
+ mapTheme?: MapControlItem;
484
634
  effect?: MapControlItem;
485
635
  annotation?: MapControlItem;
636
+ chart?: MapControlItem;
637
+ viewportJson?: MapControlItem;
638
+ mapInfo?: MapControlItem;
639
+ sqlPanel?: MapControlItem;
486
640
  aiAssistant?: MapControlItem;
641
+ [key: string]: MapControlItem | MapControlMapLegend | undefined;
487
642
  };
488
643
 
489
644
  export type LoadFiles = {
@@ -501,13 +656,23 @@ export type Notifications = {
501
656
 
502
657
  export type Locale = string;
503
658
 
659
+ export type UiTheme = string;
660
+
504
661
  export type PanelListView = string;
505
662
 
663
+ /** Transient playback requests; never serialized with the saved map. */
664
+ export type CameraTourPlaybackRequest =
665
+ | {action: 'play' | 'pause'}
666
+ | {action: 'seek'; elapsedMs: number};
667
+
506
668
  export type UiState = {
669
+ cameraTourPlaybackRequest?: CameraTourPlaybackRequest & {sequence: number};
507
670
  readOnly: boolean;
508
671
  activeSidePanel: string | null;
509
672
  currentModal: string | null;
510
673
  datasetKeyToRemove: string | null;
674
+ /** Dataset selected by the dataset-menu Replace action. Cleared when the modal closes. */
675
+ datasetToReplaceId: string | null;
511
676
  visibleDropdown: string | null;
512
677
  // export image modal ui
513
678
  exportImage: ExportImage;
@@ -525,6 +690,8 @@ export type UiState = {
525
690
  loadFiles: LoadFiles;
526
691
  // Locale of the UI
527
692
  locale: Locale;
693
+ // Theme of the UI (`light` | `dark` | `space`). First of `themes` is the default when set.
694
+ theme: UiTheme;
528
695
  // view layers by list or dataset
529
696
  layerPanelListView: PanelListView;
530
697
  // view filters by list or dataset
package/schemas.d.ts CHANGED
@@ -3,14 +3,24 @@
3
3
 
4
4
  import {RGBColor, Merge, RequireFrom} from './types';
5
5
 
6
- import {Filter, InteractionConfig, AnimationConfig, SplitMap, Feature} from './reducers';
6
+ import {
7
+ Filter,
8
+ InteractionConfig,
9
+ AnimationConfig,
10
+ SplitMap,
11
+ Feature,
12
+ MapLegendControlSettings
13
+ } from './reducers';
7
14
 
8
15
  import {LayerTextLabel} from './layers';
16
+ import {ChartConfig} from './charts';
17
+ import {CameraBookmark, CameraTour} from './camera';
9
18
 
10
19
  export type SavedFilter = {
11
20
  dataId: Filter['dataId'];
12
21
  id: Filter['id'];
13
22
  name: Filter['name'];
23
+ endName?: Filter['endName'];
14
24
  type: Filter['type'];
15
25
  value: Filter['value'];
16
26
  // deprecated
@@ -25,6 +35,8 @@ export type SavedFilter = {
25
35
  layerId: Filter['layerId'];
26
36
  syncedWithLayerTimeline: Filter['syncedWithLayerTimeline'];
27
37
  syncTimelineMode: Filter['syncTimelineMode'];
38
+ /** Hide rows that match the filter instead of keeping them. */
39
+ inverted?: boolean;
28
40
  };
29
41
  export type MinSavedFilter = RequireFrom<SavedFilter, 'dataId' | 'id' | 'name' | 'type' | 'value'>;
30
42
  export type ParsedFilter = SavedFilter | MinSavedFilter;
@@ -36,6 +48,7 @@ export type SavedInteractionConfig = {
36
48
  geocoder: {
37
49
  enabled: boolean;
38
50
  limitSearch?: boolean;
51
+ color?: RGBColor;
39
52
  };
40
53
  brush: InteractionConfig['brush']['config'] & {
41
54
  enabled: boolean;
@@ -43,6 +56,16 @@ export type SavedInteractionConfig = {
43
56
  coordinate: {
44
57
  enabled: boolean;
45
58
  };
59
+ annotation?: {
60
+ enabled: boolean;
61
+ };
62
+ legend?: {
63
+ enabled: boolean;
64
+ hideInvisibleLayers?: boolean;
65
+ };
66
+ zoomOpacity?: InteractionConfig['zoomOpacity']['config'] & {
67
+ enabled: boolean;
68
+ };
46
69
  };
47
70
 
48
71
  export type SavedScale = string;
@@ -58,6 +81,7 @@ export type SavedLayer = {
58
81
  label: string;
59
82
  color: RGBColor;
60
83
  highlightColor?: RGBColor;
84
+ uniqueIdField?: string | null;
61
85
  columns: {
62
86
  [key: string]: string;
63
87
  };
@@ -65,6 +89,7 @@ export type SavedLayer = {
65
89
  isVisible: boolean;
66
90
  visConfig: Record<string, any>;
67
91
  hidden: boolean;
92
+ isIncludedInLegend?: boolean;
68
93
  textLabel: Merge<LayerTextLabel, {field: {name: string; type: string} | null}>;
69
94
  };
70
95
  visualChannels: SavedVisualChannels;
@@ -90,6 +115,8 @@ export type SavedEffect = ParsedEffect;
90
115
  export type SavedAnimationConfig = {
91
116
  currentTime: AnimationConfig['currentTime'];
92
117
  speed: AnimationConfig['speed'];
118
+ timeFormat?: AnimationConfig['timeFormat'];
119
+ timezone?: AnimationConfig['timezone'];
93
120
  };
94
121
 
95
122
  export type SavedEditor = {
@@ -98,9 +125,12 @@ export type SavedEditor = {
98
125
  };
99
126
 
100
127
  export type SavedVisState = {
128
+ cameraTour?: CameraTour;
129
+ cameraBookmarks?: CameraBookmark[];
101
130
  filters: SavedFilter[];
102
131
  layers: SavedLayer[];
103
132
  effects: SavedEffect[];
133
+ charts?: ChartConfig[];
104
134
  interactionConfig: SavedInteractionConfig;
105
135
  layerBlending: string;
106
136
  overlayBlending?: string;
@@ -108,13 +138,18 @@ export type SavedVisState = {
108
138
  animationConfig: SavedAnimationConfig;
109
139
  editor?: SavedEditor;
110
140
  layerOrder?: any[];
141
+ groupBys?: any[];
142
+ joins?: any[];
111
143
  };
112
144
 
113
145
  // Min saved config can be passed to addDataToMap
114
146
  export type MinSavedVisStateV1 = {
147
+ cameraTour?: CameraTour;
148
+ cameraBookmarks?: CameraBookmark[];
115
149
  filters?: MinSavedFilter[];
116
150
  layers?: MinSavedLayer[];
117
151
  effects?: SavedEffect[];
152
+ charts?: ChartConfig[];
118
153
  interactionConfig?: Partial<SavedInteractionConfig>;
119
154
  layerBlending?: string;
120
155
  overlayBlending?: string;
@@ -124,16 +159,20 @@ export type MinSavedVisStateV1 = {
124
159
  };
125
160
 
126
161
  export type ParsedVisState = {
162
+ cameraTour?: CameraTour | null;
163
+ cameraBookmarks?: CameraBookmark[];
127
164
  layers?: ParsedLayer[];
128
165
  effects?: ParsedEffect[];
166
+ charts?: ChartConfig[];
129
167
  filters?: ParsedFilter[];
130
- effects?: ParsedEffect[];
131
168
  interactionConfig?: Partial<SavedInteractionConfig>;
132
169
  layerBlending?: string;
133
170
  overlayBlending?: string;
134
171
  splitMaps?: SplitMap[];
135
172
  animationConfig?: Partial<SavedAnimationConfig>;
136
173
  layerOrder?: any[];
174
+ groupBys?: any[];
175
+ joins?: any[];
137
176
  };
138
177
 
139
178
  export type ParsedUiState = {
@@ -150,8 +189,20 @@ export type ParsedUiState = {
150
189
  contentHeight?: number;
151
190
  };
152
191
  };
192
+ chart?: {
193
+ active?: boolean;
194
+ };
195
+ mapInfo?: {
196
+ active?: boolean;
197
+ show?: boolean;
198
+ };
199
+ cameraBookmarks?: {
200
+ show?: boolean;
201
+ settings?: Partial<MapLegendControlSettings>;
202
+ };
153
203
  };
154
204
  locale?: string;
205
+ theme?: string;
155
206
  };
156
207
 
157
208
  export type SavedMapState = {
@@ -264,9 +315,21 @@ export type SavedMap = {
264
315
  info: {
265
316
  app: string;
266
317
  created_at: string;
267
- title: string;
268
- description: string;
318
+ title?: string;
319
+ description?: string;
320
+ source?: string;
321
+ appName?: string;
322
+ appWebsite?: string;
323
+ appIcon?: string;
324
+ appNameColor?: string;
269
325
  };
270
326
  };
271
327
 
272
- export type LoadedMap = {datasets?: ParsedDataset[] | null; config?: ParsedConfig | null};
328
+ export type LoadedMap = {
329
+ datasets?: ParsedDataset[] | null;
330
+ config?: ParsedConfig | null;
331
+ info?: {
332
+ title?: string;
333
+ description?: string;
334
+ };
335
+ };
package/types.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  // Copyright contributors to the kepler.gl project
3
3
 
4
+ import type {GeoArrowBinaryData} from './actions';
5
+
4
6
  export type RGBColor = [number, number, number];
5
7
  export type RGBAColor = [number, number, number, number];
6
8
  export type HexColor = string; // this is the best typescript can do at the moment
@@ -52,6 +54,8 @@ export type ProcessorResult = {
52
54
  rows: any[][];
53
55
  cols?: any[];
54
56
  metadata?: any;
57
+ /** GeoArrow chunks already converted to deck.gl binary features on workers. */
58
+ geoArrowBinaryData?: GeoArrowBinaryData;
55
59
  /** Optional schema for arrow tables with metadata preserved. */
56
60
  // TODO: Should we use a loaded arrow.Table in cols instead of an array of arrow.Vectors? Why was an array of arrow.Vectors chosen?
57
61
  arrowSchema?: any;