react-bkoi-gl 2.0.0 → 2.1.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.
Files changed (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1429 -176
  3. package/dist/index.cjs +1299 -266
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +870 -0
  6. package/dist/index.d.ts +870 -2
  7. package/dist/index.js +2420 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/styles/react-bkoi-gl.css +95 -1
  10. package/package.json +83 -31
  11. package/dist/components/attribution-control.d.ts +0 -9
  12. package/dist/components/attribution-control.js +0 -20
  13. package/dist/components/attribution-control.js.map +0 -1
  14. package/dist/components/fullscreen-control.d.ts +0 -12
  15. package/dist/components/fullscreen-control.js +0 -21
  16. package/dist/components/fullscreen-control.js.map +0 -1
  17. package/dist/components/geolocate-control.d.ts +0 -21
  18. package/dist/components/geolocate-control.js +0 -46
  19. package/dist/components/geolocate-control.js.map +0 -1
  20. package/dist/components/layer.d.ts +0 -18
  21. package/dist/components/layer.js +0 -98
  22. package/dist/components/layer.js.map +0 -1
  23. package/dist/components/logo-control.d.ts +0 -9
  24. package/dist/components/logo-control.js +0 -28
  25. package/dist/components/logo-control.js.map +0 -1
  26. package/dist/components/map.d.ts +0 -27
  27. package/dist/components/map.js +0 -108
  28. package/dist/components/map.js.map +0 -1
  29. package/dist/components/marker.d.ts +0 -18
  30. package/dist/components/marker.js +0 -105
  31. package/dist/components/marker.js.map +0 -1
  32. package/dist/components/navigation-control.d.ts +0 -9
  33. package/dist/components/navigation-control.js +0 -19
  34. package/dist/components/navigation-control.js.map +0 -1
  35. package/dist/components/popup.d.ts +0 -15
  36. package/dist/components/popup.js +0 -68
  37. package/dist/components/popup.js.map +0 -1
  38. package/dist/components/scale-control.d.ts +0 -11
  39. package/dist/components/scale-control.js +0 -31
  40. package/dist/components/scale-control.js.map +0 -1
  41. package/dist/components/source.d.ts +0 -6
  42. package/dist/components/source.js +0 -95
  43. package/dist/components/source.js.map +0 -1
  44. package/dist/components/terrain-control.d.ts +0 -10
  45. package/dist/components/terrain-control.js +0 -19
  46. package/dist/components/terrain-control.js.map +0 -1
  47. package/dist/components/use-control.d.ts +0 -9
  48. package/dist/components/use-control.js +0 -30
  49. package/dist/components/use-control.js.map +0 -1
  50. package/dist/components/use-map.d.ts +0 -19
  51. package/dist/components/use-map.js +0 -54
  52. package/dist/components/use-map.js.map +0 -1
  53. package/dist/exports-maplibre-gl.d.ts +0 -33
  54. package/dist/exports-maplibre-gl.js +0 -21
  55. package/dist/exports-maplibre-gl.js.map +0 -1
  56. package/dist/maplibre/create-ref.d.ts +0 -9
  57. package/dist/maplibre/create-ref.js +0 -30
  58. package/dist/maplibre/create-ref.js.map +0 -1
  59. package/dist/maplibre/maplibre.d.ts +0 -81
  60. package/dist/maplibre/maplibre.js +0 -387
  61. package/dist/maplibre/maplibre.js.map +0 -1
  62. package/dist/styles.d.js +0 -2
  63. package/dist/styles.d.js.map +0 -1
  64. package/dist/tsconfig.build.tsbuildinfo +0 -1
  65. package/dist/types/common.d.ts +0 -20
  66. package/dist/types/common.js +0 -2
  67. package/dist/types/common.js.map +0 -1
  68. package/dist/types/events.d.ts +0 -80
  69. package/dist/types/events.js +0 -2
  70. package/dist/types/events.js.map +0 -1
  71. package/dist/types/internal.d.ts +0 -14
  72. package/dist/types/internal.js +0 -2
  73. package/dist/types/internal.js.map +0 -1
  74. package/dist/types/lib.d.ts +0 -40
  75. package/dist/types/lib.js +0 -2
  76. package/dist/types/lib.js.map +0 -1
  77. package/dist/types/style-spec.d.ts +0 -1
  78. package/dist/types/style-spec.js +0 -2
  79. package/dist/types/style-spec.js.map +0 -1
  80. package/dist/utils/apply-react-style.d.ts +0 -2
  81. package/dist/utils/apply-react-style.js +0 -16
  82. package/dist/utils/apply-react-style.js.map +0 -1
  83. package/dist/utils/assert.d.ts +0 -1
  84. package/dist/utils/assert.js +0 -6
  85. package/dist/utils/assert.js.map +0 -1
  86. package/dist/utils/compare-class-names.d.ts +0 -2
  87. package/dist/utils/compare-class-names.js +0 -23
  88. package/dist/utils/compare-class-names.js.map +0 -1
  89. package/dist/utils/deep-equal.d.ts +0 -15
  90. package/dist/utils/deep-equal.js +0 -46
  91. package/dist/utils/deep-equal.js.map +0 -1
  92. package/dist/utils/set-globals.d.ts +0 -20
  93. package/dist/utils/set-globals.js +0 -31
  94. package/dist/utils/set-globals.js.map +0 -1
  95. package/dist/utils/style-utils.d.ts +0 -3
  96. package/dist/utils/style-utils.js +0 -42
  97. package/dist/utils/style-utils.js.map +0 -1
  98. package/dist/utils/transform.d.ts +0 -18
  99. package/dist/utils/transform.js +0 -33
  100. package/dist/utils/transform.js.map +0 -1
  101. package/dist/utils/use-isomorphic-layout-effect.d.ts +0 -3
  102. package/dist/utils/use-isomorphic-layout-effect.js +0 -4
  103. package/dist/utils/use-isomorphic-layout-effect.js.map +0 -1
  104. package/src/components/attribution-control.ts +0 -56
  105. package/src/components/fullscreen-control.ts +0 -40
  106. package/src/components/geolocate-control.ts +0 -96
  107. package/src/components/layer.ts +0 -141
  108. package/src/components/logo-control.ts +0 -44
  109. package/src/components/map.tsx +0 -166
  110. package/src/components/marker.ts +0 -155
  111. package/src/components/navigation-control.ts +0 -28
  112. package/src/components/popup.ts +0 -113
  113. package/src/components/scale-control.ts +0 -44
  114. package/src/components/source.ts +0 -159
  115. package/src/components/terrain-control.ts +0 -29
  116. package/src/components/use-control.ts +0 -68
  117. package/src/components/use-map.tsx +0 -71
  118. package/src/exports-maplibre-gl.ts +0 -37
  119. package/src/index.ts +0 -3
  120. package/src/maplibre/create-ref.ts +0 -70
  121. package/src/maplibre/maplibre.ts +0 -624
  122. package/src/styles.d.ts +0 -4
  123. package/src/types/common.ts +0 -34
  124. package/src/types/events.ts +0 -133
  125. package/src/types/internal.ts +0 -26
  126. package/src/types/lib.ts +0 -84
  127. package/src/types/style-spec.ts +0 -34
  128. package/src/utils/apply-react-style.ts +0 -24
  129. package/src/utils/assert.ts +0 -5
  130. package/src/utils/compare-class-names.ts +0 -29
  131. package/src/utils/deep-equal.ts +0 -61
  132. package/src/utils/set-globals.ts +0 -51
  133. package/src/utils/style-utils.ts +0 -68
  134. package/src/utils/transform.ts +0 -58
  135. package/src/utils/use-isomorphic-layout-effect.ts +0 -8
package/dist/index.d.ts CHANGED
@@ -1,2 +1,870 @@
1
- export * from "./exports-maplibre-gl.js";
2
- export { default as default } from "./exports-maplibre-gl.js";
1
+ import * as React$1 from 'react';
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, 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
+
6
+ /** Describes the camera's state */
7
+ type ViewState = {
8
+ /** Longitude at map center */
9
+ longitude: number;
10
+ /** Latitude at map center */
11
+ latitude: number;
12
+ /** Map zoom level */
13
+ zoom: number;
14
+ /** Map rotation bearing in degrees counter-clockwise from north */
15
+ bearing: number;
16
+ /** Map angle in degrees at which the camera is looking at the ground */
17
+ pitch: number;
18
+ /** Dimensions in pixels applied on each side of the viewport for shifting the vanishing point. */
19
+ padding: PaddingOptions;
20
+ };
21
+ interface ImmutableLike<T> {
22
+ toJS: () => T;
23
+ }
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
+ }
35
+ /**
36
+ * A user-facing type that represents the minimal intersection between Mapbox and Maplibre
37
+ * User provided `mapLib` is supposed to implement this interface
38
+ * Only losely typed for compatibility
39
+ */
40
+ interface MapLib {
41
+ supported?: (options: unknown) => boolean;
42
+ Map: {
43
+ new (options: MapOptions): Map$1;
44
+ };
45
+ Marker: {
46
+ new (options: MarkerOptions): Marker$1;
47
+ };
48
+ Popup: {
49
+ new (options: PopupOptions): Popup$1;
50
+ };
51
+ AttributionControl: {
52
+ new (options: AttributionControlOptions): AttributionControl$1;
53
+ };
54
+ FullscreenControl: {
55
+ new (options: FullscreenControlOptions): FullscreenControl$1;
56
+ };
57
+ GeolocateControl: {
58
+ new (options: GeolocateControlOptions): GeolocateControl$1;
59
+ };
60
+ NavigationControl: {
61
+ new (options: NavigationControlOptions): NavigationControl$1;
62
+ };
63
+ ScaleControl: {
64
+ new (options: ScaleControlOptions): ScaleControl$1;
65
+ };
66
+ TerrainControl: {
67
+ new (options: TerrainSpecification): TerrainControl$1;
68
+ };
69
+ LogoControl: {
70
+ new (options: LogoControlOptions): LogoControl$1;
71
+ };
72
+ }
73
+
74
+ interface MapEvent<SourceT, OriginalEventT = undefined> {
75
+ type: string;
76
+ target: SourceT;
77
+ originalEvent: OriginalEventT;
78
+ }
79
+ type ErrorEvent = MapEvent<Map$1> & {
80
+ type: 'error';
81
+ error: Error;
82
+ };
83
+ type MapMouseEvent = MapMouseEvent$1 & {
84
+ point: Point;
85
+ lngLat: LngLat;
86
+ features?: MapGeoJSONFeature[];
87
+ };
88
+ type ViewStateChangeEvent = (MapEvent<Map$1, MouseEvent | TouchEvent | WheelEvent | undefined> & {
89
+ type: 'movestart' | 'move' | 'moveend' | 'zoomstart' | 'zoom' | 'zoomend';
90
+ viewState: ViewState;
91
+ }) | (MapEvent<Map$1, MouseEvent | TouchEvent | undefined> & {
92
+ type: 'rotatestart' | 'rotate' | 'rotateend' | 'dragstart' | 'drag' | 'dragend' | 'pitchstart' | 'pitch' | 'pitchend';
93
+ viewState: ViewState;
94
+ });
95
+ type MapCallbacks = {
96
+ onMouseDown?: (e: MapLayerMouseEvent) => void;
97
+ onMouseUp?: (e: MapLayerMouseEvent) => void;
98
+ onMouseOver?: (e: MapLayerMouseEvent) => void;
99
+ onMouseMove?: (e: MapLayerMouseEvent) => void;
100
+ onClick?: (e: MapLayerMouseEvent) => void;
101
+ onDblClick?: (e: MapLayerMouseEvent) => void;
102
+ onMouseEnter?: (e: MapLayerMouseEvent) => void;
103
+ onMouseLeave?: (e: MapLayerMouseEvent) => void;
104
+ onMouseOut?: (e: MapLayerMouseEvent) => void;
105
+ onContextMenu?: (e: MapLayerMouseEvent) => void;
106
+ onTouchStart?: (e: MapLayerTouchEvent) => void;
107
+ onTouchEnd?: (e: MapLayerTouchEvent) => void;
108
+ onTouchMove?: (e: MapLayerTouchEvent) => void;
109
+ onTouchCancel?: (e: MapLayerTouchEvent) => void;
110
+ onMoveStart?: (e: ViewStateChangeEvent) => void;
111
+ onMove?: (e: ViewStateChangeEvent) => void;
112
+ onMoveEnd?: (e: ViewStateChangeEvent) => void;
113
+ onDragStart?: (e: ViewStateChangeEvent) => void;
114
+ onDrag?: (e: ViewStateChangeEvent) => void;
115
+ onDragEnd?: (e: ViewStateChangeEvent) => void;
116
+ onZoomStart?: (e: ViewStateChangeEvent) => void;
117
+ onZoom?: (e: ViewStateChangeEvent) => void;
118
+ onZoomEnd?: (e: ViewStateChangeEvent) => void;
119
+ onRotateStart?: (e: ViewStateChangeEvent) => void;
120
+ onRotate?: (e: ViewStateChangeEvent) => void;
121
+ onRotateEnd?: (e: ViewStateChangeEvent) => void;
122
+ onPitchStart?: (e: ViewStateChangeEvent) => void;
123
+ onPitch?: (e: ViewStateChangeEvent) => void;
124
+ onPitchEnd?: (e: ViewStateChangeEvent) => void;
125
+ onWheel?: (e: MapWheelEvent) => void;
126
+ onBoxZoomStart?: (e: MapLibreZoomEvent) => void;
127
+ onBoxZoomEnd?: (e: MapLibreZoomEvent) => void;
128
+ onBoxZoomCancel?: (e: MapLibreZoomEvent) => void;
129
+ onResize?: (e: MapLibreEvent) => void;
130
+ onLoad?: (e: MapLibreEvent) => void;
131
+ onRender?: (e: MapLibreEvent) => void;
132
+ onIdle?: (e: MapLibreEvent) => void;
133
+ onError?: (e: ErrorEvent) => void;
134
+ onRemove?: (e: MapLibreEvent) => void;
135
+ onData?: (e: MapStyleDataEvent | MapSourceDataEvent) => void;
136
+ onStyleData?: (e: MapStyleDataEvent) => void;
137
+ onSourceData?: (e: MapSourceDataEvent) => void;
138
+ };
139
+ type PopupEvent = {
140
+ type: 'open' | 'close';
141
+ target: Popup$1;
142
+ };
143
+ type MarkerEvent<OriginalEventT = undefined> = MapEvent<Marker$1, OriginalEventT>;
144
+ type MarkerDragEvent = MarkerEvent & {
145
+ type: 'dragstart' | 'drag' | 'dragend';
146
+ lngLat: LngLat;
147
+ };
148
+ type GeolocateEvent = MapEvent<GeolocateControl$1>;
149
+ type GeolocateResultEvent = GeolocateEvent & GeolocationPosition;
150
+ type GeolocateErrorEvent = GeolocateEvent & GeolocationPositionError;
151
+
152
+ type MaplibreProps = Partial<ViewState> & MapCallbacks & {
153
+ /** Camera options used when constructing the Map instance */
154
+ initialViewState?: Partial<ViewState> & {
155
+ /** The initial bounds of the map. If bounds is specified, it overrides longitude, latitude and zoom options. */
156
+ bounds?: LngLatBoundsLike;
157
+ /** A fitBounds options object to use only when setting the bounds option. */
158
+ fitBoundsOptions?: {
159
+ offset?: PointLike;
160
+ minZoom?: number;
161
+ maxZoom?: number;
162
+ padding?: number | PaddingOptions;
163
+ };
164
+ };
165
+ /** If provided, render into an external WebGL context */
166
+ gl?: WebGLRenderingContext;
167
+ /** For external controller to override the camera state */
168
+ viewState?: ViewState & {
169
+ width: number;
170
+ height: number;
171
+ };
172
+ /** Mapbox style */
173
+ mapStyle?: string | StyleSpecification | ImmutableLike<StyleSpecification>;
174
+ /** Enable diffing when the map style changes
175
+ * @default true
176
+ */
177
+ styleDiffing?: boolean;
178
+ /** The projection property of the style. Must conform to the Projection Style Specification.
179
+ * @default 'mercator'
180
+ */
181
+ projection?: ProjectionSpecification | 'mercator' | 'globe';
182
+ /** Light properties of the map. */
183
+ light?: LightSpecification;
184
+ /** Terrain property of the style. Must conform to the Terrain Style Specification.
185
+ * If `undefined` is provided, removes terrain from the map. */
186
+ terrain?: TerrainSpecification;
187
+ /** Sky properties of the map. Must conform to the Sky Style Specification. */
188
+ sky?: SkySpecification;
189
+ /** Default layers to query on pointer events */
190
+ interactiveLayerIds?: string[];
191
+ /** CSS cursor */
192
+ cursor?: string;
193
+ };
194
+
195
+ /** These methods may break the react binding if called directly */
196
+ declare const skipMethods: readonly ["setMaxBounds", "setMinZoom", "setMaxZoom", "setMinPitch", "setMaxPitch", "setRenderWorldCopies", "setProjection", "setStyle", "addSource", "removeSource", "addLayer", "removeLayer", "setLayerZoomRange", "setFilter", "setPaintProperty", "setLayoutProperty", "setLight", "setTerrain", "setFog", "remove"];
197
+ type MapRef = {
198
+ getMap(): Map$1;
199
+ } & Omit<Map$1, (typeof skipMethods)[number]>;
200
+
201
+ type GlobalSettings = {
202
+ /** The maximum number of images (raster tiles, sprites, icons) to load in parallel.
203
+ * @default 16
204
+ */
205
+ maxParallelImageRequests?: number;
206
+ /** The map's RTL text plugin. Necessary for supporting the Arabic and Hebrew languages, which are written right-to-left. */
207
+ RTLTextPlugin?: string | {
208
+ pluginUrl: string;
209
+ lazy?: boolean;
210
+ };
211
+ /** The number of web workers instantiated on a page with maplibre-gl maps.
212
+ * @default 2
213
+ */
214
+ workerCount?: number;
215
+ /** Provides an interface for loading maplibre-gl's WebWorker bundle from a self-hosted URL.
216
+ * This is useful if your site needs to operate in a strict CSP (Content Security Policy) environment
217
+ * wherein you are not allowed to load JavaScript code from a Blob URL, which is default behavior. */
218
+ workerUrl?: string;
219
+ };
220
+
221
+ type MapContextValue = {
222
+ mapLib: MapLib;
223
+ map: MapRef;
224
+ };
225
+ type MapInitOptions = Omit<MapOptions, 'style' | 'container' | 'bounds' | 'fitBoundsOptions' | 'center'>;
226
+ type MapProps = MapInitOptions & MaplibreProps & GlobalSettings & {
227
+ mapLib?: MapLib | Promise<MapLib>;
228
+ reuseMaps?: boolean;
229
+ /** Map container id */
230
+ id?: string;
231
+ /** Map container CSS style */
232
+ style?: CSSProperties;
233
+ children?: React$1.ReactNode;
234
+ } & React$1.RefAttributes<MapRef>;
235
+ declare const Map: React$1.FC<MapProps>;
236
+
237
+ type MarkerProps = MarkerOptions & {
238
+ /** Longitude of the anchor location */
239
+ longitude: number;
240
+ /** Latitude of the anchor location */
241
+ latitude: number;
242
+ popup?: Popup$1;
243
+ /** CSS style override, applied to the control's container */
244
+ style?: React$1.CSSProperties;
245
+ onClick?: (e: MarkerEvent<MouseEvent>) => void;
246
+ onDragStart?: (e: MarkerDragEvent) => void;
247
+ onDrag?: (e: MarkerDragEvent) => void;
248
+ onDragEnd?: (e: MarkerDragEvent) => void;
249
+ children?: React$1.ReactNode;
250
+ };
251
+ declare const Marker: React$1.FC<MarkerProps>;
252
+
253
+ type PopupProps = PopupOptions & {
254
+ /** Longitude of the anchor location */
255
+ longitude: number;
256
+ /** Latitude of the anchor location */
257
+ latitude: number;
258
+ /** CSS style override, applied to the control's container */
259
+ style?: React$1.CSSProperties;
260
+ onOpen?: (e: PopupEvent) => void;
261
+ onClose?: (e: PopupEvent) => void;
262
+ children?: React$1.ReactNode;
263
+ };
264
+ declare const Popup: React$1.FC<PopupProps>;
265
+
266
+ type AttributionControlProps = AttributionControlOptions & {
267
+ /** Placement of the control relative to the map. */
268
+ position?: ControlPosition;
269
+ /** CSS style override, applied to the control's container */
270
+ style?: React$1.CSSProperties;
271
+ };
272
+ declare const AttributionControl: React$1.FC<AttributionControlProps>;
273
+
274
+ type FullscreenControlProps = Omit<FullscreenControlOptions, 'container'> & {
275
+ /** Id of the DOM element which should be made full screen. By default, the map container
276
+ * element will be made full screen. */
277
+ containerId?: string;
278
+ /** Placement of the control relative to the map. */
279
+ position?: ControlPosition;
280
+ /** CSS style override, applied to the control's container */
281
+ style?: React$1.CSSProperties;
282
+ };
283
+ declare const FullscreenControl: React$1.FC<FullscreenControlProps>;
284
+
285
+ type GeolocateControlProps = GeolocateControlOptions & {
286
+ /** Placement of the control relative to the map. */
287
+ position?: ControlPosition;
288
+ /** CSS style override, applied to the control's container */
289
+ style?: React$1.CSSProperties;
290
+ /** Called on each Geolocation API position update that returned as success. */
291
+ onGeolocate?: (e: GeolocateResultEvent) => void;
292
+ /** Called on each Geolocation API position update that returned as an error. */
293
+ onError?: (e: GeolocateErrorEvent) => void;
294
+ /** Called on each Geolocation API position update that returned as success but user position
295
+ * is out of map `maxBounds`. */
296
+ onOutOfMaxBounds?: (e: GeolocateResultEvent) => void;
297
+ /** Called when the GeolocateControl changes to the active lock state. */
298
+ onTrackUserLocationStart?: (e: GeolocateEvent) => void;
299
+ /** Called when the GeolocateControl changes to the background state. */
300
+ onTrackUserLocationEnd?: (e: GeolocateEvent) => void;
301
+ };
302
+ declare const GeolocateControl: React$1.FC<GeolocateControlProps>;
303
+
304
+ type NavigationControlProps = NavigationControlOptions & {
305
+ /** Placement of the control relative to the map. */
306
+ position?: ControlPosition;
307
+ /** CSS style override, applied to the control's container */
308
+ style?: React$1.CSSProperties;
309
+ };
310
+ declare const NavigationControl: React$1.FC<NavigationControlProps>;
311
+
312
+ type ScaleControlProps = ScaleControlOptions & {
313
+ unit?: string;
314
+ maxWidth?: number;
315
+ /** Placement of the control relative to the map. */
316
+ position?: ControlPosition;
317
+ /** CSS style override, applied to the control's container */
318
+ style?: React$1.CSSProperties;
319
+ };
320
+ declare const ScaleControl: React$1.FC<ScaleControlProps>;
321
+
322
+ type TerrainControlProps = TerrainSpecification & {
323
+ /** Placement of the control relative to the map. */
324
+ position?: ControlPosition;
325
+ /** CSS style override, applied to the control's container */
326
+ style?: React$1.CSSProperties;
327
+ };
328
+ declare const TerrainControl: React$1.FC<TerrainControlProps>;
329
+
330
+ type LogoControlProps = LogoControlOptions & {
331
+ /** Placement of the control relative to the map. */
332
+ position?: ControlPosition;
333
+ /** CSS style override, applied to the control's container */
334
+ style?: React$1.CSSProperties;
335
+ };
336
+ declare const LogoControl: React$1.FC<LogoControlProps>;
337
+
338
+ /**
339
+ * @fileoverview Source component for adding data sources to a MapLibre GL map.
340
+ *
341
+ * Sources define the data that layers can render. This component supports all
342
+ * MapLibre GL source types including GeoJSON, vector tiles, raster tiles. image. and video.
343
+ *
344
+ * @module components/source
345
+ * @see {@link https://maplibre.org/maplibre-gl-js/docs/sources/}
346
+ */
347
+
348
+ /**
349
+ * Props for the Source component.
350
+ *
351
+ * @typedef {Object} SourceProps
352
+ * @property {string} [id] - Unique identifier for the source. If not provided. one will be generated automatically.
353
+ * @property {React.ReactNode} [children] - Child Layer components that will use this source.
354
+ * @extends {SourceSpecification}
355
+ *
356
+ * @example
357
+ * ```tsx
358
+ * // GeoJSON source with a layer
359
+ * <Source id="my-data" type="geojson" data={geojsonData}>
360
+ * <Layer id="points-layer" type="circle" paint={{ 'circle-radius': 8 }} />
361
+ * </Source>
362
+ *
363
+ * // Vector tile source
364
+ * <Source id="streets" type="vector" url="mapbox://streets-v11" />
365
+ *
366
+ * // Raster source
367
+ * <Source id="satellite" type="raster" tiles={['https://example.com/tiles/{z}/{x}/{y}.png']} tileSize={256} />
368
+ * ```
369
+ */
370
+ type SourceProps = SourceSpecification & {
371
+ /** Unique identifier for the source. If not provided. one will be generated automatically. */
372
+ id?: string;
373
+ /** Child Layer components that will use this source. */
374
+ children?: any;
375
+ };
376
+ declare const Source: React$1.MemoExoticComponent<React$1.ForwardRefExoticComponent<SourceProps & React$1.RefAttributes<Source$1>>>;
377
+
378
+ /**
379
+ * @fileoverview CanvasSource component for adding canvas-based data sources to a MapLibre GL map.
380
+ *
381
+ * Canvas sources allow rendering custom HTML canvas elements as map layers.
382
+ * This is useful for dynamic, animated, or custom-rendered data overlays.
383
+ *
384
+ * @module components/canvas-source
385
+ * @see {@link https://maplibre.org/maplibre-gl-js/docs/sources/}
386
+ */
387
+
388
+ /**
389
+ * Coordinates for the canvas corners [top-left, top-right, bottom-right, bottom-left]
390
+ */
391
+ type CanvasCoordinates = [
392
+ [
393
+ number,
394
+ number
395
+ ],
396
+ [
397
+ number,
398
+ number
399
+ ],
400
+ [
401
+ number,
402
+ number
403
+ ],
404
+ [
405
+ number,
406
+ number
407
+ ]
408
+ ];
409
+ /**
410
+ * Props for the CanvasSource component.
411
+ *
412
+ * @typedef {Object} CanvasSourceProps
413
+ * @property {string} [id] - Unique identifier for the source.
414
+ * @property {CanvasCoordinates} coordinates - Corner coordinates of the canvas.
415
+ * @property {HTMLCanvasElement} canvas - The canvas element to render.
416
+ * @property {boolean} [animate] - Whether to animate the canvas (re-render on each frame).
417
+ * @property {number} [width] - Width of the canvas context.
418
+ * @property {number} [height] - Height of the canvas context.
419
+ * @property {React.ReactNode} [children] - Child Layer components.
420
+ *
421
+ * @example
422
+ * ```tsx
423
+ * // Canvas source with dynamic content
424
+ * const canvasRef = useRef<HTMLCanvasElement>(null);
425
+ * const [canvasEl, setCanvasEl] = useState<HTMLCanvasElement | null>(null);
426
+ *
427
+ * useEffect(() => {
428
+ * const canvas = canvasRef.current;
429
+ * if (!canvas) return;
430
+ * const ctx = canvas.getContext('2d');
431
+ * if (ctx) {
432
+ * ctx.fillStyle = 'rgba(255, 0, 0, 0.5)';
433
+ * ctx.fillRect(0, 0, 100, 100);
434
+ * }
435
+ * setCanvasEl(canvas);
436
+ * }, []);
437
+ *
438
+ * {canvasEl && (
439
+ * <CanvasSource
440
+ * id="canvas-source"
441
+ * coordinates={[
442
+ * [90.39, 23.83], // top-left
443
+ * [90.41, 23.83], // top-right
444
+ * [90.41, 23.81], // bottom-right
445
+ * [90.39, 23.81] // bottom-left
446
+ * ]}
447
+ * canvas={canvasEl}
448
+ * >
449
+ * <Layer type="raster" paint={{ 'raster-opacity': 0.8 }} />
450
+ * </CanvasSource>
451
+ * )}
452
+ * ```
453
+ */
454
+ type CanvasSourceProps = {
455
+ /** Unique identifier for the source */
456
+ id?: string;
457
+ /** Corner coordinates of the canvas [top-left, top-right, bottom-right, bottom-left] */
458
+ coordinates: CanvasCoordinates;
459
+ /** The canvas element to render */
460
+ canvas: HTMLCanvasElement;
461
+ /** Whether to animate the canvas (re-render on each frame) */
462
+ animate?: boolean;
463
+ /** Width of the canvas context */
464
+ width?: number;
465
+ /** Height of the canvas context */
466
+ height?: number;
467
+ /** Child Layer components */
468
+ children?: React$1.ReactNode;
469
+ };
470
+ declare const CanvasSource: React$1.NamedExoticComponent<CanvasSourceProps>;
471
+
472
+ /**
473
+ * Utility type to make id optional in layer specification.
474
+ * @private
475
+ */
476
+ type OptionalId<T> = T extends {
477
+ id: string;
478
+ } ? Omit<T, 'id'> & {
479
+ id?: string;
480
+ } : T;
481
+ /**
482
+ * Utility type to make source optional in layer specification.
483
+ * @private
484
+ */
485
+ type OptionalSource<T> = T extends {
486
+ source: string;
487
+ } ? Omit<T, 'source'> & {
488
+ source?: string;
489
+ } : T;
490
+ /**
491
+ * Props for the Layer component.
492
+ *
493
+ * @typedef {Object} LayerProps
494
+ * @property {string} [id] - Unique identifier for the layer. If not provided, one will be generated automatically.
495
+ * @property {string} [source] - The source ID this layer should use (inherited from parent Source component).
496
+ * @property {string} [beforeId] - If set, the layer will be inserted before the specified layer.
497
+ * @property {function} [onClick] - Called when the layer is clicked.
498
+ * @property {function} [onMouseEnter] - Called when the mouse enters the layer.
499
+ * @property {function} [onMouseLeave] - Called when the mouse leaves the layer.
500
+ * @property {function} [onMouseMove] - Called when the mouse moves over the layer.
501
+ * @property {function} [onMouseDown] - Called when mouse button is pressed on the layer.
502
+ * @property {function} [onMouseUp] - Called when mouse button is released on the layer.
503
+ * @property {function} [onContextMenu] - Called on right-click context menu.
504
+ * @property {function} [onDoubleClick] - Called on double click.
505
+ * @extends {LayerSpecification | CustomLayerInterface}
506
+ *
507
+ * @example
508
+ * ```tsx
509
+ * // Circle layer with paint properties
510
+ * <Layer
511
+ * id="points-layer"
512
+ * type="circle"
513
+ * paint={{
514
+ * 'circle-radius': 8,
515
+ * 'circle-color': '#007cbf'
516
+ * }}
517
+ * />
518
+ *
519
+ * // Line layer with filter
520
+ * <Layer
521
+ * id="roads-layer"
522
+ * type="line"
523
+ * source="streets"
524
+ * source-layer="road"
525
+ * filter={['==', ['get', 'type'], 'primary']}
526
+ * paint={{ 'line-width': 2 }}
527
+ * />
528
+ *
529
+ * // Interactive layer with events
530
+ * <Layer
531
+ * id="interactive-layer"
532
+ * type="fill"
533
+ * paint={{ 'fill-color': '#088' }}
534
+ * onClick={(e) => console.log('Clicked:', e.features)}
535
+ * onMouseEnter={(e) => console.log('Hover:', e.features)}
536
+ * onMouseLeave={() => console.log('Left layer')}
537
+ * />
538
+ *
539
+ * // Custom layer
540
+ * <Layer
541
+ * type="custom"
542
+ * renderingMode="2d"
543
+ * onAdd={(map) => { ... }}
544
+ * render={(gl, matrix) => { ... }}
545
+ * />
546
+ * ```
547
+ */
548
+ type LayerProps = (OptionalSource<OptionalId<LayerSpecification>> | CustomLayerInterface) & {
549
+ /** If set, the layer will be inserted before the specified layer */
550
+ beforeId?: string;
551
+ /** Called when the layer is clicked */
552
+ onClick?: (e: MapLayerMouseEvent) => void;
553
+ /** Called when the mouse enters the layer */
554
+ onMouseEnter?: (e: MapLayerMouseEvent) => void;
555
+ /** Called when the mouse leaves the layer */
556
+ onMouseLeave?: () => void;
557
+ /** Called when the mouse moves over the layer */
558
+ onMouseMove?: (e: MapLayerMouseEvent) => void;
559
+ /** Called when mouse button is pressed on the layer */
560
+ onMouseDown?: (e: MapLayerMouseEvent) => void;
561
+ /** Called when mouse button is released on the layer */
562
+ onMouseUp?: (e: MapLayerMouseEvent) => void;
563
+ /** Called on right-click context menu */
564
+ onContextMenu?: (e: MapLayerMouseEvent) => void;
565
+ /** Called on double click */
566
+ onDoubleClick?: (e: MapLayerMouseEvent) => void;
567
+ };
568
+ /**
569
+ * Layer component for adding visual layers to a MapLibre GL map.
570
+ *
571
+ * Layers define how data from sources is rendered on the map. Supports all
572
+ * MapLibre GL layer types including fill, line, circle, symbol, raster,
573
+ * hillshade, heatmap, and custom layers.
574
+ *
575
+ * Must be a child of a Source component (for data layers) or used standalone
576
+ * with a source prop for pre-existing sources.
577
+ *
578
+ * @component
579
+ * @example
580
+ * ```tsx
581
+ * // Circle layer with paint properties
582
+ * <Layer
583
+ * id="points-layer"
584
+ * type="circle"
585
+ * paint={{
586
+ * 'circle-radius': 8,
587
+ * 'circle-color': '#007cbf'
588
+ * }}
589
+ * />
590
+ *
591
+ * // Line layer with filter
592
+ * <Layer
593
+ * id="roads-layer"
594
+ * type="line"
595
+ * source="streets"
596
+ * source-layer="road"
597
+ * filter={['==', ['get', 'type'], 'primary']}
598
+ * paint={{ 'line-width': 2 }}
599
+ * />
600
+ *
601
+ * // Inside a Source component
602
+ * <Source id="geojson" type="geojson" data={data}>
603
+ * <Layer type="circle" paint={{ 'circle-radius': 6 }} />
604
+ * </Source>
605
+ * ```
606
+ */
607
+ declare function _Layer(props: LayerProps): any;
608
+ declare const Layer: React$1.MemoExoticComponent<typeof _Layer>;
609
+
610
+ type ControlOptions = {
611
+ position?: ControlPosition;
612
+ };
613
+ declare function useControl<T extends MapControl>(onCreate: (context: MapContextValue) => T, opts?: ControlOptions): T;
614
+ declare function useControl<T extends MapControl>(onCreate: (context: MapContextValue) => T, onRemove: (context: MapContextValue) => void, opts?: ControlOptions): T;
615
+ declare function useControl<T extends MapControl>(onCreate: (context: MapContextValue) => T, onAdd: (context: MapContextValue) => void, onRemove: (context: MapContextValue) => void, opts?: ControlOptions): T;
616
+
617
+ declare const MapProvider: React$1.FC<{
618
+ children?: React$1.ReactNode;
619
+ }>;
620
+ type MapCollection = {
621
+ [id: string]: MapRef | undefined;
622
+ current?: MapRef;
623
+ };
624
+ declare function useMap(): MapCollection;
625
+
626
+ /**
627
+ * Draw event types
628
+ */
629
+ interface DrawEvent {
630
+ type: string;
631
+ features?: GeoJSON.Feature<GeoJSON.Geometry>[];
632
+ featureIds?: string[];
633
+ mode?: string;
634
+ originalEvent?: unknown;
635
+ }
636
+ /**
637
+ * Draw control options - extends maplibre-gl-draw options
638
+ */
639
+ interface DrawControlOptions {
640
+ /** Whether controls are displayed by default */
641
+ displayControlsDefault?: boolean;
642
+ /** Control configuration */
643
+ controls?: {
644
+ point?: boolean;
645
+ line_string?: boolean;
646
+ polygon?: boolean;
647
+ trash?: boolean;
648
+ combine_features?: boolean;
649
+ uncombine_features?: boolean;
650
+ };
651
+ /** Custom styles for draw layers */
652
+ styles?: unknown[];
653
+ /** Available modes */
654
+ modes?: Record<string, unknown>;
655
+ /** Default mode */
656
+ defaultMode?: string;
657
+ }
658
+ type DrawControlProps = DrawControlOptions & {
659
+ /** Placement of the control relative to the map. */
660
+ position?: ControlPosition;
661
+ /** CSS style override, applied to the control's container */
662
+ style?: React$1.CSSProperties;
663
+ /** Callback fired when a feature is created */
664
+ onDrawCreate?: (e: DrawEvent) => void;
665
+ /** Callback fired when a feature is deleted */
666
+ onDrawDelete?: (e: DrawEvent) => void;
667
+ /** Callback fired when a feature is updated */
668
+ onDrawUpdate?: (e: DrawEvent) => void;
669
+ /** Callback fired when the selection changes */
670
+ onDrawSelectionChange?: (e: DrawEvent) => void;
671
+ /** Callback fired when the draw mode changes */
672
+ onDrawModeChange?: (e: DrawEvent) => void;
673
+ /** Callback fired when features are combined */
674
+ onDrawCombine?: (e: DrawEvent) => void;
675
+ /** Callback fired when features are uncombined */
676
+ onDrawUncombine?: (e: DrawEvent) => void;
677
+ /** Callback fired when rendering */
678
+ onDrawRender?: (e: DrawEvent) => void;
679
+ };
680
+ declare function _DrawControl(props: DrawControlProps): any;
681
+ declare const DrawControl: React$1.MemoExoticComponent<typeof _DrawControl>;
682
+
683
+ /**
684
+ * Options for the GlobeControl
685
+ */
686
+ interface GlobeControlOptions {
687
+ /** Custom button element */
688
+ buttonElement?: HTMLElement;
689
+ /** Custom button class name */
690
+ buttonClassName?: string;
691
+ /** Button title/tooltip text */
692
+ buttonTitle?: string;
693
+ /** Custom CSS for the button */
694
+ buttonStyle?: React.CSSProperties;
695
+ }
696
+ type GlobeControlProps = GlobeControlOptions & {
697
+ /** Position of the control on the map */
698
+ position?: ControlPosition;
699
+ /** Called when projection changes */
700
+ onProjectionChange?: (isGlobe: boolean) => void;
701
+ };
702
+ /**
703
+ * GlobeControl component for toggling between 3D globe and 2D map views.
704
+ *
705
+ * This control works with MapLibre GL 3.x+ which supports globe projection.
706
+ * Adds a button to the map that toggles between mercator (flat) and globe (3D) projections.
707
+ *
708
+ * @component
709
+ * @example
710
+ * ```tsx
711
+ * import { Map, GlobeControl } from 'react-bkoi-gl';
712
+ * import "react-bkoi-gl/styles";
713
+ *
714
+ * function GlobeExample() {
715
+ * const handleProjectionChange = (isGlobe) => {
716
+ * console.log('Globe view:', isGlobe);
717
+ * };
718
+ *
719
+ * return (
720
+ * <Map
721
+ * mapStyle={`https://map.barikoi.com/styles/osm-liberty/style.json?key=${API_KEY}`}
722
+ * initialViewState={{
723
+ * longitude: 90.3938,
724
+ * latitude: 23.8216,
725
+ * zoom: 12
726
+ * }}
727
+ * >
728
+ * <GlobeControl
729
+ * position="top-right"
730
+ * onProjectionChange={handleProjectionChange}
731
+ * />
732
+ * </Map>
733
+ * );
734
+ * }
735
+ * ```
736
+ */
737
+ declare function _GlobeControl(props: GlobeControlProps): any;
738
+ declare const GlobeControl: React$1.MemoExoticComponent<typeof _GlobeControl>;
739
+
740
+ type MapLibreMap = Map$1;
741
+ /**
742
+ * Map interaction types that can be disabled/enabled
743
+ */
744
+ type MapInteractions = 'dragPan' | 'scrollZoom' | 'boxZoom' | 'dragRotate' | 'keyboard' | 'doubleClickZoom' | 'touchZoomRotate';
745
+ /**
746
+ * Configuration for minimap interactions
747
+ */
748
+ type MinimapInteractions = Record<MapInteractions, boolean>;
749
+ /**
750
+ * Configuration for the parent rectangle overlay
751
+ */
752
+ interface ParentRectConfig {
753
+ /** Layout properties for the line layer */
754
+ lineLayout?: Record<string, unknown>;
755
+ /** Paint properties for the line layer */
756
+ linePaint?: Record<string, unknown>;
757
+ /** Paint properties for the fill layer */
758
+ fillPaint?: Record<string, unknown>;
759
+ }
760
+ /**
761
+ * Configuration for the toggle button
762
+ */
763
+ interface ToggleButtonConfig {
764
+ /** Custom SVG icon */
765
+ icon?: string;
766
+ /** Custom CSS class */
767
+ className?: string;
768
+ /** Custom inline styles */
769
+ style?: Record<string, string>;
770
+ /** Background color of the icon */
771
+ iconBackgroundColor?: string;
772
+ /** Hover color */
773
+ hoverColor?: string;
774
+ /** Enable rotation based on position */
775
+ enableRotation?: boolean;
776
+ /** Custom rotation angle */
777
+ rotationAngle?: number;
778
+ }
779
+ /**
780
+ * Minimap control options
781
+ */
782
+ interface MinimapControlOptions {
783
+ /** Initial center coordinates */
784
+ center?: [number, number];
785
+ /** Barikoi API access token */
786
+ accessToken?: string;
787
+ /** Map style for the minimap */
788
+ style?: string | StyleSpecification;
789
+ /** Zoom level difference from parent */
790
+ zoomAdjust?: number;
791
+ /** Lock to specific zoom level */
792
+ lockZoom?: number;
793
+ /** Sync pitch with parent */
794
+ pitchAdjust?: boolean;
795
+ /** Custom container styles */
796
+ containerStyle?: Record<string, string>;
797
+ /** Position on map */
798
+ position?: ControlPosition;
799
+ /** Parent rectangle configuration */
800
+ parentRect?: ParentRectConfig;
801
+ /** Whether minimap can be toggled */
802
+ toggleable?: boolean;
803
+ /** Toggle button configuration */
804
+ toggleButton?: ToggleButtonConfig;
805
+ /** Start minimized */
806
+ initialMinimized?: boolean;
807
+ /** Width when minimized */
808
+ collapsedWidth?: string;
809
+ /** Height when minimized */
810
+ collapsedHeight?: string;
811
+ /** Border radius */
812
+ borderRadius?: string;
813
+ /** Interaction configuration */
814
+ interactions?: Partial<MinimapInteractions>;
815
+ /** Toggle callback */
816
+ onToggle?: (isMinimized: boolean) => void;
817
+ /** Hide tooltip text */
818
+ hideText?: string;
819
+ /** Show tooltip text */
820
+ showText?: string;
821
+ /** Enable responsive sizing */
822
+ responsive?: boolean;
823
+ /** Responsive width */
824
+ responsiveWidth?: string;
825
+ /** Responsive height */
826
+ responsiveHeight?: string;
827
+ /** Minimum width */
828
+ minWidth?: string;
829
+ /** Minimum height */
830
+ minHeight?: string;
831
+ /** Maximum width */
832
+ maxWidth?: string;
833
+ /** Maximum height */
834
+ maxHeight?: string;
835
+ }
836
+ type MinimapControlProps = MinimapControlOptions;
837
+ /**
838
+ * Minimap class - wraps MapLibre Map as a control
839
+ */
840
+ declare class Minimap implements IControl {
841
+ private options;
842
+ private map;
843
+ private parentMap;
844
+ private container;
845
+ private readonly id;
846
+ private parentRect?;
847
+ private differentStyle;
848
+ private desync?;
849
+ private toggleButtonCleanup?;
850
+ private isMinimized;
851
+ private resizeHandler?;
852
+ constructor(options?: MinimapControlOptions);
853
+ onAdd(parentMap: MapLibreMap): HTMLElement;
854
+ onRemove(): void;
855
+ private createContainer;
856
+ private getContainerStyles;
857
+ private validateContainerStyle;
858
+ private configureInteractions;
859
+ private setupToggleButton;
860
+ private setupResponsiveSizing;
861
+ toggle(): void;
862
+ isMinimizedState(): boolean;
863
+ private addParentRect;
864
+ private setParentBounds;
865
+ private syncMaps;
866
+ }
867
+ declare function _MinimapControl(props: MinimapControlProps): any;
868
+ declare const MinimapControl: React$1.MemoExoticComponent<typeof _MinimapControl>;
869
+
870
+ 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, 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, useControl, useMap };