diff --git a/dist/index.html b/dist/index.html index 56b0c34c..188672e8 100644 --- a/dist/index.html +++ b/dist/index.html @@ -83,6 +83,7 @@

Maps JSAPI Samples

  • ui-kit-place-search-text
  • ui-kit-place-search-text-compact
  • weather-api-current-compact
  • +
  • web-components-map
  • diff --git a/dist/samples/web-components-map/app/.eslintsrc.json b/dist/samples/web-components-map/app/.eslintsrc.json new file mode 100644 index 00000000..4c44dab0 --- /dev/null +++ b/dist/samples/web-components-map/app/.eslintsrc.json @@ -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 + } +} diff --git a/dist/samples/web-components-map/app/README.md b/dist/samples/web-components-map/app/README.md new file mode 100644 index 00000000..9e8d0dd3 --- /dev/null +++ b/dist/samples/web-components-map/app/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/dist/samples/web-components-map/app/index.html b/dist/samples/web-components-map/app/index.html new file mode 100644 index 00000000..77c97f27 --- /dev/null +++ b/dist/samples/web-components-map/app/index.html @@ -0,0 +1,29 @@ + + + + + + Add a Map using HTML + + + + + + + + + + + + + diff --git a/dist/samples/web-components-map/app/index.ts b/dist/samples/web-components-map/app/index.ts new file mode 100644 index 00000000..eb949098 --- /dev/null +++ b/dist/samples/web-components-map/app/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/dist/samples/web-components-map/app/package.json b/dist/samples/web-components-map/app/package.json new file mode 100644 index 00000000..0311efd0 --- /dev/null +++ b/dist/samples/web-components-map/app/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/dist/samples/web-components-map/app/style.css b/dist/samples/web-components-map/app/style.css new file mode 100644 index 00000000..c37e7f3f --- /dev/null +++ b/dist/samples/web-components-map/app/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/dist/samples/web-components-map/app/tsconfig.json b/dist/samples/web-components-map/app/tsconfig.json new file mode 100644 index 00000000..366aabb0 --- /dev/null +++ b/dist/samples/web-components-map/app/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" + } +} diff --git a/dist/samples/web-components-map/dist/assets/index-BKW5gvRo.css b/dist/samples/web-components-map/dist/assets/index-BKW5gvRo.css new file mode 100644 index 00000000..ab00e384 --- /dev/null +++ b/dist/samples/web-components-map/dist/assets/index-BKW5gvRo.css @@ -0,0 +1,5 @@ +/** + * @license + * Copyright 2019 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ diff --git a/dist/samples/web-components-map/dist/assets/index-DgAohk_8.js b/dist/samples/web-components-map/dist/assets/index-DgAohk_8.js new file mode 100644 index 00000000..7995a52f --- /dev/null +++ b/dist/samples/web-components-map/dist/assets/index-DgAohk_8.js @@ -0,0 +1,5 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))i(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function s(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?r.credentials="include":e.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(e){if(e.ep)return;e.ep=!0;const r=s(e);fetch(e.href,r)}})();/** + * @license + * Copyright 2019 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */async function n(){await google.maps.importLibrary("maps"),console.log("Maps JavaScript API loaded.")}n(); diff --git a/dist/samples/web-components-map/dist/index.html b/dist/samples/web-components-map/dist/index.html new file mode 100644 index 00000000..96b9ed75 --- /dev/null +++ b/dist/samples/web-components-map/dist/index.html @@ -0,0 +1,29 @@ + + + + + + Add a Map using HTML + + + + + + + + + + + + + diff --git a/dist/samples/web-components-map/docs/index.html b/dist/samples/web-components-map/docs/index.html new file mode 100644 index 00000000..77c97f27 --- /dev/null +++ b/dist/samples/web-components-map/docs/index.html @@ -0,0 +1,29 @@ + + + + + + Add a Map using HTML + + + + + + + + + + + + + diff --git a/dist/samples/web-components-map/docs/index.js b/dist/samples/web-components-map/docs/index.js new file mode 100644 index 00000000..95657512 --- /dev/null +++ b/dist/samples/web-components-map/docs/index.js @@ -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] diff --git a/dist/samples/web-components-map/docs/index.ts b/dist/samples/web-components-map/docs/index.ts new file mode 100644 index 00000000..eb949098 --- /dev/null +++ b/dist/samples/web-components-map/docs/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/dist/samples/web-components-map/docs/style.css b/dist/samples/web-components-map/docs/style.css new file mode 100644 index 00000000..c37e7f3f --- /dev/null +++ b/dist/samples/web-components-map/docs/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/dist/samples/web-components-map/jsfiddle/demo.css b/dist/samples/web-components-map/jsfiddle/demo.css new file mode 100644 index 00000000..60a9cd50 --- /dev/null +++ b/dist/samples/web-components-map/jsfiddle/demo.css @@ -0,0 +1,6 @@ +/** + * @license + * Copyright 2019 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + diff --git a/dist/samples/web-components-map/jsfiddle/demo.details b/dist/samples/web-components-map/jsfiddle/demo.details new file mode 100644 index 00000000..fff1054d --- /dev/null +++ b/dist/samples/web-components-map/jsfiddle/demo.details @@ -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. diff --git a/dist/samples/web-components-map/jsfiddle/demo.html b/dist/samples/web-components-map/jsfiddle/demo.html new file mode 100644 index 00000000..b29c1ad5 --- /dev/null +++ b/dist/samples/web-components-map/jsfiddle/demo.html @@ -0,0 +1,29 @@ + + + + + + Add a Map using HTML + + + + + + + + + + + + + diff --git a/dist/samples/web-components-map/jsfiddle/demo.js b/dist/samples/web-components-map/jsfiddle/demo.js new file mode 100644 index 00000000..9549ef6b --- /dev/null +++ b/dist/samples/web-components-map/jsfiddle/demo.js @@ -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(); + diff --git a/index.html b/index.html index 56b0c34c..188672e8 100644 --- a/index.html +++ b/index.html @@ -83,6 +83,7 @@

    Maps JSAPI Samples

  • ui-kit-place-search-text
  • ui-kit-place-search-text-compact
  • weather-api-current-compact
  • +
  • web-components-map
  • diff --git a/package-lock.json b/package-lock.json index 68ef41de..ba575202 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1557,6 +1557,10 @@ "resolved": "samples/weather-api-current-compact", "link": true }, + "node_modules/@js-api-samples/web-components-map": { + "resolved": "samples/web-components-map", + "link": true + }, "node_modules/@lezer/common": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.3.tgz", @@ -8807,11 +8811,11 @@ "version": "1.0.0", "dependencies": { "@googlemaps/js-api-loader": "^2.0.0", - "terra-draw": "*", - "terra-draw-google-maps-adapter": "*" + "terra-draw": "latest", + "terra-draw-google-maps-adapter": "latest" }, "devDependencies": { - "@types/google.maps": "*", + "@types/google.maps": "latest", "typescript": "^5.9.3", "vite": "^7.1.9" } @@ -8960,7 +8964,7 @@ "name": "@js-api-samples/react-ui-kit-place-details-latlng-compact", "version": "1.0.0", "dependencies": { - "@vis.gl/react-google-maps": "*", + "@vis.gl/react-google-maps": "latest", "react": "^19.2.0", "react-dom": "^19.2.0" }, @@ -9067,6 +9071,10 @@ "samples/weather-api-current-compact": { "name": "@js-api-samples/weather-api-current-compact", "version": "1.0.0" + }, + "samples/web-components-map": { + "name": "@js-api-samples/web-components-map", + "version": "1.0.0" } } }