react-bkoi-gl 2.0.1 → 2.2.0

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/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import * as React from 'react';
1
+ import * as React$1 from 'react';
2
2
  import { CSSProperties } from 'react';
3
- import { PaddingOptions, MapOptions, Map as Map$1, MarkerOptions, Marker as Marker$1, PopupOptions, Popup as Popup$1, AttributionControlOptions, AttributionControl as AttributionControl$1, FullscreenControlOptions, FullscreenControl as FullscreenControl$1, GeolocateControlOptions, GeolocateControl as GeolocateControl$1, NavigationControlOptions, NavigationControl as NavigationControl$1, ScaleControlOptions, ScaleControl as ScaleControl$1, TerrainSpecification, TerrainControl as TerrainControl$1, LogoControlOptions, LogoControl as LogoControl$1, MapLayerMouseEvent, MapLayerTouchEvent, MapWheelEvent, MapLibreZoomEvent, MapLibreEvent, MapStyleDataEvent, MapSourceDataEvent, LngLat, MapMouseEvent as MapMouseEvent$1, Point, MapGeoJSONFeature, LngLatBoundsLike, PointLike, StyleSpecification, ProjectionSpecification, LightSpecification, SkySpecification, ControlPosition, SourceSpecification, LayerSpecification, CustomLayerInterface, IControl } from 'maplibre-gl';
4
- export { AttributionControlOptions, BackgroundLayerSpecification, CanvasSourceSpecification, CircleLayerSpecification, ControlPosition, CustomLayerInterface, FillExtrusionLayerSpecification, FillLayerSpecification, FullscreenControlOptions, GeoJSONSourceSpecification, GeolocateControlOptions, HeatmapLayerSpecification, HillshadeLayerSpecification, IControl, ImageSourceSpecification, LayerSpecification, LightSpecification, LineLayerSpecification, LngLat, LngLatBounds, LngLatBoundsLike, LngLatLike, LogoControlOptions, MapLibreZoomEvent as MapBoxZoomEvent, MapLibreEvent as MapEvent, MapGeoJSONFeature, MapLayerMouseEvent, MapLayerTouchEvent, MapOptions, MapSourceDataEvent, MapStyleDataEvent, MapTouchEvent, MapWheelEvent, MarkerOptions, NavigationControlOptions, PaddingOptions, Point, PointLike, PopupOptions, ProjectionSpecification, RasterDEMSourceSpecification, RasterLayerSpecification, RasterSourceSpecification, ScaleControlOptions, SkySpecification, SourceSpecification, StyleSpecification, SymbolLayerSpecification, TerrainSpecification, VectorSourceSpecification, VideoSourceSpecification } from 'maplibre-gl';
3
+ import { PaddingOptions, MapOptions, Map as Map$1, MarkerOptions, Marker as Marker$1, PopupOptions, Popup as Popup$1, AttributionControlOptions, AttributionControl as AttributionControl$1, FullscreenControlOptions, FullscreenControl as FullscreenControl$1, GeolocateControlOptions, GeolocateControl as GeolocateControl$1, NavigationControlOptions, NavigationControl as NavigationControl$1, ScaleControlOptions, ScaleControl as ScaleControl$1, TerrainSpecification, TerrainControl as TerrainControl$1, LogoControlOptions, LogoControl as LogoControl$1, MapLayerMouseEvent, MapLayerTouchEvent, MapWheelEvent, MapLibreZoomEvent, MapLibreEvent, MapStyleDataEvent, MapSourceDataEvent, MapMouseEvent as MapMouseEvent$1, Point, LngLat, MapGeoJSONFeature, LngLatBoundsLike, PointLike, StyleSpecification, ProjectionSpecification, LightSpecification, SkySpecification, ControlPosition, SourceSpecification, Source as Source$1, LayerSpecification, CustomLayerInterface, IControl } from 'maplibre-gl';
4
+ export { AttributionControlOptions, BackgroundLayerSpecification, CanvasSourceSpecification, CircleLayerSpecification, ControlPosition, CustomLayerInterface, FillExtrusionLayerSpecification, FillLayerSpecification, FullscreenControlOptions, GeoJSONSourceSpecification, GeolocateControlOptions, HeatmapLayerSpecification, HillshadeLayerSpecification, IControl, ImageSourceSpecification, LayerSpecification, LightSpecification, LineLayerSpecification, LngLat, LngLatBounds, LngLatBoundsLike, LngLatLike, LogoControlOptions, MapLibreZoomEvent as MapBoxZoomEvent, MapLibreEvent as MapEvent, MapGeoJSONFeature, MapLayerMouseEvent, MapLayerTouchEvent, MapMouseEvent as MapMouseEventBase, MapOptions, MapSourceDataEvent, MapStyleDataEvent, MapTouchEvent, MapWheelEvent, MarkerOptions, NavigationControlOptions, PaddingOptions, Point, PointLike, PopupOptions, ProjectionSpecification, RasterDEMSourceSpecification, RasterLayerSpecification, RasterSourceSpecification, ScaleControlOptions, SkySpecification, SourceSpecification, StyleSpecification, SymbolLayerSpecification, TerrainSpecification, VectorSourceSpecification, VideoSourceSpecification } from 'maplibre-gl';
5
5
 
6
6
  /** Describes the camera's state */
7
7
  type ViewState = {
@@ -22,6 +22,16 @@ interface ImmutableLike<T> {
22
22
  toJS: () => T;
23
23
  }
24
24
 
25
+ /**
26
+ * A relaxed control interface that accepts both MapLibre IControl implementations
27
+ * and third-party controls (e.g. @deck.gl/mapbox MapboxOverlay) that may use
28
+ * different Map type definitions.
29
+ */
30
+ interface MapControl {
31
+ onAdd?(map: unknown): unknown;
32
+ onRemove?(map: unknown): unknown;
33
+ getDefaultPosition?(): string;
34
+ }
25
35
  /**
26
36
  * A user-facing type that represents the minimal intersection between Mapbox and Maplibre
27
37
  * User provided `mapLib` is supposed to implement this interface
@@ -67,7 +77,7 @@ interface MapEvent<SourceT, OriginalEventT = undefined> {
67
77
  originalEvent: OriginalEventT;
68
78
  }
69
79
  type ErrorEvent = MapEvent<Map$1> & {
70
- type: "error";
80
+ type: 'error';
71
81
  error: Error;
72
82
  };
73
83
  type MapMouseEvent = MapMouseEvent$1 & {
@@ -76,10 +86,10 @@ type MapMouseEvent = MapMouseEvent$1 & {
76
86
  features?: MapGeoJSONFeature[];
77
87
  };
78
88
  type ViewStateChangeEvent = (MapEvent<Map$1, MouseEvent | TouchEvent | WheelEvent | undefined> & {
79
- type: "movestart" | "move" | "moveend" | "zoomstart" | "zoom" | "zoomend";
89
+ type: 'movestart' | 'move' | 'moveend' | 'zoomstart' | 'zoom' | 'zoomend';
80
90
  viewState: ViewState;
81
91
  }) | (MapEvent<Map$1, MouseEvent | TouchEvent | undefined> & {
82
- type: "rotatestart" | "rotate" | "rotateend" | "dragstart" | "drag" | "dragend" | "pitchstart" | "pitch" | "pitchend";
92
+ type: 'rotatestart' | 'rotate' | 'rotateend' | 'dragstart' | 'drag' | 'dragend' | 'pitchstart' | 'pitch' | 'pitchend';
83
93
  viewState: ViewState;
84
94
  });
85
95
  type MapCallbacks = {
@@ -127,12 +137,12 @@ type MapCallbacks = {
127
137
  onSourceData?: (e: MapSourceDataEvent) => void;
128
138
  };
129
139
  type PopupEvent = {
130
- type: "open" | "close";
140
+ type: 'open' | 'close';
131
141
  target: Popup$1;
132
142
  };
133
143
  type MarkerEvent<OriginalEventT = undefined> = MapEvent<Marker$1, OriginalEventT>;
134
144
  type MarkerDragEvent = MarkerEvent & {
135
- type: "dragstart" | "drag" | "dragend";
145
+ type: 'dragstart' | 'drag' | 'dragend';
136
146
  lngLat: LngLat;
137
147
  };
138
148
  type GeolocateEvent = MapEvent<GeolocateControl$1>;
@@ -168,7 +178,7 @@ type MaplibreProps = Partial<ViewState> & MapCallbacks & {
168
178
  /** The projection property of the style. Must conform to the Projection Style Specification.
169
179
  * @default 'mercator'
170
180
  */
171
- projection?: ProjectionSpecification | "mercator" | "globe";
181
+ projection?: ProjectionSpecification | 'mercator' | 'globe';
172
182
  /** Light properties of the map. */
173
183
  light?: LightSpecification;
174
184
  /** Terrain property of the style. Must conform to the Terrain Style Specification.
@@ -180,6 +190,9 @@ type MaplibreProps = Partial<ViewState> & MapCallbacks & {
180
190
  interactiveLayerIds?: string[];
181
191
  /** CSS cursor */
182
192
  cursor?: string;
193
+ /** Called with non-fatal warnings (e.g. transient errors before the style
194
+ * has finished loading). When omitted, warnings fall back to `console.warn`. */
195
+ onWarning?: (e: ErrorEvent) => void;
183
196
  };
184
197
 
185
198
  /** These methods may break the react binding if called directly */
@@ -211,8 +224,11 @@ type GlobalSettings = {
211
224
  type MapContextValue = {
212
225
  mapLib: MapLib;
213
226
  map: MapRef;
227
+ /** Consumer-supplied warning handler, propagated to child components so they
228
+ * can surface non-fatal warnings without touching console directly. */
229
+ onWarning?: (e: ErrorEvent) => void;
214
230
  };
215
- type MapInitOptions = Omit<MapOptions, "style" | "container" | "bounds" | "fitBoundsOptions" | "center">;
231
+ type MapInitOptions = Omit<MapOptions, 'style' | 'container' | 'bounds' | 'fitBoundsOptions' | 'center'>;
216
232
  type MapProps = MapInitOptions & MaplibreProps & GlobalSettings & {
217
233
  mapLib?: MapLib | Promise<MapLib>;
218
234
  reuseMaps?: boolean;
@@ -220,13 +236,25 @@ type MapProps = MapInitOptions & MaplibreProps & GlobalSettings & {
220
236
  id?: string;
221
237
  /** Map container CSS style */
222
238
  style?: CSSProperties;
223
- children?: React.ReactNode;
224
- /** Show Barikoi logo (default: true) */
239
+ children?: React$1.ReactNode;
240
+ /** Whether to render the Barikoi logo control.
241
+ * @default true */
225
242
  showBarikoiLogo?: boolean;
226
- /** Show Attribution (default: true) */
243
+ /** Whether to render the map attribution control.
244
+ * @default true
245
+ * @remarks Attribution is required by the OpenStreetMap and MapLibre
246
+ * license terms; keep this enabled unless you provide attribution elsewhere. */
227
247
  showAttribution?: boolean;
228
- } & React.RefAttributes<MapRef>;
229
- declare const Map: React.FC<MapProps>;
248
+ } & React$1.RefAttributes<MapRef>;
249
+ /**
250
+ * Interactive Map component using MapLibre GL.
251
+ *
252
+ * @remarks
253
+ * For keyboard navigation and accessibility, the `keyboard` prop must be set to `true` (which is default).
254
+ * If explicitly disabled (e.g. `keyboard={false}`), keyboard access (such as panning/zooming via arrow keys)
255
+ * will be unavailable to screen reader and keyboard-only users.
256
+ */
257
+ declare const Map: React$1.FC<MapProps>;
230
258
 
231
259
  type MarkerProps = MarkerOptions & {
232
260
  /** Longitude of the anchor location */
@@ -235,14 +263,14 @@ type MarkerProps = MarkerOptions & {
235
263
  latitude: number;
236
264
  popup?: Popup$1;
237
265
  /** CSS style override, applied to the control's container */
238
- style?: React.CSSProperties;
266
+ style?: React$1.CSSProperties;
239
267
  onClick?: (e: MarkerEvent<MouseEvent>) => void;
240
268
  onDragStart?: (e: MarkerDragEvent) => void;
241
269
  onDrag?: (e: MarkerDragEvent) => void;
242
270
  onDragEnd?: (e: MarkerDragEvent) => void;
243
- children?: React.ReactNode;
271
+ children?: React$1.ReactNode;
244
272
  };
245
- declare const Marker: React.FC<MarkerProps>;
273
+ declare const Marker: React$1.FC<MarkerProps>;
246
274
 
247
275
  type PopupProps = PopupOptions & {
248
276
  /** Longitude of the anchor location */
@@ -250,37 +278,37 @@ type PopupProps = PopupOptions & {
250
278
  /** Latitude of the anchor location */
251
279
  latitude: number;
252
280
  /** CSS style override, applied to the control's container */
253
- style?: React.CSSProperties;
281
+ style?: React$1.CSSProperties;
254
282
  onOpen?: (e: PopupEvent) => void;
255
283
  onClose?: (e: PopupEvent) => void;
256
- children?: React.ReactNode;
284
+ children?: React$1.ReactNode;
257
285
  };
258
- declare const Popup: React.FC<PopupProps>;
286
+ declare const Popup: React$1.FC<PopupProps>;
259
287
 
260
288
  type AttributionControlProps = AttributionControlOptions & {
261
289
  /** Placement of the control relative to the map. */
262
290
  position?: ControlPosition;
263
291
  /** CSS style override, applied to the control's container */
264
- style?: React.CSSProperties;
292
+ style?: React$1.CSSProperties;
265
293
  };
266
- declare const AttributionControl: React.FC<AttributionControlProps>;
294
+ declare const AttributionControl: React$1.FC<AttributionControlProps>;
267
295
 
268
- type FullscreenControlProps = Omit<FullscreenControlOptions, "container"> & {
296
+ type FullscreenControlProps = Omit<FullscreenControlOptions, 'container'> & {
269
297
  /** Id of the DOM element which should be made full screen. By default, the map container
270
298
  * element will be made full screen. */
271
299
  containerId?: string;
272
300
  /** Placement of the control relative to the map. */
273
301
  position?: ControlPosition;
274
302
  /** CSS style override, applied to the control's container */
275
- style?: React.CSSProperties;
303
+ style?: React$1.CSSProperties;
276
304
  };
277
- declare const FullscreenControl: React.FC<FullscreenControlProps>;
305
+ declare const FullscreenControl: React$1.FC<FullscreenControlProps>;
278
306
 
279
307
  type GeolocateControlProps = GeolocateControlOptions & {
280
308
  /** Placement of the control relative to the map. */
281
309
  position?: ControlPosition;
282
310
  /** CSS style override, applied to the control's container */
283
- style?: React.CSSProperties;
311
+ style?: React$1.CSSProperties;
284
312
  /** Called on each Geolocation API position update that returned as success. */
285
313
  onGeolocate?: (e: GeolocateResultEvent) => void;
286
314
  /** Called on each Geolocation API position update that returned as an error. */
@@ -293,15 +321,15 @@ type GeolocateControlProps = GeolocateControlOptions & {
293
321
  /** Called when the GeolocateControl changes to the background state. */
294
322
  onTrackUserLocationEnd?: (e: GeolocateEvent) => void;
295
323
  };
296
- declare const GeolocateControl: React.FC<GeolocateControlProps>;
324
+ declare const GeolocateControl: React$1.FC<GeolocateControlProps>;
297
325
 
298
326
  type NavigationControlProps = NavigationControlOptions & {
299
327
  /** Placement of the control relative to the map. */
300
328
  position?: ControlPosition;
301
329
  /** CSS style override, applied to the control's container */
302
- style?: React.CSSProperties;
330
+ style?: React$1.CSSProperties;
303
331
  };
304
- declare const NavigationControl: React.FC<NavigationControlProps>;
332
+ declare const NavigationControl: React$1.FC<NavigationControlProps>;
305
333
 
306
334
  type ScaleControlProps = ScaleControlOptions & {
307
335
  unit?: string;
@@ -309,57 +337,307 @@ type ScaleControlProps = ScaleControlOptions & {
309
337
  /** Placement of the control relative to the map. */
310
338
  position?: ControlPosition;
311
339
  /** CSS style override, applied to the control's container */
312
- style?: React.CSSProperties;
340
+ style?: React$1.CSSProperties;
313
341
  };
314
- declare const ScaleControl: React.FC<ScaleControlProps>;
342
+ declare const ScaleControl: React$1.FC<ScaleControlProps>;
315
343
 
316
344
  type TerrainControlProps = TerrainSpecification & {
317
345
  /** Placement of the control relative to the map. */
318
346
  position?: ControlPosition;
319
347
  /** CSS style override, applied to the control's container */
320
- style?: React.CSSProperties;
348
+ style?: React$1.CSSProperties;
321
349
  };
322
- declare const TerrainControl: React.FC<TerrainControlProps>;
350
+ declare const TerrainControl: React$1.FC<TerrainControlProps>;
323
351
 
324
352
  type LogoControlProps = LogoControlOptions & {
325
353
  /** Placement of the control relative to the map. */
326
354
  position?: ControlPosition;
327
355
  /** CSS style override, applied to the control's container */
328
- style?: React.CSSProperties;
356
+ style?: React$1.CSSProperties;
329
357
  };
330
- declare const LogoControl: React.FC<LogoControlProps>;
358
+ declare const LogoControl: React$1.FC<LogoControlProps>;
331
359
 
360
+ /**
361
+ * @fileoverview Source component for adding data sources to a MapLibre GL map.
362
+ *
363
+ * Sources define the data that layers can render. This component supports all
364
+ * MapLibre GL source types including GeoJSON, vector tiles, raster tiles. image. and video.
365
+ *
366
+ * @module components/source
367
+ * @see {@link https://maplibre.org/maplibre-gl-js/docs/sources/}
368
+ */
369
+
370
+ /**
371
+ * Props for the Source component.
372
+ *
373
+ * @typedef {Object} SourceProps
374
+ * @property {string} [id] - Unique identifier for the source. If not provided. one will be generated automatically.
375
+ * @property {React.ReactNode} [children] - Child Layer components that will use this source.
376
+ * @extends {SourceSpecification}
377
+ *
378
+ * @example
379
+ * ```tsx
380
+ * // GeoJSON source with a layer
381
+ * <Source id="my-data" type="geojson" data={geojsonData}>
382
+ * <Layer id="points-layer" type="circle" paint={{ 'circle-radius': 8 }} />
383
+ * </Source>
384
+ *
385
+ * // Vector tile source
386
+ * <Source id="streets" type="vector" url="mapbox://streets-v11" />
387
+ *
388
+ * // Raster source
389
+ * <Source id="satellite" type="raster" tiles={['https://example.com/tiles/{z}/{x}/{y}.png']} tileSize={256} />
390
+ * ```
391
+ */
332
392
  type SourceProps = SourceSpecification & {
393
+ /** Unique identifier for the source. If not provided. one will be generated automatically. */
333
394
  id?: string;
395
+ /** Child Layer components that will use this source. */
334
396
  children?: any;
335
397
  };
336
- declare function Source(props: SourceProps): any;
398
+ declare const Source: React$1.NamedExoticComponent<SourceProps & React$1.RefAttributes<Source$1>>;
337
399
 
400
+ /**
401
+ * @fileoverview CanvasSource component for adding canvas-based data sources to a MapLibre GL map.
402
+ *
403
+ * Canvas sources allow rendering custom HTML canvas elements as map layers.
404
+ * This is useful for dynamic, animated, or custom-rendered data overlays.
405
+ *
406
+ * @module components/canvas-source
407
+ * @see {@link https://maplibre.org/maplibre-gl-js/docs/sources/}
408
+ */
409
+
410
+ /**
411
+ * Coordinates for the canvas corners [top-left, top-right, bottom-right, bottom-left]
412
+ */
413
+ type CanvasCoordinates = [
414
+ [
415
+ number,
416
+ number
417
+ ],
418
+ [
419
+ number,
420
+ number
421
+ ],
422
+ [
423
+ number,
424
+ number
425
+ ],
426
+ [
427
+ number,
428
+ number
429
+ ]
430
+ ];
431
+ /**
432
+ * Props for the CanvasSource component.
433
+ *
434
+ * @typedef {Object} CanvasSourceProps
435
+ * @property {string} [id] - Unique identifier for the source.
436
+ * @property {CanvasCoordinates} coordinates - Corner coordinates of the canvas.
437
+ * @property {HTMLCanvasElement} canvas - The canvas element to render.
438
+ * @property {boolean} [animate] - Whether to animate the canvas (re-render on each frame).
439
+ * @property {number} [width] - Width of the canvas context.
440
+ * @property {number} [height] - Height of the canvas context.
441
+ * @property {React.ReactNode} [children] - Child Layer components.
442
+ *
443
+ * @example
444
+ * ```tsx
445
+ * // Canvas source with dynamic content
446
+ * const canvasRef = useRef<HTMLCanvasElement>(null);
447
+ * const [canvasEl, setCanvasEl] = useState<HTMLCanvasElement | null>(null);
448
+ *
449
+ * useEffect(() => {
450
+ * const canvas = canvasRef.current;
451
+ * if (!canvas) return;
452
+ * const ctx = canvas.getContext('2d');
453
+ * if (ctx) {
454
+ * ctx.fillStyle = 'rgba(255, 0, 0, 0.5)';
455
+ * ctx.fillRect(0, 0, 100, 100);
456
+ * }
457
+ * setCanvasEl(canvas);
458
+ * }, []);
459
+ *
460
+ * {canvasEl && (
461
+ * <CanvasSource
462
+ * id="canvas-source"
463
+ * coordinates={[
464
+ * [90.39, 23.83], // top-left
465
+ * [90.41, 23.83], // top-right
466
+ * [90.41, 23.81], // bottom-right
467
+ * [90.39, 23.81] // bottom-left
468
+ * ]}
469
+ * canvas={canvasEl}
470
+ * >
471
+ * <Layer type="raster" paint={{ 'raster-opacity': 0.8 }} />
472
+ * </CanvasSource>
473
+ * )}
474
+ * ```
475
+ */
476
+ type CanvasSourceProps = {
477
+ /** Unique identifier for the source */
478
+ id?: string;
479
+ /** Corner coordinates of the canvas [top-left, top-right, bottom-right, bottom-left] */
480
+ coordinates: CanvasCoordinates;
481
+ /** The canvas element to render */
482
+ canvas: HTMLCanvasElement;
483
+ /** Whether to animate the canvas (re-render on each frame) */
484
+ animate?: boolean;
485
+ /** Width of the canvas context */
486
+ width?: number;
487
+ /** Height of the canvas context */
488
+ height?: number;
489
+ /** Child Layer components */
490
+ children?: React$1.ReactNode;
491
+ };
492
+ declare const CanvasSource: React$1.NamedExoticComponent<CanvasSourceProps>;
493
+
494
+ /**
495
+ * Utility type to make id optional in layer specification.
496
+ * @private
497
+ */
338
498
  type OptionalId<T> = T extends {
339
499
  id: string;
340
- } ? Omit<T, "id"> & {
500
+ } ? Omit<T, 'id'> & {
341
501
  id?: string;
342
502
  } : T;
503
+ /**
504
+ * Utility type to make source optional in layer specification.
505
+ * @private
506
+ */
343
507
  type OptionalSource<T> = T extends {
344
508
  source: string;
345
- } ? Omit<T, "source"> & {
509
+ } ? Omit<T, 'source'> & {
346
510
  source?: string;
347
511
  } : T;
512
+ /**
513
+ * Props for the Layer component.
514
+ *
515
+ * @typedef {Object} LayerProps
516
+ * @property {string} [id] - Unique identifier for the layer. If not provided, one will be generated automatically.
517
+ * @property {string} [source] - The source ID this layer should use (inherited from parent Source component).
518
+ * @property {string} [beforeId] - If set, the layer will be inserted before the specified layer.
519
+ * @property {function} [onClick] - Called when the layer is clicked.
520
+ * @property {function} [onMouseEnter] - Called when the mouse enters the layer.
521
+ * @property {function} [onMouseLeave] - Called when the mouse leaves the layer.
522
+ * @property {function} [onMouseMove] - Called when the mouse moves over the layer.
523
+ * @property {function} [onMouseDown] - Called when mouse button is pressed on the layer.
524
+ * @property {function} [onMouseUp] - Called when mouse button is released on the layer.
525
+ * @property {function} [onContextMenu] - Called on right-click context menu.
526
+ * @property {function} [onDoubleClick] - Called on double click.
527
+ * @extends {LayerSpecification | CustomLayerInterface}
528
+ *
529
+ * @example
530
+ * ```tsx
531
+ * // Circle layer with paint properties
532
+ * <Layer
533
+ * id="points-layer"
534
+ * type="circle"
535
+ * paint={{
536
+ * 'circle-radius': 8,
537
+ * 'circle-color': '#007cbf'
538
+ * }}
539
+ * />
540
+ *
541
+ * // Line layer with filter
542
+ * <Layer
543
+ * id="roads-layer"
544
+ * type="line"
545
+ * source="streets"
546
+ * source-layer="road"
547
+ * filter={['==', ['get', 'type'], 'primary']}
548
+ * paint={{ 'line-width': 2 }}
549
+ * />
550
+ *
551
+ * // Interactive layer with events
552
+ * <Layer
553
+ * id="interactive-layer"
554
+ * type="fill"
555
+ * paint={{ 'fill-color': '#088' }}
556
+ * onClick={(e) => console.log('Clicked:', e.features)}
557
+ * onMouseEnter={(e) => console.log('Hover:', e.features)}
558
+ * onMouseLeave={() => console.log('Left layer')}
559
+ * />
560
+ *
561
+ * // Custom layer
562
+ * <Layer
563
+ * type="custom"
564
+ * renderingMode="2d"
565
+ * onAdd={(map) => { ... }}
566
+ * render={(gl, matrix) => { ... }}
567
+ * />
568
+ * ```
569
+ */
348
570
  type LayerProps = (OptionalSource<OptionalId<LayerSpecification>> | CustomLayerInterface) & {
349
571
  /** If set, the layer will be inserted before the specified layer */
350
572
  beforeId?: string;
573
+ /** Called when the layer is clicked */
574
+ onClick?: (e: MapLayerMouseEvent) => void;
575
+ /** Called when the mouse enters the layer */
576
+ onMouseEnter?: (e: MapLayerMouseEvent) => void;
577
+ /** Called when the mouse leaves the layer */
578
+ onMouseLeave?: () => void;
579
+ /** Called when the mouse moves over the layer */
580
+ onMouseMove?: (e: MapLayerMouseEvent) => void;
581
+ /** Called when mouse button is pressed on the layer */
582
+ onMouseDown?: (e: MapLayerMouseEvent) => void;
583
+ /** Called when mouse button is released on the layer */
584
+ onMouseUp?: (e: MapLayerMouseEvent) => void;
585
+ /** Called on right-click context menu */
586
+ onContextMenu?: (e: MapLayerMouseEvent) => void;
587
+ /** Called on double click */
588
+ onDoubleClick?: (e: MapLayerMouseEvent) => void;
351
589
  };
352
- declare function Layer(props: LayerProps): any;
590
+ /**
591
+ * Layer component for adding visual layers to a MapLibre GL map.
592
+ *
593
+ * Layers define how data from sources is rendered on the map. Supports all
594
+ * MapLibre GL layer types including fill, line, circle, symbol, raster,
595
+ * hillshade, heatmap, and custom layers.
596
+ *
597
+ * Must be a child of a Source component (for data layers) or used standalone
598
+ * with a source prop for pre-existing sources.
599
+ *
600
+ * @component
601
+ * @example
602
+ * ```tsx
603
+ * // Circle layer with paint properties
604
+ * <Layer
605
+ * id="points-layer"
606
+ * type="circle"
607
+ * paint={{
608
+ * 'circle-radius': 8,
609
+ * 'circle-color': '#007cbf'
610
+ * }}
611
+ * />
612
+ *
613
+ * // Line layer with filter
614
+ * <Layer
615
+ * id="roads-layer"
616
+ * type="line"
617
+ * source="streets"
618
+ * source-layer="road"
619
+ * filter={['==', ['get', 'type'], 'primary']}
620
+ * paint={{ 'line-width': 2 }}
621
+ * />
622
+ *
623
+ * // Inside a Source component
624
+ * <Source id="geojson" type="geojson" data={data}>
625
+ * <Layer type="circle" paint={{ 'circle-radius': 6 }} />
626
+ * </Source>
627
+ * ```
628
+ */
629
+ declare function _Layer(props: LayerProps): any;
630
+ declare const Layer: React$1.MemoExoticComponent<typeof _Layer>;
353
631
 
354
632
  type ControlOptions = {
355
633
  position?: ControlPosition;
356
634
  };
357
- declare function useControl<T extends IControl>(onCreate: (context: MapContextValue) => T, opts?: ControlOptions): T;
358
- declare function useControl<T extends IControl>(onCreate: (context: MapContextValue) => T, onRemove: (context: MapContextValue) => void, opts?: ControlOptions): T;
359
- declare function useControl<T extends IControl>(onCreate: (context: MapContextValue) => T, onAdd: (context: MapContextValue) => void, onRemove: (context: MapContextValue) => void, opts?: ControlOptions): T;
635
+ declare function useControl<T extends MapControl>(onCreate: (context: MapContextValue) => T, opts?: ControlOptions): T;
636
+ declare function useControl<T extends MapControl>(onCreate: (context: MapContextValue) => T, onRemove: (context: MapContextValue) => void, opts?: ControlOptions): T;
637
+ declare function useControl<T extends MapControl>(onCreate: (context: MapContextValue) => T, onAdd: (context: MapContextValue) => void, onRemove: (context: MapContextValue) => void, opts?: ControlOptions): T;
360
638
 
361
- declare const MapProvider: React.FC<{
362
- children?: React.ReactNode;
639
+ declare const MapProvider: React$1.FC<{
640
+ children?: React$1.ReactNode;
363
641
  }>;
364
642
  type MapCollection = {
365
643
  [id: string]: MapRef | undefined;
@@ -367,4 +645,262 @@ type MapCollection = {
367
645
  };
368
646
  declare function useMap(): MapCollection;
369
647
 
370
- export { AttributionControl, type AttributionControlProps, type ErrorEvent, FullscreenControl, type FullscreenControlProps, GeolocateControl, type GeolocateControlProps, type GeolocateErrorEvent, type GeolocateEvent, type GeolocateResultEvent, type ImmutableLike, Layer, type LayerProps, LogoControl, type LogoControlProps, Map, type MapCallbacks, type MapLib, type MapMouseEvent, type MapProps, MapProvider, type MapRef, Marker, type MarkerDragEvent, type MarkerEvent, type MarkerProps, NavigationControl, type NavigationControlProps, Popup, type PopupEvent, type PopupProps, ScaleControl, type ScaleControlProps, Source, type SourceProps, TerrainControl, type TerrainControlProps, type ViewState, type ViewStateChangeEvent, Map as default, useControl, useMap };
648
+ /**
649
+ * Draw event types
650
+ */
651
+ interface DrawEvent {
652
+ type: string;
653
+ features?: GeoJSON.Feature<GeoJSON.Geometry>[];
654
+ featureIds?: string[];
655
+ mode?: string;
656
+ originalEvent?: unknown;
657
+ }
658
+ /**
659
+ * Draw control options - extends maplibre-gl-draw options
660
+ */
661
+ interface DrawControlOptions {
662
+ /** Whether controls are displayed by default */
663
+ displayControlsDefault?: boolean;
664
+ /** Control configuration */
665
+ controls?: {
666
+ point?: boolean;
667
+ line_string?: boolean;
668
+ polygon?: boolean;
669
+ trash?: boolean;
670
+ combine_features?: boolean;
671
+ uncombine_features?: boolean;
672
+ };
673
+ /** Custom styles for draw layers */
674
+ styles?: unknown[];
675
+ /** Available modes */
676
+ modes?: Record<string, unknown>;
677
+ /** Default mode */
678
+ defaultMode?: string;
679
+ }
680
+ type DrawControlProps = DrawControlOptions & {
681
+ /** Placement of the control relative to the map. */
682
+ position?: ControlPosition;
683
+ /** CSS style override, applied to the control's container */
684
+ style?: React$1.CSSProperties;
685
+ /** Callback fired when a feature is created */
686
+ onDrawCreate?: (e: DrawEvent) => void;
687
+ /** Callback fired when a feature is deleted */
688
+ onDrawDelete?: (e: DrawEvent) => void;
689
+ /** Callback fired when a feature is updated */
690
+ onDrawUpdate?: (e: DrawEvent) => void;
691
+ /** Callback fired when the selection changes */
692
+ onDrawSelectionChange?: (e: DrawEvent) => void;
693
+ /** Callback fired when the draw mode changes */
694
+ onDrawModeChange?: (e: DrawEvent) => void;
695
+ /** Callback fired when features are combined */
696
+ onDrawCombine?: (e: DrawEvent) => void;
697
+ /** Callback fired when features are uncombined */
698
+ onDrawUncombine?: (e: DrawEvent) => void;
699
+ /** Callback fired when rendering */
700
+ onDrawRender?: (e: DrawEvent) => void;
701
+ };
702
+ declare function _DrawControl(props: DrawControlProps): any;
703
+ declare const DrawControl: React$1.MemoExoticComponent<typeof _DrawControl>;
704
+
705
+ /**
706
+ * Options for the GlobeControl
707
+ */
708
+ interface GlobeControlOptions {
709
+ /** Custom button element */
710
+ buttonElement?: HTMLElement;
711
+ /** Custom button class name */
712
+ buttonClassName?: string;
713
+ /** Button title/tooltip text */
714
+ buttonTitle?: string;
715
+ /** Custom CSS for the button */
716
+ buttonStyle?: React.CSSProperties;
717
+ }
718
+ type GlobeControlProps = GlobeControlOptions & {
719
+ /** Position of the control on the map */
720
+ position?: ControlPosition;
721
+ /** Called when projection changes */
722
+ onProjectionChange?: (isGlobe: boolean) => void;
723
+ };
724
+ /**
725
+ * GlobeControl component for toggling between 3D globe and 2D map views.
726
+ *
727
+ * This control works with MapLibre GL 3.x+ which supports globe projection.
728
+ * Adds a button to the map that toggles between mercator (flat) and globe (3D) projections.
729
+ *
730
+ * @component
731
+ * @example
732
+ * ```tsx
733
+ * import { Map, GlobeControl } from 'react-bkoi-gl';
734
+ * import "react-bkoi-gl/styles";
735
+ *
736
+ * function GlobeExample() {
737
+ * const handleProjectionChange = (isGlobe) => {
738
+ * console.log('Globe view:', isGlobe);
739
+ * };
740
+ *
741
+ * return (
742
+ * <Map
743
+ * mapStyle={`https://map.barikoi.com/styles/osm-liberty/style.json?key=${API_KEY}`}
744
+ * initialViewState={{
745
+ * longitude: 90.3938,
746
+ * latitude: 23.8216,
747
+ * zoom: 12
748
+ * }}
749
+ * >
750
+ * <GlobeControl
751
+ * position="top-right"
752
+ * onProjectionChange={handleProjectionChange}
753
+ * />
754
+ * </Map>
755
+ * );
756
+ * }
757
+ * ```
758
+ */
759
+ declare function _GlobeControl(props: GlobeControlProps): any;
760
+ declare const GlobeControl: React$1.MemoExoticComponent<typeof _GlobeControl>;
761
+
762
+ type MapLibreMap = Map$1;
763
+ /**
764
+ * Map interaction types that can be disabled/enabled
765
+ */
766
+ type MapInteractions = 'dragPan' | 'scrollZoom' | 'boxZoom' | 'dragRotate' | 'keyboard' | 'doubleClickZoom' | 'touchZoomRotate';
767
+ /**
768
+ * Configuration for minimap interactions
769
+ */
770
+ type MinimapInteractions = Record<MapInteractions, boolean>;
771
+ /**
772
+ * Configuration for the parent rectangle overlay
773
+ */
774
+ interface ParentRectConfig {
775
+ /** Layout properties for the line layer */
776
+ lineLayout?: Record<string, unknown>;
777
+ /** Paint properties for the line layer */
778
+ linePaint?: Record<string, unknown>;
779
+ /** Paint properties for the fill layer */
780
+ fillPaint?: Record<string, unknown>;
781
+ }
782
+ /**
783
+ * Configuration for the toggle button
784
+ */
785
+ interface ToggleButtonConfig {
786
+ /** Custom SVG icon */
787
+ icon?: string;
788
+ /** Custom CSS class */
789
+ className?: string;
790
+ /** Custom inline styles */
791
+ style?: Record<string, string>;
792
+ /** Background color of the icon */
793
+ iconBackgroundColor?: string;
794
+ /** Hover color */
795
+ hoverColor?: string;
796
+ /** Enable rotation based on position */
797
+ enableRotation?: boolean;
798
+ /** Custom rotation angle */
799
+ rotationAngle?: number;
800
+ }
801
+ /**
802
+ * Minimap control options
803
+ */
804
+ interface MinimapControlOptions {
805
+ /** Initial center coordinates */
806
+ center?: [number, number];
807
+ /** Barikoi API access token */
808
+ accessToken?: string;
809
+ /** Map style for the minimap */
810
+ style?: string | StyleSpecification;
811
+ /** Zoom level difference from parent */
812
+ zoomAdjust?: number;
813
+ /** Lock to specific zoom level */
814
+ lockZoom?: number;
815
+ /** Sync pitch with parent */
816
+ pitchAdjust?: boolean;
817
+ /** Custom container styles */
818
+ containerStyle?: Record<string, string>;
819
+ /** Position on map */
820
+ position?: ControlPosition;
821
+ /** Parent rectangle configuration */
822
+ parentRect?: ParentRectConfig;
823
+ /** Whether minimap can be toggled */
824
+ toggleable?: boolean;
825
+ /** Toggle button configuration */
826
+ toggleButton?: ToggleButtonConfig;
827
+ /** Start minimized */
828
+ initialMinimized?: boolean;
829
+ /** Width when minimized */
830
+ collapsedWidth?: string;
831
+ /** Height when minimized */
832
+ collapsedHeight?: string;
833
+ /** Border radius */
834
+ borderRadius?: string;
835
+ /** Interaction configuration */
836
+ interactions?: Partial<MinimapInteractions>;
837
+ /** Toggle callback */
838
+ onToggle?: (isMinimized: boolean) => void;
839
+ /** Hide tooltip text */
840
+ hideText?: string;
841
+ /** Show tooltip text */
842
+ showText?: string;
843
+ /** Enable responsive sizing */
844
+ responsive?: boolean;
845
+ /** Responsive width */
846
+ responsiveWidth?: string;
847
+ /** Responsive height */
848
+ responsiveHeight?: string;
849
+ /** Minimum width */
850
+ minWidth?: string;
851
+ /** Minimum height */
852
+ minHeight?: string;
853
+ /** Maximum width */
854
+ maxWidth?: string;
855
+ /** Maximum height */
856
+ maxHeight?: string;
857
+ }
858
+ type MinimapControlProps = MinimapControlOptions;
859
+ /**
860
+ * Minimap class - wraps MapLibre Map as a control
861
+ */
862
+ declare class Minimap implements IControl {
863
+ private options;
864
+ private map;
865
+ private parentMap;
866
+ private container;
867
+ private readonly id;
868
+ private parentRect?;
869
+ private differentStyle;
870
+ private desync?;
871
+ private toggleButtonCleanup?;
872
+ private isMinimized;
873
+ private resizeHandler?;
874
+ private resizeTimeout?;
875
+ private transitionTimeout?;
876
+ private toggleButtonStyleEl?;
877
+ private liveRegion?;
878
+ constructor(options?: MinimapControlOptions);
879
+ onAdd(parentMap: MapLibreMap): HTMLElement;
880
+ onRemove(): void;
881
+ private createContainer;
882
+ private getContainerStyles;
883
+ private validateContainerStyle;
884
+ private configureInteractions;
885
+ private setupToggleButton;
886
+ private setupResponsiveSizing;
887
+ toggle(): void;
888
+ isMinimizedState(): boolean;
889
+ private addParentRect;
890
+ private setParentBounds;
891
+ private syncMaps;
892
+ }
893
+ declare function _MinimapControl(props: MinimapControlProps): any;
894
+ declare const MinimapControl: React$1.MemoExoticComponent<typeof _MinimapControl>;
895
+
896
+ interface Logger {
897
+ warn: (message: any, ...args: any[]) => void;
898
+ error: (message: any, ...args: any[]) => void;
899
+ }
900
+ declare const logger: {
901
+ warn(message: any, ...args: any[]): void;
902
+ error(message: any, ...args: any[]): void;
903
+ };
904
+ declare function setLogger(customLogger: Partial<Logger>): void;
905
+
906
+ export { AttributionControl, type AttributionControlProps, type CanvasCoordinates, CanvasSource, type CanvasSourceProps, DrawControl, type DrawControlOptions, type DrawControlProps, type ErrorEvent, FullscreenControl, type FullscreenControlProps, GeolocateControl, type GeolocateControlProps, type GeolocateErrorEvent, type GeolocateEvent, type GeolocateResultEvent, GlobeControl, type GlobeControlOptions, type GlobeControlProps, type ImmutableLike, Layer, type LayerProps, type Logger, LogoControl, type LogoControlProps, Map, type MapCallbacks, type MapControl, type MapInteractions, type MapLib, type MapMouseEvent, type MapProps, MapProvider, type MapRef, Marker, type MarkerDragEvent, type MarkerEvent, type MarkerProps, Minimap, MinimapControl, type MinimapControlOptions, type MinimapControlProps, type MinimapInteractions, NavigationControl, type NavigationControlProps, type ParentRectConfig, Popup, type PopupEvent, type PopupProps, ScaleControl, type ScaleControlProps, Source, type SourceProps, TerrainControl, type TerrainControlProps, type ToggleButtonConfig, type ViewState, type ViewStateChangeEvent, Map as default, logger, setLogger, useControl, useMap };