@kepler.gl/types 3.3.0-alpha.0 → 3.3.0-alpha.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.
package/actions.d.ts CHANGED
@@ -2,6 +2,8 @@
2
2
  // Copyright contributors to the kepler.gl project
3
3
 
4
4
  import {SavedMap, ParsedConfig, SavedConfigV1, MinSavedConfigV1} from './schemas';
5
+ import type {LayerVisConfig} from './layers';
6
+ import type {ViewportPadding} from './reducers';
5
7
 
6
8
  /** EXPORT_FILE_TO_CLOUD */
7
9
  export type MapData = {
@@ -65,10 +67,17 @@ export type ProtoDataset = {
65
67
 
66
68
  export type AddDataToMapOptions = {
67
69
  centerMap?: boolean;
70
+ /**
71
+ * Padding in pixels applied when `centerMap` is true.
72
+ * Use this so a few points are not hidden under the side panel or other UI.
73
+ * A number applies the same padding on all sides.
74
+ */
75
+ padding?: ViewportPadding;
68
76
  readOnly?: boolean;
69
77
  keepExistingConfig?: boolean;
70
78
  autoCreateLayers?: boolean;
71
79
  autoCreateTooltips?: boolean;
80
+ layerVisConfig?: Partial<LayerVisConfig>;
72
81
  };
73
82
 
74
83
  export type AddDataToMapPayload = {
@@ -0,0 +1,50 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright contributors to the kepler.gl project
3
+
4
+ import {AnnotationKind} from '@kepler.gl/constants';
5
+
6
+ export {AnnotationKind} from '@kepler.gl/constants';
7
+ export {isAnnotationKind, isAnnotationWithArm} from '@kepler.gl/constants';
8
+
9
+ export type BaseAnnotation = {
10
+ id: string;
11
+ kind: AnnotationKind;
12
+ isVisible: boolean;
13
+ autoSize: boolean;
14
+ autoSizeY: boolean;
15
+ anchorPoint: [number, number];
16
+ label: string;
17
+ editorState?: Record<string, any>;
18
+ mapIndex?: number;
19
+ lineColor: string;
20
+ lineWidth: number;
21
+ textWidth: number;
22
+ textHeight: number;
23
+ textVerticalAlign?: 'top' | 'middle' | 'bottom';
24
+ };
25
+
26
+ export type AnnotationWithArm = BaseAnnotation & {
27
+ armLength: number;
28
+ angle: number;
29
+ };
30
+
31
+ export type TextAnnotation = BaseAnnotation & {
32
+ kind: AnnotationKind.TEXT;
33
+ };
34
+
35
+ export type PointAnnotation = AnnotationWithArm & {
36
+ kind: AnnotationKind.POINT;
37
+ };
38
+
39
+ export type ArrowAnnotation = AnnotationWithArm & {
40
+ kind: AnnotationKind.ARROW;
41
+ };
42
+
43
+ export type CircleAnnotation = AnnotationWithArm & {
44
+ kind: AnnotationKind.CIRCLE;
45
+ radiusInMeters: number;
46
+ };
47
+
48
+ export type Annotation = TextAnnotation | PointAnnotation | ArrowAnnotation | CircleAnnotation;
49
+
50
+ export type AnnotationPropsPartial = Partial<Annotation>;
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/datasets.d.ts CHANGED
@@ -9,11 +9,6 @@ export type DomainStops = {
9
9
  interpolation: 'interpolate';
10
10
  };
11
11
 
12
- export type ZoomStopsConfig = {
13
- enabled?: boolean;
14
- stops: ZoomStops | null;
15
- };
16
-
17
12
  export type DatasetAttribution = {
18
13
  title: string;
19
14
  url: string | null;
package/effects.d.ts CHANGED
@@ -3,16 +3,18 @@
3
3
 
4
4
  type EffectParameterDescription = {
5
5
  name: string;
6
- type?: 'number' | 'array' | 'color';
6
+ type?: 'number' | 'array' | 'color' | 'checkbox';
7
7
  label?: string | false | (string | false)[];
8
+ tooltip?: string;
8
9
  min: number;
9
10
  max: number;
10
- defaultValue?: number | number[];
11
+ defaultValue?: number | number[] | boolean;
11
12
  };
12
13
 
13
14
  export type EffectDescription = {
14
15
  type: string;
15
16
  name: string;
17
+ description?: string;
16
18
  parameters: EffectParameterDescription[];
17
19
  };
18
20
 
package/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export * from './schemas';
8
8
  export * from './types';
9
9
  export * from './components';
10
10
  export * from './effects';
11
+ export * from './annotations';
11
12
  export * from './datasets';
12
13
 
13
14
  export * as StacTypes from './stac';
package/layers.d.ts CHANGED
@@ -27,7 +27,7 @@ export type LayerBaseConfig = {
27
27
  };
28
28
 
29
29
  // for aggregate layer, aggregatedBins is returned for custom color scale
30
- aggregatedBins?: AggregatedBin[];
30
+ aggregatedBins?: Record<number, AggregatedBin>;
31
31
 
32
32
  columnMode?: string;
33
33
  heightField?: VisualChannelField;
@@ -162,12 +162,13 @@ export type LayerTextLabel = {
162
162
  color: RGBColor;
163
163
  background: boolean;
164
164
  size: number;
165
+ weight: number;
165
166
  offset: [number, number];
166
167
  anchor: string;
167
168
  alignment: string;
168
169
  outlineWidth: number;
169
170
  outlineColor: RGBAColor;
170
- backgroundColor: RGBAColor;
171
+ backgroundColor: RGBAColor | null;
171
172
  };
172
173
 
173
174
  export type ColorRangeConfig = {
@@ -243,6 +244,8 @@ export type VisConfigNumber = VisConfig & {
243
244
  defaultValue: number;
244
245
  range: SizeRange;
245
246
  step: number;
247
+ focusRange?: [number, number];
248
+ focusWeight?: number;
246
249
  };
247
250
 
248
251
  export type VisConfigBoolean = VisConfig & {
@@ -341,6 +344,12 @@ export type LayerVisConfigSettings = {
341
344
  allowHover: VisConfigBoolean;
342
345
  showNeighborOnHover: VisConfigBoolean;
343
346
  showHighlightColor: VisConfigBoolean;
347
+ scenegraph: VisConfigInput;
348
+ scenegraphEnabled: VisConfigBoolean;
349
+ scenegraphCustomModelUrl: VisConfigInput;
350
+ scenegraphColorEnabled: VisConfigBoolean;
351
+ scenegraphUseTrailColor: VisConfigBoolean;
352
+ scenegraphColor: VisConfigColorSelect;
344
353
  [key: string]: LayerVisConfigTypes;
345
354
  };
346
355
 
@@ -404,6 +413,7 @@ export type TextConfigNumber = {
404
413
 
405
414
  export type LayerTextConfig = {
406
415
  fontSize: TextConfigNumber;
416
+ fontWeight: TextConfigNumber;
407
417
  outlineWidth: TextConfigNumber;
408
418
  textAnchor: TextConfigSelect;
409
419
  textAlignment: TextConfigSelect;
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.0",
4
+ "version": "3.3.0-alpha.10",
5
5
  "description": "kepler.gl types used by kepler.gl components, actions and reducers",
6
6
  "license": "MIT",
7
7
  "types": "index.d.ts",
@@ -27,13 +27,15 @@
27
27
  },
28
28
  "maintainers": [
29
29
  "Shan He <heshan0131@gmail.com>",
30
- "Giuseppe Macri <gmacri@uber.com>"
30
+ "Giuseppe Macri <gmacri@uber.com>",
31
+ "Igor Dykhta <dikhta.igor@gmail.com>",
32
+ "Xun Li <lixun910@gmail.com>"
31
33
  ],
32
34
  "engines": {
33
- "node": ">=18"
35
+ "node": ">=20"
34
36
  },
35
37
  "volta": {
36
- "node": "18.18.2",
38
+ "node": "20.19.3",
37
39
  "yarn": "4.4.0"
38
40
  },
39
41
  "packageManager": "yarn@4.4.0"
package/reducers.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  // Copyright contributors to the kepler.gl project
3
3
 
4
4
  import {Field, Millisecond} from './types';
5
+ import {MapSplitMode, MapViewMode} from '@kepler.gl/constants';
5
6
  type MapViewState = {
6
7
  latitude: number;
7
8
  longitude: number;
@@ -24,9 +25,12 @@ export type MapState = {
24
25
  height: number;
25
26
  minZoom?: number;
26
27
  maxZoom?: number;
28
+ maxPitch?: number;
27
29
  maxBounds?: Bounds;
28
30
  initialState?: any;
29
31
  scale?: number;
32
+ /** Layer rendering parameters forwarded from visState for use during layer construction in globe mode. */
33
+ layerParameters?: Record<string, string | boolean>;
30
34
 
31
35
  // the following 4 properties assist with split viewports that can optionally have (un)synced viewports and zooms
32
36
  /** Is the application split into 2 maps? */
@@ -37,10 +41,52 @@ export type MapState = {
37
41
  isZoomLocked: boolean;
38
42
  /** An array of either 0 or 2 Viewport objects (index 0 for left map; index 1 for right map) */
39
43
  splitMapViewports: Viewport[];
44
+ mapViewMode?: MapViewMode;
45
+ globe?: {
46
+ enabled: boolean;
47
+ config: {
48
+ atmosphere: boolean;
49
+ hugeHalo: boolean;
50
+ hugeHaloRadius: number;
51
+ hugeHaloOpacity: number;
52
+ azimuth: boolean;
53
+ azimuthAngle: number;
54
+ terminator: boolean;
55
+ terminatorOpacity: number;
56
+ basemap: boolean;
57
+ labels: boolean;
58
+ labelsColor: [number, number, number];
59
+ adminLines: boolean;
60
+ adminLinesColor: [number, number, number];
61
+ water: boolean;
62
+ waterColor: [number, number, number];
63
+ surfaceColor: [number, number, number];
64
+ surface: boolean;
65
+ backgroundColor: [number, number, number];
66
+ stars: boolean;
67
+ };
68
+ };
69
+ /** The current split map mode (single, dual, swipe) */
70
+ mapSplitMode: MapSplitMode;
71
+ /** Swipe compare divider position as a percentage (0-100) */
72
+ swipeComparePercentage: number;
40
73
  };
41
74
 
42
75
  export type Bounds = [number, number, number, number];
43
76
 
77
+ /**
78
+ * Padding in pixels used when fitting the map viewport to bounds.
79
+ * A number applies the same padding on all sides.
80
+ */
81
+ export type ViewportPadding =
82
+ | number
83
+ | {
84
+ top?: number;
85
+ bottom?: number;
86
+ left?: number;
87
+ right?: number;
88
+ };
89
+
44
90
  export type RangeFieldDomain = {
45
91
  domain: number[];
46
92
  step: number;
@@ -249,6 +295,20 @@ export type SplitMap = {
249
295
  layers: SplitMapLayers;
250
296
  };
251
297
 
298
+ export type LayerOrderGroup = {
299
+ id: string;
300
+ label: string;
301
+ isVisible: boolean;
302
+ layerOrder: LayerOrder;
303
+ isIncludedInLegend: boolean;
304
+ };
305
+
306
+ export type LayerOrderEntry = string | LayerOrderGroup;
307
+ export type LayerOrder = LayerOrderEntry[];
308
+ export type FlatLayerOrder = string[];
309
+ export type LayerOrderHierarchyEntry = ['layer', any] | ['layerGroup', LayerOrderGroup];
310
+ export type LayerOrderHierarchy = LayerOrderHierarchyEntry[];
311
+
252
312
  /** See "Locale aware formats" at https://momentjs.com/docs/#/parsing/string-format/ */
253
313
  export type AnimationConfigTimeFormat = 'L' | 'L LT' | 'L LTS';
254
314
 
@@ -317,6 +377,9 @@ export type TooltipInfo = BaseInteraction & {
317
377
  export type Geocoder = BaseInteraction & {
318
378
  id: 'geocoder';
319
379
  position: number[] | null;
380
+ config: {
381
+ limitSearch: boolean;
382
+ };
320
383
  };
321
384
  export type Brush = BaseInteraction & {
322
385
  id: 'brush';
@@ -419,6 +482,17 @@ export type ExportMap = {
419
482
  format: 'HTML' | 'JSON';
420
483
  };
421
484
 
485
+ export type ExportVideo = {
486
+ mediaType: string;
487
+ cameraPreset: string;
488
+ fileName: string;
489
+ resolution: string;
490
+ durationMs: number;
491
+ swipeStartPct: number;
492
+ swipeEndPct: number;
493
+ swipeEasing: 'linear' | 'ease-in-out';
494
+ };
495
+
422
496
  export type MapControlItem = {
423
497
  show: boolean;
424
498
  active: boolean;
@@ -447,8 +521,12 @@ export type MapControls = {
447
521
  splitMap?: MapControlItem;
448
522
  mapDraw?: MapControlItem;
449
523
  mapLocale?: MapControlItem;
524
+ mapTheme?: MapControlItem;
450
525
  effect?: MapControlItem;
526
+ annotation?: MapControlItem;
527
+ sqlPanel?: MapControlItem;
451
528
  aiAssistant?: MapControlItem;
529
+ [key: string]: MapControlItem | MapControlMapLegend | undefined;
452
530
  };
453
531
 
454
532
  export type LoadFiles = {
@@ -466,6 +544,8 @@ export type Notifications = {
466
544
 
467
545
  export type Locale = string;
468
546
 
547
+ export type UiTheme = string;
548
+
469
549
  export type PanelListView = string;
470
550
 
471
551
  export type UiState = {
@@ -480,6 +560,8 @@ export type UiState = {
480
560
  exportData: ExportData;
481
561
  // html export
482
562
  exportMap: ExportMap;
563
+ // export video modal ui
564
+ exportVideo: ExportVideo;
483
565
  // map control panels
484
566
  mapControls: MapControls;
485
567
  // ui notifications
@@ -488,6 +570,8 @@ export type UiState = {
488
570
  loadFiles: LoadFiles;
489
571
  // Locale of the UI
490
572
  locale: Locale;
573
+ // Theme of the UI (`light` | `dark`), used when enableThemeToggle is on
574
+ theme: UiTheme;
491
575
  // view layers by list or dataset
492
576
  layerPanelListView: PanelListView;
493
577
  // view filters by list or dataset
@@ -520,6 +604,8 @@ export type Viewport = {
520
604
  minZoom?: number;
521
605
  /** Maximum allowed viewport zoom */
522
606
  maxZoom?: number;
607
+ /** Maximum pitch angle in degrees */
608
+ maxPitch?: number;
523
609
  /** Maximum geographical bounds, pan/zoom operations are constrained within those bounds */
524
610
  maxBounds?: Bounds;
525
611
  /** viewport transition duration use by geocoder panel **/
package/schemas.d.ts CHANGED
@@ -35,6 +35,7 @@ export type SavedInteractionConfig = {
35
35
  };
36
36
  geocoder: {
37
37
  enabled: boolean;
38
+ limitSearch?: boolean;
38
39
  };
39
40
  brush: InteractionConfig['brush']['config'] & {
40
41
  enabled: boolean;
@@ -106,6 +107,7 @@ export type SavedVisState = {
106
107
  splitMaps: SplitMap[];
107
108
  animationConfig: SavedAnimationConfig;
108
109
  editor?: SavedEditor;
110
+ layerOrder?: any[];
109
111
  };
110
112
 
111
113
  // Min saved config can be passed to addDataToMap
@@ -131,18 +133,26 @@ export type ParsedVisState = {
131
133
  overlayBlending?: string;
132
134
  splitMaps?: SplitMap[];
133
135
  animationConfig?: Partial<SavedAnimationConfig>;
136
+ layerOrder?: any[];
134
137
  };
135
138
 
136
139
  export type ParsedUiState = {
137
- mapControls: {
138
- mapLegend: {
139
- active: boolean;
140
- settings: {
141
- position: string;
142
- contentHeight: number;
140
+ mapControls?: {
141
+ mapLegend?: {
142
+ active?: boolean;
143
+ settings?: {
144
+ position?: {
145
+ x: number;
146
+ y: number;
147
+ anchorX: 'left' | 'right';
148
+ anchorY: 'top' | 'bottom';
149
+ };
150
+ contentHeight?: number;
143
151
  };
144
152
  };
145
153
  };
154
+ locale?: string;
155
+ theme?: string;
146
156
  };
147
157
 
148
158
  export type SavedMapState = {
package/stac.d.ts CHANGED
@@ -49,6 +49,7 @@ export type FullWidthHalfMaxFWHM = number;
49
49
  export interface Fields {
50
50
  'eo:cloud_cover'?: CloudCover;
51
51
  'eo:bands'?: Bands;
52
+ bands?: CoreBand[];
52
53
  /**
53
54
  * This interface was referenced by `Fields`'s JSON-Schema definition
54
55
  * via the `patternProperty` "^(?!eo:)".
@@ -57,6 +58,7 @@ export interface Fields {
57
58
  }
58
59
  export interface Band {
59
60
  name?: NameOfTheBand;
61
+ description?: string;
60
62
  common_name?: CommonNameOfTheBand;
61
63
  center_wavelength?: CenterWavelength;
62
64
  full_width_half_max?: FullWidthHalfMaxFWHM;
@@ -111,7 +113,7 @@ export type GeoJSONGeometry =
111
113
  | GeoJSONMultiPoint2
112
114
  | GeoJSONMultiLineString2
113
115
  | GeoJSONMultiPolygon2;
114
- export type STACVersion = '1.0.0';
116
+ export type STACVersion = '1.0.0' | '1.1.0' | string;
115
117
  export type ReferenceToAJSONSchema = string;
116
118
  export type STACExtensions = ReferenceToAJSONSchema[];
117
119
  /**
@@ -429,7 +431,7 @@ export interface ProviderFields {
429
431
  * This object represents Collections in a SpatioTemporal Asset Catalog.
430
432
  */
431
433
  export type STACCollectionSpecification = STACCollection;
432
- export type STACVersion = '1.0.0';
434
+ export type STACVersion = '1.0.0' | '1.1.0' | string;
433
435
  export type ReferenceToAJSONSchema = string;
434
436
  export type STACExtensions = ReferenceToAJSONSchema[];
435
437
  export type TypeOfSTACEntity = 'Collection';
@@ -770,6 +772,7 @@ export type NumberOfPixelsInTheBucket = number;
770
772
 
771
773
  export interface Assetfields {
772
774
  'raster:bands'?: Bands;
775
+ bands?: CoreBand[];
773
776
  /**
774
777
  * This interface was referenced by `Assetfields`'s JSON-Schema definition
775
778
  * via the `patternProperty` "^(?!raster:)".
@@ -809,18 +812,42 @@ export interface StacExtensions {
809
812
  [k: string]: unknown;
810
813
  }
811
814
 
815
+ /**
816
+ * STAC 1.1.0 Core Band Object.
817
+ * Merges spectral (formerly eo:bands) and data-value (formerly raster:bands) fields
818
+ * into a single band object in common metadata.
819
+ */
820
+ export interface CoreBand {
821
+ name?: string;
822
+ description?: string;
823
+ 'eo:common_name'?: CommonNameOfTheBand;
824
+ 'eo:center_wavelength'?: number;
825
+ 'eo:full_width_half_max'?: number;
826
+ data_type?: DataTypeOfTheBand;
827
+ nodata?: NoDataPixelValue;
828
+ unit?: string;
829
+ bits_per_sample?: number;
830
+ sampling?: PixelSamplingInTheBand;
831
+ scale?: number;
832
+ offset?: number;
833
+ spatial_resolution?: number;
834
+ statistics?: Statistics;
835
+ histogram?: Histogram;
836
+ [k: string]: unknown;
837
+ }
838
+
812
839
  /**
813
840
  * STAC Item or Collection
814
841
  */
815
842
  export type STACObject = STACItem | STACCollection;
816
843
 
817
844
  /**
818
- * STAC Item including our required extensions: EO and Raster
845
+ * STAC Item including required extensions: EO and Raster (1.0.x) or core bands (1.1.0+)
819
846
  */
820
847
  export type CompleteSTACItem = STACItem & EOExtension & RasterExtension;
821
848
 
822
849
  /**
823
- * STAC Collection including our required extensions: Item Assets, EO, and Raster
850
+ * STAC Collection including required extensions (1.0.x) or core bands (1.1.0+)
824
851
  */
825
852
  export type CompleteSTACCollection = STACCollection &
826
853
  ItemAssetsDefinitionExtension &