Skip to content

Commit df3a134

Browse files
Update dist folder [skip ci] (#865)
1 parent ff46439 commit df3a134

File tree

15 files changed

+222
-155
lines changed

15 files changed

+222
-155
lines changed
Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<!--
33
@license
44
Copyright 2025 Google LLC. All Rights Reserved.
55
SPDX-License-Identifier: Apache-2.0
66
-->
7-
<!--[START maps_add_map]-->
7+
<!--[START maps_add_map]-->
88
<html>
99
<head>
1010
<title>Add a Map</title>
1111

1212
<link rel="stylesheet" type="text/css" href="./style.css" />
1313
<script type="module" src="./index.js"></script>
14+
<!-- prettier-ignore -->
15+
<script>(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})
16+
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
1417
</head>
1518
<body>
16-
<!--[START maps_add_map_heading]-->
17-
<h3>My Google Maps Demo</h3>
18-
<!--[END maps_add_map_heading]-->
1919
<!--[START maps_add_map_body]-->
20-
<div id="map"></div>
20+
<!-- The map, centered at Uluru, Australia. -->
21+
<gmp-map center="-25.344,131.031" zoom="4" map-id="DEMO_MAP_ID">
22+
<!--[START maps_add_map_controls]-->
23+
<div id="controls" slot="control-inline-start-block-start">
24+
<h3>My Google Maps Demo</h3>
25+
</div>
26+
<!--[END maps_add_map_controls]-->
27+
</gmp-map>
2128
<!--[END maps_add_map_body]-->
22-
<!-- prettier-ignore -->
23-
<script>(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})
24-
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
2529
</body>
2630
</html>
27-
<!--[END maps_add_map]-->
31+
<!--[END maps_add_map]-->

dist/samples/add-map/app/index.ts

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,39 @@
55
*/
66

77
// [START maps_add_map]
8-
// Initialize and add the map.
9-
let map;
108
async function initMap(): Promise<void> {
119
// [START maps_add_map_instantiate_map]
12-
// The location of Uluru, Australia.
13-
const position = {lat: -25.344, lng: 131.031};
14-
10+
// [START maps_add_map_libraries]
1511
// Request the needed libraries.
16-
const {Map} =
17-
await google.maps.importLibrary('maps') as google.maps.MapsLibrary;
18-
const {AdvancedMarkerElement} =
19-
await google.maps.importLibrary('marker') as google.maps.MarkerLibrary;
12+
const [{ Map }, { AdvancedMarkerElement }] = await Promise.all([
13+
google.maps.importLibrary("maps") as Promise<google.maps.MapsLibrary>,
14+
google.maps.importLibrary("marker") as Promise<google.maps.MarkerLibrary>,
15+
]);
16+
// [END maps_add_map_libraries]
17+
// [START maps_add_map_innermap]
18+
// Get the gmp-map element.
19+
const mapElement = document.querySelector(
20+
"gmp-map"
21+
) as google.maps.MapElement;
22+
23+
// Get the inner map.
24+
const innerMap = mapElement.innerMap;
2025

21-
// The map, centered at Uluru, Australia.
22-
map = new Map(document.getElementById('map') as HTMLElement, {
23-
zoom: 4,
24-
center: position,
25-
mapId: 'DEMO_MAP_ID',
26+
// Set map options.
27+
innerMap.setOptions({
28+
mapTypeControl: false,
2629
});
30+
// [END maps_add_map_innermap]
2731
// [END maps_add_map_instantiate_map]
2832

2933
// [START maps_add_map_instantiate_marker]
30-
// The marker, positioned at Uluru.
31-
const marker = new AdvancedMarkerElement({map, position, title: 'Uluru'});
32-
// [END maps_add_map_instantiate_marker]
34+
// Add a marker positioned at the map center (Uluru).
35+
const marker = new AdvancedMarkerElement({
36+
map: innerMap,
37+
position: mapElement.center,
38+
title: "Uluru/Ayers Rock",
39+
});
40+
// [END maps_add_map_instantiate_marker]
3341
}
3442
initMap();
3543
// [END maps_add_map]

dist/samples/add-map/app/style.css

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,28 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66
/* [START maps_add_map] */
7-
/*
7+
/*
88
* Always set the map height explicitly to define the size of the div element
99
* that contains the map.
1010
*/
11-
#map {
12-
height: 100%;
13-
}
14-
15-
/*
11+
gmp-map {
12+
height: 100%;
13+
}
14+
15+
/*
1616
* Optional: Makes the sample page fill the window.
1717
*/
18-
html,
19-
body {
20-
height: 100%;
21-
margin: 0;
22-
padding: 0;
23-
}
24-
/* [END maps_add_map] */
25-
18+
html,
19+
body {
20+
height: 100%;
21+
margin: 0;
22+
padding: 0;
23+
}
24+
/* [END maps_add_map] */
25+
26+
#controls h3 {
27+
font-size: 1.5em;
28+
background-color: white;
29+
margin: 8px;
30+
padding: 2px;
31+
}

dist/samples/add-map/dist/assets/index-35dha72j.js

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/*
2+
* @license
3+
* Copyright 2025 Google LLC. All Rights Reserved.
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/gmp-map{height:100%}html,body{height:100%;margin:0;padding:0}#controls h3{font-size:1.5em;background-color:#fff;margin:8px;padding:2px}

dist/samples/add-map/dist/assets/index-RaMcGHQe.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/samples/add-map/dist/assets/index-kz-ac4rW.css

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<!--
33
@license
44
Copyright 2025 Google LLC. All Rights Reserved.
55
SPDX-License-Identifier: Apache-2.0
66
-->
7-
<!--[START maps_add_map]-->
7+
<!--[START maps_add_map]-->
88
<html>
99
<head>
1010
<title>Add a Map</title>
1111

12-
<script type="module" crossorigin src="./assets/index-35dha72j.js"></script>
13-
<link rel="stylesheet" crossorigin href="./assets/index-kz-ac4rW.css">
12+
<!-- prettier-ignore -->
13+
<script>(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})
14+
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
15+
<script type="module" crossorigin src="./assets/index-RaMcGHQe.js"></script>
16+
<link rel="stylesheet" crossorigin href="./assets/index-BJeCMP20.css">
1417
</head>
1518
<body>
16-
<!--[START maps_add_map_heading]-->
17-
<h3>My Google Maps Demo</h3>
18-
<!--[END maps_add_map_heading]-->
1919
<!--[START maps_add_map_body]-->
20-
<div id="map"></div>
20+
<!-- The map, centered at Uluru, Australia. -->
21+
<gmp-map center="-25.344,131.031" zoom="4" map-id="DEMO_MAP_ID">
22+
<!--[START maps_add_map_controls]-->
23+
<div id="controls" slot="control-inline-start-block-start">
24+
<h3>My Google Maps Demo</h3>
25+
</div>
26+
<!--[END maps_add_map_controls]-->
27+
</gmp-map>
2128
<!--[END maps_add_map_body]-->
22-
<!-- prettier-ignore -->
23-
<script>(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})
24-
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
2529
</body>
2630
</html>
27-
<!--[END maps_add_map]-->
31+
<!--[END maps_add_map]-->
Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<!--
33
@license
44
Copyright 2025 Google LLC. All Rights Reserved.
55
SPDX-License-Identifier: Apache-2.0
66
-->
7-
<!--[START maps_add_map]-->
7+
<!--[START maps_add_map]-->
88
<html>
99
<head>
1010
<title>Add a Map</title>
1111

1212
<link rel="stylesheet" type="text/css" href="./style.css" />
1313
<script type="module" src="./index.js"></script>
14+
<!-- prettier-ignore -->
15+
<script>(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})
16+
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
1417
</head>
1518
<body>
16-
<!--[START maps_add_map_heading]-->
17-
<h3>My Google Maps Demo</h3>
18-
<!--[END maps_add_map_heading]-->
1919
<!--[START maps_add_map_body]-->
20-
<div id="map"></div>
20+
<!-- The map, centered at Uluru, Australia. -->
21+
<gmp-map center="-25.344,131.031" zoom="4" map-id="DEMO_MAP_ID">
22+
<!--[START maps_add_map_controls]-->
23+
<div id="controls" slot="control-inline-start-block-start">
24+
<h3>My Google Maps Demo</h3>
25+
</div>
26+
<!--[END maps_add_map_controls]-->
27+
</gmp-map>
2128
<!--[END maps_add_map_body]-->
22-
<!-- prettier-ignore -->
23-
<script>(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})
24-
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
2529
</body>
2630
</html>
27-
<!--[END maps_add_map]-->
31+
<!--[END maps_add_map]-->

dist/samples/add-map/docs/index.js

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,34 @@
55
* SPDX-License-Identifier: Apache-2.0
66
*/
77
// [START maps_add_map]
8-
// Initialize and add the map.
9-
let map;
108
async function initMap() {
119
// [START maps_add_map_instantiate_map]
12-
// The location of Uluru, Australia.
13-
const position = { lat: -25.344, lng: 131.031 };
10+
// [START maps_add_map_libraries]
1411
// Request the needed libraries.
15-
const { Map } = await google.maps.importLibrary('maps');
16-
const { AdvancedMarkerElement } = await google.maps.importLibrary('marker');
17-
// The map, centered at Uluru, Australia.
18-
map = new Map(document.getElementById('map'), {
19-
zoom: 4,
20-
center: position,
21-
mapId: 'DEMO_MAP_ID',
12+
const [{ Map }, { AdvancedMarkerElement }] = await Promise.all([
13+
google.maps.importLibrary("maps"),
14+
google.maps.importLibrary("marker"),
15+
]);
16+
// [END maps_add_map_libraries]
17+
// [START maps_add_map_innermap]
18+
// Get the gmp-map element.
19+
const mapElement = document.querySelector("gmp-map");
20+
// Get the inner map.
21+
const innerMap = mapElement.innerMap;
22+
// Set map options.
23+
innerMap.setOptions({
24+
mapTypeControl: false,
2225
});
26+
// [END maps_add_map_innermap]
2327
// [END maps_add_map_instantiate_map]
2428
// [START maps_add_map_instantiate_marker]
25-
// The marker, positioned at Uluru.
26-
const marker = new AdvancedMarkerElement({ map, position, title: 'Uluru' });
27-
// [END maps_add_map_instantiate_marker]
29+
// Add a marker positioned at the map center (Uluru).
30+
const marker = new AdvancedMarkerElement({
31+
map: innerMap,
32+
position: mapElement.center,
33+
title: "Uluru/Ayers Rock",
34+
});
35+
// [END maps_add_map_instantiate_marker]
2836
}
2937
initMap();
3038
// [END maps_add_map]

0 commit comments

Comments
 (0)