@studiometa/ui-mapbox 1.11.0 → 2.0.0-alpha.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/dist/AbstractMapboxControl.js +1 -1
- package/dist/AbstractMapboxControl.js.map +1 -1
- package/dist/AbstractMapboxMapChild.d.ts +32 -12
- package/dist/AbstractMapboxMapChild.js +24 -17
- package/dist/AbstractMapboxMapChild.js.map +1 -1
- package/dist/MapboxCluster.d.ts +19 -2
- package/dist/MapboxCluster.js +11 -9
- package/dist/MapboxCluster.js.map +1 -1
- package/dist/MapboxClusterItem.d.ts +11 -3
- package/dist/MapboxClusterItem.js +5 -6
- package/dist/MapboxClusterItem.js.map +1 -1
- package/dist/MapboxFullscreenControl.d.ts +8 -4
- package/dist/MapboxFullscreenControl.js +6 -2
- package/dist/MapboxFullscreenControl.js.map +1 -1
- package/dist/MapboxGeocoder.d.ts +9 -0
- package/dist/MapboxGeocoder.js +1 -2
- package/dist/MapboxGeocoder.js.map +1 -1
- package/dist/MapboxGeolocateControl.d.ts +8 -4
- package/dist/MapboxGeolocateControl.js +16 -12
- package/dist/MapboxGeolocateControl.js.map +1 -1
- package/dist/MapboxImage.d.ts +11 -1
- package/dist/MapboxImage.js +0 -1
- package/dist/MapboxImage.js.map +1 -1
- package/dist/MapboxImages.d.ts +9 -1
- package/dist/MapboxImages.js +1 -2
- package/dist/MapboxImages.js.map +1 -1
- package/dist/MapboxLayer.js.map +1 -1
- package/dist/MapboxMap.d.ts +17 -2
- package/dist/MapboxMap.js +4 -5
- package/dist/MapboxMap.js.map +1 -1
- package/dist/MapboxMarker.js.map +1 -1
- package/dist/MapboxNavigationControl.d.ts +8 -4
- package/dist/MapboxNavigationControl.js +13 -9
- package/dist/MapboxNavigationControl.js.map +1 -1
- package/dist/MapboxPopup.js.map +1 -1
- package/dist/MapboxSource.js +1 -1
- package/dist/MapboxSource.js.map +1 -1
- package/dist/StoreLocator.d.ts +76 -51
- package/dist/StoreLocator.js +111 -105
- package/dist/StoreLocator.js.map +1 -1
- package/dist/catalog.js.map +1 -1
- package/dist/dependencies.d.ts +6 -4
- package/dist/dependencies.js +6 -4
- package/dist/dependencies.js.map +1 -1
- package/dist/manifest.js +14 -84
- package/dist/manifest.js.map +1 -1
- package/dist/scripts/manifest-types.d.ts +3 -3
- package/package.json +3 -3
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { AbstractMapboxControl } from "./AbstractMapboxControl.js";
|
|
2
2
|
import { getMapboxGl } from "./dependencies.js";
|
|
3
|
-
import { withExtraConfig } from "@studiometa/js-toolkit/withExtraConfig";
|
|
4
3
|
//#region src/MapboxNavigationControl.ts
|
|
5
4
|
/**
|
|
6
5
|
* Add a navigation control to the map.
|
|
6
|
+
*
|
|
7
7
|
* @see https://ui.studiometa.dev/reference/items/MapboxMap/
|
|
8
8
|
*/
|
|
9
|
-
var MapboxNavigationControl = class extends
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
var MapboxNavigationControl = class extends AbstractMapboxControl {
|
|
10
|
+
/**
|
|
11
|
+
* Config.
|
|
12
|
+
*/
|
|
13
|
+
static config = {
|
|
14
|
+
name: "MapboxNavigationControl",
|
|
15
|
+
options: {
|
|
16
|
+
showCompass: Boolean,
|
|
17
|
+
showZoom: Boolean,
|
|
18
|
+
visualizePitch: Boolean
|
|
19
|
+
}
|
|
20
|
+
};
|
|
17
21
|
/**
|
|
18
22
|
* Create the mapbox NavigationControl instance.
|
|
19
23
|
* @protected
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapboxNavigationControl.js","names":[],"sources":["../src/MapboxNavigationControl.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"MapboxNavigationControl.js","names":[],"sources":["../src/MapboxNavigationControl.ts"],"sourcesContent":["import type { BaseConfig, BaseProps } from '@studiometa/js-toolkit';\nimport type { NavigationControlOptions } from 'mapbox-gl';\nimport { AbstractMapboxControl, type AbstractMapboxControlProps } from './AbstractMapboxControl.js';\nimport { getMapboxGl } from './dependencies.js';\n\nexport interface MapboxNavigationControlProps extends AbstractMapboxControlProps {\n $options: AbstractMapboxControlProps['$options'] & {\n showCompass: boolean;\n showZoom: boolean;\n visualizePitch: boolean;\n };\n}\n\n/**\n * Add a navigation control to the map.\n *\n * @see https://ui.studiometa.dev/reference/items/MapboxMap/\n */\nexport class MapboxNavigationControl<T extends BaseProps = BaseProps> extends AbstractMapboxControl<\n T & MapboxNavigationControlProps\n> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'MapboxNavigationControl',\n options: {\n showCompass: Boolean,\n showZoom: Boolean,\n visualizePitch: Boolean,\n },\n };\n\n /**\n * Create the mapbox NavigationControl instance.\n * @protected\n */\n createControl(options: NavigationControlOptions) {\n return new (getMapboxGl().NavigationControl)(options);\n }\n}\n\nexport default MapboxNavigationControl;\n"],"mappings":";;;;;;;;AAkBA,IAAa,0BAAb,cAA8E,sBAE5E;;;;CAIA,OAAO,SAAqB;EAC1B,MAAM;EACN,SAAS;GACP,aAAa;GACb,UAAU;GACV,gBAAgB;GACjB;EACF;;;;;CAMD,cAAc,SAAmC;AAC/C,SAAO,KAAK,aAAa,EAAC,kBAAmB,QAAQ"}
|
package/dist/MapboxPopup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapboxPopup.js","names":[],"sources":["../src/MapboxPopup.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"MapboxPopup.js","names":[],"sources":["../src/MapboxPopup.ts"],"sourcesContent":["import type { BaseConfig, BaseProps } from '@studiometa/js-toolkit';\nimport type { Popup, PopupOptions } from 'mapbox-gl';\nimport {\n AbstractMapboxMapChild,\n type AbstractMapboxMapChildProps,\n} from './AbstractMapboxMapChild.js';\nimport { getMapboxGl } from './dependencies.js';\nimport type { MapboxMarker } from './MapboxMarker.js';\n\nexport interface MapboxPopupProps extends AbstractMapboxMapChildProps {\n $options: {\n lngLat: [number, number];\n /**\n * Popup options.\n * @see https://docs.mapbox.com/mapbox-gl-js/api/markers#popup\n */\n popupOptions: PopupOptions;\n };\n}\n\n/**\n * Display a popup on a MapboxMap map.\n * @see https://ui.studiometa.dev/reference/items/MapboxMap\n */\nexport class MapboxPopup<T extends BaseProps = BaseProps> extends AbstractMapboxMapChild<\n T & MapboxPopupProps\n> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'MapboxPopup',\n options: {\n lngLat: {\n type: Array,\n default: () => [0, 0],\n },\n popupOptions: Object,\n },\n };\n\n /**\n * Popup instance.\n * @private\n */\n __popup: Popup;\n\n /**\n * Whether this component hid its own source element (to avoid rendering the\n * content twice). Tracked so teardown restores the original visibility only\n * when it was the one to change it.\n * @private\n */\n __didHide = false;\n\n /**\n * The mapbox Popup instance.\n */\n get popup() {\n if (!this.__popup) {\n this.__popup = new (getMapboxGl().Popup)(this.$options.popupOptions);\n }\n\n return this.__popup;\n }\n\n /**\n * Mounted hook.\n */\n mounted() {\n this.whenMapReady((map) => {\n const { popup, $el, $options } = this;\n\n popup.setLngLat($options.lngLat);\n\n const content = $el.innerHTML.trim();\n if (content) {\n popup.setHTML(content);\n // Hide the source markup so the content is not rendered twice: once in\n // the popup and once in the document. Remember we did so — only when it\n // was visible — to restore it on teardown.\n if (!$el.hidden) {\n $el.hidden = true;\n this.__didHide = true;\n }\n }\n\n // When inside a marker, hand the popup to it rather than adding it to the\n // map directly (the marker owns its popup via `setPopup`). Pushing to the\n // marker — instead of letting the marker pull us — also covers the dynamic\n // append case where the marker mounted first and found no popup to query.\n const marker = this.$closest<MapboxMarker>('MapboxMarker');\n if (marker) {\n marker.setChildPopup(this);\n } else {\n popup.addTo(map);\n }\n });\n }\n\n /**\n * Teardown hook.\n */\n __onDestroyed() {\n this.__popup?.remove();\n this.__popup = undefined;\n\n // Restore the source element's visibility only if this component hid it, so\n // a reused or remounted element keeps its original state.\n if (this.__didHide) {\n this.$el.hidden = false;\n this.__didHide = false;\n }\n }\n}\n\nexport default MapboxPopup;\n"],"mappings":";;;;;;;AAwBA,IAAa,cAAb,cAAkE,uBAEhE;;;;CAIA,OAAO,SAAqB;EAC1B,MAAM;EACN,SAAS;GACP,QAAQ;IACN,MAAM;IACN,eAAe,CAAC,GAAG,EAAE;IACtB;GACD,cAAc;GACf;EACF;;;;;CAMD;;;;;;;CAQA,YAAY;;;;CAKZ,IAAI,QAAQ;AACV,MAAI,CAAC,KAAK,QACR,MAAK,UAAU,KAAK,aAAa,EAAC,MAAO,KAAK,SAAS,aAAa;AAGtE,SAAO,KAAK;;;;;CAMd,UAAU;AACR,OAAK,cAAc,QAAQ;GACzB,MAAM,EAAE,OAAO,KAAK,aAAa;AAEjC,SAAM,UAAU,SAAS,OAAO;GAEhC,MAAM,UAAU,IAAI,UAAU,MAAM;AACpC,OAAI,SAAS;AACX,UAAM,QAAQ,QAAQ;AAItB,QAAI,CAAC,IAAI,QAAQ;AACf,SAAI,SAAS;AACb,UAAK,YAAY;;;GAQrB,MAAM,SAAS,KAAK,SAAuB,eAAe;AAC1D,OAAI,OACF,QAAO,cAAc,KAAK;OAE1B,OAAM,MAAM,IAAI;IAElB;;;;;CAMJ,gBAAgB;AACd,OAAK,SAAS,QAAQ;AACtB,OAAK,UAAU,KAAA;AAIf,MAAI,KAAK,WAAW;AAClB,QAAK,IAAI,SAAS;AAClB,QAAK,YAAY"}
|
package/dist/MapboxSource.js
CHANGED
|
@@ -35,7 +35,7 @@ var MapboxSource = class extends AbstractMapboxMapChild {
|
|
|
35
35
|
data
|
|
36
36
|
};
|
|
37
37
|
} catch (err) {
|
|
38
|
-
this.$
|
|
38
|
+
this.$error("mapbox-source.invalid-geojson", "Invalid JSON in the `geojson` ref.", err);
|
|
39
39
|
return source;
|
|
40
40
|
}
|
|
41
41
|
}
|
package/dist/MapboxSource.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapboxSource.js","names":[],"sources":["../src/MapboxSource.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"MapboxSource.js","names":[],"sources":["../src/MapboxSource.ts"],"sourcesContent":["import type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\nimport type { SourceSpecification, GeoJSONSourceSpecification, GeoJSONSource } from 'mapbox-gl';\nimport {\n AbstractMapboxMapChild,\n type AbstractMapboxMapChildProps,\n} from './AbstractMapboxMapChild.js';\nimport { claimMapboxOwnership, getMapboxOwner, releaseMapboxOwnership } from './utils.js';\n\nexport interface MapboxSourceProps extends AbstractMapboxMapChildProps {\n $refs: {\n geojson?: HTMLScriptElement;\n };\n $options: {\n id: string;\n /**\n * The source specification, e.g. `{ type: 'geojson', data }`.\n * @see https://docs.mapbox.com/style-spec/reference/sources/\n */\n source: SourceSpecification;\n };\n}\n\n/**\n * Add a source to the map.\n * @see https://ui.studiometa.dev/reference/items/MapboxMap/\n */\nexport class MapboxSource<T extends BaseProps = BaseProps> extends AbstractMapboxMapChild<\n T & MapboxSourceProps\n> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n name: 'MapboxSource',\n refs: ['geojson'],\n options: {\n id: String,\n source: Object,\n },\n };\n\n /**\n * Resolve the source specification.\n *\n * When a `geojson` ref — a `<script data-ref=\"geojson\" type=\"application/json\">`\n * element — is present, its content is parsed as inline GeoJSON and injected\n * as the source spec's `data`. Otherwise the `source` option is used as is.\n */\n get source(): SourceSpecification {\n const { source } = this.$options;\n const script = this.$refs.geojson;\n const content = script?.textContent?.trim();\n\n // Only inject inline data when the script ref holds actual content. A\n // missing, empty or whitespace-only ref is treated as \"no inline data\" and\n // the `source` option is used as is instead of injecting `data: null`.\n if (!content) {\n return source;\n }\n\n try {\n const data = JSON.parse(content) as GeoJSONSourceSpecification['data'];\n return { ...source, data } as SourceSpecification;\n } catch (err) {\n this.$error('mapbox-source.invalid-geojson', 'Invalid JSON in the `geojson` ref.', err);\n return source;\n }\n }\n\n /**\n * Whether this instance owns the source under its id. Only a source this\n * instance owns — along with the layers tied to it — may be removed on\n * teardown; a source declared by someone else outside the family is left\n * untouched, and a source a newer sibling has since adopted is left to that\n * sibling.\n * @private\n */\n __added = false;\n\n /**\n * The `kind:id` ownership key for this source.\n * @private\n */\n get __ownershipKey(): string {\n return `source:${this.$options.id}`;\n }\n\n /**\n * Mounted hook.\n *\n * Adopt-or-add: when the id is free, add the source and claim ownership. When\n * a source with this id already exists, adding it again would throw a\n * duplicate-id error, so instead update its data (for GeoJSON) and — when the\n * existing source belongs to a sibling `MapboxSource` (e.g. a `Fetch` swap\n * mounted the replacement before the original tore down) — take over\n * ownership. A source declared outside the family is left untouched and not\n * owned.\n */\n mounted() {\n this.whenMapReady((map) => {\n const { id } = this.$options;\n const { source } = this;\n\n if (!map.getSource(id)) {\n map.addSource(id, source);\n // Own the id, keyed to the very source object just added: the liveness\n // probe reports the entry stale the moment this source is removed (a\n // `setStyle` wipe, an external `removeSource`) or replaced under the same\n // id, so it can never misclassify a stranger's later source (H6).\n const added = map.getSource(id);\n claimMapboxOwnership(map, this.__ownershipKey, this, () => map.getSource(id) === added);\n this.__added = true;\n return;\n }\n\n // The id is taken. Only adopt it from another family instance; an\n // externally declared source stays untouched. `getMapboxOwner` validates\n // the existing owner's liveness, so a stale entry left by a wiped/removed\n // source does not read as owned and is not adopted here.\n if (getMapboxOwner(map, this.__ownershipKey)) {\n if (source.type === 'geojson' && 'data' in source) {\n const existing = map.getSource<GeoJSONSource>(id);\n existing?.setData(source.data as GeoJSONSourceSpecification['data']);\n }\n\n const existing = map.getSource(id);\n claimMapboxOwnership(map, this.__ownershipKey, this, () => map.getSource(id) === existing);\n this.__added = true;\n }\n });\n }\n\n /**\n * Teardown hook.\n */\n __onDestroyed() {\n const map = this.__readyMap;\n const { id } = this.$options;\n\n // Only remove a source this instance still owns: a newer sibling may have\n // adopted the id, and a removed map is already gone (`__readyMap` is unset).\n if (\n this.__added &&\n getMapboxOwner(map as object, this.__ownershipKey) === this &&\n map?.getSource(id)\n ) {\n // Remove every layer tied to the source before removing the source itself,\n // otherwise Mapbox throws because layers still reference a missing source.\n //\n // H7 (PR #567 review): this also removes layers owned by still-mounted\n // `MapboxLayer` instances. Those layers now keep a standing `sourcedata`\n // recovery watch (see `MapboxLayer.__handleSourceData`), so when a source\n // with the same id is later re-added they re-commit themselves rather than\n // vanishing permanently. The removal here is unavoidable (Mapbox rejects\n // removing a source still referenced by a layer); recovery is the layer's\n // job. The common `Fetch` swap (source AND layers replaced together) is\n // likewise fine: the replacement layers re-commit on their own.\n for (const layer of map.getStyle().layers) {\n if ('source' in layer && layer.source === id) {\n map.removeLayer(layer.id);\n }\n }\n\n map.removeSource(id);\n releaseMapboxOwnership(map, this.__ownershipKey, this);\n }\n }\n}\n\nexport default MapboxSource;\n"],"mappings":";;;;;;;AA0BA,IAAa,eAAb,cAAmE,uBAEjE;;;;CAIA,OAAO,SAAqB;EAC1B,MAAM;EACN,MAAM,CAAC,UAAU;EACjB,SAAS;GACP,IAAI;GACJ,QAAQ;GACT;EACF;;;;;;;;CASD,IAAI,SAA8B;EAChC,MAAM,EAAE,WAAW,KAAK;EAExB,MAAM,UADS,KAAK,MAAM,SACF,aAAa,MAAM;AAK3C,MAAI,CAAC,QACH,QAAO;AAGT,MAAI;GACF,MAAM,OAAO,KAAK,MAAM,QAAQ;AAChC,UAAO;IAAE,GAAG;IAAQ;IAAM;WACnB,KAAK;AACZ,QAAK,OAAO,iCAAiC,sCAAsC,IAAI;AACvF,UAAO;;;;;;;;;;;CAYX,UAAU;;;;;CAMV,IAAI,iBAAyB;AAC3B,SAAO,UAAU,KAAK,SAAS;;;;;;;;;;;;;CAcjC,UAAU;AACR,OAAK,cAAc,QAAQ;GACzB,MAAM,EAAE,OAAO,KAAK;GACpB,MAAM,EAAE,WAAW;AAEnB,OAAI,CAAC,IAAI,UAAU,GAAG,EAAE;AACtB,QAAI,UAAU,IAAI,OAAO;IAKzB,MAAM,QAAQ,IAAI,UAAU,GAAG;AAC/B,yBAAqB,KAAK,KAAK,gBAAgB,YAAY,IAAI,UAAU,GAAG,KAAK,MAAM;AACvF,SAAK,UAAU;AACf;;AAOF,OAAI,eAAe,KAAK,KAAK,eAAe,EAAE;AAC5C,QAAI,OAAO,SAAS,aAAa,UAAU,OACxB,KAAI,UAAyB,GAAG,EACvC,QAAQ,OAAO,KAA2C;IAGtE,MAAM,WAAW,IAAI,UAAU,GAAG;AAClC,yBAAqB,KAAK,KAAK,gBAAgB,YAAY,IAAI,UAAU,GAAG,KAAK,SAAS;AAC1F,SAAK,UAAU;;IAEjB;;;;;CAMJ,gBAAgB;EACd,MAAM,MAAM,KAAK;EACjB,MAAM,EAAE,OAAO,KAAK;AAIpB,MACE,KAAK,WACL,eAAe,KAAe,KAAK,eAAe,KAAK,QACvD,KAAK,UAAU,GAAG,EAClB;AAYA,QAAK,MAAM,SAAS,IAAI,UAAU,CAAC,OACjC,KAAI,YAAY,SAAS,MAAM,WAAW,GACxC,KAAI,YAAY,MAAM,GAAG;AAI7B,OAAI,aAAa,GAAG;AACpB,0BAAuB,KAAK,KAAK,gBAAgB,KAAK"}
|
package/dist/StoreLocator.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { MapboxMap } from "./MapboxMap.js";
|
|
|
2
2
|
import { MapboxClusterItem } from "./MapboxClusterItem.js";
|
|
3
3
|
import { MapboxCluster } from "./MapboxCluster.js";
|
|
4
4
|
import { MapboxGeocoder } from "./MapboxGeocoder.js";
|
|
5
|
-
import { BaseConfig, BaseProps } from "@studiometa/js-toolkit";
|
|
5
|
+
import { BaseConfig, BaseProps, ChildrenCollection } from "@studiometa/js-toolkit";
|
|
6
6
|
import { LngLatBoundsLike, Map, Popup } from "mapbox-gl";
|
|
7
7
|
import { Base } from "@studiometa/js-toolkit/Base";
|
|
8
8
|
|
|
@@ -14,6 +14,15 @@ interface StoreLocatorProps extends BaseProps {
|
|
|
14
14
|
fitOnUpdate: boolean;
|
|
15
15
|
popupOptions: Record<string, unknown>;
|
|
16
16
|
};
|
|
17
|
+
$emits: {
|
|
18
|
+
'map-select': {
|
|
19
|
+
item: MapboxClusterItem;
|
|
20
|
+
};
|
|
21
|
+
'map-deselect': void;
|
|
22
|
+
'map-filter': {
|
|
23
|
+
items: MapboxClusterItem[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
17
26
|
}
|
|
18
27
|
/**
|
|
19
28
|
* Coordinate a "find a store near you" experience on top of a `MapboxMap`.
|
|
@@ -41,17 +50,15 @@ interface StoreLocatorProps extends BaseProps {
|
|
|
41
50
|
* and the `map-select` event.
|
|
42
51
|
*
|
|
43
52
|
* The orchestrator requires its `MapboxCluster` (and `MapboxMap`) to live within
|
|
44
|
-
* its own subtree
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* never called into. Register each component independently
|
|
50
|
-
* `registerComponent`,
|
|
51
|
-
* `
|
|
52
|
-
*
|
|
53
|
-
* the connected-event retry, and the orchestrator declares no child components
|
|
54
|
-
* so nothing is ever double-mounted.
|
|
53
|
+
* its own subtree. It watches both with `$watchChildren()`, so a cluster or
|
|
54
|
+
* geocoder that mounts late — or one that replaces the wired instance — is
|
|
55
|
+
* picked up without polling; it subscribes to `MAPBOX_MAP_CONNECTED` because a
|
|
56
|
+
* map announces its Mapbox instance *after* mounting, which a children
|
|
57
|
+
* collection cannot report; and it subscribes to the map's own `remove` event
|
|
58
|
+
* so a removed map is never called into. Register each component independently
|
|
59
|
+
* with `registerComponent`: `StoreLocator`, `MapboxMap`, `MapboxCluster` and
|
|
60
|
+
* `MapboxClusterItem`. Registration and mount order do not matter, and the
|
|
61
|
+
* orchestrator declares no child components so nothing is ever double-mounted.
|
|
55
62
|
*
|
|
56
63
|
* @see https://ui.studiometa.dev/reference/items/MapboxMap/
|
|
57
64
|
*/
|
|
@@ -61,9 +68,9 @@ declare class StoreLocator<T extends BaseProps = BaseProps> extends Base<T & Sto
|
|
|
61
68
|
*
|
|
62
69
|
* No child components are declared: `MapboxMap`, `MapboxCluster`,
|
|
63
70
|
* `MapboxClusterItem` and `MapboxGeocoder` are each registered independently
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
71
|
+
* with `registerComponent` and mount on their own. The orchestrator discovers
|
|
72
|
+
* them through `$watchChildren()`; declaring them here would double-mount
|
|
73
|
+
* them, since the registry already mounts a declared element.
|
|
67
74
|
*/
|
|
68
75
|
static config: BaseConfig;
|
|
69
76
|
/**
|
|
@@ -99,13 +106,13 @@ declare class StoreLocator<T extends BaseProps = BaseProps> extends Base<T & Sto
|
|
|
99
106
|
__popup?: Popup;
|
|
100
107
|
/**
|
|
101
108
|
* Unsubscribe callbacks for the `MapboxCluster` listeners, flushed both on
|
|
102
|
-
*
|
|
103
|
-
* the new instance rather than staying subscribed to the
|
|
109
|
+
* unmount and when the cluster is replaced (so the orchestrator re-wires onto
|
|
110
|
+
* the new instance rather than staying subscribed to the unmounted one).
|
|
104
111
|
* @private
|
|
105
112
|
*/
|
|
106
113
|
__offCluster: Array<() => void>;
|
|
107
114
|
/**
|
|
108
|
-
* Unsubscribe callbacks for the `MapboxGeocoder` listeners, flushed on
|
|
115
|
+
* Unsubscribe callbacks for the `MapboxGeocoder` listeners, flushed on unmount.
|
|
109
116
|
* @private
|
|
110
117
|
*/
|
|
111
118
|
__offGeocoder: Array<() => void>;
|
|
@@ -129,26 +136,33 @@ declare class StoreLocator<T extends BaseProps = BaseProps> extends Base<T & Sto
|
|
|
129
136
|
*/
|
|
130
137
|
__offMapConnected?: () => void;
|
|
131
138
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
* Whether the `MapboxCluster` listeners are already attached.
|
|
139
|
+
* The mounted `MapboxCluster` descendants, live and in DOM order.
|
|
140
|
+
*
|
|
141
|
+
* The collection answers "has the cluster mounted yet?" on its own: a cluster
|
|
142
|
+
* that mounts late, or one that replaces the wired one, reaches the
|
|
143
|
+
* `added`/`removed` callbacks with nothing to poll. The cluster still
|
|
144
|
+
* dispatches `MAPBOX_CLUSTER_CONNECTED` for `MapboxClusterItem`, which looks
|
|
145
|
+
* *up* for its cluster and has no watching counterpart to `$closest()`.
|
|
140
146
|
* @private
|
|
141
147
|
*/
|
|
142
|
-
|
|
148
|
+
__clusters: ChildrenCollection<MapboxCluster>;
|
|
143
149
|
/**
|
|
144
|
-
*
|
|
150
|
+
* The mounted `MapboxGeocoder` descendants, live and in DOM order. The
|
|
151
|
+
* geocoder is optional, so nothing waits for it: it wires itself whenever it
|
|
152
|
+
* turns up.
|
|
145
153
|
* @private
|
|
146
154
|
*/
|
|
147
|
-
|
|
155
|
+
__geocoders: ChildrenCollection<MapboxGeocoder>;
|
|
148
156
|
/**
|
|
149
|
-
* The
|
|
157
|
+
* The child `MapboxMap` component, once it has mounted.
|
|
158
|
+
*
|
|
159
|
+
* The getter does not warn when there is none: a wrapper mounts before the
|
|
160
|
+
* elements inside it and mount order is not guaranteed, so "no map yet" is
|
|
161
|
+
* the normal state on every healthy locator. A locator with genuinely no map
|
|
162
|
+
* in its markup is reported once instead, from
|
|
163
|
+
* {@link __warnWhenMapIsMissing}.
|
|
150
164
|
*/
|
|
151
|
-
get mapboxMap(): MapboxMap
|
|
165
|
+
get mapboxMap(): MapboxMap | undefined;
|
|
152
166
|
/**
|
|
153
167
|
* The child `MapboxCluster`, discovered in the subtree.
|
|
154
168
|
*/
|
|
@@ -284,41 +298,52 @@ declare class StoreLocator<T extends BaseProps = BaseProps> extends Base<T & Sto
|
|
|
284
298
|
*/
|
|
285
299
|
__waitForConnectedMap(): void;
|
|
286
300
|
/**
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
301
|
+
* Report a locator with no `MapboxMap` in its markup, once.
|
|
302
|
+
*
|
|
303
|
+
* The check reads the **element**, not the mounted instance: DOM ancestry is
|
|
304
|
+
* a fact that exists before anything mounts, so it is immune both to mount
|
|
305
|
+
* ordering and to the map's mount strategy — a `data-mount` that has not
|
|
306
|
+
* fired yet is not a missing map. `whenDOMSettled()` waits for
|
|
307
|
+
* the mutation batch that brought the locator in, which is the earliest
|
|
308
|
+
* moment the markup can be judged complete.
|
|
291
309
|
* @private
|
|
292
310
|
*/
|
|
293
|
-
|
|
311
|
+
__warnWhenMapIsMissing(): Promise<void>;
|
|
294
312
|
/**
|
|
295
|
-
* Detach the current cluster listeners
|
|
296
|
-
* `__wireChildren` binds afresh onto a replacement cluster.
|
|
313
|
+
* Detach the current cluster listeners so a replacement can be wired afresh.
|
|
297
314
|
* @private
|
|
298
315
|
*/
|
|
299
316
|
__unwireCluster(): void;
|
|
300
317
|
/**
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
*
|
|
318
|
+
* Detach the current geocoder listener.
|
|
319
|
+
* @private
|
|
320
|
+
*/
|
|
321
|
+
__unwireGeocoder(): void;
|
|
322
|
+
/**
|
|
323
|
+
* Attach the `MapboxCluster` listeners, once, to the first cluster in the
|
|
324
|
+
* subtree. A no-op while the orchestrator itself is unmounted: the collection
|
|
325
|
+
* outlives a mount cycle, so `mounted()` wires whatever it already holds.
|
|
326
|
+
* @private
|
|
327
|
+
*/
|
|
328
|
+
__wireCluster(cluster?: MapboxCluster): void;
|
|
329
|
+
/**
|
|
330
|
+
* Attach the optional `MapboxGeocoder` listener, once, to the first geocoder
|
|
331
|
+
* in the subtree.
|
|
307
332
|
* @private
|
|
308
|
-
* @param {number} attempt
|
|
309
333
|
*/
|
|
310
|
-
|
|
334
|
+
__wireGeocoder(geocoder?: MapboxGeocoder): void;
|
|
311
335
|
/**
|
|
312
|
-
* Mounted hook:
|
|
313
|
-
*
|
|
314
|
-
*
|
|
336
|
+
* Mounted hook: wire whatever the children collections already hold, bind the
|
|
337
|
+
* delegated sidebar click, resolve and bind the map, and install the standing
|
|
338
|
+
* `MAPBOX_MAP_CONNECTED` subscription so a late or replaced map rebinds
|
|
339
|
+
* instead of stranding the orchestrator.
|
|
315
340
|
*/
|
|
316
341
|
mounted(): void;
|
|
317
342
|
/**
|
|
318
|
-
*
|
|
343
|
+
* Unmounted hook: detach every listener, close the popup and clear the cached
|
|
319
344
|
* references — even when the element has already been detached from the DOM.
|
|
320
345
|
*/
|
|
321
|
-
|
|
346
|
+
unmounted(): void;
|
|
322
347
|
}
|
|
323
348
|
//#endregion
|
|
324
349
|
export { StoreLocator, StoreLocator as default, StoreLocatorProps };
|