@kepler.gl/types 3.2.6 → 3.3.0-alpha.1

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,7 @@
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';
5
6
 
6
7
  /** EXPORT_FILE_TO_CLOUD */
7
8
  export type MapData = {
@@ -69,6 +70,7 @@ export type AddDataToMapOptions = {
69
70
  keepExistingConfig?: boolean;
70
71
  autoCreateLayers?: boolean;
71
72
  autoCreateTooltips?: boolean;
73
+ layerVisConfig?: Partial<LayerVisConfig>;
72
74
  };
73
75
 
74
76
  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/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;
@@ -427,6 +437,7 @@ export type LayerCallbacks = {
427
437
  }
428
438
  ) => void;
429
439
  onRedrawNeeded?: (idx: number) => void;
440
+ onFitBounds?: (idx: number, bounds: [number, number, number, number]) => void;
430
441
  };
431
442
 
432
443
  export type BindedLayerCallbacks = {
@@ -438,6 +449,7 @@ export type BindedLayerCallbacks = {
438
449
  coordinate?: [number, number]
439
450
  ) => void;
440
451
  onRedrawNeeded?: () => void;
452
+ onFitBounds?: (bounds: [number, number, number, number]) => void;
441
453
  };
442
454
 
443
455
  export type VisualChannelAggregation = 'colorAggregation' | 'sizeAggregation';
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.2.6",
4
+ "version": "3.3.0-alpha.1",
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,7 +2,15 @@
2
2
  // Copyright contributors to the kepler.gl project
3
3
 
4
4
  import {Field, Millisecond} from './types';
5
- import type {MapViewState} from '@deck.gl/core/typed';
5
+ type MapViewState = {
6
+ latitude: number;
7
+ longitude: number;
8
+ zoom: number;
9
+ bearing?: number;
10
+ pitch?: number;
11
+ transitionDuration?: number;
12
+ transitionInterpolator?: object;
13
+ };
6
14
  import type {ExportResolutionOption} from '@kepler.gl/constants';
7
15
 
8
16
  export type MapState = {
@@ -16,6 +24,7 @@ export type MapState = {
16
24
  height: number;
17
25
  minZoom?: number;
18
26
  maxZoom?: number;
27
+ maxPitch?: number;
19
28
  maxBounds?: Bounds;
20
29
  initialState?: any;
21
30
  scale?: number;
@@ -309,6 +318,9 @@ export type TooltipInfo = BaseInteraction & {
309
318
  export type Geocoder = BaseInteraction & {
310
319
  id: 'geocoder';
311
320
  position: number[] | null;
321
+ config: {
322
+ limitSearch: boolean;
323
+ };
312
324
  };
313
325
  export type Brush = BaseInteraction & {
314
326
  id: 'brush';
@@ -411,6 +423,14 @@ export type ExportMap = {
411
423
  format: 'HTML' | 'JSON';
412
424
  };
413
425
 
426
+ export type ExportVideo = {
427
+ mediaType: string;
428
+ cameraPreset: string;
429
+ fileName: string;
430
+ resolution: string;
431
+ durationMs: number;
432
+ };
433
+
414
434
  export type MapControlItem = {
415
435
  show: boolean;
416
436
  active: boolean;
@@ -440,6 +460,7 @@ export type MapControls = {
440
460
  mapDraw?: MapControlItem;
441
461
  mapLocale?: MapControlItem;
442
462
  effect?: MapControlItem;
463
+ annotation?: MapControlItem;
443
464
  aiAssistant?: MapControlItem;
444
465
  };
445
466
 
@@ -472,6 +493,8 @@ export type UiState = {
472
493
  exportData: ExportData;
473
494
  // html export
474
495
  exportMap: ExportMap;
496
+ // export video modal ui
497
+ exportVideo: ExportVideo;
475
498
  // map control panels
476
499
  mapControls: MapControls;
477
500
  // ui notifications
@@ -512,6 +535,8 @@ export type Viewport = {
512
535
  minZoom?: number;
513
536
  /** Maximum allowed viewport zoom */
514
537
  maxZoom?: number;
538
+ /** Maximum pitch angle in degrees */
539
+ maxPitch?: number;
515
540
  /** Maximum geographical bounds, pan/zoom operations are constrained within those bounds */
516
541
  maxBounds?: Bounds;
517
542
  /** viewport transition duration use by geocoder panel **/
@@ -607,4 +632,4 @@ export type TypedFilter =
607
632
  | TypedTimeRangeFilter
608
633
  | TypedSelectFilter
609
634
  | TypedMultiSelectFilter
610
- | TypedPolygonFilter;
635
+ | TypedPolygonFilter;
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;
@@ -134,15 +135,21 @@ export type ParsedVisState = {
134
135
  };
135
136
 
136
137
  export type ParsedUiState = {
137
- mapControls: {
138
- mapLegend: {
139
- active: boolean;
140
- settings: {
141
- position: string;
142
- contentHeight: number;
138
+ mapControls?: {
139
+ mapLegend?: {
140
+ active?: boolean;
141
+ settings?: {
142
+ position?: {
143
+ x: number;
144
+ y: number;
145
+ anchorX: 'left' | 'right';
146
+ anchorY: 'top' | 'bottom';
147
+ };
148
+ contentHeight?: number;
143
149
  };
144
150
  };
145
151
  };
152
+ locale?: string;
146
153
  };
147
154
 
148
155
  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 &
package/types.d.ts CHANGED
@@ -6,6 +6,26 @@ export type RGBAColor = [number, number, number, number];
6
6
  export type HexColor = string; // this is the best typescript can do at the moment
7
7
  export type Millisecond = number;
8
8
 
9
+ /**
10
+ * Deck.gl picking info with relaxed layer generics for compatibility with DeckGL React callbacks.
11
+ * deck.gl 9's DeckGL component infers callback parameter types that are structurally incompatible
12
+ * with `PickingInfo` from `@deck.gl/core` (missing `color`/`pixelRatio`, different `Layer` generic).
13
+ */
14
+ export type PickInfo<DataT = any> = {
15
+ layer?: {id: string; state?: Record<string, any>} | null;
16
+ sourceLayer?: {id: string} | null;
17
+ viewport?: {width?: number; height?: number} | null;
18
+ index: number;
19
+ picked?: boolean;
20
+ object?: DataT;
21
+ x: number;
22
+ y: number;
23
+ pixel?: [number, number];
24
+ coordinate?: number[];
25
+ color?: Uint8Array | null;
26
+ pixelRatio?: number;
27
+ };
28
+
9
29
  export type ValueOf<T> = T[keyof T];
10
30
 
11
31
  export type Merge<A, B> = {[K in keyof A]: K extends keyof B ? B[K] : A[K]} & B extends infer O