Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ <h1>Maps JSAPI Samples</h1>
<li><a href='/samples/ui-kit-place-search-text/dist'>ui-kit-place-search-text</a></li>
<li><a href='/samples/ui-kit-place-search-text-compact/dist'>ui-kit-place-search-text-compact</a></li>
<li><a href='/samples/weather-api-current-compact/dist'>weather-api-current-compact</a></li>
<li><a href='/samples/web-components-map/dist'>web-components-map</a></li>
</ul>
</body>
</html>
13 changes: 13 additions & 0 deletions dist/samples/web-components-map/app/.eslintsrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": [
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"rules": {
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/no-this-alias": 1,
"@typescript-eslint/no-empty-function": 1,
"@typescript-eslint/explicit-module-boundary-types": 1,
"@typescript-eslint/no-unused-vars": 1
}
}
40 changes: 40 additions & 0 deletions dist/samples/web-components-map/app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Google Maps JavaScript Sample

This sample is generated from @googlemaps/js-samples located at
https://github.com/googlemaps-samples/js-api-samples.

## Setup

### Before starting run:

`npm i`

### Run an example on a local web server

`cd samples/web-components-map`
`npm start`

### Build an individual example

`cd samples/web-components-map`
`npm run build`

From 'samples':

`npm run build --workspace=web-components-map/`

### Build all of the examples.

From 'samples':

`npm run build-all`

### Run lint to check for problems

`cd samples/web-components-map`
`npx eslint index.ts`

## Feedback

For feedback related to this sample, please open a new issue on
[GitHub](https://github.com/googlemaps-samples/js-api-samples/issues).
29 changes: 29 additions & 0 deletions dist/samples/web-components-map/app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<!--
@license
Copyright 2019 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!-- [START maps_web_components_map] -->
<html>
<head>
<title>Add a Map using HTML</title>

<link rel="stylesheet" type="text/css" href="./style.css" />
<script type="module" src="./index.js"></script>
<!-- prettier-ignore -->
<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)) })
({ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly" });</script>
</head>
<body>
<!-- [START maps_web_components_map_gmpmap] -->
<gmp-map
center="37.4220656,-122.0840897"
zoom="10"
map-id="DEMO_MAP_ID"
style="height: 400px"
></gmp-map>
<!-- [END maps_web_components_map_gmpmap] -->
</body>
</html>
<!-- [END maps_web_components_map] -->
15 changes: 15 additions & 0 deletions dist/samples/web-components-map/app/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

// [START maps_web_components_map]
// This example adds a map using web components.
async function initMap(): Promise<void> {
await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
console.log('Maps JavaScript API loaded.');
}

initMap();
// [END maps_web_components_map]
14 changes: 14 additions & 0 deletions dist/samples/web-components-map/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@js-api-samples/web-components-map",
"version": "1.0.0",
"scripts": {
"build": "tsc && bash ../jsfiddle.sh web-components-map && bash ../app.sh web-components-map && bash ../docs.sh web-components-map && npm run build:vite --workspace=. && bash ../dist.sh web-components-map",
"test": "tsc && npm run build:vite --workspace=.",
"start": "tsc && vite build --base './' && vite",
"build:vite": "vite build --base './'",
"preview": "vite preview"
},
"dependencies": {

}
}
7 changes: 7 additions & 0 deletions dist/samples/web-components-map/app/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
/* [START maps_web_components_map] */
/* [END maps_web_components_map] */
17 changes: 17 additions & 0 deletions dist/samples/web-components-map/app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"strict": true,
"noImplicitAny": false,
"lib": [
"es2015",
"esnext",
"es6",
"dom",
"dom.iterable"
],
"moduleResolution": "Node",
"jsx": "preserve"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
5 changes: 5 additions & 0 deletions dist/samples/web-components-map/dist/assets/index-DgAohk_8.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions dist/samples/web-components-map/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<!--
@license
Copyright 2019 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!-- [START maps_web_components_map] -->
<html>
<head>
<title>Add a Map using HTML</title>

<!-- prettier-ignore -->
<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)) })
({ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly" });</script>
<script type="module" crossorigin src="./assets/index-DgAohk_8.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-BKW5gvRo.css">
</head>
<body>
<!-- [START maps_web_components_map_gmpmap] -->
<gmp-map
center="37.4220656,-122.0840897"
zoom="10"
map-id="DEMO_MAP_ID"
style="height: 400px"
></gmp-map>
<!-- [END maps_web_components_map_gmpmap] -->
</body>
</html>
<!-- [END maps_web_components_map] -->
29 changes: 29 additions & 0 deletions dist/samples/web-components-map/docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<!--
@license
Copyright 2019 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!-- [START maps_web_components_map] -->
<html>
<head>
<title>Add a Map using HTML</title>

<link rel="stylesheet" type="text/css" href="./style.css" />
<script type="module" src="./index.js"></script>
<!-- prettier-ignore -->
<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)) })
({ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly" });</script>
</head>
<body>
<!-- [START maps_web_components_map_gmpmap] -->
<gmp-map
center="37.4220656,-122.0840897"
zoom="10"
map-id="DEMO_MAP_ID"
style="height: 400px"
></gmp-map>
<!-- [END maps_web_components_map_gmpmap] -->
</body>
</html>
<!-- [END maps_web_components_map] -->
14 changes: 14 additions & 0 deletions dist/samples/web-components-map/docs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use strict";
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
// [START maps_web_components_map]
// This example adds a map using web components.
async function initMap() {
await google.maps.importLibrary("maps");
console.log('Maps JavaScript API loaded.');
}
initMap();
// [END maps_web_components_map]
15 changes: 15 additions & 0 deletions dist/samples/web-components-map/docs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

// [START maps_web_components_map]
// This example adds a map using web components.
async function initMap(): Promise<void> {
await google.maps.importLibrary("maps") as google.maps.MapsLibrary;
console.log('Maps JavaScript API loaded.');
}

initMap();
// [END maps_web_components_map]
7 changes: 7 additions & 0 deletions dist/samples/web-components-map/docs/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
/* [START maps_web_components_map] */
/* [END maps_web_components_map] */
6 changes: 6 additions & 0 deletions dist/samples/web-components-map/jsfiddle/demo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

7 changes: 7 additions & 0 deletions dist/samples/web-components-map/jsfiddle/demo.details
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: web-components-map
authors:
- Geo Developer IX Documentation Team
tags:
- google maps
load_type: h
description: Sample code supporting Google Maps Platform JavaScript API documentation.
29 changes: 29 additions & 0 deletions dist/samples/web-components-map/jsfiddle/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<!--
@license
Copyright 2019 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->

<html>
<head>
<title>Add a Map using HTML</title>

<link rel="stylesheet" type="text/css" href="./style.css" />
<script type="module" src="./index.js"></script>
<!-- prettier-ignore -->
<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)) })
({ key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly" });</script>
</head>
<body>

<gmp-map
center="37.4220656,-122.0840897"
zoom="10"
map-id="DEMO_MAP_ID"
style="height: 400px"
></gmp-map>

</body>
</html>

14 changes: 14 additions & 0 deletions dist/samples/web-components-map/jsfiddle/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use strict";
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

// This example adds a map using web components.
async function initMap() {
await google.maps.importLibrary("maps");
console.log('Maps JavaScript API loaded.');
}
initMap();

1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ <h1>Maps JSAPI Samples</h1>
<li><a href='/samples/ui-kit-place-search-text/dist'>ui-kit-place-search-text</a></li>
<li><a href='/samples/ui-kit-place-search-text-compact/dist'>ui-kit-place-search-text-compact</a></li>
<li><a href='/samples/weather-api-current-compact/dist'>weather-api-current-compact</a></li>
<li><a href='/samples/web-components-map/dist'>web-components-map</a></li>
</ul>
</body>
</html>
16 changes: 12 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.