@yarrow-uz/yarrow-map-web-sdk 1.0.40 → 1.0.42
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/README.md +54 -6
- package/dist/main.js +2 -2
- package/dist/maps/brandBadge.d.ts +1 -0
- package/dist/maps/yarrow.d.ts +17 -3
- package/dist/maps/yarrowControls.d.ts +9 -1
- package/dist/module.js +2 -2
- package/dist/react/index.js +1 -1
- package/dist/react/useYarrowMap.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -140,7 +140,7 @@ const mapConfig = new YarrowMapConfig({
|
|
|
140
140
|
theme, // 'light' | 'dark' (default: 'light')
|
|
141
141
|
cache, // { enabled?: boolean, lifespanDays?: number }
|
|
142
142
|
brandBadgePosition, // 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
|
|
143
|
-
controls // { enabled?: boolean, position?: 'left'|'right', zoom?: boolean, compass?: boolean }
|
|
143
|
+
controls // { enabled?: boolean, position?: 'left'|'left-top'|'left-bottom'|'right'|'right-top'|'right-bottom', zoom?: boolean, compass?: boolean }
|
|
144
144
|
});
|
|
145
145
|
```
|
|
146
146
|
|
|
@@ -163,7 +163,7 @@ const mapConfig = new YarrowMapConfig({
|
|
|
163
163
|
brandBadgePosition: 'top-right',
|
|
164
164
|
controls: {
|
|
165
165
|
enabled: true, // Yarrow controls are OFF by default
|
|
166
|
-
position: 'right',
|
|
166
|
+
position: 'right-bottom', // Optional placement: left/left-top/left-bottom/right/right-top/right-bottom
|
|
167
167
|
zoom: true, // Optional
|
|
168
168
|
compass: true // Optional
|
|
169
169
|
},
|
|
@@ -175,6 +175,8 @@ yarrowMap.init().then(() => {
|
|
|
175
175
|
});
|
|
176
176
|
```
|
|
177
177
|
|
|
178
|
+
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
|
+
|
|
178
180
|
## Basic Map Manipulation
|
|
179
181
|
|
|
180
182
|
### Changing the Map Style
|
|
@@ -355,8 +357,43 @@ yarrowMap.addLayer(
|
|
|
355
357
|
featureCollection, // GeoJSON FeatureCollection
|
|
356
358
|
paint, // Paint properties object
|
|
357
359
|
layout, // Layout properties object
|
|
358
|
-
iconSettings
|
|
360
|
+
iconSettings, // Icon configuration (width, height)
|
|
361
|
+
options // Optional: { sourceId?: string, filter?: LayerFilter }
|
|
362
|
+
);
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Managing Sources Explicitly
|
|
366
|
+
|
|
367
|
+
```javascript
|
|
368
|
+
yarrowMap.addSource('vehicles-source', vehicleFeatureCollection);
|
|
369
|
+
yarrowMap.updateSourceData('vehicles-source', nextVehicleFeatureCollection);
|
|
370
|
+
|
|
371
|
+
yarrowMap.addLayer(
|
|
372
|
+
'active-vehicles',
|
|
373
|
+
'circle',
|
|
374
|
+
nextVehicleFeatureCollection,
|
|
375
|
+
{
|
|
376
|
+
'circle-radius': ['interpolate', ['linear'], ['zoom'], 10, 4, 16, 10],
|
|
377
|
+
'circle-color': ['case', ['==', ['get', 'status'], 'active'], '#16a34a', '#9ca3af']
|
|
378
|
+
},
|
|
379
|
+
{},
|
|
380
|
+
{},
|
|
381
|
+
{
|
|
382
|
+
sourceId: 'vehicles-source',
|
|
383
|
+
filter: ['==', ['get', 'status'], 'active']
|
|
384
|
+
}
|
|
385
|
+
);
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Feature State and Rendered Queries
|
|
389
|
+
|
|
390
|
+
```javascript
|
|
391
|
+
yarrowMap.setFeatureState(
|
|
392
|
+
{ source: 'vehicles-source', id: 101 },
|
|
393
|
+
{ selected: true }
|
|
359
394
|
);
|
|
395
|
+
|
|
396
|
+
const features = yarrowMap.queryRenderedFeatures({ layers: ['active-vehicles'] });
|
|
360
397
|
```
|
|
361
398
|
|
|
362
399
|
**Symbol layer with custom icons:**
|
|
@@ -893,7 +930,13 @@ constructor(
|
|
|
893
930
|
brandBadgePosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
894
931
|
controls?: {
|
|
895
932
|
enabled?: boolean; // default: false
|
|
896
|
-
position?:
|
|
933
|
+
position?:
|
|
934
|
+
| 'left'
|
|
935
|
+
| 'left-top'
|
|
936
|
+
| 'left-bottom'
|
|
937
|
+
| 'right'
|
|
938
|
+
| 'right-top'
|
|
939
|
+
| 'right-bottom';
|
|
897
940
|
zoom?: boolean; // default: true
|
|
898
941
|
compass?: boolean; // default: true
|
|
899
942
|
};
|
|
@@ -916,7 +959,11 @@ constructor(
|
|
|
916
959
|
| `onIconClick(layerGroup, callback)` | `layerGroup: 'pois' \| 'buildings', callback: Function` | `void` | Listen for icon clicks |
|
|
917
960
|
| `onLayerClick(layerGroup, callback)` | `layerGroup: 'pois' \| 'buildings', callback: Function` | `void` | Alias for onIconClick (same method) |
|
|
918
961
|
| `changeBackgroundColor(color)` | `color: string` | `void` | Change map background color |
|
|
919
|
-
| `
|
|
962
|
+
| `addSource()` | `sourceId, data` | `void` | Add/replace a GeoJSON source |
|
|
963
|
+
| `updateSourceData()` | `sourceId, data` | `void` | Update data for an existing GeoJSON source (or create it) |
|
|
964
|
+
| `addLayer()` | `layerName, layerType, featureCollection, paint?, layout?, iconSettings?, options?` | `void` | Add a layer to the map (supports `sourceId` and `filter`) |
|
|
965
|
+
| `setFeatureState()` | `featureIdentifier, state` | `void` | Set state for a specific feature |
|
|
966
|
+
| `queryRenderedFeatures()` | `geometryOrOptions?, options?` | `MapGeoJSONFeature[]` | Query currently rendered features (supports `{ layers }`) |
|
|
920
967
|
| `removeLayer(layerName)` | `layerName: string` | `void` | Remove a layer from the map |
|
|
921
968
|
| `addMarker(coordinates, options?)` | `coordinates: [lat, lng], options?: MarkerOptions` | `Marker \| null` | Add a marker to the map |
|
|
922
969
|
| `removeMarker(marker)` | `marker: Marker` | `void` | Remove a marker from the map |
|
|
@@ -967,9 +1014,10 @@ interface SearchOptions {
|
|
|
967
1014
|
|
|
968
1015
|
## Version Information
|
|
969
1016
|
|
|
970
|
-
- **Current Version**: 1.0.
|
|
1017
|
+
- **Current Version**: 1.0.41
|
|
971
1018
|
- **Dependencies**: maplibre-gl ^5.5.0, axios ^1.7.9
|
|
972
1019
|
- **Repository**: https://git.yarrow.uz/yarrow-sdk/frontend/yarrow-map-web-sdk
|
|
1020
|
+
- **Changelog**: `CHANGELOG.md`
|
|
973
1021
|
|
|
974
1022
|
## Support
|
|
975
1023
|
|