From ab2214b6d0b1fcce52fa7283332893de4c74849d Mon Sep 17 00:00:00 2001 From: Justin Poehnelt Date: Wed, 5 Jan 2022 09:34:46 -0700 Subject: [PATCH] fix: use named exports instead of default (#411) BREAKING CHANGE: This library is now using named exports instead of default. --- .gitignore | 2 ++ README.md | 6 ++++-- examples/basic.html | 4 ++-- examples/events.html | 2 +- examples/lettered.html | 2 +- examples/picturelabel.html | 2 +- rollup.config.js | 9 +++------ src/index.ts | 4 ++-- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 21dbe0e..23e758a 100644 --- a/.gitignore +++ b/.gitignore @@ -226,3 +226,5 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk + +.vscode diff --git a/README.md b/README.md index d24bb3f..ef3f359 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,11 @@ or `yarn add @googlemaps/markerwithlabel` -Alternativly you may add the umd package directly to the html document using the unpkg link. +Alternatively you may add the umd package directly to the html document using the unpkg link. `` -When adding via unpkg, the marker with labels can be accessed at `MarkerWithLabel`. +When adding via unpkg, the marker with labels can be accessed at `new markerWithLabel.MarkerWithLabel()`. A version can be specified by using `https://unpkg.com/@googlemaps/markerwithlabel@VERSION/dist/...`. @@ -42,6 +42,8 @@ The reference documentation can be found at this [link](https://googlemaps.githu ## Example ```js +import { MarkerWithLabel } from '@googlemaps/markerwithlabel'; + new MarkerWithLabel({ position: new google.maps.LatLng(49.475, -123.84), clickable: true, diff --git a/examples/basic.html b/examples/basic.html index 5ddd31f..df797c9 100644 --- a/examples/basic.html +++ b/examples/basic.html @@ -47,7 +47,7 @@ mapTypeId: google.maps.MapTypeId.ROADMAP, }); - var marker1 = new MarkerWithLabel({ + var marker1 = new markerWithLabel.MarkerWithLabel({ position: homeLatLng, draggable: false, clickable: false, @@ -58,7 +58,7 @@ labelStyle: { opacity: 0.75 }, }); - var marker2 = new MarkerWithLabel({ + var marker2 = new markerWithLabel.MarkerWithLabel({ position: new google.maps.LatLng(49.475, -123.84), draggable: true, map: map, diff --git a/examples/events.html b/examples/events.html index b6ddf19..1ced10a 100644 --- a/examples/events.html +++ b/examples/events.html @@ -45,7 +45,7 @@ mapTypeId: google.maps.MapTypeId.ROADMAP, }); - var marker = new MarkerWithLabel({ + var marker = new markerWithLabel.MarkerWithLabel({ position: homeLatLng, draggable: true, raiseOnDrag: true, diff --git a/examples/lettered.html b/examples/lettered.html index 6a32aca..fb29ad5 100644 --- a/examples/lettered.html +++ b/examples/lettered.html @@ -44,7 +44,7 @@ mapTypeId: google.maps.MapTypeId.ROADMAP, }); - marker = new MarkerWithLabel({ + marker = new markerWithLabel.MarkerWithLabel({ position: homeLatLng, map: map, draggable: true, diff --git a/examples/picturelabel.html b/examples/picturelabel.html index e030bb1..be96fb3 100644 --- a/examples/picturelabel.html +++ b/examples/picturelabel.html @@ -41,7 +41,7 @@ pictureLabel = document.createElement("img"); pictureLabel.src = "home.jpg"; - marker = new MarkerWithLabel({ + marker = new markerWithLabel.MarkerWithLabel({ position: homeLatLng, map: map, draggable: true, diff --git a/rollup.config.js b/rollup.config.js index 1b0887e..b469a26 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -40,15 +40,13 @@ export default [ file: "dist/index.umd.js", format: "umd", sourcemap: true, - exports: "default", - name: "MarkerWithLabel", + name: "markerWithLabel", }, { file: "dist/index.min.js", format: "iife", sourcemap: true, - exports: "default", - name: "MarkerWithLabel", + name: "markerWithLabel", }, ], }, @@ -62,7 +60,7 @@ export default [ output: { file: "dist/index.dev.js", format: "iife", - name: "MarkerWithLabel", + name: "markerWithLabel", }, }, { @@ -74,7 +72,6 @@ export default [ file: "dist/index.esm.js", format: "esm", sourcemap: true, - name: "MarkerWithLabel", }, }, ]; diff --git a/src/index.ts b/src/index.ts index 577b384..563c011 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,6 +14,6 @@ * limitations under the License. */ -import { MarkerWithLabel } from "./marker"; +import { MarkerWithLabel, MarkerWithLabelOptions } from "./marker"; -export default MarkerWithLabel; +export { MarkerWithLabel, MarkerWithLabelOptions };