@remotion/maptiler 4.0.536 → 4.0.537
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/esm/index.mjs +47 -19
- package/package.json +3 -3
package/dist/esm/index.mjs
CHANGED
|
@@ -57,7 +57,7 @@ var useMapPremounting = (getLayerIds) => {
|
|
|
57
57
|
hiddenRef.current = hidden;
|
|
58
58
|
layerIdsRef.current = getLayerIds;
|
|
59
59
|
const applyPremountVisibility = useCallback(() => {
|
|
60
|
-
if (!map) {
|
|
60
|
+
if (!map || !map.style) {
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
for (const id of layerIdsRef.current()) {
|
|
@@ -306,7 +306,7 @@ var MapLayerContent = ({ beforeId, layer: passedLayer }) => {
|
|
|
306
306
|
const previousLayerRef = useRef3(null);
|
|
307
307
|
const { continueRender, delayRender } = useDelayRender2();
|
|
308
308
|
useEffect3(() => {
|
|
309
|
-
if (!map) {
|
|
309
|
+
if (!map || !map.style) {
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
312
|
const loadingHandle = delayRender(`Drawing MapTiler layer ${layer.id}`);
|
|
@@ -369,6 +369,9 @@ var MapLayerContent = ({ beforeId, layer: passedLayer }) => {
|
|
|
369
369
|
return;
|
|
370
370
|
}
|
|
371
371
|
return () => {
|
|
372
|
+
if (!map.style) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
372
375
|
if (map.getLayer(layer.id)) {
|
|
373
376
|
map.removeLayer(layer.id);
|
|
374
377
|
map.triggerRepaint();
|
|
@@ -1672,7 +1675,8 @@ var MapRegionDrawing = ({
|
|
|
1672
1675
|
}) => {
|
|
1673
1676
|
const { map } = useContext9(MapTilerContext);
|
|
1674
1677
|
const { continueRender, delayRender } = useDelayRender6();
|
|
1675
|
-
const [
|
|
1678
|
+
const [readyMap, setReadyMap] = useState2(null);
|
|
1679
|
+
const isReady = map !== null && readyMap === map;
|
|
1676
1680
|
useLayoutEffect(() => {
|
|
1677
1681
|
if (isReady) {
|
|
1678
1682
|
return;
|
|
@@ -1691,7 +1695,7 @@ var MapRegionDrawing = ({
|
|
|
1691
1695
|
outlineGlowLayerId
|
|
1692
1696
|
]);
|
|
1693
1697
|
useLayoutEffect(() => {
|
|
1694
|
-
if (!map) {
|
|
1698
|
+
if (!map || !map.style) {
|
|
1695
1699
|
return;
|
|
1696
1700
|
}
|
|
1697
1701
|
if (!map.getSource(fillSourceId)) {
|
|
@@ -1754,7 +1758,7 @@ var MapRegionDrawing = ({
|
|
|
1754
1758
|
map.setPaintProperty(outlineSourceId, "line-color", strokeColor);
|
|
1755
1759
|
map.setPaintProperty(outlineSourceId, "line-width", strokeWidth);
|
|
1756
1760
|
applyPremountVisibility();
|
|
1757
|
-
const onIdle = () =>
|
|
1761
|
+
const onIdle = () => setReadyMap(map);
|
|
1758
1762
|
map.once("idle", onIdle);
|
|
1759
1763
|
map.triggerRepaint();
|
|
1760
1764
|
return () => {
|
|
@@ -1775,7 +1779,7 @@ var MapRegionDrawing = ({
|
|
|
1775
1779
|
strokeWidth
|
|
1776
1780
|
]);
|
|
1777
1781
|
useLayoutEffect(() => {
|
|
1778
|
-
if (!isReady || !map) {
|
|
1782
|
+
if (!isReady || !map || !map.style) {
|
|
1779
1783
|
return;
|
|
1780
1784
|
}
|
|
1781
1785
|
const frameHandle = delayRender(`Drawing ${feature.properties.name}`);
|
|
@@ -1806,6 +1810,9 @@ var MapRegionDrawing = ({
|
|
|
1806
1810
|
return;
|
|
1807
1811
|
}
|
|
1808
1812
|
return () => {
|
|
1813
|
+
if (!map.style) {
|
|
1814
|
+
return;
|
|
1815
|
+
}
|
|
1809
1816
|
if (map.getLayer(outlineSourceId)) {
|
|
1810
1817
|
map.removeLayer(outlineSourceId);
|
|
1811
1818
|
}
|
|
@@ -2006,7 +2013,8 @@ var MapRouteDrawing = ({
|
|
|
2006
2013
|
}) => {
|
|
2007
2014
|
const { map } = useContext10(MapTilerContext);
|
|
2008
2015
|
const { continueRender, delayRender } = useDelayRender7();
|
|
2009
|
-
const [
|
|
2016
|
+
const [readyMap, setReadyMap] = useState3(null);
|
|
2017
|
+
const isReady = map !== null && readyMap === map;
|
|
2010
2018
|
useLayoutEffect2(() => {
|
|
2011
2019
|
if (isReady) {
|
|
2012
2020
|
return;
|
|
@@ -2023,7 +2031,7 @@ var MapRouteDrawing = ({
|
|
|
2023
2031
|
glowLayerId
|
|
2024
2032
|
]);
|
|
2025
2033
|
useLayoutEffect2(() => {
|
|
2026
|
-
if (!map) {
|
|
2034
|
+
if (!map || !map.style) {
|
|
2027
2035
|
return;
|
|
2028
2036
|
}
|
|
2029
2037
|
if (!map.getSource(sourceId)) {
|
|
@@ -2066,7 +2074,7 @@ var MapRouteDrawing = ({
|
|
|
2066
2074
|
map.setPaintProperty(sourceId, "line-color", strokeColor);
|
|
2067
2075
|
map.setPaintProperty(sourceId, "line-width", strokeWidth);
|
|
2068
2076
|
applyPremountVisibility();
|
|
2069
|
-
const onIdle = () =>
|
|
2077
|
+
const onIdle = () => setReadyMap(map);
|
|
2070
2078
|
map.once("idle", onIdle);
|
|
2071
2079
|
map.triggerRepaint();
|
|
2072
2080
|
return () => {
|
|
@@ -2084,7 +2092,7 @@ var MapRouteDrawing = ({
|
|
|
2084
2092
|
strokeWidth
|
|
2085
2093
|
]);
|
|
2086
2094
|
useLayoutEffect2(() => {
|
|
2087
|
-
if (!isReady || !map) {
|
|
2095
|
+
if (!isReady || !map || !map.style) {
|
|
2088
2096
|
return;
|
|
2089
2097
|
}
|
|
2090
2098
|
const frameHandle = delayRender(`Drawing ${feature.properties.name} route`);
|
|
@@ -2112,6 +2120,9 @@ var MapRouteDrawing = ({
|
|
|
2112
2120
|
return;
|
|
2113
2121
|
}
|
|
2114
2122
|
return () => {
|
|
2123
|
+
if (!map.style) {
|
|
2124
|
+
return;
|
|
2125
|
+
}
|
|
2115
2126
|
if (map.getLayer(sourceId)) {
|
|
2116
2127
|
map.removeLayer(sourceId);
|
|
2117
2128
|
}
|
|
@@ -2248,7 +2259,7 @@ var MapSourceContent = ({ children, id, source }) => {
|
|
|
2248
2259
|
const { continueRender, delayRender } = useDelayRender8();
|
|
2249
2260
|
sourceRef.current = source;
|
|
2250
2261
|
useEffect9(() => {
|
|
2251
|
-
if (!map) {
|
|
2262
|
+
if (!map || !map.style) {
|
|
2252
2263
|
return;
|
|
2253
2264
|
}
|
|
2254
2265
|
const loadingHandle = delayRender(`Loading MapTiler source ${id}`);
|
|
@@ -2268,6 +2279,9 @@ var MapSourceContent = ({ children, id, source }) => {
|
|
|
2268
2279
|
return () => {
|
|
2269
2280
|
map.off("idle", finish);
|
|
2270
2281
|
finish();
|
|
2282
|
+
if (!map.style) {
|
|
2283
|
+
return;
|
|
2284
|
+
}
|
|
2271
2285
|
for (const layer of map.getStyle().layers ?? []) {
|
|
2272
2286
|
if ("source" in layer && layer.source === id && map.getLayer(layer.id)) {
|
|
2273
2287
|
map.removeLayer(layer.id);
|
|
@@ -2280,7 +2294,7 @@ var MapSourceContent = ({ children, id, source }) => {
|
|
|
2280
2294
|
};
|
|
2281
2295
|
}, [continueRender, delayRender, id, map, styleRevision]);
|
|
2282
2296
|
useEffect9(() => {
|
|
2283
|
-
if (!map || source.type !== "geojson") {
|
|
2297
|
+
if (!map || !map.style || source.type !== "geojson") {
|
|
2284
2298
|
return;
|
|
2285
2299
|
}
|
|
2286
2300
|
const existingSource = map.getSource(id);
|
|
@@ -2357,7 +2371,11 @@ var MapSource = ({
|
|
|
2357
2371
|
});
|
|
2358
2372
|
};
|
|
2359
2373
|
// src/MapViewport.tsx
|
|
2360
|
-
import {
|
|
2374
|
+
import {
|
|
2375
|
+
config as maptilerConfig,
|
|
2376
|
+
MapStyle,
|
|
2377
|
+
Map as MapTilerMap
|
|
2378
|
+
} from "@maptiler/sdk";
|
|
2361
2379
|
import"@maptiler/sdk/style.css";
|
|
2362
2380
|
import { useLayoutEffect as useLayoutEffect3, useMemo as useMemo5, useRef as useRef8, useState as useState4 } from "react";
|
|
2363
2381
|
import {
|
|
@@ -2559,7 +2577,7 @@ var MapViewportContent = ({
|
|
|
2559
2577
|
onMapReadyRef.current = onMapReady;
|
|
2560
2578
|
const { continueRender, delayRender } = useDelayRender9();
|
|
2561
2579
|
const [loadedMap, setLoadedMap] = useState4(null);
|
|
2562
|
-
const map = loadedMap?.map
|
|
2580
|
+
const map = loadedMap?.map.style ? loadedMap.map : null;
|
|
2563
2581
|
const [cameraRevision, setCameraRevision] = useState4(0);
|
|
2564
2582
|
const [styleRevision, setStyleRevision] = useState4(0);
|
|
2565
2583
|
const contextValue = useMemo5(() => ({ cameraRevision, map, styleRevision }), [cameraRevision, map, styleRevision]);
|
|
@@ -2574,6 +2592,12 @@ var MapViewportContent = ({
|
|
|
2574
2592
|
let cancelled = false;
|
|
2575
2593
|
const initialCamera = initialCameraRef.current;
|
|
2576
2594
|
const initialOptions = initialMapOptionsRef.current;
|
|
2595
|
+
lastMapStyleRef.current = initialOptions.mapStyle;
|
|
2596
|
+
lastLayerVisibilityRef.current = {
|
|
2597
|
+
administrativeBorders: initialOptions.administrativeBorders,
|
|
2598
|
+
showLabels: initialOptions.showLabels
|
|
2599
|
+
};
|
|
2600
|
+
maptilerConfig.telemetry = false;
|
|
2577
2601
|
const mapInstance = new MapTilerMap({
|
|
2578
2602
|
fullscreenControl: false,
|
|
2579
2603
|
geolocateControl: false,
|
|
@@ -2607,6 +2631,9 @@ var MapViewportContent = ({
|
|
|
2607
2631
|
});
|
|
2608
2632
|
mapRef.current = mapInstance;
|
|
2609
2633
|
mapInstance.on("load", () => {
|
|
2634
|
+
if (cancelled) {
|
|
2635
|
+
return;
|
|
2636
|
+
}
|
|
2610
2637
|
stripStyleLayers({
|
|
2611
2638
|
administrativeBorders: initialOptions.administrativeBorders,
|
|
2612
2639
|
map: mapInstance,
|
|
@@ -2623,6 +2650,7 @@ var MapViewportContent = ({
|
|
|
2623
2650
|
});
|
|
2624
2651
|
return () => {
|
|
2625
2652
|
cancelled = true;
|
|
2653
|
+
setLoadedMap(null);
|
|
2626
2654
|
mapInstance.remove();
|
|
2627
2655
|
mapRef.current = null;
|
|
2628
2656
|
continueRender(loadingHandle);
|
|
@@ -2634,7 +2662,7 @@ var MapViewportContent = ({
|
|
|
2634
2662
|
}
|
|
2635
2663
|
}, [continueRender, loadedMap]);
|
|
2636
2664
|
useLayoutEffect3(() => {
|
|
2637
|
-
if (!map) {
|
|
2665
|
+
if (!map || !map.style) {
|
|
2638
2666
|
return;
|
|
2639
2667
|
}
|
|
2640
2668
|
const currentCenter = map.getCenter();
|
|
@@ -2687,7 +2715,7 @@ var MapViewportContent = ({
|
|
|
2687
2715
|
zoom
|
|
2688
2716
|
]);
|
|
2689
2717
|
useLayoutEffect3(() => {
|
|
2690
|
-
if (!map || lastMapStyleRef.current === mapStyle && lastLayerVisibilityRef.current.showLabels === showLabels && lastLayerVisibilityRef.current.administrativeBorders === administrativeBorders) {
|
|
2718
|
+
if (!map || !map.style || lastMapStyleRef.current === mapStyle && lastLayerVisibilityRef.current.showLabels === showLabels && lastLayerVisibilityRef.current.administrativeBorders === administrativeBorders) {
|
|
2691
2719
|
return;
|
|
2692
2720
|
}
|
|
2693
2721
|
const styleHandle = delayRender("Updating MapTiler style");
|
|
@@ -2727,13 +2755,13 @@ var MapViewportContent = ({
|
|
|
2727
2755
|
showLabels
|
|
2728
2756
|
]);
|
|
2729
2757
|
useLayoutEffect3(() => {
|
|
2730
|
-
if (map && language) {
|
|
2758
|
+
if (map?.style && language) {
|
|
2731
2759
|
map.setLanguage(language);
|
|
2732
2760
|
map.triggerRepaint();
|
|
2733
2761
|
}
|
|
2734
2762
|
}, [language, map]);
|
|
2735
2763
|
useLayoutEffect3(() => {
|
|
2736
|
-
if (!map) {
|
|
2764
|
+
if (!map || !map.style) {
|
|
2737
2765
|
return;
|
|
2738
2766
|
}
|
|
2739
2767
|
if (terrain) {
|
|
@@ -2744,7 +2772,7 @@ var MapViewportContent = ({
|
|
|
2744
2772
|
map.triggerRepaint();
|
|
2745
2773
|
}, [map, terrain, terrainExaggeration]);
|
|
2746
2774
|
useLayoutEffect3(() => {
|
|
2747
|
-
if (map && projection) {
|
|
2775
|
+
if (map?.style && projection) {
|
|
2748
2776
|
map.setProjection(projection, { persist: true });
|
|
2749
2777
|
map.triggerRepaint();
|
|
2750
2778
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/maptiler",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.537",
|
|
4
4
|
"description": "MapTiler components for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@maptiler/sdk": "4.0.2",
|
|
27
27
|
"@turf/turf": "7.3.2",
|
|
28
|
-
"remotion": "4.0.
|
|
28
|
+
"remotion": "4.0.537"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": ">=16.8.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"react": "19.2.3",
|
|
44
44
|
"react-dom": "19.2.3",
|
|
45
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
45
|
+
"@remotion/eslint-config-internal": "4.0.537",
|
|
46
46
|
"eslint": "9.19.0",
|
|
47
47
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
48
48
|
},
|