Skip to content

Commit 3ae6ede

Browse files
Update dist folder [skip ci] (#608)
1 parent 1bd2459 commit 3ae6ede

File tree

20 files changed

+461
-0
lines changed

20 files changed

+461
-0
lines changed

dist/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ <h1>Maps JSAPI Samples</h1>
4646
<li><a href='/samples/place-autocomplete-data-session/dist'>place-autocomplete-data-session</a></li>
4747
<li><a href='/samples/place-autocomplete-element/dist'>place-autocomplete-element</a></li>
4848
<li><a href='/samples/place-autocomplete-map/dist'>place-autocomplete-map</a></li>
49+
<li><a href='/samples/place-class/dist'>place-class</a></li>
4950
<li><a href='/samples/place-text-search/dist'>place-text-search</a></li>
5051
<li><a href='/samples/test-example/dist'>test-example</a></li>
5152
<li><a href='/samples/ui-kit-customization/dist'>ui-kit-customization</a></li>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": [
3+
"plugin:@typescript-eslint/recommended"
4+
],
5+
"parser": "@typescript-eslint/parser",
6+
"rules": {
7+
"@typescript-eslint/ban-ts-comment": 0,
8+
"@typescript-eslint/no-this-alias": 1,
9+
"@typescript-eslint/no-empty-function": 1,
10+
"@typescript-eslint/explicit-module-boundary-types": 1,
11+
"@typescript-eslint/no-unused-vars": 1
12+
}
13+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Google Maps JavaScript Sample
2+
3+
This sample is generated from @googlemaps/js-samples located at
4+
https://github.com/googlemaps-samples/js-api-samples.
5+
6+
## Setup
7+
8+
### Before starting run:
9+
10+
`npm i`
11+
12+
### Run an example on a local web server
13+
14+
First `cd` to the folder for the sample to run, then:
15+
16+
`npm start`
17+
18+
### Build an individual example
19+
20+
From `samples/`:
21+
22+
`npm run build --workspace=sample-name/`
23+
24+
### Build all of the examples.
25+
26+
From `samples/`:
27+
28+
`npm run build-all`
29+
30+
## Feedback
31+
32+
For feedback related to this sample, please open a new issue on
33+
[GitHub](https://github.com/googlemaps-samples/js-api-samples/issues).
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!doctype html>
2+
<!--
3+
@license
4+
Copyright 2019 Google LLC. All Rights Reserved.
5+
SPDX-License-Identifier: Apache-2.0
6+
-->
7+
<!-- [START maps_place_class] -->
8+
<html>
9+
<head>
10+
<title>Place Class</title>
11+
12+
<link rel="stylesheet" type="text/css" href="./style.css" />
13+
<script type="module" src="./index.js"></script>
14+
</head>
15+
<body>
16+
<div id="map"></div>
17+
18+
<!-- prettier-ignore -->
19+
<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))})
20+
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
21+
</body>
22+
</html>
23+
<!-- [END maps_place_class] -->
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* @license
3+
* Copyright 2022 Google LLC. All Rights Reserved.
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
// [START maps_place_class]
8+
let map: google.maps.Map;
9+
let centerCoordinates = { lat: 37.4161493, lng: -122.0812166 };
10+
11+
async function initMap() {
12+
const { Map } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
13+
14+
map = new Map(document.getElementById('map') as HTMLElement, {
15+
center: centerCoordinates,
16+
zoom: 14,
17+
// [START_EXCLUDE]
18+
mapId: '4504f8b37365c3d0',
19+
// [END_EXCLUDE]
20+
});
21+
22+
getPlaceDetails();
23+
}
24+
25+
// [START maps_place_class_fetchfields]
26+
async function getPlaceDetails() {
27+
const { Place } = await google.maps.importLibrary("places") as google.maps.PlacesLibrary;
28+
const { AdvancedMarkerElement } = await google.maps.importLibrary("marker") as google.maps.MarkerLibrary;
29+
// Use place ID to create a new Place instance.
30+
const place = new Place({
31+
id: 'ChIJN5Nz71W3j4ARhx5bwpTQEGg',
32+
requestedLanguage: 'en', // optional
33+
});
34+
35+
// Call fetchFields, passing the desired data fields.
36+
await place.fetchFields({ fields: ['displayName', 'formattedAddress', 'location'] });
37+
38+
// Log the result
39+
console.log(place.displayName);
40+
console.log(place.formattedAddress);
41+
42+
// Add an Advanced Marker
43+
const marker = new AdvancedMarkerElement({
44+
map,
45+
position: place.location,
46+
title: place.displayName,
47+
});
48+
}
49+
// [END maps_place_class_fetchfields]
50+
51+
initMap();
52+
// [END maps_place_class]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@js-api-samples/place-class",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"build": "tsc && bash ../jsfiddle.sh place-class && bash ../app.sh place-class && bash ../docs.sh place-class && npm run build:vite --workspace=. && bash ../dist.sh place-class",
6+
"test": "tsc && npm run build:vite --workspace=.",
7+
"start": "tsc && vite build --base './' && vite",
8+
"build:vite": "vite build --base './'",
9+
"preview": "vite preview"
10+
},
11+
"dependencies": {
12+
13+
}
14+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* @license
3+
* Copyright 2019 Google LLC. All Rights Reserved.
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/* [START maps_place_class] */
7+
/*
8+
* Always set the map height explicitly to define the size of the div element
9+
* that contains the map.
10+
*/
11+
#map {
12+
height: 100%;
13+
}
14+
15+
/*
16+
* Optional: Makes the sample page fill the window.
17+
*/
18+
html,
19+
body {
20+
height: 100%;
21+
margin: 0;
22+
padding: 0;
23+
}
24+
25+
/* [END maps_place_class] */
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"compilerOptions": {
3+
"module": "esnext",
4+
"target": "esnext",
5+
"strict": true,
6+
"noImplicitAny": false,
7+
"lib": [
8+
"es2015",
9+
"esnext",
10+
"es6",
11+
"dom",
12+
"dom.iterable"
13+
],
14+
"moduleResolution": "Node",
15+
"jsx": "preserve"
16+
}
17+
}

dist/samples/place-class/dist/assets/index-CLgMNE7p.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.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* @license
3+
* Copyright 2019 Google LLC. All Rights Reserved.
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/#map{height:100%}html,body{height:100%;margin:0;padding:0}

0 commit comments

Comments
 (0)