Browse Source

fix: use named exports instead of default (#411)

BREAKING CHANGE: This library is now using named exports instead of default.
main
Justin Poehnelt 3 years ago committed by GitHub
parent
commit
ab2214b6d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .gitignore
  2. 6
      README.md
  3. 4
      examples/basic.html
  4. 2
      examples/events.html
  5. 2
      examples/lettered.html
  6. 2
      examples/picturelabel.html
  7. 9
      rollup.config.js
  8. 4
      src/index.ts

2
.gitignore vendored

@ -226,3 +226,5 @@ $RECYCLE.BIN/
# Windows shortcuts # Windows shortcuts
*.lnk *.lnk
.vscode

6
README.md

@ -27,11 +27,11 @@ or
`yarn add @googlemaps/markerwithlabel` `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.
`<script src="https://unpkg.com/@googlemaps/markerwithlabel/dist/index.min.js"></script>` `<script src="https://unpkg.com/@googlemaps/markerwithlabel/dist/index.min.js"></script>`
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/...`. 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 ## Example
```js ```js
import { MarkerWithLabel } from '@googlemaps/markerwithlabel';
new MarkerWithLabel({ new MarkerWithLabel({
position: new google.maps.LatLng(49.475, -123.84), position: new google.maps.LatLng(49.475, -123.84),
clickable: true, clickable: true,

4
examples/basic.html

@ -47,7 +47,7 @@
mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeId: google.maps.MapTypeId.ROADMAP,
}); });
var marker1 = new MarkerWithLabel({ var marker1 = new markerWithLabel.MarkerWithLabel({
position: homeLatLng, position: homeLatLng,
draggable: false, draggable: false,
clickable: false, clickable: false,
@ -58,7 +58,7 @@
labelStyle: { opacity: 0.75 }, labelStyle: { opacity: 0.75 },
}); });
var marker2 = new MarkerWithLabel({ var marker2 = new markerWithLabel.MarkerWithLabel({
position: new google.maps.LatLng(49.475, -123.84), position: new google.maps.LatLng(49.475, -123.84),
draggable: true, draggable: true,
map: map, map: map,

2
examples/events.html

@ -45,7 +45,7 @@
mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeId: google.maps.MapTypeId.ROADMAP,
}); });
var marker = new MarkerWithLabel({ var marker = new markerWithLabel.MarkerWithLabel({
position: homeLatLng, position: homeLatLng,
draggable: true, draggable: true,
raiseOnDrag: true, raiseOnDrag: true,

2
examples/lettered.html

@ -44,7 +44,7 @@
mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeId: google.maps.MapTypeId.ROADMAP,
}); });
marker = new MarkerWithLabel({ marker = new markerWithLabel.MarkerWithLabel({
position: homeLatLng, position: homeLatLng,
map: map, map: map,
draggable: true, draggable: true,

2
examples/picturelabel.html

@ -41,7 +41,7 @@
pictureLabel = document.createElement("img"); pictureLabel = document.createElement("img");
pictureLabel.src = "home.jpg"; pictureLabel.src = "home.jpg";
marker = new MarkerWithLabel({ marker = new markerWithLabel.MarkerWithLabel({
position: homeLatLng, position: homeLatLng,
map: map, map: map,
draggable: true, draggable: true,

9
rollup.config.js

@ -40,15 +40,13 @@ export default [
file: "dist/index.umd.js", file: "dist/index.umd.js",
format: "umd", format: "umd",
sourcemap: true, sourcemap: true,
exports: "default", name: "markerWithLabel",
name: "MarkerWithLabel",
}, },
{ {
file: "dist/index.min.js", file: "dist/index.min.js",
format: "iife", format: "iife",
sourcemap: true, sourcemap: true,
exports: "default", name: "markerWithLabel",
name: "MarkerWithLabel",
}, },
], ],
}, },
@ -62,7 +60,7 @@ export default [
output: { output: {
file: "dist/index.dev.js", file: "dist/index.dev.js",
format: "iife", format: "iife",
name: "MarkerWithLabel", name: "markerWithLabel",
}, },
}, },
{ {
@ -74,7 +72,6 @@ export default [
file: "dist/index.esm.js", file: "dist/index.esm.js",
format: "esm", format: "esm",
sourcemap: true, sourcemap: true,
name: "MarkerWithLabel",
}, },
}, },
]; ];

4
src/index.ts

@ -14,6 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
import { MarkerWithLabel } from "./marker"; import { MarkerWithLabel, MarkerWithLabelOptions } from "./marker";
export default MarkerWithLabel; export { MarkerWithLabel, MarkerWithLabelOptions };

Loading…
Cancel
Save