diff --git a/samples/web-components-map/README.md b/samples/web-components-map/README.md new file mode 100644 index 00000000..9e8d0dd3 --- /dev/null +++ b/samples/web-components-map/README.md @@ -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). diff --git a/samples/web-components-map/index.html b/samples/web-components-map/index.html new file mode 100644 index 00000000..77c97f27 --- /dev/null +++ b/samples/web-components-map/index.html @@ -0,0 +1,29 @@ + + + + + + Add a Map using HTML + + + + + + + + + + + + + diff --git a/samples/web-components-map/index.ts b/samples/web-components-map/index.ts new file mode 100644 index 00000000..eb949098 --- /dev/null +++ b/samples/web-components-map/index.ts @@ -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 { + await google.maps.importLibrary("maps") as google.maps.MapsLibrary; + console.log('Maps JavaScript API loaded.'); +} + +initMap(); +// [END maps_web_components_map] diff --git a/samples/web-components-map/package.json b/samples/web-components-map/package.json new file mode 100644 index 00000000..0311efd0 --- /dev/null +++ b/samples/web-components-map/package.json @@ -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": { + + } +} diff --git a/samples/web-components-map/style.css b/samples/web-components-map/style.css new file mode 100644 index 00000000..c37e7f3f --- /dev/null +++ b/samples/web-components-map/style.css @@ -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] */ \ No newline at end of file diff --git a/samples/web-components-map/tsconfig.json b/samples/web-components-map/tsconfig.json new file mode 100644 index 00000000..366aabb0 --- /dev/null +++ b/samples/web-components-map/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "esnext", + "target": "esnext", + "strict": true, + "noImplicitAny": false, + "lib": [ + "es2015", + "esnext", + "es6", + "dom", + "dom.iterable" + ], + "moduleResolution": "Node", + "jsx": "preserve" + } +}