Skip to content

Commit be43799

Browse files
authored
fix: adds missing files to dist. (#118)
1 parent cb1bdd0 commit be43799

File tree

10 files changed

+308
-0
lines changed

10 files changed

+308
-0
lines changed

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

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

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

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// [START maps_add_map]
18+
// Initialize and add the map
19+
let map;
20+
async function initMap(): Promise<void> {
21+
// [START maps_add_map_instantiate_map]
22+
// The location of Uluru.
23+
const position = {lat: -25.344, lng: 131.031};
24+
25+
// Request needed libraries.
26+
const {Map} =
27+
await google.maps.importLibrary('maps') as google.maps.MapsLibrary;
28+
const {AdvancedMarkerElement} =
29+
await google.maps.importLibrary('marker') as google.maps.MarkerLibrary;
30+
31+
// The map, centered at Uluru
32+
map = new Map(document.getElementById('map') as HTMLElement, {
33+
zoom: 4,
34+
center: position,
35+
mapId: 'DEMO_MAP_ID',
36+
});
37+
// [END maps_add_map_instantiate_map]
38+
39+
// [START maps_add_map_instantiate_marker]
40+
// The marker, positioned at Uluru
41+
const marker = new AdvancedMarkerElement({map, position, title: 'Uluru'});
42+
// [END maps_add_map_instantiate_marker]
43+
}
44+
initMap();
45+
// [END maps_add_map]

dist/samples/map-simple/dist/assets/index-C7GG8HeP.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// [START maps_map_simple]
18+
let map: google.maps.Map;
19+
async function initMap(): Promise<void> {
20+
const { Map } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
21+
map = new Map(document.getElementById("map") as HTMLElement, {
22+
center: { lat: -34.397, lng: 150.644 },
23+
zoom: 8,
24+
});
25+
}
26+
27+
initMap();
28+
// [END maps_map_simple]

dist/samples/place-autocomplete-element/dist/assets/index-DOD-xGL4.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// [START maps_place_autocomplete_element]
18+
async function initMap(): Promise<void> {
19+
// [START maps_place_autocomplete_element_add]
20+
// Request needed libraries.
21+
//@ts-ignore
22+
await google.maps.importLibrary("places") as google.maps.PlacesLibrary;
23+
// Create the input HTML element, and append it.
24+
//@ts-ignore
25+
const placeAutocomplete = new google.maps.places.PlaceAutocompleteElement();
26+
//@ts-ignore
27+
document.body.appendChild(placeAutocomplete);
28+
// [END maps_place_autocomplete_element_add]
29+
30+
// Inject HTML UI.
31+
const selectedPlaceTitle = document.createElement('p');
32+
selectedPlaceTitle.textContent = '';
33+
document.body.appendChild(selectedPlaceTitle);
34+
35+
const selectedPlaceInfo = document.createElement('pre');
36+
selectedPlaceInfo.textContent = '';
37+
document.body.appendChild(selectedPlaceInfo);
38+
39+
// [START maps_place_autocomplete_element_listener]
40+
// Add the gmp-placeselect listener, and display the results.
41+
//@ts-ignore
42+
placeAutocomplete.addEventListener('gmp-placeselect', async ({ place }) => { // TODO: gmp-placeselect -> gmp-select; place -> placePrediction
43+
await place.fetchFields({ fields: ['displayName', 'formattedAddress', 'location'] });
44+
45+
selectedPlaceTitle.textContent = 'Selected Place:';
46+
selectedPlaceInfo.textContent = JSON.stringify(
47+
place.toJSON(), /* replacer */ null, /* space */ 2);
48+
});
49+
// [END maps_place_autocomplete_element_listener]
50+
}
51+
52+
initMap();
53+
// [END maps_place_autocomplete_element]
54+
export { };

dist/samples/place-autocomplete-map/dist/assets/index-Bbvz6yYP.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// [START maps_place_autocomplete_map]
18+
let map: google.maps.Map;
19+
let marker: google.maps.marker.AdvancedMarkerElement;
20+
let infoWindow: google.maps.InfoWindow;
21+
async function initMap(): Promise<void> {
22+
// Request needed libraries.
23+
//@ts-ignore
24+
const [{ Map }, { AdvancedMarkerElement }] = await Promise.all([
25+
google.maps.importLibrary("marker"),
26+
google.maps.importLibrary("places")
27+
]);
28+
29+
// Initialize the map.
30+
map = new google.maps.Map(document.getElementById('map') as HTMLElement, {
31+
center: { lat: 40.749933, lng: -73.98633 },
32+
zoom: 13,
33+
mapId: '4504f8b37365c3d0',
34+
mapTypeControl: false,
35+
});
36+
// [START maps_place_autocomplete_map_add]
37+
//@ts-ignore
38+
const placeAutocomplete = new google.maps.places.PlaceAutocompleteElement();
39+
//@ts-ignore
40+
placeAutocomplete.id = 'place-autocomplete-input';
41+
42+
const card = document.getElementById('place-autocomplete-card') as HTMLElement;
43+
//@ts-ignore
44+
card.appendChild(placeAutocomplete);
45+
map.controls[google.maps.ControlPosition.TOP_LEFT].push(card);
46+
// [END maps_place_autocomplete_map_add]
47+
48+
// Create the marker and infowindow
49+
marker = new google.maps.marker.AdvancedMarkerElement({
50+
map,
51+
});
52+
53+
infoWindow = new google.maps.InfoWindow({});
54+
55+
// [START maps_place_autocomplete_map_listener]
56+
// Add the gmp-placeselect listener, and display the results on the map.
57+
//@ts-ignore
58+
placeAutocomplete.addEventListener('gmp-placeselect', async ({ place }) => { // TODO: gmp-placeselect -> gmp-select; place -> placePrediction
59+
await place.fetchFields({ fields: ['displayName', 'formattedAddress', 'location'] });
60+
61+
// If the place has a geometry, then present it on a map.
62+
if (place.viewport) {
63+
map.fitBounds(place.viewport);
64+
} else {
65+
map.setCenter(place.location);
66+
map.setZoom(17);
67+
}
68+
69+
let content = '<div id="infowindow-content">' +
70+
'<span id="place-displayname" class="title">' + place.displayName + '</span><br />' +
71+
'<span id="place-address">' + place.formattedAddress + '</span>' +
72+
'</div>';
73+
74+
updateInfoWindow(content, place.location);
75+
marker.position = place.location;
76+
});
77+
// [END maps_place_autocomplete_map_listener]
78+
}
79+
80+
// Helper function to create an info window.
81+
function updateInfoWindow(content, center) {
82+
infoWindow.setContent(content);
83+
infoWindow.setPosition(center);
84+
infoWindow.open({
85+
map,
86+
anchor: marker,
87+
shouldFocus: false,
88+
});
89+
}
90+
91+
initMap();
92+
// [END maps_place_autocomplete_map]
93+
export { };

dist/samples/place-text-search/dist/assets/index-BUY_NbT6.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// [START maps_place_text_search]
18+
let map;
19+
let center;
20+
21+
async function initMap() {
22+
const { Map } = await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
23+
24+
center = { lat: 37.4161493, lng: -122.0812166 };
25+
map = new Map(document.getElementById('map') as HTMLElement, {
26+
center: center,
27+
zoom: 11,
28+
mapId: 'DEMO_MAP_ID',
29+
});
30+
31+
findPlaces();
32+
}
33+
34+
async function findPlaces() {
35+
const { Place } = await google.maps.importLibrary("places") as google.maps.PlacesLibrary;
36+
const { AdvancedMarkerElement } = await google.maps.importLibrary("marker") as google.maps.MarkerLibrary;
37+
// [START maps_place_text_search_request]
38+
const request = {
39+
textQuery: 'Tacos in Mountain View',
40+
fields: ['displayName', 'location', 'businessStatus'],
41+
includedType: 'restaurant',
42+
locationBias: { lat: 37.4161493, lng: -122.0812166 },
43+
isOpenNow: true,
44+
language: 'en-US',
45+
maxResultCount: 8,
46+
minRating: 3.2,
47+
region: 'us',
48+
useStrictTypeFiltering: false,
49+
};
50+
51+
//@ts-ignore
52+
const { places } = await Place.searchByText(request);
53+
// [END maps_place_text_search_request]
54+
55+
if (places.length) {
56+
console.log(places);
57+
58+
const { LatLngBounds } = await google.maps.importLibrary("core") as google.maps.CoreLibrary;
59+
const bounds = new LatLngBounds();
60+
61+
// Loop through and get all the results.
62+
places.forEach((place) => {
63+
const markerView = new AdvancedMarkerElement({
64+
map,
65+
position: place.location,
66+
title: place.displayName,
67+
});
68+
69+
bounds.extend(place.location as google.maps.LatLng);
70+
console.log(place);
71+
});
72+
73+
map.fitBounds(bounds);
74+
75+
} else {
76+
console.log('No results');
77+
}
78+
}
79+
80+
initMap();
81+
// [END maps_place_text_search]
82+
83+
export { };

0 commit comments

Comments
 (0)