Skip to content

Commit c92ac39

Browse files
authored
fix(google-maps): deprecate heatmap component (#809)
1 parent b0b4969 commit c92ac39

1 file changed

Lines changed: 34 additions & 3 deletions

File tree

‎packages/script/src/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue‎

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,46 @@ import { useGoogleMapsResource } from './useGoogleMapsResource'
55
const props =defineProps<{
66
/**
77
* Configuration options for the heatmap layer visualization.
8+
* @deprecated Google deprecated the Maps JavaScript API `HeatmapLayer` (May 2025) and removed it in v3.65 (May 2026). Consider [deck.gl HeatmapLayer](https://deck.gl/docs/api-reference/aggregation-layers/heatmap-layer) instead.
89
* @seehttps://developers.google.com/maps/documentation/javascript/reference/visualization#HeatmapLayerOptions
910
*/
10-
options?:Omit<google.maps.visualization.HeatmapLayerOptions, 'map'>
11+
options?:Omit<HeatmapLayerOptions, 'map'>
1112
}>()
1213
13-
const heatmapLayer =useGoogleMapsResource<google.maps.visualization.HeatmapLayer>({
14+
if (import.meta.dev) {
15+
console.warn(
16+
'[nuxt-scripts] <ScriptGoogleMapsHeatmapLayer> is deprecated. '
17+
+'Google deprecated the Maps JavaScript API HeatmapLayer (May 2025) and removed it in v3.65 (May 2026). '
18+
+'Consider deck.gl HeatmapLayer instead: https://deck.gl/docs/api-reference/aggregation-layers/heatmap-layer',
19+
)
20+
}
21+
22+
/**
23+
* Configuration options for the heatmap layer visualization.
24+
*
25+
* The `HeatmapLayer` types were removed from `@types/google.maps` in v3.65 as part of Google's
26+
* deprecation (the runtime feature is still available until May 2026), so we type the surface locally.
27+
* @seehttps://developers.google.com/maps/documentation/javascript/reference/visualization#HeatmapLayerOptions
28+
*/
29+
interfaceHeatmapLayerOptions {
30+
data?:unknown
31+
dissipating?:boolean
32+
gradient?:string[]
33+
map?:google.maps.Map
34+
maxIntensity?:number
35+
opacity?:number
36+
radius?:number
37+
}
38+
interfaceHeatmapLayer {
39+
setMap: (map:google.maps.Map|null) =>void
40+
setOptions: (options:HeatmapLayerOptions) =>void
41+
}
42+
43+
const heatmapLayer =useGoogleMapsResource<HeatmapLayer>({
1444
async create({ mapsApi, map }) {
1545
awaitmapsApi.importLibrary('visualization')
16-
returnnewmapsApi.visualization.HeatmapLayer({
46+
const Layer =mapsApi.visualization.HeatmapLayerasunknownasnew (opts:HeatmapLayerOptions) =>HeatmapLayer
47+
returnnewLayer({
1748
map,
1849
...props.options,
1950
})

0 commit comments

Comments
 (0)