@tomtom-org/maps-sdk-plugin-viewport-places 0.5.2 → 0.5.4

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 (2) hide show
  1. package/README.md +14 -3
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Viewport Places Plugin
2
2
 
3
- Lightweight plugin for the [TomTom Maps SDK for Javascript](https://docs.tomtom.com/maps-sdk-js/introduction/overview) that keeps places in sync with the current map viewport by creating and managing "place modules" that refresh as the map moves.
3
+ Plugin for the [TomTom Maps SDK for JavaScript](https://docs.tomtom.com/maps-sdk-js/introduction/overview) that keeps places in sync with the current map viewport: each search you add gets its own place module, which searches again whenever the map moves.
4
4
 
5
5
  ## Docs & examples
6
6
 
@@ -9,13 +9,13 @@ Lightweight plugin for the [TomTom Maps SDK for Javascript](https://docs.tomtom.
9
9
 
10
10
  ## Quickstart
11
11
 
12
- Note: SDK plugins `@tomtom-org/maps-sdk` as a peer dependency — ensure the SDK is installed in your project.
12
+ Note: this plugin declares `@tomtom-org/maps-sdk` as a peer dependency — ensure the SDK is installed in your project.
13
13
 
14
14
  ```bash
15
15
  npm install @tomtom-org/maps-sdk maplibre-gl @tomtom-org/maps-sdk-plugin-viewport-places
16
16
  ```
17
17
 
18
- 1. Follow the SDK [Project setup](https://docs.tomtom.com/maps-sdk-js/guides/introduction/project-setup) or the Map [quickstart](https://docs.tomtom.com/maps-sdk-js/guides/map/quickstart) to create and initialize a `TomTomMap`.
18
+ 1. Follow the SDK [Project setup](https://docs.tomtom.com/maps-sdk-js/introduction/project-setup) or the Map [quickstart](https://docs.tomtom.com/maps-sdk-js/guides/map/quickstart) to create and initialize a `TomTomMap`.
19
19
 
20
20
  2. Import and use the plugin (plugin-specific steps only):
21
21
 
@@ -25,11 +25,22 @@ import { ViewportPlaces } from '@tomtom-org/maps-sdk-plugin-viewport-places';
25
25
  // assume `map` is your initialized TomTomMap instance
26
26
  const viewportPlaces = new ViewportPlaces(map);
27
27
 
28
+ // a text search
28
29
  await viewportPlaces.add({
29
30
  id: 'restaurants',
30
31
  searchOptions: { query: 'restaurant', limit: 40 },
31
32
  minZoom: 12,
32
33
  });
34
+
35
+ // a POI category search
36
+ await viewportPlaces.addPOICategories({
37
+ id: 'parking',
38
+ categories: ['PARKING_GARAGE', 'CHARGING_LOCATION'],
39
+ });
40
+
41
+ // change or drop a place module by its id
42
+ await viewportPlaces.update({ id: 'restaurants', searchOptions: { query: 'pizza' } });
43
+ viewportPlaces.remove('parking');
33
44
  ```
34
45
 
35
46
  Place modules are rendered bottom-up in the order they are added: the first added module appears at the bottom and later modules are stacked on top.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tomtom-org/maps-sdk-plugin-viewport-places",
3
3
  "author": "TomTom International B.V.",
4
4
  "license": "See in LICENSE.txt",
5
- "version": "0.5.2",
5
+ "version": "0.5.4",
6
6
  "type": "module",
7
7
  "description": "Plugin to leverage search to show places on the current viewport that refresh as the map moves",
8
8
  "types": "dist/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "typescript": "^6.0.3",
18
18
  "vite": "^8.3.2",
19
19
  "vitest": "^4.1.11",
20
- "@tomtom-org/maps-sdk": "1.0.0-rc.0"
20
+ "@tomtom-org/maps-sdk": "1.0.0-rc.1"
21
21
  },
22
22
  "files": [
23
23
  "dist",