@tomtom-org/maps-sdk-plugin-viewport-places 0.5.8 → 0.5.10
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 +193 -0
- package/README.md +1 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.es.js +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.5.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2823](https://github.com/tomtom-internal/maps-sdk-js/pull/2823) [`d1b906f`](https://github.com/tomtom-internal/maps-sdk-js/commit/d1b906f460c33607bf9789475ad85bff339b7c3b) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - The package ships its `CHANGELOG.md`, as the SDK does, so you can read what changed between two releases from `node_modules`
|
|
8
|
+
|
|
9
|
+
- [#2813](https://github.com/tomtom-internal/maps-sdk-js/pull/2813) [`c186703`](https://github.com/tomtom-internal/maps-sdk-js/commit/c1867038e9a38e300ea72e8812419204bf008e73) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - A `maxZoom` of 0 is honoured, and `update()` rebuilds the places layers only when it is given a places config
|
|
10
|
+
|
|
11
|
+
- [#2811](https://github.com/tomtom-internal/maps-sdk-js/pull/2811) [`e77a737`](https://github.com/tomtom-internal/maps-sdk-js/commit/e77a737112b1e1cbf8115d86ebfcbd2d487e78c0) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - `new ViewportPlaces(map, { onError })` hands you a refresh on map move that fails, as the search's `SDKError` or the map's `TomTomMapError`, instead of only logging it
|
|
12
|
+
|
|
13
|
+
## 0.5.9
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#2803](https://github.com/tomtom-internal/maps-sdk-js/pull/2803) [`1a62c72`](https://github.com/tomtom-internal/maps-sdk-js/commit/1a62c72eb372d037397bb88485ea731763f3e554) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - The README links the repository's security policy page, which sends a vulnerability report to TomTom's HackerOne program
|
|
18
|
+
|
|
19
|
+
## 0.5.8
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#2742](https://github.com/tomtom-internal/maps-sdk-js/pull/2742) [`2fcc1ab`](https://github.com/tomtom-internal/maps-sdk-js/commit/2fcc1abc07bcdf89aff3942ff1207637ed00f419) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - The `license` field reads `SEE LICENSE IN LICENSE.txt`, the form npm and license scanners recognise, so they point to the package's own `LICENSE.txt` instead of reporting an unknown license
|
|
24
|
+
|
|
25
|
+
- [#2734](https://github.com/tomtom-internal/maps-sdk-js/pull/2734) [`9a12d95`](https://github.com/tomtom-internal/maps-sdk-js/commit/9a12d95c22e60e69fb1891237344ca259aa236a5) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - Installs beside `@tomtom-org/maps-sdk` 1.0.0 and every later 1.x release: the peer range on the SDK runs up to `<2.0.0` instead of stopping below 1.0.0
|
|
26
|
+
|
|
27
|
+
- [#2697](https://github.com/tomtom-internal/maps-sdk-js/pull/2697) [`3d9c9a3`](https://github.com/tomtom-internal/maps-sdk-js/commit/3d9c9a34b897cf8eb791096620ed3e18dead1966) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - The package page on npm and the API reference of its entry points say the plugin is in Public Preview until its 1.0.0 release, as its guides already do
|
|
28
|
+
|
|
29
|
+
- [#2726](https://github.com/tomtom-internal/maps-sdk-js/pull/2726) [`eae0ebd`](https://github.com/tomtom-internal/maps-sdk-js/commit/eae0ebd9ca51c18ad9b4d3edeb3cd8d062834189) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - A refresh on map move, or the clear on `remove`, that fails is logged as a warning instead of leaving an unhandled rejection, for example while the map's style failed to load
|
|
30
|
+
|
|
31
|
+
## 0.5.7
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- [#2693](https://github.com/tomtom-internal/maps-sdk-js/pull/2693) [`db69794`](https://github.com/tomtom-internal/maps-sdk-js/commit/db69794e00011a820e2046a161e5390d07b8bb7a) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - Plugins are side-effect free, so your bundler drops every part of a plugin your app doesn't use
|
|
36
|
+
|
|
37
|
+
- Each plugin declares `"sideEffects": false`, and its knob catalogue and other module-level tables are dropped when nothing reads them
|
|
38
|
+
- flyover takes `@turf/turf` as a peer dependency, the copy the SDK already requires, instead of bundling its own
|
|
39
|
+
- The plugins' bundles keep their module-level names, as the SDK's do, so Sandpack and builds that transpile `node_modules` with Babel run their loops correctly
|
|
40
|
+
|
|
41
|
+
## 0.5.6
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- [#2590](https://github.com/tomtom-internal/maps-sdk-js/pull/2590) [`75fb3ea`](https://github.com/tomtom-internal/maps-sdk-js/commit/75fb3eab4d38b2aad8f4f671c3fd84f78ffc19f3) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - license: the privacy clause of `LICENSE.txt` now links the TomTom Privacy Policy, https://www.tomtom.com/privacy/
|
|
46
|
+
|
|
47
|
+
- [#2614](https://github.com/tomtom-internal/maps-sdk-js/pull/2614) [`fe596fc`](https://github.com/tomtom-internal/maps-sdk-js/commit/fe596fcb2d1c5a05dddb77547f48debc1b856a12) Thanks [@JulianChinAFoeng-TomTom](https://github.com/JulianChinAFoeng-TomTom)! - tests: each package's unit test run now fails when its coverage drops below the goals in `TESTING.md`
|
|
48
|
+
|
|
49
|
+
## 0.5.5
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- [#2522](https://github.com/tomtom-internal/maps-sdk-js/pull/2522) [`9f01f52`](https://github.com/tomtom-internal/maps-sdk-js/commit/9f01f52ee6f5a4ca23a2a44586c6cfac3595937f) Thanks [@AlvaroGraca-TomTom](https://github.com/AlvaroGraca-TomTom)! - No code change: this version is on the `latest` npm tag, which the previous one missed
|
|
54
|
+
|
|
55
|
+
## 0.5.4
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- [#2519](https://github.com/tomtom-internal/maps-sdk-js/pull/2519) [`7b854b3`](https://github.com/tomtom-internal/maps-sdk-js/commit/7b854b30bc25fdac5d9afe1975d6961a0bb137f5) Thanks [@AlvaroGraca-TomTom](https://github.com/AlvaroGraca-TomTom)! - No code change: this version is on the `latest` npm tag, which the previous one missed
|
|
60
|
+
|
|
61
|
+
## 0.5.3
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- [#2517](https://github.com/tomtom-internal/maps-sdk-js/pull/2517) [`49611d0`](https://github.com/tomtom-internal/maps-sdk-js/commit/49611d0ac91dc0b584e3d059d1f654208bdead6c) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - The README's Project setup link opens the page again, and its quickstart shows a POI category search and updating or removing a place module
|
|
66
|
+
|
|
67
|
+
## 0.5.2
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- [#2506](https://github.com/tomtom-internal/maps-sdk-js/pull/2506) [`12099bd`](https://github.com/tomtom-internal/maps-sdk-js/commit/12099bdc040f3ce2d3990266bfb42024cda7956c) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - The package ships without source maps, so a stack trace through the plugin points into its minified bundle
|
|
72
|
+
- An app's own source maps still lead a trace to the plugin's frames (`dist/index.es.js:1:2345`); share such a trace in a report and TomTom maps it back to the source
|
|
73
|
+
|
|
74
|
+
## 0.5.1
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- [#2338](https://github.com/tomtom-internal/maps-sdk-js/pull/2338) [`9095b5d`](https://github.com/tomtom-internal/maps-sdk-js/commit/9095b5d952788eed8f0c2610a300fafc90b12bba) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - Modules keep the `base-map` marker type under the renamed `markerType`, which needs `@tomtom-org/maps-sdk` `>=0.61.0`.
|
|
79
|
+
|
|
80
|
+
- Modules keep drawing as `base-map` by default under the renamed `markerType`
|
|
81
|
+
- The peer dependency on `@tomtom-org/maps-sdk` is the range `>=0.61.0 <1.0.0`, the first release with `markerType`
|
|
82
|
+
- Updated dependencies:
|
|
83
|
+
- @tomtom-org/maps-sdk@0.61.0
|
|
84
|
+
|
|
85
|
+
## 0.5.0
|
|
86
|
+
|
|
87
|
+
### Minor Changes
|
|
88
|
+
|
|
89
|
+
- [#2279](https://github.com/tomtom-internal/maps-sdk-js/pull/2279) [`0574709`](https://github.com/tomtom-internal/maps-sdk-js/commit/0574709de2be181fe2ed64c6b16e1ec69bec269b) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - Requires `@tomtom-org/maps-sdk` `>=0.59.0 <1.0.0`: each module's viewport searches run through the SDK's new `createLatestRequest`, with no change to what the plugin shows or cancels
|
|
90
|
+
|
|
91
|
+
- [#2193](https://github.com/tomtom-internal/maps-sdk-js/pull/2193) [`c324ff0`](https://github.com/tomtom-internal/maps-sdk-js/commit/c324ff04afb892a600eda5ca9e6576d380ccc9c7) Thanks [@JulianChinAFoeng-TomTom](https://github.com/JulianChinAFoeng-TomTom)! - **Breaking:** `searchOptions` takes the SDK's grouped `filters` — `searchOptions: { filters: { poiCategories } }` — and `update()` merges `filters` member by member, like the rest of `searchOptions`. It takes no `cursor`: every module searches the first page of the current viewport
|
|
92
|
+
|
|
93
|
+
## 0.4.0
|
|
94
|
+
|
|
95
|
+
### Minor Changes
|
|
96
|
+
|
|
97
|
+
- [#2216](https://github.com/tomtom-internal/maps-sdk-js/pull/2216) [`5bfbe75`](https://github.com/tomtom-internal/maps-sdk-js/commit/5bfbe75ec9517789c8624fd2ede1034590e51d48) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - **Breaking:** `ViewportPlaces.remove` throws for an unknown ID, as `update` does, instead of logging to the console
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- [#2217](https://github.com/tomtom-internal/maps-sdk-js/pull/2217) [`8eff899`](https://github.com/tomtom-internal/maps-sdk-js/commit/8eff899c713586296529fb22a4c84f3663fa0859) Thanks [@DanielForniessoria-TomTom](https://github.com/DanielForniessoria-TomTom)! - Built with the latest minor releases of the plugin build toolchain; no change to the plugin's API or peer dependencies
|
|
102
|
+
|
|
103
|
+
- [#2189](https://github.com/tomtom-internal/maps-sdk-js/pull/2189) [`834257b`](https://github.com/tomtom-internal/maps-sdk-js/commit/834257b27bee5c60e1cc1782a466d7f6a6f5f8d8) Thanks [@JulianChinAFoeng-TomTom](https://github.com/JulianChinAFoeng-TomTom)! - Viewport searches call `discoverPlaces`, following the SDK renaming `search` ([#2189](https://github.com/tomtom-internal/maps-sdk-js/issues/2189))
|
|
104
|
+
- Updated dependencies:
|
|
105
|
+
- @tomtom-org/maps-sdk@0.58.0
|
|
106
|
+
|
|
107
|
+
## 0.3.0
|
|
108
|
+
|
|
109
|
+
### Minor Changes
|
|
110
|
+
|
|
111
|
+
- [#2188](https://github.com/tomtom-internal/maps-sdk-js/pull/2188) [`9e1d080`](https://github.com/tomtom-internal/maps-sdk-js/commit/9e1d080397ee2d16b6185873661890e5a81f7b65) Thanks [@AlvaroGraca-TomTom](https://github.com/AlvaroGraca-TomTom)!
|
|
112
|
+
|
|
113
|
+
- **Breaking:** `searchOptions` no longer accepts `geoBias`; each module always searches the current viewport
|
|
114
|
+
- A new viewport cancels the search a module still has in flight
|
|
115
|
+
- Accept every SDK release below 1.0: the peer dependency on `@tomtom-org/maps-sdk` is the range `>=0.55.1 <1.0.0` instead of an exact version
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- Updated dependencies:
|
|
120
|
+
- @tomtom-org/maps-sdk@0.56.0
|
|
121
|
+
|
|
122
|
+
## [0.2.1](https://github.com/tomtom-internal/maps-sdk-js/compare/maps-sdk-plugin-viewport-places-v0.2.0...maps-sdk-plugin-viewport-places-v0.2.1) (2026-04-30)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### Features
|
|
126
|
+
|
|
127
|
+
* improve api reference types, adjust syntax for agent toolkit plugin, and improve agents.md ([9428902](https://github.com/tomtom-internal/maps-sdk-js/commit/9428902605299302fdbb206f22a514e6761d0716))
|
|
128
|
+
|
|
129
|
+
## [0.2.0](https://github.com/tomtom-internal/maps-sdk-js/compare/maps-sdk-plugin-viewport-places-v0.1.8...maps-sdk-plugin-viewport-places-v0.2.0) (2026-03-16)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### ⚠ BREAKING CHANGES
|
|
133
|
+
|
|
134
|
+
* improve poi categories relationship with search
|
|
135
|
+
|
|
136
|
+
### Features
|
|
137
|
+
|
|
138
|
+
* improve poi categories relationship with search ([52f5a26](https://github.com/tomtom-internal/maps-sdk-js/commit/52f5a265dbe0ae4cbb3386de3740cb887ed1a11c))
|
|
139
|
+
* incident details service improvements and added agent tools ([9f3058d](https://github.com/tomtom-internal/maps-sdk-js/commit/9f3058dd55fde278ea8d8b58ddb223c354dd9ada))
|
|
140
|
+
|
|
141
|
+
## [0.1.8](https://github.com/tomtom-internal/maps-sdk-js/compare/maps-sdk-plugin-viewport-places-v0.1.7...maps-sdk-plugin-viewport-places-v0.1.8) (2026-02-16)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### Bug Fixes
|
|
145
|
+
|
|
146
|
+
* omit bounding box and position from search options in viewport places plugin since they should be automatically set ([a2ffd50](https://github.com/tomtom-internal/maps-sdk-js/commit/a2ffd503c58cbf0c17c678b54cf6f83d8074936f))
|
|
147
|
+
|
|
148
|
+
## [0.1.6](https://github.com/tomtom-internal/maps-sdk-js/compare/maps-sdk-plugin-viewport-places-v0.1.5...maps-sdk-plugin-viewport-places-v0.1.6) (2026-01-30)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
### Features
|
|
152
|
+
|
|
153
|
+
* **viewport-places:** improve types ([817678e](https://github.com/tomtom-internal/maps-sdk-js/commit/817678e6d280560307bfb445bf183136aca69a41))
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
### Bug Fixes
|
|
157
|
+
|
|
158
|
+
* improve release workflow and update documentation ([905a7ed](https://github.com/tomtom-internal/maps-sdk-js/commit/905a7ed0f3770ce51ac2937a948ef4ad6b8bfcaa))
|
|
159
|
+
|
|
160
|
+
## [0.1.5](https://github.com/tomtom-internal/maps-sdk-js/compare/maps-sdk-plugin-viewport-places-v0.1.4...maps-sdk-plugin-viewport-places-v0.1.5) (2026-01-30)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
### Bug Fixes
|
|
164
|
+
|
|
165
|
+
* improve release workflow and update documentation ([905a7ed](https://github.com/tomtom-internal/maps-sdk-js/commit/905a7ed0f3770ce51ac2937a948ef4ad6b8bfcaa))
|
|
166
|
+
|
|
167
|
+
## [0.1.4](https://github.com/tomtom-internal/maps-sdk-js/compare/maps-sdk-plugin-viewport-places-v0.1.3...maps-sdk-plugin-viewport-places-v0.1.4) (2026-01-30)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
### Features
|
|
171
|
+
|
|
172
|
+
* **viewport-places:** improve types ([817678e](https://github.com/tomtom-internal/maps-sdk-js/commit/817678e6d280560307bfb445bf183136aca69a41))
|
|
173
|
+
|
|
174
|
+
## [0.1.3](https://github.com/tomtom-internal/maps-sdk-js/compare/maps-sdk-plugin-viewport-places-v0.1.2...maps-sdk-plugin-viewport-places-v0.1.3) (2026-01-30)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
### Features
|
|
178
|
+
|
|
179
|
+
* **viewport-places:** improve TSDocs ([01ced36](https://github.com/tomtom-internal/maps-sdk-js/commit/01ced36e895f679e0f92f2241d9442c9415e0eb2))
|
|
180
|
+
|
|
181
|
+
## [0.1.2](https://github.com/tomtom-internal/maps-sdk-js/compare/maps-sdk-plugin-viewport-places-v0.1.1...maps-sdk-plugin-viewport-places-v0.1.2) (2026-01-29)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
### Features
|
|
185
|
+
|
|
186
|
+
* simplify viewport places method name, and improve api reference docs ([46c7de1](https://github.com/tomtom-internal/maps-sdk-js/commit/46c7de1f504839a796d8052567069b5d87ccdb0b))
|
|
187
|
+
|
|
188
|
+
## [0.1.1](https://github.com/tomtom-internal/maps-sdk-js/compare/maps-sdk-plugin-viewport-places-v0.1.0...maps-sdk-plugin-viewport-places-v0.1.1) (2026-01-29)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
### Features
|
|
192
|
+
|
|
193
|
+
* add plugins workspace with first plugin to easily display search-powered layers of places on the map ([eac82a2](https://github.com/tomtom-internal/maps-sdk-js/commit/eac82a2ebe731e87463564eb5e1331089ca1cc70))
|
package/README.md
CHANGED
|
@@ -53,4 +53,4 @@ See `LICENSE.txt`.
|
|
|
53
53
|
|
|
54
54
|
## Security
|
|
55
55
|
|
|
56
|
-
To report a security vulnerability, follow [
|
|
56
|
+
To report a security vulnerability, follow our [security policy](https://github.com/tomtom-international/maps-sdk-js/security/policy), which keeps it private.
|
package/dist/index.d.ts
CHANGED
|
@@ -58,6 +58,20 @@ export type ViewportPlacesOptions = Omit<ViewportPlacesAddOptions, 'id'> & {
|
|
|
58
58
|
*/
|
|
59
59
|
id: string;
|
|
60
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* The options for creating a {@link ViewportPlaces}.
|
|
63
|
+
*
|
|
64
|
+
* @group Viewport Places
|
|
65
|
+
*/
|
|
66
|
+
export type ViewportPlacesConstructorOptions = {
|
|
67
|
+
/**
|
|
68
|
+
* Called when a refresh on map move, or the clear of a removed module, fails: with the `SDKError` of the
|
|
69
|
+
* search, or the `TomTomMapError` of the map.
|
|
70
|
+
*
|
|
71
|
+
* @defaultValue a `console.warn`
|
|
72
|
+
*/
|
|
73
|
+
onError?: (error: unknown) => void;
|
|
74
|
+
};
|
|
61
75
|
/**
|
|
62
76
|
* A class for managing dynamic searched place modules on a TomTom map.
|
|
63
77
|
*
|
|
@@ -77,11 +91,12 @@ export declare class ViewportPlaces {
|
|
|
77
91
|
*/
|
|
78
92
|
private registeredModules;
|
|
79
93
|
private readonly mapLibreMap;
|
|
94
|
+
private readonly onError;
|
|
80
95
|
/**
|
|
81
96
|
* Creates an instance of ViewportPlaces bound to a TomTom map.
|
|
82
97
|
* @param map - The TomTom map instance to attach place modules to.
|
|
83
98
|
*/
|
|
84
|
-
constructor(map: TomTomMap);
|
|
99
|
+
constructor(map: TomTomMap, { onError }?: ViewportPlacesConstructorOptions);
|
|
85
100
|
private getRegisteredModule;
|
|
86
101
|
/**
|
|
87
102
|
* Performs the update logic for a registered PlacesModule, cancelling whatever search that
|
package/dist/index.es.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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:
|
|
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 warn=e=>console.warn("Viewport places could not refresh or clear",e),ViewportPlaces=class{map;registeredModules={};mapLibreMap;onError;constructor(e,{onError:s=warn}={}){this.map=e,this.mapLibreMap=e.mapLibreMap,this.onError=s}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:r,latestSearch:t}=s,a=this.mapLibreMap.getZoom(),{minZoom:i=0,maxZoom:c=Number.POSITIVE_INFINITY}=r;if(a<i||a>c)return t.cancel(),void(await o.clear());const l=await t.run(e=>discoverPlaces({geoBias:{boundingBox:this.map.getBBox()},limit:100,...r.searchOptions,signal:e}));l.current&&await o.show(l.value)}async add(e){const s=e.id??generateId(),o={...e,placesModuleConfig:{markerType:"base-map",...e.placesModuleConfig}},r=await PlacesModule.create(this.map,o.placesModuleConfig),t=this.mapLibreMap.on("moveend",()=>{this.searchAndDisplay(s).catch(this.onError)});return this.registeredModules[s]={placesModule:r,subscription:t,options:o,latestSearch:createLatestRequest()},await this.searchAndDisplay(s),r}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(this.onError),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}},e.placesModuleConfig&&s.placesModule.applyConfig(s.options.placesModuleConfig),await this.searchAndDisplay(e.id)}};export{ViewportPlaces};
|
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 LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "0.5.
|
|
5
|
+
"version": "0.5.10",
|
|
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",
|
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
"typescript": "^6.0.3",
|
|
19
19
|
"vite": "^8.3.4",
|
|
20
20
|
"vitest": "^5.0.5",
|
|
21
|
-
"@tomtom-org/maps-sdk": "1.0.0-rc.
|
|
21
|
+
"@tomtom-org/maps-sdk": "1.0.0-rc.6"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"dist",
|
|
25
25
|
"package.json",
|
|
26
26
|
"README.md",
|
|
27
|
+
"CHANGELOG.md",
|
|
27
28
|
"LICENSE.txt",
|
|
28
29
|
"THIRD_PARTY.txt",
|
|
29
30
|
"!**/*.map"
|