@yarrow-uz/yarrow-map-web-sdk 1.0.42 → 1.0.44
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/CHANGELOG.md +55 -0
- package/README.md +70 -49
- package/dist/config/main.d.ts +2 -0
- package/dist/main.js +2 -2
- package/dist/maps/yarrow.d.ts +3 -1
- package/dist/module.js +2 -2
- package/dist/react/index.js +1 -1
- package/dist/react/useYarrowMap.d.ts +1 -0
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.0.44] - 2026-02-28
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Added `apiKey` as a required configuration option.
|
|
9
|
+
- Added `setYarrowApiKey()` and `getYarrowApiKey()` helper functions for API key management.
|
|
10
|
+
- Added axios interceptor to automatically append `api_key` to every request.
|
|
11
|
+
- Added `CHANGELOG.md` to package files for npm distribution.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- Made `apiKey` required in `YarrowMapConfig`, `YarrowMapReactConfig`, and type definitions.
|
|
15
|
+
- Enhanced brand badge and controls appearance with updated CSS properties for improved visual quality.
|
|
16
|
+
- Updated `README.md` with API reference, local development instructions, and apiKey requirement.
|
|
17
|
+
- Removed deprecated legacy constructor signature from YarrowMapConfig (positional arguments).
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- Corrected layer type handling in YarrowMap class for improved functionality.
|
|
21
|
+
|
|
22
|
+
## [1.0.43] - 2026-02-25
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- `changeBrandBadgePosition(position)` API to update the brand badge corner at runtime.
|
|
26
|
+
- Type declaration for `changeBrandBadgePosition(position: BrandBadgePosition)`.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
- Reduced brand badge `z-index` from `2147483647` to `1000` for better overlay stacking behavior.
|
|
30
|
+
- Updated `README.md` with runtime brand badge positioning docs and API reference.
|
|
31
|
+
|
|
32
|
+
## [1.0.42] - 2026-02-20
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
- Support for 6-way controls placement: `left`, `left-top`, `left-bottom`, `right`, `right-top`, `right-bottom`.
|
|
36
|
+
- Automatic controls inset when controls and badge share the same corner, preventing overlap.
|
|
37
|
+
- Dynamic collision recalculation using `ResizeObserver` as badge size changes.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
- Migrated brand badge asset from PNG to SVG.
|
|
41
|
+
- Improved dark theme compass needle visibility for controls.
|
|
42
|
+
- Updated controls positioning docs and TypeScript declarations to include new placement options.
|
|
43
|
+
|
|
44
|
+
## [1.0.41] - 2026-02-19
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
- `addSource(sourceId, data)` for explicit GeoJSON source management.
|
|
48
|
+
- `updateSourceData(sourceId, data)` to update existing source data (or create source if missing).
|
|
49
|
+
- `setFeatureState(featureIdentifier, state)` to support per-feature interactive state.
|
|
50
|
+
- `queryRenderedFeatures(geometryOrOptions?, options?)` passthrough support, including `{ layers: [...] }`.
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
- `addLayer(...)` now supports `options.sourceId` and `options.filter`.
|
|
54
|
+
- `addLayer(...)` paint typing now accepts full expression-based paint values from MapLibre style spec.
|
|
55
|
+
- API docs updated in `README.md` for new source/layer/state/query capabilities.
|
package/README.md
CHANGED
|
@@ -6,12 +6,13 @@ This document provides a comprehensive guide to using the Yarrow Map Web SDK for
|
|
|
6
6
|
|
|
7
7
|
- [Getting Started](#getting-started)
|
|
8
8
|
- [Installation](#installation)
|
|
9
|
-
- [React Usage](#react-usage)
|
|
10
9
|
- [Initialization](#initialization)
|
|
11
10
|
- [Configuration Options](#configuration-options)
|
|
11
|
+
- [React Usage](#react-usage)
|
|
12
12
|
- [Basic Map Manipulation](#basic-map-manipulation)
|
|
13
13
|
- [Changing the Map Style](#changing-the-map-style)
|
|
14
14
|
- [Changing the Map Theme](#changing-the-map-theme)
|
|
15
|
+
- [Changing Brand Badge Position](#changing-brand-badge-position)
|
|
15
16
|
- [Moving the Map View](#moving-the-map-view)
|
|
16
17
|
- [Changing Background Color](#changing-background-color)
|
|
17
18
|
- [Handling Events](#handling-events)
|
|
@@ -39,6 +40,7 @@ This document provides a comprehensive guide to using the Yarrow Map Web SDK for
|
|
|
39
40
|
- [Advanced Features](#advanced-features)
|
|
40
41
|
- [Custom Icons and Styling](#custom-icons-and-styling)
|
|
41
42
|
- [Performance Optimization](#performance-optimization)
|
|
43
|
+
- [API Reference](#api-reference)
|
|
42
44
|
|
|
43
45
|
---
|
|
44
46
|
|
|
@@ -52,52 +54,9 @@ First, add the Yarrow Map Web SDK to your project using your preferred package m
|
|
|
52
54
|
npm install @yarrow-uz/yarrow-map-web-sdk
|
|
53
55
|
```
|
|
54
56
|
|
|
55
|
-
###
|
|
56
|
-
|
|
57
|
-
React APIs are exported from the `@yarrow-uz/yarrow-map-web-sdk/react` subpath.
|
|
58
|
-
|
|
59
|
-
```tsx
|
|
60
|
-
import { YarrowMapView } from '@yarrow-uz/yarrow-map-web-sdk/react';
|
|
61
|
-
|
|
62
|
-
export const MapScreen = () => {
|
|
63
|
-
return (
|
|
64
|
-
<YarrowMapView
|
|
65
|
-
config={{
|
|
66
|
-
center: [69.2401, 41.2995],
|
|
67
|
-
zoom: 12,
|
|
68
|
-
brandBadgePosition: 'bottom-left',
|
|
69
|
-
}}
|
|
70
|
-
style={{ width: '100%', height: '600px' }}
|
|
71
|
-
/>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
You can also use the hook for custom composition:
|
|
77
|
-
|
|
78
|
-
```tsx
|
|
79
|
-
import { useYarrowMap } from '@yarrow-uz/yarrow-map-web-sdk/react';
|
|
57
|
+
### Local Development
|
|
80
58
|
|
|
81
|
-
|
|
82
|
-
const { containerRef, isReady, error } = useYarrowMap({
|
|
83
|
-
config: {
|
|
84
|
-
center: [69.2401, 41.2995],
|
|
85
|
-
zoom: 12,
|
|
86
|
-
brandBadgePosition: 'bottom-right',
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<div>
|
|
92
|
-
<div ref={containerRef} style={{ width: '100%', height: '600px' }} />
|
|
93
|
-
{isReady && <p>Map ready</p>}
|
|
94
|
-
{error && <p>Failed to initialize map</p>}
|
|
95
|
-
</div>
|
|
96
|
-
);
|
|
97
|
-
};
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
**SSR note:** The React integration initializes the map only on the client side.
|
|
59
|
+
When running your application locally, serve it on **port 8080** to avoid CORS issues with the map API. Running on any other port will cause CORS errors.
|
|
101
60
|
|
|
102
61
|
### Initialization
|
|
103
62
|
|
|
@@ -134,6 +93,7 @@ The `YarrowMapConfig` class accepts a single configuration object:
|
|
|
134
93
|
const mapConfig = new YarrowMapConfig({
|
|
135
94
|
container, // string | HTMLElement
|
|
136
95
|
center, // [number, number] - [lng, lat]
|
|
96
|
+
apiKey, // string - Required, get from https://dashboard.yarrow.uz/
|
|
137
97
|
zoom, // number (default: 10)
|
|
138
98
|
minZoom, // number (default: 0)
|
|
139
99
|
maxZoom, // number (default: 19)
|
|
@@ -155,6 +115,7 @@ const mapConfig = new YarrowMapConfig({
|
|
|
155
115
|
zoom: 12,
|
|
156
116
|
minZoom: 5,
|
|
157
117
|
maxZoom: 18,
|
|
118
|
+
apiKey: 'YOUR_API_KEY', // Required - get from https://dashboard.yarrow.uz/
|
|
158
119
|
theme: 'dark',
|
|
159
120
|
cache: {
|
|
160
121
|
enabled: true, // Enable local persistent cache (default: false)
|
|
@@ -177,6 +138,54 @@ yarrowMap.init().then(() => {
|
|
|
177
138
|
|
|
178
139
|
When controls and the brand badge are placed in the same corner (for example `right-bottom` with `brandBadgePosition: 'bottom-right'`), the SDK automatically adds spacing so they do not overlap.
|
|
179
140
|
|
|
141
|
+
### React Usage
|
|
142
|
+
|
|
143
|
+
React APIs are exported from the `@yarrow-uz/yarrow-map-web-sdk/react` subpath.
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
import { YarrowMapView } from '@yarrow-uz/yarrow-map-web-sdk/react';
|
|
147
|
+
|
|
148
|
+
export const MapScreen = () => {
|
|
149
|
+
return (
|
|
150
|
+
<YarrowMapView
|
|
151
|
+
config={{
|
|
152
|
+
center: [69.2401, 41.2995],
|
|
153
|
+
zoom: 12,
|
|
154
|
+
apiKey: 'YOUR_API_KEY', // Required - get from https://dashboard.yarrow.uz/
|
|
155
|
+
brandBadgePosition: 'bottom-left',
|
|
156
|
+
}}
|
|
157
|
+
style={{ width: '100%', height: '600px' }}
|
|
158
|
+
/>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
You can also use the hook for custom composition:
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
import { useYarrowMap } from '@yarrow-uz/yarrow-map-web-sdk/react';
|
|
167
|
+
|
|
168
|
+
export const MapScreen = () => {
|
|
169
|
+
const { containerRef, isReady, error } = useYarrowMap({
|
|
170
|
+
config: {
|
|
171
|
+
center: [69.2401, 41.2995],
|
|
172
|
+
zoom: 12,
|
|
173
|
+
brandBadgePosition: 'bottom-right',
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<div>
|
|
179
|
+
<div ref={containerRef} style={{ width: '100%', height: '600px' }} />
|
|
180
|
+
{isReady && <p>Map ready</p>}
|
|
181
|
+
{error && <p>Failed to initialize map</p>}
|
|
182
|
+
</div>
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**SSR note:** The React integration initializes the map only on the client side.
|
|
188
|
+
|
|
180
189
|
## Basic Map Manipulation
|
|
181
190
|
|
|
182
191
|
### Changing the Map Style
|
|
@@ -210,6 +219,7 @@ const mapConfig = new YarrowMapConfig({
|
|
|
210
219
|
zoom: 12,
|
|
211
220
|
minZoom: 5,
|
|
212
221
|
maxZoom: 18,
|
|
222
|
+
apiKey: 'YOUR_API_KEY', // Required - get from https://dashboard.yarrow.uz/
|
|
213
223
|
theme: 'dark', // Set initial theme to dark
|
|
214
224
|
});
|
|
215
225
|
```
|
|
@@ -230,6 +240,17 @@ await yarrowMap.changeTheme('light');
|
|
|
230
240
|
- Preserves custom icons and markers
|
|
231
241
|
- Seamless theme transition
|
|
232
242
|
|
|
243
|
+
### Changing Brand Badge Position
|
|
244
|
+
|
|
245
|
+
You can set the initial badge position in config or change it dynamically after map initialization.
|
|
246
|
+
|
|
247
|
+
```javascript
|
|
248
|
+
// Move badge to the top-right corner
|
|
249
|
+
yarrowMap.changeBrandBadgePosition('top-right');
|
|
250
|
+
|
|
251
|
+
// Other values: 'top-left' | 'bottom-left' | 'bottom-right'
|
|
252
|
+
```
|
|
253
|
+
|
|
233
254
|
### Moving the Map View
|
|
234
255
|
|
|
235
256
|
You can programmatically move the map to a new location or fit it to a specific geographic area.
|
|
@@ -951,6 +972,7 @@ constructor(
|
|
|
951
972
|
| `init()` | None | `Promise<void>` | Initialize the map with styles and icons |
|
|
952
973
|
| `changeStyles(styleType?)` | `styleType?: 'satellite' \| 'hybrid'` | `Promise<any>` | Change map style |
|
|
953
974
|
| `changeTheme(theme)` | `theme: 'light' \| 'dark'` | `Promise<any>` | Switch between light and dark themes |
|
|
975
|
+
| `changeBrandBadgePosition(position)` | `position: 'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right'` | `BrandBadgePosition` | Change brand badge corner position at runtime |
|
|
954
976
|
| `zoomTo(lat, lng, zoom)` | `lat: number, lng: number, zoom: number` | `void` | Fly to specific coordinates |
|
|
955
977
|
| `fitBounds(data)` | `data: GeoJSON` | `void` | Fit map to show all features |
|
|
956
978
|
| `getBoundingBox(data)` | `data: GeoJSON` | `BoundingBox` | Calculate bounding box of features |
|
|
@@ -1014,11 +1036,10 @@ interface SearchOptions {
|
|
|
1014
1036
|
|
|
1015
1037
|
## Version Information
|
|
1016
1038
|
|
|
1017
|
-
- **Current Version**: 1.0.
|
|
1039
|
+
- **Current Version**: 1.0.44
|
|
1018
1040
|
- **Dependencies**: maplibre-gl ^5.5.0, axios ^1.7.9
|
|
1019
|
-
- **Repository**: https://git.yarrow.uz/yarrow-sdk/frontend/yarrow-map-web-sdk
|
|
1020
1041
|
- **Changelog**: `CHANGELOG.md`
|
|
1021
1042
|
|
|
1022
1043
|
## Support
|
|
1023
1044
|
|
|
1024
|
-
For issues, questions, or contributions,
|
|
1045
|
+
For issues, questions, or contributions, contact the Yarrow development team.
|