@tileflow/interactions 0.1.0-alpha.5 → 0.1.0-alpha.6
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/maplibre-entry.d.ts +5 -0
- package/dist/maplibre-entry.js +14 -0
- package/package.json +1 -1
package/dist/maplibre-entry.d.ts
CHANGED
|
@@ -195,6 +195,11 @@ type TileflowMapLibrePoiPointerEvent = Readonly<{
|
|
|
195
195
|
point: unknown;
|
|
196
196
|
}>;
|
|
197
197
|
type TileflowMapLibrePoiMap = Readonly<{
|
|
198
|
+
/** A style layer's source; lets the controller keep its manifest while the style only restyles. */
|
|
199
|
+
getLayer?: (id: string) => Readonly<{
|
|
200
|
+
source?: unknown;
|
|
201
|
+
sourceLayer?: unknown;
|
|
202
|
+
}> | undefined;
|
|
198
203
|
getStyle: () => unknown;
|
|
199
204
|
off?: (event: string, listener: (event: unknown) => void) => unknown;
|
|
200
205
|
on: (event: string, listener: (event: unknown) => void) => Readonly<{
|
package/dist/maplibre-entry.js
CHANGED
|
@@ -1804,6 +1804,11 @@ function createTileflowMapLibrePoiController(options) {
|
|
|
1804
1804
|
}
|
|
1805
1805
|
options.onActivate?.(match, modality);
|
|
1806
1806
|
};
|
|
1807
|
+
let loaded;
|
|
1808
|
+
const sourcesOf = (layers) => options.map.getLayer ? layers.map(({ layerId }) => {
|
|
1809
|
+
const layer = options.map.getLayer(layerId);
|
|
1810
|
+
return layer ? `${String(layer.source)}/${String(layer.sourceLayer)}` : "";
|
|
1811
|
+
}).join("\n") : void 0;
|
|
1807
1812
|
const refreshManifest = () => {
|
|
1808
1813
|
if (disposed) return;
|
|
1809
1814
|
setHovered(null, "programmatic");
|
|
@@ -1812,6 +1817,12 @@ function createTileflowMapLibrePoiController(options) {
|
|
|
1812
1817
|
options.onManifestChange?.(true);
|
|
1813
1818
|
return;
|
|
1814
1819
|
}
|
|
1820
|
+
if (loaded && sourcesOf(loaded.manifest.layers) === loaded.sources) {
|
|
1821
|
+
manifest = loaded.manifest;
|
|
1822
|
+
options.onManifestChange?.(true);
|
|
1823
|
+
return;
|
|
1824
|
+
}
|
|
1825
|
+
loaded = void 0;
|
|
1815
1826
|
const style = options.map.getStyle();
|
|
1816
1827
|
if (style === void 0) {
|
|
1817
1828
|
manifest = null;
|
|
@@ -1819,6 +1830,8 @@ function createTileflowMapLibrePoiController(options) {
|
|
|
1819
1830
|
return;
|
|
1820
1831
|
}
|
|
1821
1832
|
manifest = parsePoiManifest(style, options.onDiagnostic);
|
|
1833
|
+
const sources = manifest ? sourcesOf(manifest.layers) : void 0;
|
|
1834
|
+
if (manifest && sources !== void 0) loaded = { manifest, sources };
|
|
1822
1835
|
options.onManifestChange?.(manifest !== null);
|
|
1823
1836
|
};
|
|
1824
1837
|
let manifestRefreshScheduled = false;
|
|
@@ -1833,6 +1846,7 @@ function createTileflowMapLibrePoiController(options) {
|
|
|
1833
1846
|
};
|
|
1834
1847
|
const handleStyleLoad = () => {
|
|
1835
1848
|
manifestRefreshScheduled = false;
|
|
1849
|
+
loaded = void 0;
|
|
1836
1850
|
refreshManifest();
|
|
1837
1851
|
};
|
|
1838
1852
|
try {
|