Skip to content
This repository was archived by the owner on Jun 22, 2021. It is now read-only.

Commit 39d2e1c

Browse files
authored
typedoc for documentation (#562)
1 parent a5c9ab1 commit 39d2e1c

File tree

14 files changed

+185
-34
lines changed

14 files changed

+185
-34
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
**/package-lock.json
33
**dist/
44
**/.npmrc
5+
**/docs
56

67
# Logs
78
logs

.travis.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,19 @@ node_js:
33
- stable
44
script:
55
- npm run ci
6+
- npm run docs
67
- lerna exec "codecov"
8+
before_deploy:
9+
- touch docs/.nojekyll
10+
deploy:
11+
provider: pages
12+
skip_cleanup: true
13+
github_token: "$GITHUB_TOKEN"
14+
keep_history: true
15+
committer_from_gh: true
16+
local_dir: docs
17+
on:
18+
branch: master
719
env:
820
global:
9-
secure: tBVMdVCrBSggJUSlAmyiwOPrRr86NQ6GRcUa4JXwGJuDqb6twf8v7pzmUTnf4FMP+VSE0bVn0QxXHkfK4adyytqGtbjbKuaShvqR02J84F80gMV2IP5Ik+Y3GmvBL/lQKIRt1Jmsqa2mhLU2/qvy9K0iKP+bPuF/vm06Rt5jYZbUGQT9qPW0P96WyZcx85hEu+V+ydVEx8RQAkD507WW4SgRNlrDmQhfA2Kxpy7xkm1z7RizeHW0yDIWzMThZpt1AL788EsNBNo/U35x6NN2xDxLP99uUpCg3B7vnzU4Xfq4wUwb77+b6qSvDlrUQOLWfRmilcZorr7kQvk2/FnFpnHhTXkYpGzUaUTe+JrrkE1sq5qqkbYPtqKmA4xwnHjG5bvrapI1A2aWuknf9ErnTSPuHTei1LWTn3Cj3CmPzXI4scvSHIlIc5Ns7KODFm2k56SFiNYvJ86SgoEg+7jwEyEtuF3/9e9WUGGDnjHIpFvgiLhV34QPKOB3skyJF8NI9ZuPYFHBr78zSUHdYyZZTLrAClPVr1JuqB9T0aG+cGrtdVEA8u1NdIjRLVX647YfpDAAEnGdbDzjHx3YrQOJAkBe5nrMqr9000BhP8B1yDuETwbVMLoBat0HxqH4UJCy6rvsNvSScX2G2fAuDVx5Jyfb9vafGTuT1nyTH2jTN14=
21+
secure: fnIHhOmHE9tFYzo1pYa4d9jAELBYPCvS7Bmqpw3BH8iIJrnROEcIQa96G98RUchb1pop7tg+DxDdgMdBLxfriTRMzskbyeAhvuIgF8uL706jzlRgZHz5Jg5y933BW4hegFxbDMoSnShNwBoqH3QkFj/wHqCqOTEwd3m+ahMlGyWKvUDmEVL+K/D7j2Tq6dtFPIu1tgX3gPd9KWSEznFE1NrWSVCSSaz2j99Neq6PllI2qE7v7V4fCXFxn2Dc2TxEwuxOvfumucFQsGezd4WMJI7nPO94v7Ggt1FUgxZ/Q5qiykEQuYvXsIjW6CRTqFmNiiJLqVKCVlYNQcgCRoQtGJ0cukjG48q2NU6aw9szuVP+9hisSoJK7DLKGDw1Qozx+OtOe/wQHuXhyxbt6FJRg6JGILYpVAPfn+HyHwldqgyUHvMUZkWIV4CE1K4cclKa/u8XloJ6vOtdQRvwcgLXn7KI0r3P50NdTA0Nm9JdJgfqZL58PHBs2T8y3qHOR0FRehAqWHqnd2fPdm8WsZkS646moNaw+WA85mUr6da/uuiR1AH/tAsusL3ObDeIFRhuMOT+rXdG/Rpiibnf+9FamRPtB7HvVXSCFEoOSPEYoO23sdLqTZPD2eTS/Vxn8pKQnb9+hlINNKy3UiCcYDB3iON+KuJ5qHuMhSEkG10efZA=

README.md

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,50 @@
11
[![Build Status](https://travis-ci.org/googlemaps/v3-utility-library.svg?branch=master)](https://travis-ci.org/googlemaps/v3-utility-library)
22
[![codecov](https://codecov.io/gh/googlemaps/v3-utility-library/branch/master/graph/badge.svg)](https://codecov.io/gh/googlemaps/v3-utility-library)
33
![GitHub contributors](https://img.shields.io/github/contributors/googlemaps/v3-utility-library)
4+
![TypeScript](https://badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555)
5+
![Apache-2.0](https://img.shields.io/badge/license-Apache-blue)
46

5-
Plugins for Google Maps JavaScript API v3
7+
Google Maps JavaScript API v3 Utilities
68
===================================================
79

810
## Description
911

10-
In this project you can find a set of utility libraries developed for Google Maps JavaScript API v3:
12+
In this project you can find a utility packages developed for the Google Maps JavaScript API V3.
1113

12-
- ArcGIS Server Link for Google Maps JavaScript API V3
14+
## Documentation
15+
16+
Documentation for the utility packages below can be found at https://googlemaps.github.io/v3-utility-library/.
17+
18+
## Packages
19+
- @googlemaps/jest-mocks Jest mocks for Google Maps in TypeScript
20+
- @googlemaps/loader - Dynamic loader for Google Maps script using Promise or callback patterns
21+
- @googlemaps/ogc - WMS Layers and more(tbd)
22+
- @google/markerclusterer - Cluster nearby markers
23+
- @google/markerclustererplus - Extended version of @google/markerclusterer
24+
- @googlemaps/markermanager - Show and hide markers based on zoom and bounds to improve performance
25+
- @google/markerwithlabel - Markers with labels and matching events
26+
27+
## Archive
28+
29+
The following packages have never been officially published and are not maintained. Please open an issue to prioritize their inclusion.
30+
- ArcGIS Server Link
1331
- CanvasLayer
14-
- ExtOverviewMapControl for V3
15-
- Geolocation Marker for Google Maps v3
32+
- ExtOverviewMapControl
33+
- Geolocation Marker
1634
- InfoBox
1735
- InfoBubble
18-
- KeyDragZoom for V3
19-
- MapLabel for Google Maps V3
20-
- MarkerClusterer for Google Maps v3
21-
- MarkerClustererPlus for Google Maps V3
22-
- MarkerManager v3
23-
- MarkerWithLabel for V3
24-
- RichMarker for Google Maps v3
36+
- KeyDragZoom
37+
- MapLabel
38+
- RichMarker
2539
- RouteBoxer
2640
- StyledMarker
2741

42+
## Other Resources
43+
- [Google Maps VS Documentation](https://developers.google.com/maps/documentation/javascript/tutorial)
44+
- [Google Maps V3 Reference Documenations](https://developers.google.com/maps/documentation/javascript/reference/)
45+
- [Google Maps Typings](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/googlemaps) - Community supported `npm i -D @types/googlemaps`
46+
- [Google Maps V3 Samples](https://github.com/googlemaps/js-samples)
47+
2848
## Support
2949

3050
These libraries are community supported. We're comfortable enough with the stability and features of

archive/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Archived
22

3-
The packages in this folder have been moved here because they have never been published. To open prioritize one of these packages for update and publishing to npm, please open an issue.
3+
The packages in this folder have been moved here because they have never been published and are not maintained. To open prioritize one of these packages for update and publishing to npm, please open an issue.

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"private": true,
44
"scripts": {
55
"bootstrap": "lerna bootstrap",
6-
"ci": "npm run bootstrap && npm run prepare && npm run lint && npm run test",
6+
"ci": "npm run lint && npm run test",
7+
"docs": "rm -rf docs/ && typedoc .",
78
"format": "sort-package-json && prettier *.json *.js --write && lerna run format",
89
"lint": "lerna run lint",
910
"prepare": "lerna run prepare",
@@ -15,9 +16,11 @@
1516
"@google/markerwithlabel": "file:packages/markerwithlabel",
1617
"@googlemaps/jest-mocks": "file:packages/jest-mocks",
1718
"@googlemaps/loader": "file:packages/loader",
19+
"@googlemaps/markermanager": "file:packages/markermanager",
1820
"@googlemaps/ogc": "file:packages/ogc"
1921
},
2022
"devDependencies": {
23+
"@googlemaps/jest-mocks": "file:../jest-mocks",
2124
"@types/googlemaps": "^3.37.7",
2225
"@types/jest": "^24.0.19",
2326
"@typescript-eslint/eslint-plugin": "^2.4.0",
@@ -31,13 +34,16 @@
3134
"jest": "^24.9.0",
3235
"lerna": "^3.16.4",
3336
"prettier": "^1.18.2",
37+
"query-string": "^6.8.3",
3438
"rollup": "^1.24.0",
3539
"rollup-plugin-commonjs": "^10.1.0",
3640
"rollup-plugin-node-resolve": "^5.2.0",
3741
"rollup-plugin-terser": "^5.1.2",
3842
"rollup-plugin-typescript2": "^0.24.3",
3943
"sort-package-json": "^1.22.1",
4044
"ts-jest": "^24.1.0",
45+
"typedoc": "^0.15.0",
46+
"typedoc-plugin-lerna-packages": "^0.2.1",
4147
"typescript": "^3.6.4"
4248
}
4349
}

packages/jest-mocks/CONTRIB.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
How to contribute
2+
=================
3+
4+
Want to help out? That's awesome!
5+
6+
The library is open source and lives on GitHub at:
7+
https://github.com/googlemaps/v3-utility-library/tree/master/packages/jest-mocks.
8+
Open an issue or fork the library and submit a pull request.
9+
10+
Keep in mind that before we can accept any pull requests we have to jump
11+
through a couple of legal hurdles, primarily a Contributor License Agreement
12+
(CLA):
13+
14+
- **If you are an individual writing original source code**
15+
and you're sure you own the intellectual property,
16+
then you'll need to sign an
17+
[individual CLA](http://code.google.com/legal/individual-cla-v1.0.html).
18+
- **If you work for a company that wants to allow you to contribute your work**,
19+
then you'll need to sign a
20+
[corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html)
21+
22+
Follow either of the two links above to access the appropriate CLA and
23+
instructions for how to sign and return it. Once we receive it, we'll be able
24+
to accept your pull requests.

packages/jest-mocks/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Jest Mocks for Google Maps v3
2+
=============================
3+
4+
## Description
5+
6+
Jest mocks for Google Maps in TypeScript.
7+
8+
**Note:** Currently this is a partial set of mocks/stubs.
9+
10+
## NPM
11+
12+
Available via NPM as the package `@googlemaps/jest-mocks`
13+
14+
## Example
15+
16+
```typescript
17+
import { initialize } from "@googlemaps/jest-mocks";
18+
19+
beforeEach(() => {
20+
initialize();
21+
});
22+
23+
```
24+
25+
## Support
26+
27+
This library is community supported. We're comfortable enough with the stability and features of
28+
the library that we want you to build real production applications on it.
29+
30+
If you find a bug, or have a feature suggestion, please [log an issue][issues]. If you'd like to
31+
contribute, please read [How to Contribute][contrib].
32+
33+
[issues]: https://github.com/googlemaps/v3-utility-library/issues

packages/markermanager/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ MarkerManager v3
55

66
Marker manager is an interface between the map and the user, designed to manage adding and removing many points when the viewport changes.
77

8-
###How it Works:
8+
### How it Works:
99

1010
The MarkerManager places its markers onto a grid, similar to the map tiles. When the user moves the viewport, it computes which grid cells have entered or left the viewport, and shows or hides all the markers in those cells. (If the users scrolls the viewport beyond the markers that are loaded, no markers will be visible until the EVENT_moveend triggers an update.) In practical consequences, this allows 10,000 markers to be distributed over a large area, and as long as only 100-200 are visible in any given viewport, the user will see good performance corresponding to the 100 visible markers, rather than poor performance corresponding to the total 10,000 markers. Note that some code is optimized for speed over space, with the goal of accommodating thousands of markers.
1111

packages/markermanager/src/gridbounds.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
/**
1818
* Helper class to create a bounds of INT ranges.
19-
* @param bounds Array.<Object.<string, number>> Bounds object.
20-
* @constructor
19+
* @ignore
2120
*/
2221
export class GridBounds {
2322
public z: number;
@@ -26,6 +25,11 @@ export class GridBounds {
2625
public minY: number;
2726
public maxY: number;
2827

28+
/**
29+
*
30+
* @param bounds
31+
* @param z
32+
*/
2933
constructor(bounds: google.maps.Point[], z: number) {
3034
// [sw, ne]
3135
this.z = z;

packages/markermanager/src/markermanager.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,9 @@ interface Options {
2525
trackMarkers?: boolean;
2626
borderPadding?: number;
2727
}
28+
2829
/**
2930
* Creates a new MarkerManager that will show/hide markers on a map.
30-
*
31-
* Events:
32-
* @event changed (Parameters: shown bounds, shown markers) Notify listeners when the state of what is displayed changes.
33-
* @event loaded MarkerManager has succesfully been initialized.
34-
*
35-
* @constructor
36-
* @param map The map to manage.
37-
* @param options A container for optional arguments:
38-
* maxZoom The maximum zoom level for which to create tiles.
39-
* borderPadding The width in pixels beyond the map border,
40-
* where markers should be display.
41-
* trackMarkers Whether or not this manager should track marker
42-
* movements.
4331
*/
4432
class MarkerManager {
4533
public shown: boolean;
@@ -57,6 +45,11 @@ class MarkerManager {
5745
private _numMarkers: { [k: string]: number };
5846
private _shownBounds: GridBounds;
5947

48+
/**
49+
* @constructor
50+
* @param map The map to manage.
51+
* @param {Options} options
52+
*/
6053
constructor(
6154
map: google.maps.Map,
6255
{ maxZoom = 19, trackMarkers, shown = true, borderPadding = 100 }: Options

packages/markermanager/src/utils.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,31 @@
1414
* limitations under the License.
1515
*/
1616

17+
/**
18+
* @ignore
19+
*
20+
* @param lng
21+
*/
1722
function lngToX(lng: number): number {
1823
return 1 + lng / 180;
1924
}
20-
25+
/**
26+
* @ignore
27+
*
28+
* @param {number} lat
29+
* @returns {number}
30+
*/
2131
function latToY(lat: number): number {
2232
const sinofphi = Math.sin((lat * Math.PI) / 180);
2333
return 1 - (0.5 / Math.PI) * Math.log((1 + sinofphi) / (1 - sinofphi));
2434
}
2535

36+
/**
37+
* @ignore
38+
*
39+
* @param latlng
40+
* @param zoom
41+
*/
2642
export function latLngToPixel(
2743
latlng: google.maps.LatLng,
2844
zoom: number

packages/ogc/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
* limitations under the License.
1515
*/
1616

17-
export { WMSLayer } from "./wmslayer";
17+
export { WMSLayer, WMSLayerOptions, xyzToBounds } from "./wmslayer";

packages/ogc/src/wmslayer.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,39 @@
1717
/// <reference types="@types/googlemaps" />
1818
import { stringify } from "query-string";
1919

20+
/**
21+
* @ignore
22+
*/
2023
const DEFAULT_WMS_PARAMS = {
2124
request: "GetMap",
2225
service: "WMS",
2326
srs: "EPSG:3857"
2427
};
28+
29+
/**
30+
* @ignore
31+
*/
2532
const EPSG_3857_EXTENT = 20037508.34789244;
33+
34+
/**
35+
* @ignore
36+
*/
2637
const ORIG_X = -EPSG_3857_EXTENT; // x starts from right
38+
39+
/**
40+
* @ignore
41+
*/
2742
const ORIG_Y = EPSG_3857_EXTENT; // y starts from top
2843

29-
function xyzToBounds(x: number, y: number, zoom: number): Array<number> {
44+
/**
45+
* Convert xyz tile coordinates to mercator bounds.
46+
*
47+
* @param x
48+
* @param y
49+
* @param zoom
50+
* @returns {number[]} minx, miny, maxx, maxy
51+
*/
52+
function xyzToBounds(x: number, y: number, zoom: number): number[] {
3053
const tileSize = (EPSG_3857_EXTENT * 2) / Math.pow(2, zoom);
3154
const minx = ORIG_X + x * tileSize;
3255
const maxx = ORIG_X + (x + 1) * tileSize;
@@ -50,6 +73,11 @@ interface WMSLayerOptions {
5073
minZoom?: number;
5174
opacity?: number;
5275
}
76+
77+
/**
78+
*
79+
* @param {WMSLayerOptions} params
80+
*/
5381
const WMSLayer = function({
5482
url,
5583
layers,

typedoc.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
mode: "modules",
3+
target: "es6",
4+
out: "docs",
5+
exclude: ["**/node_modules/**", "**/*.spec.ts", "**/*.test.ts"],
6+
lernaExclude: [],
7+
name: "Google Maps JavaScript API v3 Utilities",
8+
excludePrivate: true,
9+
skipInternal: true,
10+
ignoreCompilerErrors: true,
11+
module: "commonjs",
12+
categorizeByGroup: true,
13+
readme: "./README.md"
14+
};

0 commit comments

Comments
 (0)