react-bkoi-gl 1.0.7 → 2.0.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.
Files changed (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +172 -18
  3. package/dist/index.cjs +671 -736
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +370 -0
  6. package/dist/index.d.ts +370 -2
  7. package/dist/index.js +1434 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/styles/index.d.ts +4 -0
  10. package/dist/styles/react-bkoi-gl.css +1 -1
  11. package/package.json +84 -36
  12. package/bkoi-gl/package.json +0 -6
  13. package/dist/components/attribution-control.d.ts +0 -11
  14. package/dist/components/attribution-control.js +0 -19
  15. package/dist/components/attribution-control.js.map +0 -1
  16. package/dist/components/fullscreen-control.d.ts +0 -14
  17. package/dist/components/fullscreen-control.js +0 -21
  18. package/dist/components/fullscreen-control.js.map +0 -1
  19. package/dist/components/geolocate-control.d.ts +0 -37
  20. package/dist/components/geolocate-control.js +0 -46
  21. package/dist/components/geolocate-control.js.map +0 -1
  22. package/dist/components/layer.d.ts +0 -17
  23. package/dist/components/layer.js +0 -99
  24. package/dist/components/layer.js.map +0 -1
  25. package/dist/components/map.d.ts +0 -23
  26. package/dist/components/map.js +0 -102
  27. package/dist/components/map.js.map +0 -1
  28. package/dist/components/marker.d.ts +0 -41
  29. package/dist/components/marker.js +0 -98
  30. package/dist/components/marker.js.map +0 -1
  31. package/dist/components/navigation-control.d.ts +0 -11
  32. package/dist/components/navigation-control.js +0 -19
  33. package/dist/components/navigation-control.js.map +0 -1
  34. package/dist/components/popup.d.ts +0 -33
  35. package/dist/components/popup.js +0 -79
  36. package/dist/components/popup.js.map +0 -1
  37. package/dist/components/scale-control.d.ts +0 -13
  38. package/dist/components/scale-control.js +0 -31
  39. package/dist/components/scale-control.js.map +0 -1
  40. package/dist/components/source.d.ts +0 -7
  41. package/dist/components/source.js +0 -97
  42. package/dist/components/source.js.map +0 -1
  43. package/dist/components/use-control.d.ts +0 -9
  44. package/dist/components/use-control.js +0 -31
  45. package/dist/components/use-control.js.map +0 -1
  46. package/dist/components/use-map.d.ts +0 -20
  47. package/dist/components/use-map.js +0 -54
  48. package/dist/components/use-map.js.map +0 -1
  49. package/dist/exports-bkoi-gl.cjs +0 -1512
  50. package/dist/exports-bkoi-gl.d.ts +0 -89
  51. package/dist/exports-bkoi-gl.js +0 -36
  52. package/dist/exports-bkoi-gl.js.map +0 -1
  53. package/dist/exports-mapbox.d.ts +0 -139
  54. package/dist/exports-mapbox.js +0 -36
  55. package/dist/exports-mapbox.js.map +0 -1
  56. package/dist/mapbox/create-ref.d.ts +0 -9
  57. package/dist/mapbox/create-ref.js +0 -64
  58. package/dist/mapbox/create-ref.js.map +0 -1
  59. package/dist/mapbox/mapbox.d.ts +0 -81
  60. package/dist/mapbox/mapbox.js +0 -476
  61. package/dist/mapbox/mapbox.js.map +0 -1
  62. package/dist/types/common.d.ts +0 -78
  63. package/dist/types/common.js +0 -2
  64. package/dist/types/common.js.map +0 -1
  65. package/dist/types/events-bkoi-gl.d.ts +0 -49
  66. package/dist/types/events-bkoi-gl.js +0 -2
  67. package/dist/types/events-bkoi-gl.js.map +0 -1
  68. package/dist/types/events-mapbox.d.ts +0 -49
  69. package/dist/types/events-mapbox.js +0 -2
  70. package/dist/types/events-mapbox.js.map +0 -1
  71. package/dist/types/events.d.ts +0 -39
  72. package/dist/types/events.js +0 -2
  73. package/dist/types/events.js.map +0 -1
  74. package/dist/types/index.d.ts +0 -70
  75. package/dist/types/index.js +0 -5
  76. package/dist/types/index.js.map +0 -1
  77. package/dist/types/lib.d.ts +0 -224
  78. package/dist/types/lib.js +0 -2
  79. package/dist/types/lib.js.map +0 -1
  80. package/dist/types/public.d.ts +0 -2
  81. package/dist/types/public.js +0 -2
  82. package/dist/types/public.js.map +0 -1
  83. package/dist/types/style-spec-bkoi-gl.d.ts +0 -9
  84. package/dist/types/style-spec-bkoi-gl.js +0 -2
  85. package/dist/types/style-spec-bkoi-gl.js.map +0 -1
  86. package/dist/types/style-spec-mapbox.d.ts +0 -7
  87. package/dist/types/style-spec-mapbox.js +0 -2
  88. package/dist/types/style-spec-mapbox.js.map +0 -1
  89. package/dist/utils/apply-react-style.d.ts +0 -2
  90. package/dist/utils/apply-react-style.js +0 -16
  91. package/dist/utils/apply-react-style.js.map +0 -1
  92. package/dist/utils/assert.d.ts +0 -1
  93. package/dist/utils/assert.js +0 -6
  94. package/dist/utils/assert.js.map +0 -1
  95. package/dist/utils/deep-equal.d.ts +0 -15
  96. package/dist/utils/deep-equal.js +0 -46
  97. package/dist/utils/deep-equal.js.map +0 -1
  98. package/dist/utils/set-globals.d.ts +0 -22
  99. package/dist/utils/set-globals.js +0 -19
  100. package/dist/utils/set-globals.js.map +0 -1
  101. package/dist/utils/style-utils.d.ts +0 -2
  102. package/dist/utils/style-utils.js +0 -42
  103. package/dist/utils/style-utils.js.map +0 -1
  104. package/dist/utils/transform.d.ts +0 -26
  105. package/dist/utils/transform.js +0 -56
  106. package/dist/utils/transform.js.map +0 -1
  107. package/dist/utils/use-isomorphic-layout-effect.d.ts +0 -3
  108. package/dist/utils/use-isomorphic-layout-effect.js +0 -4
  109. package/dist/utils/use-isomorphic-layout-effect.js.map +0 -1
  110. package/src/components/attribution-control.ts +0 -32
  111. package/src/components/fullscreen-control.tsx +0 -37
  112. package/src/components/geolocate-control.ts +0 -90
  113. package/src/components/layer.ts +0 -133
  114. package/src/components/map.tsx +0 -155
  115. package/src/components/marker.ts +0 -137
  116. package/src/components/navigation-control.ts +0 -29
  117. package/src/components/popup.ts +0 -116
  118. package/src/components/scale-control.ts +0 -46
  119. package/src/components/source.ts +0 -158
  120. package/src/components/use-control.ts +0 -64
  121. package/src/components/use-map.tsx +0 -69
  122. package/src/exports-bkoi-gl.ts +0 -156
  123. package/src/exports-mapbox.ts +0 -159
  124. package/src/index.ts +0 -2
  125. package/src/mapbox/create-ref.ts +0 -118
  126. package/src/mapbox/mapbox.ts +0 -742
  127. package/src/types/common.ts +0 -94
  128. package/src/types/events-bkoi-gl.ts +0 -78
  129. package/src/types/events-mapbox.ts +0 -76
  130. package/src/types/events.ts +0 -73
  131. package/src/types/index.ts +0 -93
  132. package/src/types/lib.ts +0 -279
  133. package/src/types/public.ts +0 -9
  134. package/src/types/style-spec-bkoi-gl.ts +0 -81
  135. package/src/types/style-spec-mapbox.ts +0 -80
  136. package/src/utils/apply-react-style.ts +0 -20
  137. package/src/utils/assert.ts +0 -5
  138. package/src/utils/deep-equal.ts +0 -61
  139. package/src/utils/set-globals.ts +0 -57
  140. package/src/utils/style-utils.ts +0 -59
  141. package/src/utils/transform.ts +0 -86
  142. package/src/utils/use-isomorphic-layout-effect.ts +0 -7
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Barikoi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,14 @@
1
1
  <h1 align="center">react-bkoi-gl | <a href="https://docs.barikoi.com/npm/npm-intro">Docs</a></h1>
2
2
 
3
+ <p align="center">
4
+ <a href="https://www.npmjs.com/package/react-bkoi-gl"><img src="https://img.shields.io/npm/v/react-bkoi-gl.svg" alt="npm version"></a>
5
+ <a href="https://www.npmjs.com/package/react-bkoi-gl"><img src="https://img.shields.io/npm/dw/react-bkoi-gl" alt="npm downloads"></a>
6
+ <a href="https://bundlephobia.com/package/react-bkoi-gl"><img src="https://img.shields.io/bundlephobia/min/react-bkoi-gl" alt="Bundle Size"></a>
7
+ <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white" alt="TypeScript"></a>
8
+ <a href="https://nodejs.org/"><img src="https://img.shields.io/node/v/react-bkoi-gl" alt="Node.js Version"></a>
9
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
10
+ </p>
11
+
3
12
  ## Description
4
13
 
5
14
  `react-bkoi-gl` is a suite of [React](http://facebook.github.io/react/) components designed to provide a API for [Barikoi Maps](https://docs.barikoi.com/docs/maps-api). More information in the online documentation.
@@ -17,35 +26,44 @@ Or via yarn:
17
26
  yarn add react-bkoi-gl
18
27
  ```
19
28
 
20
- ### Example
29
+ ## Example
21
30
 
22
- ```js
31
+ ### JavaScript (`js`) Example
32
+ ```jsx
23
33
  import { useRef } from 'react';
24
- import { Map, FullscreenControl, GeolocateControl, NavigationControl, ScaleControl } from 'react-bkoi-gl';
34
+ import {
35
+ Map,
36
+ Marker,
37
+ Popup,
38
+ Layer,
39
+ Source,
40
+ NavigationControl,
41
+ FullscreenControl,
42
+ GeolocateControl,
43
+ ScaleControl,
44
+ } from 'react-bkoi-gl';
25
45
 
26
46
  // Import Styles
27
- import "react-bkoi-gl/styles"
47
+ import "react-bkoi-gl/styles";
28
48
 
29
49
  const App = () => {
30
- const BARIKOI_API_KEY = 'YOUR_BARIKOI_API_KEY_HERE'
31
- const mapStyle = `https://map.barikoi.com/styles/osm-liberty/style.json?key=${BARIKOI_API_KEY}`
50
+ const BARIKOI_API_KEY = 'YOUR_BARIKOI_API_KEY_HERE';
51
+ const mapStyle = `https://map.barikoi.com/styles/osm-liberty/style.json?key=${BARIKOI_API_KEY}`;
32
52
  const mapContainer = useRef(null);
33
53
  const mapRef = useRef(null);
34
54
  const initialViewState = {
35
55
  longitude: 90.36402,
36
56
  latitude: 23.823731,
37
57
  minZoom: 4,
38
- maxZoom: 30,
58
+ maxZoom: 22,
39
59
  zoom: 13,
40
60
  bearing: 0,
41
61
  pitch: 0,
42
- antialias: true
43
- }
62
+ antialias: true,
63
+ };
44
64
 
45
65
  return (
46
- <div
47
- ref={mapContainer} style={containerStyles}
48
- >
66
+ <div ref={mapContainer} style={containerStyles}>
49
67
  <Map
50
68
  ref={mapRef}
51
69
  mapStyle={mapStyle}
@@ -53,16 +71,39 @@ const App = () => {
53
71
  initialViewState={initialViewState}
54
72
  doubleClickZoom={false}
55
73
  dragRotate={false}
56
- attributionControl={false}
57
74
  >
58
- <GeolocateControl position="top-right" />
59
- <FullscreenControl position="top-right" />
75
+ <Marker longitude={90.36402} latitude={23.823731} color="red" />
76
+ <Popup longitude={90.36402} latitude={23.823731}>
77
+ <div>Hello, Barikoi!</div>
78
+ </Popup>
79
+ <Source
80
+ id="points"
81
+ type="geojson"
82
+ data={{
83
+ type: 'FeatureCollection',
84
+ features: [
85
+ {
86
+ type: 'Feature',
87
+ properties: {},
88
+ geometry: { type: 'Point', coordinates: [90.36402, 23.823731] }
89
+ }
90
+ ]
91
+ }}
92
+ />
93
+ <Layer
94
+ id="points-layer"
95
+ type="circle"
96
+ source="points"
97
+ paint={{ 'circle-radius': 10, 'circle-color': '#ff0000' }}
98
+ />
60
99
  <NavigationControl position="top-right" />
100
+ <FullscreenControl position="top-right" />
101
+ <GeolocateControl position="top-right" />
61
102
  <ScaleControl position="bottom-right" />
62
103
  </Map>
63
104
  </div>
64
- )
65
- }
105
+ );
106
+ };
66
107
 
67
108
  // JSX Styles
68
109
  const containerStyles = {
@@ -70,11 +111,124 @@ const containerStyles = {
70
111
  height: "100vh",
71
112
  minHeight: "400px",
72
113
  overflow: "hidden",
114
+ };
115
+
116
+ export default App;
117
+ ```
118
+
119
+ ### TypeScript (`ts`) Example
120
+ ```tsx
121
+ import { useRef } from 'react';
122
+ import {
123
+ Map,
124
+ Marker,
125
+ Popup,
126
+ Layer,
127
+ Source,
128
+ NavigationControl,
129
+ FullscreenControl,
130
+ GeolocateControl,
131
+ ScaleControl,
132
+ MapRef
133
+ } from 'react-bkoi-gl';
134
+
135
+ // Import Styles
136
+ import "react-bkoi-gl/styles";
137
+
138
+ interface MapProps {
139
+ longitude: number;
140
+ latitude: number;
73
141
  }
74
142
 
75
- export default App
143
+ const App: React.FC = () => {
144
+ const BARIKOI_API_KEY = 'YOUR_BARIKOI_API_KEY_HERE';
145
+ const mapStyle = `https://map.barikoi.com/styles/osm-liberty/style.json?key=${BARIKOI_API_KEY}`;
146
+ const mapContainer = useRef<HTMLDivElement>(null);
147
+ const mapRef = useRef<MapRef>(null);
148
+ const initialViewState = {
149
+ longitude: 90.36402,
150
+ latitude: 23.823731,
151
+ minZoom: 4,
152
+ maxZoom: 22,
153
+ zoom: 13,
154
+ bearing: 0,
155
+ pitch: 0,
156
+ antialias: true,
157
+ };
158
+
159
+ return (
160
+ <div ref={mapContainer} style={containerStyles}>
161
+ <Map
162
+ ref={mapRef}
163
+ mapStyle={mapStyle}
164
+ style={{ width: "100%", height: "100%" }}
165
+ initialViewState={initialViewState}
166
+ doubleClickZoom={false}
167
+ dragRotate={false}
168
+ >
169
+ <Marker longitude={90.36402} latitude={23.823731} color="red" />
170
+ <Popup longitude={90.36402} latitude={23.823731}>
171
+ <div>Hello, Barikoi!</div>
172
+ </Popup>
173
+ <Source
174
+ id="points"
175
+ type="geojson"
176
+ data={{
177
+ type: 'FeatureCollection',
178
+ features: [
179
+ {
180
+ type: 'Feature',
181
+ properties: {},
182
+ geometry: { type: 'Point', coordinates: [90.36402, 23.823731] }
183
+ }
184
+ ]
185
+ }}
186
+ />
187
+ <Layer
188
+ id="points-layer"
189
+ type="circle"
190
+ source="points"
191
+ paint={{ 'circle-radius': 10, 'circle-color': '#ff0000' }}
192
+ />
193
+ <NavigationControl position="top-right" />
194
+ <FullscreenControl position="top-right" />
195
+ <GeolocateControl position="top-right" />
196
+ <ScaleControl position="bottom-right" />
197
+ </Map>
198
+ </div>
199
+ );
200
+ };
201
+
202
+ // JSX Styles
203
+ const containerStyles: React.CSSProperties = {
204
+ width: "100%",
205
+ height: "100vh",
206
+ minHeight: "400px",
207
+ overflow: "hidden",
208
+ };
209
+
210
+ export default App;
76
211
  ```
77
212
 
213
+ ## Components
214
+
215
+ Here is a list of all available components in `react-bkoi-gl`:
216
+
217
+ | Component | Description |
218
+ |---------------------|-----------------------------------------------------------------------------|
219
+ | `Map` | The core component for rendering a Barikoi map. Must be the parent of all other components. |
220
+ | `Marker` | Displays a marker on the map at specified coordinates. |
221
+ | `Popup` | Displays a popup with custom content at specified coordinates. |
222
+ | `Layer` | Adds a custom layer to the map. |
223
+ | `Source` | Defines a data source for the map. |
224
+ | `NavigationControl` | Adds zoom and rotation controls. |
225
+ | `FullscreenControl` | Adds a button to toggle fullscreen mode. |
226
+ | `GeolocateControl` | Centers the map on the user's location. |
227
+ | `ScaleControl` | Displays a scale bar. |
228
+ | `TerrainControl` | Adds terrain control to the map. |
229
+ | `useMap` | Custom hook for managing the map instance. |
230
+ | `useControl` | Custom hook for managing map controls. |
231
+
78
232
  ## Get Barikoi API key
79
233
 
80
234
  To access Barikoi's API services, you need to: