@studiometa/ui-mapbox 0.0.1 → 1.10.0-beta.0
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/AbstractMapboxControl.d.ts +53 -0
- package/AbstractMapboxControl.js +70 -0
- package/AbstractMapboxControl.js.map +1 -0
- package/AbstractMapboxMapChild.d.ts +229 -0
- package/AbstractMapboxMapChild.js +336 -0
- package/AbstractMapboxMapChild.js.map +1 -0
- package/LICENSE.md +110 -0
- package/MapboxCluster.d.ts +208 -0
- package/MapboxCluster.js +418 -0
- package/MapboxCluster.js.map +1 -0
- package/MapboxClusterItem.d.ts +130 -0
- package/MapboxClusterItem.js +182 -0
- package/MapboxClusterItem.js.map +1 -0
- package/MapboxFullscreenControl.d.ts +21 -0
- package/MapboxFullscreenControl.js +21 -0
- package/MapboxFullscreenControl.js.map +1 -0
- package/MapboxGeocoder.d.ts +64 -0
- package/MapboxGeocoder.js +80 -0
- package/MapboxGeocoder.js.map +1 -0
- package/MapboxGeolocateControl.d.ts +23 -0
- package/MapboxGeolocateControl.js +31 -0
- package/MapboxGeolocateControl.js.map +1 -0
- package/MapboxImage.d.ts +49 -0
- package/MapboxImage.js +83 -0
- package/MapboxImage.js.map +1 -0
- package/MapboxImages.d.ts +66 -0
- package/MapboxImages.js +95 -0
- package/MapboxImages.js.map +1 -0
- package/MapboxLayer.d.ts +99 -0
- package/MapboxLayer.js +148 -0
- package/MapboxLayer.js.map +1 -0
- package/MapboxMap.d.ts +64 -0
- package/MapboxMap.js +131 -0
- package/MapboxMap.js.map +1 -0
- package/MapboxMarker.d.ts +56 -0
- package/MapboxMarker.js +73 -0
- package/MapboxMarker.js.map +1 -0
- package/MapboxNavigationControl.d.ts +27 -0
- package/MapboxNavigationControl.js +28 -0
- package/MapboxNavigationControl.js.map +1 -0
- package/MapboxPopup.d.ts +51 -0
- package/MapboxPopup.js +76 -0
- package/MapboxPopup.js.map +1 -0
- package/MapboxSource.d.ts +68 -0
- package/MapboxSource.js +104 -0
- package/MapboxSource.js.map +1 -0
- package/README.md +85 -0
- package/StoreLocator.d.ts +323 -0
- package/StoreLocator.js +538 -0
- package/StoreLocator.js.map +1 -0
- package/catalog.d.ts +7 -0
- package/catalog.js +68 -0
- package/catalog.js.map +1 -0
- package/dependencies.d.ts +85 -0
- package/dependencies.js +84 -0
- package/dependencies.js.map +1 -0
- package/index.d.ts +18 -0
- package/index.js +19 -0
- package/index.js.map +1 -0
- package/manifest.d.ts +6 -0
- package/manifest.js +133 -0
- package/manifest.js.map +1 -0
- package/package.json +43 -3
- package/utils.d.ts +112 -0
- package/utils.js +143 -0
- package/utils.js.map +1 -0
- package/Claude-of-Duty/node_modules/@esbuild/darwin-arm64/bin/esbuild +0 -0
- package/alfred-projects-cache.tsv +0 -137
- package/claude-501/-Users-titouanmathis--dotfiles/298a49f7-c4b3-4a50-9707-a9c0d0733e95/scratchpad/pptest/config.json +0 -1
- package/claude-501/-Users-titouanmathis--dotfiles/298a49f7-c4b3-4a50-9707-a9c0d0733e95/scratchpad/pptest/stub/herdr +0 -8
- package/claude-501/-Users-titouanmathis--dotfiles/7d127a50-a71a-411a-bc1f-15b070f909f9/tasks/bg1cckto6.output +0 -4
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/after.toml +0 -298
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/before.toml +0 -298
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/extracted.txt +0 -36
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/final.log +0 -496
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/guard.sh +0 -18
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/lock.check +0 -917
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/mise-registry.json +0 -3827
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/mise.lock.before +0 -917
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/misetest/.config/mise/conf.d/extra.toml +0 -2
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/misetest/.config/mise/mise.lock +0 -47
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/misetest/mise.lock +0 -47
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/misetest/mise.toml +0 -2
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/probe/.github/workflows/mise-check.yml +0 -188
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/probe/.github/workflows/renovate.yml +0 -62
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/probe/mise.lock +0 -917
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/probe/mise.toml +0 -291
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/probe/probe.log +0 -4974
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/probe/probe2.log +0 -22
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/probe/probe3.log +0 -4916
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/probe/renovate.json +0 -62
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/renovate-local.log +0 -670
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/symtest/link/mise.lock +0 -47
- package/claude-501/-Users-titouanmathis--dotfiles/dd4cd328-df52-4522-a502-48fa24b7b142/scratchpad/symtest/real/source.toml +0 -4
- package/claude-501/-Users-titouanmathis-Lab--studiometa-automations/d6c27f69-577a-468b-9bb3-a45c03a66143/scratchpad/cookie.txt +0 -1
- package/gitlab-docs-read.md +0 -8
- package/gitlab-instance-limits.txt +0 -8
- package/piab-501/piab-devops-019fcbcc991d-59c77b27-fresh-47da8bd318.config +0 -1
- package/pins-new.txt +0 -36
- package/pins-old.txt +0 -36
- package/reply +0 -0
- package/zsh0IBbcP +0 -0
- package/zsh2LqT39 +0 -0
- package/zsh6KJGTP +0 -0
- package/zshN1hNdy +0 -0
- package/zshNjWSYH +0 -11
- package/zshNvB745 +0 -0
- package/zshOXC0uH +0 -0
- package/zshPG9CFU +0 -0
- package/zshVOeZsK +0 -0
- package/zshVqIgQS +0 -0
- package/zshXTrFg8 +0 -0
- package/zshaUGubs +0 -11
- package/zshbzOT6d +0 -1
- package/zshnbtbGK +0 -0
- package/zshpQi1EI +0 -2
- package/zshwhMjOD +0 -1
package/StoreLocator.js
ADDED
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
import { MAPBOX_MAP_CONNECTED } from "./AbstractMapboxMapChild.js";
|
|
2
|
+
import { MAPBOX_CLUSTER_CONNECTED } from "./MapboxCluster.js";
|
|
3
|
+
import { getMapboxGl } from "./dependencies.js";
|
|
4
|
+
import { Base } from "@studiometa/js-toolkit";
|
|
5
|
+
import { nextTick } from "@studiometa/js-toolkit/utils";
|
|
6
|
+
//#region StoreLocator.ts
|
|
7
|
+
/**
|
|
8
|
+
* Maximum number of `nextTick` retries used to wire the `MapboxCluster` and the
|
|
9
|
+
* optional `MapboxGeocoder`. They are mounted asynchronously (the geocoder even
|
|
10
|
+
* lazy-imports its module), so they may not be queryable yet on the `map-load`
|
|
11
|
+
* event: we poll a few ticks before giving up.
|
|
12
|
+
*/
|
|
13
|
+
const WIRE_CHILDREN_MAX_ATTEMPTS = 10;
|
|
14
|
+
/**
|
|
15
|
+
* Coordinate a "find a store near you" experience on top of a `MapboxMap`.
|
|
16
|
+
*
|
|
17
|
+
* `StoreLocator` is a thin **orchestrator**: it owns no map rendering and no item
|
|
18
|
+
* registry of its own. It wraps a `MapboxMap` containing a
|
|
19
|
+
* [`MapboxCluster`](./MapboxCluster.js) of
|
|
20
|
+
* [`MapboxClusterItem`](./MapboxClusterItem.js)s (the declarative clustered map +
|
|
21
|
+
* list source driver) plus an optional
|
|
22
|
+
* [`MapboxGeocoder`](./MapboxGeocoder.js), and layers the search UX on top:
|
|
23
|
+
* selection, viewport filtering and address search. The cluster keeps owning the
|
|
24
|
+
* data (it derives the source from the registered items); the orchestrator only
|
|
25
|
+
* reads that item set and reacts to it.
|
|
26
|
+
*
|
|
27
|
+
* Each store has three independent states, each with its own source of truth:
|
|
28
|
+
*
|
|
29
|
+
* 1. **Registered** — the item exists in the DOM. Owned by the `MapboxCluster`,
|
|
30
|
+
* it drives the **map data** and only changes when the item set changes (e.g.
|
|
31
|
+
* a `Fetch` swaps the list). The orchestrator is notified through the
|
|
32
|
+
* cluster's `map-update` event.
|
|
33
|
+
* 2. **In bounds** — the item's `lngLat` is inside the current viewport. Drives
|
|
34
|
+
* **list visibility + distance sort only**, recomputed on map `moveend`, and
|
|
35
|
+
* never touches the map data.
|
|
36
|
+
* 3. **Selected** — the chosen item. Drives fly-to, the popup, `active` styling
|
|
37
|
+
* and the `map-select` event.
|
|
38
|
+
*
|
|
39
|
+
* The orchestrator requires its `MapboxCluster` (and `MapboxMap`) to live within
|
|
40
|
+
* its own subtree; it resolves them with `$query`, retries a few ticks for
|
|
41
|
+
* asynchronously-mounted children, and — like the map children — subscribes to
|
|
42
|
+
* the `MAPBOX_MAP_CONNECTED` / `MAPBOX_CLUSTER_CONNECTED` events so a late or
|
|
43
|
+
* replaced map/cluster (re)binds instead of stranding the orchestrator on a
|
|
44
|
+
* destroyed instance, and to the map's own `remove` event so a removed map is
|
|
45
|
+
* never called into. Register each component independently (e.g. with
|
|
46
|
+
* `registerComponent`, optionally behind a lazy `importWhen*` helper):
|
|
47
|
+
* `StoreLocator`, `MapboxMap`, `MapboxCluster` and `MapboxClusterItem`.
|
|
48
|
+
* Registration order does not matter because children resolve their map through
|
|
49
|
+
* the connected-event retry, and the orchestrator declares no child components
|
|
50
|
+
* so nothing is ever double-mounted.
|
|
51
|
+
*
|
|
52
|
+
* @see https://ui.studiometa.dev/reference/items/MapboxMap/
|
|
53
|
+
*/
|
|
54
|
+
var StoreLocator = class extends Base {
|
|
55
|
+
/**
|
|
56
|
+
* Config.
|
|
57
|
+
*
|
|
58
|
+
* No child components are declared: `MapboxMap`, `MapboxCluster`,
|
|
59
|
+
* `MapboxClusterItem` and `MapboxGeocoder` are each registered independently
|
|
60
|
+
* (e.g. with `registerComponent`, optionally behind a lazy `importWhen*`
|
|
61
|
+
* helper) and mount on their own. The orchestrator discovers them through
|
|
62
|
+
* `$query` once available — declaring them here would double-mount them.
|
|
63
|
+
*/
|
|
64
|
+
static config = {
|
|
65
|
+
name: "StoreLocator",
|
|
66
|
+
emits: [
|
|
67
|
+
"map-select",
|
|
68
|
+
"map-deselect",
|
|
69
|
+
"map-filter"
|
|
70
|
+
],
|
|
71
|
+
options: {
|
|
72
|
+
itemZoomLevel: {
|
|
73
|
+
type: Number,
|
|
74
|
+
default: 14
|
|
75
|
+
},
|
|
76
|
+
noSort: Boolean,
|
|
77
|
+
fitOnUpdate: Boolean,
|
|
78
|
+
popupOptions: {
|
|
79
|
+
type: Object,
|
|
80
|
+
default: () => ({})
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Whether the underlying map has finished loading.
|
|
86
|
+
*/
|
|
87
|
+
isLoaded = false;
|
|
88
|
+
/**
|
|
89
|
+
* The Mapbox `Map` instance cached at load, so every listener and teardown
|
|
90
|
+
* path reaches it without a fresh `$query` (which returns nothing once the
|
|
91
|
+
* element is detached).
|
|
92
|
+
* @private
|
|
93
|
+
*/
|
|
94
|
+
__map;
|
|
95
|
+
/**
|
|
96
|
+
* The child `MapboxCluster`, cached at wire-time for detach-safe teardown.
|
|
97
|
+
* @private
|
|
98
|
+
*/
|
|
99
|
+
__cluster;
|
|
100
|
+
/**
|
|
101
|
+
* The optional child `MapboxGeocoder`, cached at wire-time.
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
__geocoder;
|
|
105
|
+
/**
|
|
106
|
+
* The currently selected item, if any.
|
|
107
|
+
* @private
|
|
108
|
+
*/
|
|
109
|
+
__selected;
|
|
110
|
+
/**
|
|
111
|
+
* The popup opened for the selected item, created lazily.
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
__popup;
|
|
115
|
+
/**
|
|
116
|
+
* Unsubscribe callbacks for the `MapboxCluster` listeners, flushed both on
|
|
117
|
+
* destroy and when the cluster is replaced (so the orchestrator re-wires onto
|
|
118
|
+
* the new instance rather than staying subscribed to the destroyed one).
|
|
119
|
+
* @private
|
|
120
|
+
*/
|
|
121
|
+
__offCluster = [];
|
|
122
|
+
/**
|
|
123
|
+
* Unsubscribe callbacks for the `MapboxGeocoder` listeners, flushed on destroy.
|
|
124
|
+
* @private
|
|
125
|
+
*/
|
|
126
|
+
__offGeocoder = [];
|
|
127
|
+
/**
|
|
128
|
+
* Off handle for the pending `map-load` subscription.
|
|
129
|
+
* @private
|
|
130
|
+
*/
|
|
131
|
+
__offMapLoad;
|
|
132
|
+
/**
|
|
133
|
+
* Off handle for the ready map's own `remove` subscription, used to drop the
|
|
134
|
+
* cached map the moment it is removed so no listener/teardown ever calls a
|
|
135
|
+
* method on a dead map.
|
|
136
|
+
* @private
|
|
137
|
+
*/
|
|
138
|
+
__offMapRemove;
|
|
139
|
+
/**
|
|
140
|
+
* Off handle for the standing document-level `MAPBOX_MAP_CONNECTED` retry
|
|
141
|
+
* subscription, so a map that mounts (or a replacement that mounts after the
|
|
142
|
+
* previous was removed) rebinds the orchestrator.
|
|
143
|
+
* @private
|
|
144
|
+
*/
|
|
145
|
+
__offMapConnected;
|
|
146
|
+
/**
|
|
147
|
+
* Off handle for the standing document-level `MAPBOX_CLUSTER_CONNECTED` retry
|
|
148
|
+
* subscription, so a cluster that mounts late — or replaces the wired one — is
|
|
149
|
+
* (re)wired instead of stranding the orchestrator on a destroyed instance.
|
|
150
|
+
* @private
|
|
151
|
+
*/
|
|
152
|
+
__offClusterConnected;
|
|
153
|
+
/**
|
|
154
|
+
* Whether the `MapboxCluster` listeners are already attached.
|
|
155
|
+
* @private
|
|
156
|
+
*/
|
|
157
|
+
__clusterWired = false;
|
|
158
|
+
/**
|
|
159
|
+
* Whether the `MapboxGeocoder` `map-result` listener is already attached.
|
|
160
|
+
* @private
|
|
161
|
+
*/
|
|
162
|
+
__geocoderWired = false;
|
|
163
|
+
/**
|
|
164
|
+
* The closest child `MapboxMap` component.
|
|
165
|
+
*/
|
|
166
|
+
get mapboxMap() {
|
|
167
|
+
const mapboxMap = this.$query("MapboxMap")[0];
|
|
168
|
+
if (!mapboxMap) this.$warn("Can not find a child MapboxMap component.");
|
|
169
|
+
return mapboxMap;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The child `MapboxCluster`, discovered in the subtree.
|
|
173
|
+
*/
|
|
174
|
+
get cluster() {
|
|
175
|
+
return this.__cluster ?? this.$query("MapboxCluster")[0];
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The optional child `MapboxGeocoder`, discovered in the subtree.
|
|
179
|
+
*/
|
|
180
|
+
get geocoder() {
|
|
181
|
+
return this.__geocoder ?? this.$query("MapboxGeocoder")[0];
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The Mapbox `Map` instance. Only valid once the map has loaded.
|
|
185
|
+
*/
|
|
186
|
+
get map() {
|
|
187
|
+
return this.__map ?? this.mapboxMap?.map;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* The registered items, read from the cluster (their single source of truth).
|
|
191
|
+
*/
|
|
192
|
+
get items() {
|
|
193
|
+
return this.__cluster?.items ?? [];
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Select an item: deactivate the previous one, fly to the item, open its
|
|
197
|
+
* popup, mark it active and emit a `map-select` event.
|
|
198
|
+
* @param {MapboxClusterItem} item
|
|
199
|
+
*/
|
|
200
|
+
selectItem(item) {
|
|
201
|
+
if (this.__selected && this.__selected !== item) this.__selected.setActive(false);
|
|
202
|
+
item.setActive(true);
|
|
203
|
+
this.__selected = item;
|
|
204
|
+
this.__map?.flyTo({
|
|
205
|
+
center: item.lngLat,
|
|
206
|
+
zoom: this.$options.itemZoomLevel
|
|
207
|
+
});
|
|
208
|
+
this.__openPopup(item);
|
|
209
|
+
this.$emit("map-select", item);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Clear the current selection, close the popup and emit a `map-deselect` event.
|
|
213
|
+
*/
|
|
214
|
+
deselect() {
|
|
215
|
+
if (this.__selected) {
|
|
216
|
+
this.__selected.setActive(false);
|
|
217
|
+
this.__selected = void 0;
|
|
218
|
+
}
|
|
219
|
+
this.__popup?.remove();
|
|
220
|
+
this.$emit("map-deselect");
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Open (or move) the selection popup on the given item, using its popup
|
|
224
|
+
* content. A content-less item closes any open popup instead.
|
|
225
|
+
*
|
|
226
|
+
* NOTE: closing this popup through Mapbox's own close-button UI does NOT clear
|
|
227
|
+
* the selection — `data-active`/`aria-current`/`__selected` stay set by design.
|
|
228
|
+
* Popup visibility and selection are independent: dismissing the popup does not
|
|
229
|
+
* deselect the store. Call `deselect()` explicitly to clear the selection.
|
|
230
|
+
* @private
|
|
231
|
+
* @param {MapboxClusterItem} item
|
|
232
|
+
*/
|
|
233
|
+
__openPopup(item) {
|
|
234
|
+
const map = this.__map;
|
|
235
|
+
if (!map) return;
|
|
236
|
+
const content = item.popupContent;
|
|
237
|
+
if (!content) {
|
|
238
|
+
this.__popup?.remove();
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (!this.__popup) this.__popup = new (getMapboxGl()).Popup(this.$options.popupOptions);
|
|
242
|
+
this.__popup.setLngLat(item.lngLat).setHTML(content).addTo(map);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Fit the map to the whole item set (when `fitOnUpdate`) then recompute the
|
|
246
|
+
* in-view list. Runs on an item-set change (the cluster's `map-update` event) and
|
|
247
|
+
* when the cluster is first wired.
|
|
248
|
+
* @private
|
|
249
|
+
*/
|
|
250
|
+
__refresh() {
|
|
251
|
+
if (this.$options.fitOnUpdate && this.items.length > 0) this.__map?.fitBounds(this.__getItemsBounds(), { padding: 40 });
|
|
252
|
+
this.__filterItemsInView();
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Compute the bounding box of the whole registered item set as a
|
|
256
|
+
* `[[minLng, minLat], [maxLng, maxLat]]` tuple.
|
|
257
|
+
* @private
|
|
258
|
+
* @returns {LngLatBoundsLike}
|
|
259
|
+
*/
|
|
260
|
+
__getItemsBounds() {
|
|
261
|
+
let minLng = Infinity;
|
|
262
|
+
let minLat = Infinity;
|
|
263
|
+
let maxLng = -Infinity;
|
|
264
|
+
let maxLat = -Infinity;
|
|
265
|
+
for (const item of this.items) {
|
|
266
|
+
const [lng, lat] = item.lngLat;
|
|
267
|
+
minLng = Math.min(minLng, lng);
|
|
268
|
+
minLat = Math.min(minLat, lat);
|
|
269
|
+
maxLng = Math.max(maxLng, lng);
|
|
270
|
+
maxLat = Math.max(maxLat, lat);
|
|
271
|
+
}
|
|
272
|
+
return [[minLng, minLat], [maxLng, maxLat]];
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Recompute the visible/sorted list = registered ∩ in-bounds, distance-sorted.
|
|
276
|
+
*
|
|
277
|
+
* Reflects the in-bounds state on every item, reorders the in-view items in
|
|
278
|
+
* their shared parent list (so DOM order matches distance) and emits `map-filter`
|
|
279
|
+
* with the in-view items. Never touches the map data.
|
|
280
|
+
* @private
|
|
281
|
+
*/
|
|
282
|
+
__filterItemsInView() {
|
|
283
|
+
const map = this.__map;
|
|
284
|
+
if (!map) return;
|
|
285
|
+
const bounds = map.getBounds();
|
|
286
|
+
const center = map.getCenter();
|
|
287
|
+
const inView = [];
|
|
288
|
+
for (const item of this.items) {
|
|
289
|
+
const isInBounds = Boolean(bounds?.contains(item.lngLat));
|
|
290
|
+
item.setInBounds(isInBounds);
|
|
291
|
+
if (isInBounds) inView.push(item);
|
|
292
|
+
}
|
|
293
|
+
if (!this.$options.noSort && center) {
|
|
294
|
+
const { LngLat } = getMapboxGl();
|
|
295
|
+
inView.sort((a, b) => center.distanceTo(new LngLat(a.lngLat[0], a.lngLat[1])) - center.distanceTo(new LngLat(b.lngLat[0], b.lngLat[1])));
|
|
296
|
+
}
|
|
297
|
+
this.__reorderList(inView);
|
|
298
|
+
this.$emit("map-filter", inView);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Reorder the in-view items so their DOM order matches the distance sort.
|
|
302
|
+
* Appending a connected node moves it, keeping the list free of duplicates.
|
|
303
|
+
* Items are reordered inside their own shared parent — the sidebar list
|
|
304
|
+
* element — which is resolved per item so no `list` ref is required (a ref
|
|
305
|
+
* declared on the sidebar would not bind anyway: the items live inside the
|
|
306
|
+
* nested `MapboxCluster`, outside this orchestrator's ref scope).
|
|
307
|
+
* @private
|
|
308
|
+
* @param {MapboxClusterItem[]} items
|
|
309
|
+
*/
|
|
310
|
+
__reorderList(items) {
|
|
311
|
+
for (const item of items) item.$el.parentElement?.append(item.$el);
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Handle the cluster's `map-item-click`: select the item behind the clicked
|
|
315
|
+
* unclustered point, if one was resolved.
|
|
316
|
+
* @private
|
|
317
|
+
*/
|
|
318
|
+
__handleItemClick = (event) => {
|
|
319
|
+
const [item] = event.detail ?? [];
|
|
320
|
+
if (item) this.selectItem(item);
|
|
321
|
+
};
|
|
322
|
+
/**
|
|
323
|
+
* Handle a click anywhere in the sidebar: resolve the nearest
|
|
324
|
+
* `MapboxClusterItem` element back to its instance and select it. Delegated on
|
|
325
|
+
* the root so it survives `Fetch`/facet list swaps.
|
|
326
|
+
* @private
|
|
327
|
+
*/
|
|
328
|
+
__handleListClick = (event) => {
|
|
329
|
+
const el = event.target?.closest?.("[data-component=\"MapboxClusterItem\"]");
|
|
330
|
+
if (!el) return;
|
|
331
|
+
const item = this.items.find((candidate) => candidate.$el === el);
|
|
332
|
+
if (item) this.selectItem(item);
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* Handle the cluster's `map-update` (the item set changed): re-fit and re-filter.
|
|
336
|
+
* Drops a stale selection whose item is no longer registered.
|
|
337
|
+
* @private
|
|
338
|
+
*/
|
|
339
|
+
__handleClusterUpdate = () => {
|
|
340
|
+
if (this.__selected && !this.items.includes(this.__selected)) this.deselect();
|
|
341
|
+
this.__refresh();
|
|
342
|
+
};
|
|
343
|
+
/**
|
|
344
|
+
* Handle a `MapboxGeocoder` `map-result`: frame the map on the geocoded location.
|
|
345
|
+
* @private
|
|
346
|
+
*/
|
|
347
|
+
__handleGeocoderResult = (event) => {
|
|
348
|
+
const [result] = event.detail ?? [];
|
|
349
|
+
const map = this.__map;
|
|
350
|
+
if (!map || !result) return;
|
|
351
|
+
if (Array.isArray(result.bbox)) {
|
|
352
|
+
const [minLng, minLat, maxLng, maxLat] = result.bbox;
|
|
353
|
+
map.fitBounds([[minLng, minLat], [maxLng, maxLat]]);
|
|
354
|
+
} else if (result.center) map.flyTo({ center: result.center });
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* Recompute the in-view list whenever the viewport settles.
|
|
358
|
+
* @private
|
|
359
|
+
*/
|
|
360
|
+
__handleMoveEnd = () => {
|
|
361
|
+
this.__filterItemsInView();
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* React to the map being ready: cache it, subscribe to its `remove`, bind the
|
|
365
|
+
* viewport listener and wire the children.
|
|
366
|
+
*
|
|
367
|
+
* Idempotent for the same map (a re-entrant `map-load` or connected event does
|
|
368
|
+
* not double-bind `moveend`), and rebinds cleanly onto a replacement map.
|
|
369
|
+
* @private
|
|
370
|
+
*/
|
|
371
|
+
__handleMapLoad = () => {
|
|
372
|
+
const map = this.mapboxMap?.map;
|
|
373
|
+
if (!map) return;
|
|
374
|
+
if (this.__map && this.__map !== map) this.__map.off("moveend", this.__handleMoveEnd);
|
|
375
|
+
this.isLoaded = true;
|
|
376
|
+
this.__map = map;
|
|
377
|
+
this.__bindMapRemove(map);
|
|
378
|
+
map.off("moveend", this.__handleMoveEnd);
|
|
379
|
+
map.on("moveend", this.__handleMoveEnd);
|
|
380
|
+
this.__wireChildren();
|
|
381
|
+
};
|
|
382
|
+
/**
|
|
383
|
+
* Subscribe once to the ready map's own `remove` event so a map removed while
|
|
384
|
+
* the orchestrator stays mounted drops the cached (now dead) map instead of
|
|
385
|
+
* calling `flyTo`/`getBounds`/`fitBounds`/`off` on it. A replacement map
|
|
386
|
+
* announces itself through `MAPBOX_MAP_CONNECTED` and rebinds the orchestrator.
|
|
387
|
+
* @private
|
|
388
|
+
* @param {Map} map
|
|
389
|
+
*/
|
|
390
|
+
__bindMapRemove(map) {
|
|
391
|
+
this.__offMapRemove?.();
|
|
392
|
+
this.__offMapRemove = void 0;
|
|
393
|
+
if (typeof map?.on !== "function") return;
|
|
394
|
+
const handler = () => {
|
|
395
|
+
this.__offMapRemove?.();
|
|
396
|
+
this.__offMapRemove = void 0;
|
|
397
|
+
this.__map?.off("moveend", this.__handleMoveEnd);
|
|
398
|
+
this.__map = void 0;
|
|
399
|
+
this.isLoaded = false;
|
|
400
|
+
};
|
|
401
|
+
map.on("remove", handler);
|
|
402
|
+
this.__offMapRemove = () => map.off("remove", handler);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Resolve the child `MapboxMap` and bind to it — now if it is already loaded,
|
|
406
|
+
* otherwise once on `map-load`. When none exists yet the standing
|
|
407
|
+
* `MAPBOX_MAP_CONNECTED` subscription rebinds later.
|
|
408
|
+
* @private
|
|
409
|
+
*/
|
|
410
|
+
__bindMap() {
|
|
411
|
+
const { mapboxMap } = this;
|
|
412
|
+
if (!mapboxMap) return;
|
|
413
|
+
if (mapboxMap.isLoaded) this.__handleMapLoad();
|
|
414
|
+
else {
|
|
415
|
+
this.__offMapLoad?.();
|
|
416
|
+
this.__offMapLoad = mapboxMap.$on("map-load", this.__handleMapLoad, { once: true });
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Subscribe once to `MAPBOX_MAP_CONNECTED` and (re)bind when a `MapboxMap`
|
|
421
|
+
* inside this orchestrator connects — a late-mounted map, or a replacement for
|
|
422
|
+
* one that was removed. Ignores maps outside this subtree (several independent
|
|
423
|
+
* locators/maps can share a page).
|
|
424
|
+
* @private
|
|
425
|
+
*/
|
|
426
|
+
__waitForConnectedMap() {
|
|
427
|
+
if (this.__offMapConnected) return;
|
|
428
|
+
const handler = (event) => {
|
|
429
|
+
const mapboxMap = event.detail;
|
|
430
|
+
if (!mapboxMap?.$el || !this.$el.contains(mapboxMap.$el)) return;
|
|
431
|
+
if (this.__map && this.__map === mapboxMap.map) return;
|
|
432
|
+
this.__bindMap();
|
|
433
|
+
};
|
|
434
|
+
document.addEventListener(MAPBOX_MAP_CONNECTED, handler);
|
|
435
|
+
this.__offMapConnected = () => document.removeEventListener(MAPBOX_MAP_CONNECTED, handler);
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Subscribe once to `MAPBOX_CLUSTER_CONNECTED` and (re)wire when a
|
|
439
|
+
* `MapboxCluster` inside this orchestrator connects. A cluster that replaces
|
|
440
|
+
* the wired one drops the stale wiring and re-wires onto the new instance, so
|
|
441
|
+
* list clicks, viewport filtering and selection keep working after a swap.
|
|
442
|
+
* @private
|
|
443
|
+
*/
|
|
444
|
+
__waitForConnectedCluster() {
|
|
445
|
+
if (this.__offClusterConnected) return;
|
|
446
|
+
const handler = (event) => {
|
|
447
|
+
const cluster = event.detail;
|
|
448
|
+
if (!cluster?.$el || !this.$el.contains(cluster.$el)) return;
|
|
449
|
+
if (this.__cluster && this.__cluster !== cluster) this.__unwireCluster();
|
|
450
|
+
if (!this.__clusterWired) this.__wireChildren();
|
|
451
|
+
};
|
|
452
|
+
document.addEventListener(MAPBOX_CLUSTER_CONNECTED, handler);
|
|
453
|
+
this.__offClusterConnected = () => document.removeEventListener(MAPBOX_CLUSTER_CONNECTED, handler);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Detach the current cluster listeners and reset the wiring flag so
|
|
457
|
+
* `__wireChildren` binds afresh onto a replacement cluster.
|
|
458
|
+
* @private
|
|
459
|
+
*/
|
|
460
|
+
__unwireCluster() {
|
|
461
|
+
for (const off of this.__offCluster) off();
|
|
462
|
+
this.__offCluster = [];
|
|
463
|
+
this.__clusterWired = false;
|
|
464
|
+
this.__cluster = void 0;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Attach the `MapboxCluster`/`MapboxGeocoder` listeners once those children
|
|
468
|
+
* are available. Both mount asynchronously (the geocoder even lazy-imports its
|
|
469
|
+
* module), so we poll a bounded number of ticks until *each* is wired — the
|
|
470
|
+
* cluster is required, the geocoder optional. A locator missing the geocoder
|
|
471
|
+
* simply polls to the attempt cap (bounded and harmless). The standing
|
|
472
|
+
* connected-event subscriptions cover anything that mounts after the cap.
|
|
473
|
+
* @private
|
|
474
|
+
* @param {number} attempt
|
|
475
|
+
*/
|
|
476
|
+
__wireChildren(attempt = 0) {
|
|
477
|
+
const { cluster, geocoder } = this;
|
|
478
|
+
if (cluster && cluster.$isMounted && !this.__clusterWired) {
|
|
479
|
+
this.__clusterWired = true;
|
|
480
|
+
this.__cluster = cluster;
|
|
481
|
+
this.__offCluster.push(cluster.$on("map-item-click", this.__handleItemClick));
|
|
482
|
+
this.__offCluster.push(cluster.$on("map-update", this.__handleClusterUpdate));
|
|
483
|
+
this.__refresh();
|
|
484
|
+
}
|
|
485
|
+
if (geocoder && !this.__geocoderWired) {
|
|
486
|
+
this.__geocoderWired = true;
|
|
487
|
+
this.__geocoder = geocoder;
|
|
488
|
+
this.__offGeocoder.push(geocoder.$on("map-result", this.__handleGeocoderResult));
|
|
489
|
+
}
|
|
490
|
+
if ((!this.__clusterWired || !this.__geocoderWired) && attempt < WIRE_CHILDREN_MAX_ATTEMPTS) nextTick(() => {
|
|
491
|
+
if (this.$isMounted) this.__wireChildren(attempt + 1);
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Mounted hook: bind the delegated sidebar click, resolve and bind the map,
|
|
496
|
+
* and install the standing connected-event subscriptions so a late or replaced
|
|
497
|
+
* map/cluster (re)binds instead of stranding the orchestrator.
|
|
498
|
+
*/
|
|
499
|
+
mounted() {
|
|
500
|
+
this.$el.addEventListener("click", this.__handleListClick);
|
|
501
|
+
this.__bindMap();
|
|
502
|
+
this.__waitForConnectedMap();
|
|
503
|
+
this.__waitForConnectedCluster();
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Destroyed hook: detach every listener, close the popup and clear the cached
|
|
507
|
+
* references — even when the element has already been detached from the DOM.
|
|
508
|
+
*/
|
|
509
|
+
destroyed() {
|
|
510
|
+
for (const off of this.__offCluster) off();
|
|
511
|
+
for (const off of this.__offGeocoder) off();
|
|
512
|
+
this.__offCluster = [];
|
|
513
|
+
this.__offGeocoder = [];
|
|
514
|
+
this.__offMapLoad?.();
|
|
515
|
+
this.__offMapLoad = void 0;
|
|
516
|
+
this.__offMapRemove?.();
|
|
517
|
+
this.__offMapRemove = void 0;
|
|
518
|
+
this.__offMapConnected?.();
|
|
519
|
+
this.__offMapConnected = void 0;
|
|
520
|
+
this.__offClusterConnected?.();
|
|
521
|
+
this.__offClusterConnected = void 0;
|
|
522
|
+
this.__map?.off("moveend", this.__handleMoveEnd);
|
|
523
|
+
this.$el.removeEventListener("click", this.__handleListClick);
|
|
524
|
+
this.__popup?.remove();
|
|
525
|
+
this.__popup = void 0;
|
|
526
|
+
this.__selected = void 0;
|
|
527
|
+
this.__map = void 0;
|
|
528
|
+
this.__cluster = void 0;
|
|
529
|
+
this.__geocoder = void 0;
|
|
530
|
+
this.isLoaded = false;
|
|
531
|
+
this.__clusterWired = false;
|
|
532
|
+
this.__geocoderWired = false;
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
//#endregion
|
|
536
|
+
export { StoreLocator, StoreLocator as default };
|
|
537
|
+
|
|
538
|
+
//# sourceMappingURL=StoreLocator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoreLocator.js","names":[],"sources":["../StoreLocator.ts"],"sourcesContent":["import { Base, type BaseProps, type BaseConfig } from '@studiometa/js-toolkit';\nimport { nextTick } from '@studiometa/js-toolkit/utils';\nimport type { Map, LngLatLike, LngLatBoundsLike, Popup } from 'mapbox-gl';\nimport { getMapboxGl } from './dependencies.js';\nimport { MapboxMap } from './MapboxMap.js';\nimport { MAPBOX_MAP_CONNECTED } from './AbstractMapboxMapChild.js';\nimport { MAPBOX_CLUSTER_CONNECTED, type MapboxCluster } from './MapboxCluster.js';\nimport type { MapboxClusterItem } from './MapboxClusterItem.js';\nimport type { MapboxGeocoder } from './MapboxGeocoder.js';\n\n/**\n * Maximum number of `nextTick` retries used to wire the `MapboxCluster` and the\n * optional `MapboxGeocoder`. They are mounted asynchronously (the geocoder even\n * lazy-imports its module), so they may not be queryable yet on the `map-load`\n * event: we poll a few ticks before giving up.\n */\nconst WIRE_CHILDREN_MAX_ATTEMPTS = 10;\n\nexport interface StoreLocatorProps extends BaseProps {\n $options: {\n itemZoomLevel: number;\n noSort: boolean;\n fitOnUpdate: boolean;\n popupOptions: Record<string, unknown>;\n };\n}\n\n/**\n * Coordinate a \"find a store near you\" experience on top of a `MapboxMap`.\n *\n * `StoreLocator` is a thin **orchestrator**: it owns no map rendering and no item\n * registry of its own. It wraps a `MapboxMap` containing a\n * [`MapboxCluster`](./MapboxCluster.js) of\n * [`MapboxClusterItem`](./MapboxClusterItem.js)s (the declarative clustered map +\n * list source driver) plus an optional\n * [`MapboxGeocoder`](./MapboxGeocoder.js), and layers the search UX on top:\n * selection, viewport filtering and address search. The cluster keeps owning the\n * data (it derives the source from the registered items); the orchestrator only\n * reads that item set and reacts to it.\n *\n * Each store has three independent states, each with its own source of truth:\n *\n * 1. **Registered** — the item exists in the DOM. Owned by the `MapboxCluster`,\n * it drives the **map data** and only changes when the item set changes (e.g.\n * a `Fetch` swaps the list). The orchestrator is notified through the\n * cluster's `map-update` event.\n * 2. **In bounds** — the item's `lngLat` is inside the current viewport. Drives\n * **list visibility + distance sort only**, recomputed on map `moveend`, and\n * never touches the map data.\n * 3. **Selected** — the chosen item. Drives fly-to, the popup, `active` styling\n * and the `map-select` event.\n *\n * The orchestrator requires its `MapboxCluster` (and `MapboxMap`) to live within\n * its own subtree; it resolves them with `$query`, retries a few ticks for\n * asynchronously-mounted children, and — like the map children — subscribes to\n * the `MAPBOX_MAP_CONNECTED` / `MAPBOX_CLUSTER_CONNECTED` events so a late or\n * replaced map/cluster (re)binds instead of stranding the orchestrator on a\n * destroyed instance, and to the map's own `remove` event so a removed map is\n * never called into. Register each component independently (e.g. with\n * `registerComponent`, optionally behind a lazy `importWhen*` helper):\n * `StoreLocator`, `MapboxMap`, `MapboxCluster` and `MapboxClusterItem`.\n * Registration order does not matter because children resolve their map through\n * the connected-event retry, and the orchestrator declares no child components\n * so nothing is ever double-mounted.\n *\n * @see https://ui.studiometa.dev/reference/items/MapboxMap/\n */\nexport class StoreLocator<T extends BaseProps = BaseProps> extends Base<T & StoreLocatorProps> {\n /**\n * Config.\n *\n * No child components are declared: `MapboxMap`, `MapboxCluster`,\n * `MapboxClusterItem` and `MapboxGeocoder` are each registered independently\n * (e.g. with `registerComponent`, optionally behind a lazy `importWhen*`\n * helper) and mount on their own. The orchestrator discovers them through\n * `$query` once available — declaring them here would double-mount them.\n */\n static config: BaseConfig = {\n name: 'StoreLocator',\n emits: ['map-select', 'map-deselect', 'map-filter'],\n options: {\n itemZoomLevel: {\n type: Number,\n default: 14,\n },\n // Boolean options default to `false`, so sorting is ON by default;\n // `data-option-no-sort` disables the distance sort.\n noSort: Boolean,\n // Fit the map bounds to the item set whenever it changes.\n fitOnUpdate: Boolean,\n // Options forwarded to the `mapboxgl.Popup` opened on selection.\n popupOptions: {\n type: Object,\n default: () => ({}),\n },\n },\n };\n\n /**\n * Whether the underlying map has finished loading.\n */\n isLoaded = false;\n\n /**\n * The Mapbox `Map` instance cached at load, so every listener and teardown\n * path reaches it without a fresh `$query` (which returns nothing once the\n * element is detached).\n * @private\n */\n __map?: Map;\n\n /**\n * The child `MapboxCluster`, cached at wire-time for detach-safe teardown.\n * @private\n */\n __cluster?: MapboxCluster;\n\n /**\n * The optional child `MapboxGeocoder`, cached at wire-time.\n * @private\n */\n __geocoder?: MapboxGeocoder;\n\n /**\n * The currently selected item, if any.\n * @private\n */\n __selected?: MapboxClusterItem;\n\n /**\n * The popup opened for the selected item, created lazily.\n * @private\n */\n __popup?: Popup;\n\n /**\n * Unsubscribe callbacks for the `MapboxCluster` listeners, flushed both on\n * destroy and when the cluster is replaced (so the orchestrator re-wires onto\n * the new instance rather than staying subscribed to the destroyed one).\n * @private\n */\n __offCluster: Array<() => void> = [];\n\n /**\n * Unsubscribe callbacks for the `MapboxGeocoder` listeners, flushed on destroy.\n * @private\n */\n __offGeocoder: Array<() => void> = [];\n\n /**\n * Off handle for the pending `map-load` subscription.\n * @private\n */\n __offMapLoad?: () => void;\n\n /**\n * Off handle for the ready map's own `remove` subscription, used to drop the\n * cached map the moment it is removed so no listener/teardown ever calls a\n * method on a dead map.\n * @private\n */\n __offMapRemove?: () => void;\n\n /**\n * Off handle for the standing document-level `MAPBOX_MAP_CONNECTED` retry\n * subscription, so a map that mounts (or a replacement that mounts after the\n * previous was removed) rebinds the orchestrator.\n * @private\n */\n __offMapConnected?: () => void;\n\n /**\n * Off handle for the standing document-level `MAPBOX_CLUSTER_CONNECTED` retry\n * subscription, so a cluster that mounts late — or replaces the wired one — is\n * (re)wired instead of stranding the orchestrator on a destroyed instance.\n * @private\n */\n __offClusterConnected?: () => void;\n\n /**\n * Whether the `MapboxCluster` listeners are already attached.\n * @private\n */\n __clusterWired = false;\n\n /**\n * Whether the `MapboxGeocoder` `map-result` listener is already attached.\n * @private\n */\n __geocoderWired = false;\n\n /**\n * The closest child `MapboxMap` component.\n */\n get mapboxMap() {\n const mapboxMap = this.$query<MapboxMap>('MapboxMap')[0];\n\n if (!mapboxMap) {\n this.$warn('Can not find a child MapboxMap component.');\n }\n\n return mapboxMap;\n }\n\n /**\n * The child `MapboxCluster`, discovered in the subtree.\n */\n get cluster(): MapboxCluster | undefined {\n return this.__cluster ?? this.$query<MapboxCluster>('MapboxCluster')[0];\n }\n\n /**\n * The optional child `MapboxGeocoder`, discovered in the subtree.\n */\n get geocoder(): MapboxGeocoder | undefined {\n return this.__geocoder ?? this.$query<MapboxGeocoder>('MapboxGeocoder')[0];\n }\n\n /**\n * The Mapbox `Map` instance. Only valid once the map has loaded.\n */\n get map() {\n return this.__map ?? this.mapboxMap?.map;\n }\n\n /**\n * The registered items, read from the cluster (their single source of truth).\n */\n get items(): readonly MapboxClusterItem[] {\n return this.__cluster?.items ?? [];\n }\n\n /**\n * Select an item: deactivate the previous one, fly to the item, open its\n * popup, mark it active and emit a `map-select` event.\n * @param {MapboxClusterItem} item\n */\n selectItem(item: MapboxClusterItem) {\n if (this.__selected && this.__selected !== item) {\n this.__selected.setActive(false);\n }\n\n item.setActive(true);\n this.__selected = item;\n\n this.__map?.flyTo({\n center: item.lngLat as LngLatLike,\n zoom: this.$options.itemZoomLevel,\n });\n\n this.__openPopup(item);\n this.$emit('map-select', item);\n }\n\n /**\n * Clear the current selection, close the popup and emit a `map-deselect` event.\n */\n deselect() {\n if (this.__selected) {\n this.__selected.setActive(false);\n this.__selected = undefined;\n }\n\n this.__popup?.remove();\n this.$emit('map-deselect');\n }\n\n /**\n * Open (or move) the selection popup on the given item, using its popup\n * content. A content-less item closes any open popup instead.\n *\n * NOTE: closing this popup through Mapbox's own close-button UI does NOT clear\n * the selection — `data-active`/`aria-current`/`__selected` stay set by design.\n * Popup visibility and selection are independent: dismissing the popup does not\n * deselect the store. Call `deselect()` explicitly to clear the selection.\n * @private\n * @param {MapboxClusterItem} item\n */\n __openPopup(item: MapboxClusterItem) {\n const map = this.__map;\n\n if (!map) {\n return;\n }\n\n const content = item.popupContent;\n\n if (!content) {\n this.__popup?.remove();\n return;\n }\n\n if (!this.__popup) {\n this.__popup = new (getMapboxGl().Popup)(this.$options.popupOptions);\n }\n\n this.__popup.setLngLat(item.lngLat as LngLatLike).setHTML(content).addTo(map);\n }\n\n /**\n * Fit the map to the whole item set (when `fitOnUpdate`) then recompute the\n * in-view list. Runs on an item-set change (the cluster's `map-update` event) and\n * when the cluster is first wired.\n * @private\n */\n __refresh() {\n if (this.$options.fitOnUpdate && this.items.length > 0) {\n this.__map?.fitBounds(this.__getItemsBounds(), { padding: 40 });\n }\n\n this.__filterItemsInView();\n }\n\n /**\n * Compute the bounding box of the whole registered item set as a\n * `[[minLng, minLat], [maxLng, maxLat]]` tuple.\n * @private\n * @returns {LngLatBoundsLike}\n */\n __getItemsBounds(): LngLatBoundsLike {\n let minLng = Infinity;\n let minLat = Infinity;\n let maxLng = -Infinity;\n let maxLat = -Infinity;\n\n for (const item of this.items) {\n const [lng, lat] = item.lngLat;\n minLng = Math.min(minLng, lng);\n minLat = Math.min(minLat, lat);\n maxLng = Math.max(maxLng, lng);\n maxLat = Math.max(maxLat, lat);\n }\n\n return [\n [minLng, minLat],\n [maxLng, maxLat],\n ];\n }\n\n /**\n * Recompute the visible/sorted list = registered ∩ in-bounds, distance-sorted.\n *\n * Reflects the in-bounds state on every item, reorders the in-view items in\n * their shared parent list (so DOM order matches distance) and emits `map-filter`\n * with the in-view items. Never touches the map data.\n * @private\n */\n __filterItemsInView() {\n const map = this.__map;\n\n if (!map) {\n return;\n }\n\n const bounds = map.getBounds();\n const center = map.getCenter();\n const inView: MapboxClusterItem[] = [];\n\n for (const item of this.items) {\n const isInBounds = Boolean(bounds?.contains(item.lngLat as LngLatLike));\n item.setInBounds(isInBounds);\n\n if (isInBounds) {\n inView.push(item);\n }\n }\n\n if (!this.$options.noSort && center) {\n const { LngLat } = getMapboxGl();\n inView.sort(\n (a, b) =>\n center.distanceTo(new LngLat(a.lngLat[0], a.lngLat[1])) -\n center.distanceTo(new LngLat(b.lngLat[0], b.lngLat[1])),\n );\n }\n\n this.__reorderList(inView);\n this.$emit('map-filter', inView);\n }\n\n /**\n * Reorder the in-view items so their DOM order matches the distance sort.\n * Appending a connected node moves it, keeping the list free of duplicates.\n * Items are reordered inside their own shared parent — the sidebar list\n * element — which is resolved per item so no `list` ref is required (a ref\n * declared on the sidebar would not bind anyway: the items live inside the\n * nested `MapboxCluster`, outside this orchestrator's ref scope).\n * @private\n * @param {MapboxClusterItem[]} items\n */\n __reorderList(items: MapboxClusterItem[]) {\n for (const item of items) {\n item.$el.parentElement?.append(item.$el);\n }\n }\n\n /**\n * Handle the cluster's `map-item-click`: select the item behind the clicked\n * unclustered point, if one was resolved.\n * @private\n */\n __handleItemClick = (event: Event) => {\n const [item] = (event as CustomEvent).detail ?? [];\n\n if (item) {\n this.selectItem(item as MapboxClusterItem);\n }\n };\n\n /**\n * Handle a click anywhere in the sidebar: resolve the nearest\n * `MapboxClusterItem` element back to its instance and select it. Delegated on\n * the root so it survives `Fetch`/facet list swaps.\n * @private\n */\n __handleListClick = (event: Event) => {\n const target = event.target as Element | null;\n const el = target?.closest?.('[data-component=\"MapboxClusterItem\"]');\n\n if (!el) {\n return;\n }\n\n const item = this.items.find((candidate) => candidate.$el === el);\n\n if (item) {\n this.selectItem(item);\n }\n };\n\n /**\n * Handle the cluster's `map-update` (the item set changed): re-fit and re-filter.\n * Drops a stale selection whose item is no longer registered.\n * @private\n */\n __handleClusterUpdate = () => {\n // The selected store may have been removed by the swap. Run the full\n // deselect cleanup — not just clearing `__selected` — so its popup is\n // removed from the map and `map-deselect` is emitted, instead of leaving the\n // removed store's popup stranded while the locator claims nothing is\n // selected.\n if (this.__selected && !this.items.includes(this.__selected)) {\n this.deselect();\n }\n\n this.__refresh();\n };\n\n /**\n * Handle a `MapboxGeocoder` `map-result`: frame the map on the geocoded location.\n * @private\n */\n __handleGeocoderResult = (event: Event) => {\n const [result] = (event as CustomEvent).detail ?? [];\n const map = this.__map;\n\n if (!map || !result) {\n return;\n }\n\n if (Array.isArray(result.bbox)) {\n const [minLng, minLat, maxLng, maxLat] = result.bbox;\n map.fitBounds([\n [minLng, minLat],\n [maxLng, maxLat],\n ]);\n } else if (result.center) {\n map.flyTo({ center: result.center as LngLatLike });\n }\n };\n\n /**\n * Recompute the in-view list whenever the viewport settles.\n * @private\n */\n __handleMoveEnd = () => {\n this.__filterItemsInView();\n };\n\n /**\n * React to the map being ready: cache it, subscribe to its `remove`, bind the\n * viewport listener and wire the children.\n *\n * Idempotent for the same map (a re-entrant `map-load` or connected event does\n * not double-bind `moveend`), and rebinds cleanly onto a replacement map.\n * @private\n */\n __handleMapLoad = () => {\n const map = this.mapboxMap?.map;\n\n if (!map) {\n return;\n }\n\n // Rebinding onto a replacement: drop the viewport listener from the previous\n // map before caching and binding the new one.\n if (this.__map && this.__map !== map) {\n this.__map.off('moveend', this.__handleMoveEnd);\n }\n\n this.isLoaded = true;\n this.__map = map;\n this.__bindMapRemove(map);\n map.off('moveend', this.__handleMoveEnd);\n map.on('moveend', this.__handleMoveEnd);\n this.__wireChildren();\n };\n\n /**\n * Subscribe once to the ready map's own `remove` event so a map removed while\n * the orchestrator stays mounted drops the cached (now dead) map instead of\n * calling `flyTo`/`getBounds`/`fitBounds`/`off` on it. A replacement map\n * announces itself through `MAPBOX_MAP_CONNECTED` and rebinds the orchestrator.\n * @private\n * @param {Map} map\n */\n __bindMapRemove(map: Map) {\n this.__offMapRemove?.();\n this.__offMapRemove = undefined;\n\n // Degrade gracefully for minimal map doubles without an event emitter.\n if (typeof map?.on !== 'function') {\n return;\n }\n\n const handler = () => {\n this.__offMapRemove?.();\n this.__offMapRemove = undefined;\n this.__map?.off('moveend', this.__handleMoveEnd);\n this.__map = undefined;\n this.isLoaded = false;\n };\n\n map.on('remove', handler);\n this.__offMapRemove = () => map.off('remove', handler);\n }\n\n /**\n * Resolve the child `MapboxMap` and bind to it — now if it is already loaded,\n * otherwise once on `map-load`. When none exists yet the standing\n * `MAPBOX_MAP_CONNECTED` subscription rebinds later.\n * @private\n */\n __bindMap() {\n const { mapboxMap } = this;\n\n if (!mapboxMap) {\n return;\n }\n\n if (mapboxMap.isLoaded) {\n this.__handleMapLoad();\n } else {\n this.__offMapLoad?.();\n this.__offMapLoad = mapboxMap.$on('map-load', this.__handleMapLoad, { once: true });\n }\n }\n\n /**\n * Subscribe once to `MAPBOX_MAP_CONNECTED` and (re)bind when a `MapboxMap`\n * inside this orchestrator connects — a late-mounted map, or a replacement for\n * one that was removed. Ignores maps outside this subtree (several independent\n * locators/maps can share a page).\n * @private\n */\n __waitForConnectedMap() {\n if (this.__offMapConnected) {\n return;\n }\n\n const handler = (event: Event) => {\n const mapboxMap = (event as CustomEvent<MapboxMap>).detail;\n\n // The map lives *inside* the orchestrator: filter to descendants.\n if (!mapboxMap?.$el || !this.$el.contains(mapboxMap.$el)) {\n return;\n }\n\n // Already bound to this exact, loaded map: nothing to do.\n if (this.__map && this.__map === mapboxMap.map) {\n return;\n }\n\n this.__bindMap();\n };\n\n document.addEventListener(MAPBOX_MAP_CONNECTED, handler);\n this.__offMapConnected = () => document.removeEventListener(MAPBOX_MAP_CONNECTED, handler);\n }\n\n /**\n * Subscribe once to `MAPBOX_CLUSTER_CONNECTED` and (re)wire when a\n * `MapboxCluster` inside this orchestrator connects. A cluster that replaces\n * the wired one drops the stale wiring and re-wires onto the new instance, so\n * list clicks, viewport filtering and selection keep working after a swap.\n * @private\n */\n __waitForConnectedCluster() {\n if (this.__offClusterConnected) {\n return;\n }\n\n const handler = (event: Event) => {\n const cluster = (event as CustomEvent<MapboxCluster>).detail;\n\n if (!cluster?.$el || !this.$el.contains(cluster.$el)) {\n return;\n }\n\n if (this.__cluster && this.__cluster !== cluster) {\n // A replacement cluster: drop the stale wiring and re-wire onto it.\n this.__unwireCluster();\n }\n\n if (!this.__clusterWired) {\n this.__wireChildren();\n }\n };\n\n document.addEventListener(MAPBOX_CLUSTER_CONNECTED, handler);\n this.__offClusterConnected = () =>\n document.removeEventListener(MAPBOX_CLUSTER_CONNECTED, handler);\n }\n\n /**\n * Detach the current cluster listeners and reset the wiring flag so\n * `__wireChildren` binds afresh onto a replacement cluster.\n * @private\n */\n __unwireCluster() {\n for (const off of this.__offCluster) {\n off();\n }\n this.__offCluster = [];\n this.__clusterWired = false;\n this.__cluster = undefined;\n }\n\n /**\n * Attach the `MapboxCluster`/`MapboxGeocoder` listeners once those children\n * are available. Both mount asynchronously (the geocoder even lazy-imports its\n * module), so we poll a bounded number of ticks until *each* is wired — the\n * cluster is required, the geocoder optional. A locator missing the geocoder\n * simply polls to the attempt cap (bounded and harmless). The standing\n * connected-event subscriptions cover anything that mounts after the cap.\n * @private\n * @param {number} attempt\n */\n __wireChildren(attempt = 0) {\n const { cluster, geocoder } = this;\n\n // The cluster becomes queryable as soon as it is constructed, but its\n // GeoJSON source is only added from its `mounted()` hook. Observing\n // `$isMounted` guarantees the source is ready before we wire and refresh.\n if (cluster && cluster.$isMounted && !this.__clusterWired) {\n this.__clusterWired = true;\n this.__cluster = cluster;\n this.__offCluster.push(cluster.$on('map-item-click', this.__handleItemClick));\n this.__offCluster.push(cluster.$on('map-update', this.__handleClusterUpdate));\n // Catch up on the cluster's current item set: it may have emitted its\n // seeded `map-update` before we subscribed.\n this.__refresh();\n }\n\n if (geocoder && !this.__geocoderWired) {\n this.__geocoderWired = true;\n this.__geocoder = geocoder;\n this.__offGeocoder.push(geocoder.$on('map-result', this.__handleGeocoderResult));\n }\n\n if ((!this.__clusterWired || !this.__geocoderWired) && attempt < WIRE_CHILDREN_MAX_ATTEMPTS) {\n nextTick(() => {\n if (this.$isMounted) {\n this.__wireChildren(attempt + 1);\n }\n });\n }\n }\n\n /**\n * Mounted hook: bind the delegated sidebar click, resolve and bind the map,\n * and install the standing connected-event subscriptions so a late or replaced\n * map/cluster (re)binds instead of stranding the orchestrator.\n */\n mounted() {\n this.$el.addEventListener('click', this.__handleListClick);\n\n this.__bindMap();\n this.__waitForConnectedMap();\n this.__waitForConnectedCluster();\n }\n\n /**\n * Destroyed hook: detach every listener, close the popup and clear the cached\n * references — even when the element has already been detached from the DOM.\n */\n destroyed() {\n for (const off of this.__offCluster) {\n off();\n }\n for (const off of this.__offGeocoder) {\n off();\n }\n this.__offCluster = [];\n this.__offGeocoder = [];\n\n this.__offMapLoad?.();\n this.__offMapLoad = undefined;\n this.__offMapRemove?.();\n this.__offMapRemove = undefined;\n this.__offMapConnected?.();\n this.__offMapConnected = undefined;\n this.__offClusterConnected?.();\n this.__offClusterConnected = undefined;\n\n this.__map?.off('moveend', this.__handleMoveEnd);\n this.$el.removeEventListener('click', this.__handleListClick);\n\n this.__popup?.remove();\n this.__popup = undefined;\n this.__selected = undefined;\n this.__map = undefined;\n this.__cluster = undefined;\n this.__geocoder = undefined;\n this.isLoaded = false;\n this.__clusterWired = false;\n this.__geocoderWired = false;\n }\n}\n\nexport default StoreLocator;\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDnC,IAAa,eAAb,cAAmE,KAA4B;;;;;;;;;;CAU7F,OAAO,SAAqB;EAC1B,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AEP,OAAK,eAAe,EAAE;AACtB,OAAK,gBAAgB,EAAE;AAEvB,OAAK,gBAAgB;AACrB,OAAK,eAAe,KAAA;AACpB,OAAK,kBAAkB;AACvB,OAAK,iBAAiB,KAAA;AACtB,OAAK,qBAAqB;AAC1B,OAAK,oBAAoB,KAAA;AACzB,OAAK,yBAAyB;AAC9B,OAAK,wBAAwB,KAAA;AAE7B,OAAK,OAAO,IAAI,WAAW,KAAK,gBAAgB;AAChD,OAAK,IAAI,oBAAoB,SAAS,KAAK,kBAAkB;AAE7D,OAAK,SAAS,QAAQ;AACtB,OAAK,UAAU,KAAA;AACf,OAAK,aAAa,KAAA;AAClB,OAAK,QAAQ,KAAA;AACb,OAAK,YAAY,KAAA;AACjB,OAAK,aAAa,KAAA;AAClB,OAAK,WAAW;AAChB,OAAK,iBAAiB;AACtB,OAAK,kBAAkB"}
|
package/catalog.d.ts
ADDED
package/catalog.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** The autoload catalog for every declarative `@studiometa/ui-mapbox` component. */
|
|
2
|
+
const catalog = {
|
|
3
|
+
packageName: "@studiometa/ui-mapbox",
|
|
4
|
+
strategy: "visible",
|
|
5
|
+
components: [
|
|
6
|
+
{
|
|
7
|
+
token: "MapboxCluster",
|
|
8
|
+
group: "mapbox"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
token: "MapboxClusterItem",
|
|
12
|
+
group: "mapbox"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
token: "MapboxFullscreenControl",
|
|
16
|
+
group: "mapbox"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
token: "MapboxGeocoder",
|
|
20
|
+
group: "mapbox"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
token: "MapboxGeolocateControl",
|
|
24
|
+
group: "mapbox"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
token: "MapboxImage",
|
|
28
|
+
group: "mapbox"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
token: "MapboxImages",
|
|
32
|
+
group: "mapbox"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
token: "MapboxLayer",
|
|
36
|
+
group: "mapbox"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
token: "MapboxMap",
|
|
40
|
+
group: "mapbox"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
token: "MapboxMarker",
|
|
44
|
+
group: "mapbox"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
token: "MapboxNavigationControl",
|
|
48
|
+
group: "mapbox"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
token: "MapboxPopup",
|
|
52
|
+
group: "mapbox"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
token: "MapboxSource",
|
|
56
|
+
group: "mapbox"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
token: "StoreLocator",
|
|
60
|
+
group: "mapbox"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
abstractExports: ["AbstractMapboxControl", "AbstractMapboxMapChild"]
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
export { catalog };
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=catalog.js.map
|
package/catalog.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","names":[],"sources":["../catalog.ts"],"sourcesContent":["import type { ComponentCatalog, CuratedComponentMetadata } from '@studiometa/ui-autoload';\n\n// Mapbox GL and the optional geocoder are external (import-map resolved) and no longer served by\n// the CDN, so these components declare neither a CDN-served stylesheet nor a bundled integration\n// chunk — consumers load the Mapbox JavaScript and CSS from the source their import map points at.\nconst components: readonly CuratedComponentMetadata[] = [\n { token: 'MapboxCluster', group: 'mapbox' },\n { token: 'MapboxClusterItem', group: 'mapbox' },\n { token: 'MapboxFullscreenControl', group: 'mapbox' },\n { token: 'MapboxGeocoder', group: 'mapbox' },\n { token: 'MapboxGeolocateControl', group: 'mapbox' },\n { token: 'MapboxImage', group: 'mapbox' },\n { token: 'MapboxImages', group: 'mapbox' },\n { token: 'MapboxLayer', group: 'mapbox' },\n { token: 'MapboxMap', group: 'mapbox' },\n { token: 'MapboxMarker', group: 'mapbox' },\n { token: 'MapboxNavigationControl', group: 'mapbox' },\n { token: 'MapboxPopup', group: 'mapbox' },\n { token: 'MapboxSource', group: 'mapbox' },\n { token: 'StoreLocator', group: 'mapbox' },\n];\n\n/** The autoload catalog for every declarative `@studiometa/ui-mapbox` component. */\nexport const catalog: ComponentCatalog = {\n packageName: '@studiometa/ui-mapbox',\n strategy: 'visible',\n components,\n abstractExports: ['AbstractMapboxControl', 'AbstractMapboxMapChild'],\n};\n"],"mappings":";AAuBA,MAAa,UAA4B;CACvC,aAAa;CACb,UAAU;CACV,YArBsD;EACtD;GAAE,OAAO;GAAiB,OAAO;GAAU;EAC3C;GAAE,OAAO;GAAqB,OAAO;GAAU;EAC/C;GAAE,OAAO;GAA2B,OAAO;GAAU;EACrD;GAAE,OAAO;GAAkB,OAAO;GAAU;EAC5C;GAAE,OAAO;GAA0B,OAAO;GAAU;EACpD;GAAE,OAAO;GAAe,OAAO;GAAU;EACzC;GAAE,OAAO;GAAgB,OAAO;GAAU;EAC1C;GAAE,OAAO;GAAe,OAAO;GAAU;EACzC;GAAE,OAAO;GAAa,OAAO;GAAU;EACvC;GAAE,OAAO;GAAgB,OAAO;GAAU;EAC1C;GAAE,OAAO;GAA2B,OAAO;GAAU;EACrD;GAAE,OAAO;GAAe,OAAO;GAAU;EACzC;GAAE,OAAO;GAAgB,OAAO;GAAU;EAC1C;GAAE,OAAO;GAAgB,OAAO;GAAU;EAC3C;CAOC,iBAAiB,CAAC,yBAAyB,yBAAyB;CACrE"}
|