@tomtom-org/maps-sdk-plugin-viewport-places 0.5.6 → 0.5.8
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 +6 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +1 -1
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This plugin for the [TomTom Maps SDK for JavaScript](https://docs.tomtom.com/maps-sdk-js/introduction/overview) 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
|
+
> **Public preview.** This plugin is in [Public Preview](https://docs.tomtom.com/legal/public-preview) until its 1.0.0 release.
|
|
6
|
+
|
|
5
7
|
## Docs & examples
|
|
6
8
|
|
|
7
9
|
- Developer guide: https://docs.tomtom.com/maps-sdk-js/guides/plugins/viewport-places
|
|
@@ -48,3 +50,7 @@ The plugin renders place modules bottom-up in the order you add them. The first
|
|
|
48
50
|
## License
|
|
49
51
|
|
|
50
52
|
See `LICENSE.txt`.
|
|
53
|
+
|
|
54
|
+
## Security
|
|
55
|
+
|
|
56
|
+
To report a security vulnerability, follow [SECURITY.md](https://github.com/tomtom-international/maps-sdk-js/blob/main/SECURITY.md), which keeps it private.
|
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,9 @@ export type ViewportPlacesOptions = Omit<ViewportPlacesAddOptions, 'id'> & {
|
|
|
64
64
|
* It uses the SDK search service to keep its place modules current automatically as the
|
|
65
65
|
* map viewport changes.
|
|
66
66
|
*
|
|
67
|
+
* @remarks
|
|
68
|
+
* **[Public Preview](https://docs.tomtom.com/legal/public-preview)** until the plugin's 1.0.0 release.
|
|
69
|
+
*
|
|
67
70
|
* @group Viewport Places
|
|
68
71
|
*/
|
|
69
72
|
export declare class ViewportPlaces {
|
package/dist/index.es.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateId
|
|
1
|
+
import{generateId}from"@tomtom-org/maps-sdk/core";import{PlacesModule}from"@tomtom-org/maps-sdk/map";import{createLatestRequest,discoverPlaces}from"@tomtom-org/maps-sdk/services";var ViewportPlaces=class{map;registeredModules={};mapLibreMap;constructor(e){this.map=e,this.mapLibreMap=e.mapLibreMap}getRegisteredModule(e){const s=this.registeredModules[e];if(!s)throw new Error(`Place module with id ${e} not found`);return s}async searchAndDisplay(e){const s=this.registeredModules[e];if(!s)return;const{placesModule:o,options:t,latestSearch:a}=s,i=this.mapLibreMap.getZoom();if(t.minZoom&&i<t.minZoom||t.maxZoom&&i>t.maxZoom)return a.cancel(),void(await o.clear());const r=await a.run(e=>discoverPlaces({geoBias:{boundingBox:this.map.getBBox()},limit:100,...t.searchOptions,signal:e}));r.current&&await o.show(r.value)}async add(e){const s=e.id??generateId(),o={...e,placesModuleConfig:{markerType:"base-map",...e.placesModuleConfig}},t=await PlacesModule.create(this.map,o.placesModuleConfig),a=this.mapLibreMap.on("moveend",()=>{this.searchAndDisplay(s).catch(e=>console.warn("Viewport places could not refresh",e))});return this.registeredModules[s]={placesModule:t,subscription:a,options:o,latestSearch:createLatestRequest()},await this.searchAndDisplay(s),t}async addPOICategories(e){return this.add({...e,searchOptions:{filters:{poiCategories:e.categories}}})}remove(e){const s=this.getRegisteredModule(e);s.latestSearch.cancel(),s.placesModule.clear().catch(e=>console.warn("Viewport places could not clear",e)),s.subscription.unsubscribe(),delete this.registeredModules[e]}removeAll(){Object.keys(this.registeredModules).forEach(e=>this.remove(e))}async update(e){const s=this.getRegisteredModule(e.id),o=s.options;s.options={...o,...e,searchOptions:{...o.searchOptions,...e.searchOptions,filters:{...o.searchOptions.filters,...e.searchOptions.filters}},placesModuleConfig:{...o.placesModuleConfig,...e.placesModuleConfig}},s.placesModule.applyConfig(s.options.placesModuleConfig),await this.searchAndDisplay(e.id)}};export{ViewportPlaces};
|
package/package.json
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomtom-org/maps-sdk-plugin-viewport-places",
|
|
3
3
|
"author": "TomTom International B.V.",
|
|
4
|
-
"license": "
|
|
5
|
-
"version": "0.5.
|
|
4
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
+
"version": "0.5.8",
|
|
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",
|
|
9
|
+
"sideEffects": false,
|
|
9
10
|
"peerDependencies": {
|
|
10
|
-
"@tomtom-org/maps-sdk": ">=0.64.0 <1.0.0 ||
|
|
11
|
+
"@tomtom-org/maps-sdk": ">=0.64.0 <1.0.0 || ^1.0.0-rc.0"
|
|
11
12
|
},
|
|
12
13
|
"devDependencies": {
|
|
13
14
|
"@tsconfig/recommended": "^1.0.13",
|
|
14
|
-
"@types/node": "^26.6.
|
|
15
|
-
"@vitest/coverage-v8": "^5.0.
|
|
16
|
-
"rolldown": "^1.2.
|
|
15
|
+
"@types/node": "^26.6.5",
|
|
16
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
17
|
+
"rolldown": "^1.2.14",
|
|
17
18
|
"typescript": "^6.0.3",
|
|
18
|
-
"vite": "8.3.
|
|
19
|
-
"vitest": "^5.0.
|
|
20
|
-
"@tomtom-org/maps-sdk": "1.0.0-rc.
|
|
19
|
+
"vite": "^8.3.4",
|
|
20
|
+
"vitest": "^5.0.5",
|
|
21
|
+
"@tomtom-org/maps-sdk": "1.0.0-rc.4"
|
|
21
22
|
},
|
|
22
23
|
"files": [
|
|
23
24
|
"dist",
|