Skip to content

Commit 8151f13

Browse files
committed
use goong-js
1 parent 227afdb commit 8151f13

File tree

141 files changed

+9591
-1231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+9591
-1231
lines changed

.github/workflows/npm-publish.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish to npmjs
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v1
12+
- uses: actions/setup-node@v1
13+
with:
14+
node-version: '12.x'
15+
registry-url: https://registry.npmjs.org/
16+
- run: npm ci
17+
- run: npm run test-fast
18+
- run: npm run build
19+
- run: npm publish --access public
20+
env:
21+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
env:
15-
MapboxAccessToken: ${{ secrets.MAPBOX_ACCESS_TOKEN_CI }}
15+
GoongAccessToken: ${{ secrets.GOONG_MAPTILES_KEY_CI }}
1616

1717
steps:
1818
- uses: actions/[email protected]

.github/workflows/website.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
publish-website:
1010
runs-on: ubuntu-latest
1111

12-
if: github.repository_owner == 'visgl'
12+
if: github.repository_owner == 'goong-io'
1313

1414
env:
15-
MapboxAccessToken: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
15+
GoongAccessToken: ${{ secrets.GOONG_MAPTILES_KEY_CI }}
1616

1717
steps:
1818
- uses: actions/[email protected]
@@ -24,7 +24,7 @@ jobs:
2424

2525
- name: Get version
2626
id: get-version
27-
run: LATEST=$(npm show react-map-gl version | grep -o -E "^[0-9]+\.[0-9]+") && echo "::set-output name=latest::/${LATEST}-release"
27+
run: LATEST=$(npm show @goongmaps/goong-map-react version | grep -o -E "^[0-9]+\.[0-9]+") && echo "::set-output name=latest::/${LATEST}-release"
2828

2929
- name: Check version
3030
if: ${{ !endsWith(github.ref, steps.get-version.outputs.latest) }}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
# Version 1.0.9 Goong
4+
5+
- Convert code to Goong
6+
- Use `@goongmaps/goong-js` module
7+
38
# Version 6.1
49

510
## 6.1.0-beta.1 (Jan 22, 2021)

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PRs and bug reports are welcome, and we are actively looking for new maintainers
88

99
The **master** branch is the active development branch.
1010

11-
Building react-map-gl locally from the source requires node.js `>=8`.
11+
Building `@goongmaps/goong-map-react` locally from the source requires node.js `>=8`.
1212
We use [yarn](https://yarnpkg.com/en/docs/install) to manage the dependencies.
1313

1414
```bash

LICENSE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Copyright (c) 2020, Goong Inc
2+
13
Copyright (c) 2020 Urban Computing Foundation
24

35
Permission is hereby granted, free of charge, to any person obtaining a copy

README.md

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
11
<p align="right">
2-
<a href="https://npmjs.org/package/react-map-gl">
3-
<img src="https://img.shields.io/npm/v/react-map-gl.svg?style=flat-square" alt="version" />
2+
<a href="https://npmjs.org/package/@goongmaps/goong-map-react">
3+
<img src="https://img.shields.io/npm/v/@goongmaps/goong-map-react.svg?style=flat-square" alt="version" />
44
</a>
5-
<a href="https://github.com/visgl/react-map-gl/actions?query=workflow%3Atest+branch%3Amaster">
6-
<img src="https://github.com/visgl/react-map-gl/workflows/test/badge.svg?branch=master" alt="build" />
7-
<a href="https://npmjs.org/package/react-map-gl">
8-
<img src="https://img.shields.io/npm/dm/react-map-gl.svg?style=flat-square" alt="downloads" />
5+
<a href="https://npmjs.org/package/@goongmaps/goong-map-react">
6+
<img src="https://img.shields.io/npm/dm/@goongmaps/goong-map-react.svg?style=flat-square" alt="downloads" />
97
</a>
108
</p>
119

12-
<h1 align="center">react-map-gl | <a href="https://visgl.github.io/react-map-gl">Docs</a></h1>
10+
## @goongmaps/goong-map-react | [Documentation](/docs)
1311

14-
`react-map-gl` is a suite of [React](http://facebook.github.io/react/) components designed to provide a React API for [Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js)-compatible libraries. More information in the online documentation.
12+
`@goongmaps/goong-map-react` is a fork of [react-map-gl](https://github.com/visgl/react-map-gl). It provides React components for [Goong GL JS](https://github.com/goong-io/goong-js). More information in the online documentation.
1513

1614
See our [Design Philosophy](docs/README.md#design-philosophy).
1715

1816
### Installation
1917

20-
Using `react-map-gl` requires `react >= 16.3`.
18+
Using `@goongmaps/goong-map-react` requires `react >= 16.3`.
2119

2220
```sh
23-
npm install --save react-map-gl
21+
npm install --save @goongmaps/goong-map-react
2422
```
2523

2624
### Example
2725

2826
```js
2927
import * as React from 'react';
30-
import ReactMapGL from 'react-map-gl';
28+
import ReactMapGL from '@goongmaps/goong-map-react';
3129

3230
function Map() {
3331
const [viewport, setViewport] = React.useState({
34-
latitude: 37.7577,
35-
longitude: -122.4376,
36-
zoom: 8
32+
latitude: 21.03072,
33+
longitude: 105.85239,
34+
zoom: 12
3735
});
3836

3937
return (
@@ -47,25 +45,21 @@ function Map() {
4745
}
4846
```
4947

50-
### Using Mapbox Tokens
48+
### Using Goong Maptiles key
5149

52-
**Starting with v2.0, mapbox-gl requires a Mapbox token for any usage, with or without the Mapbox data service. See [about Mapbox tokens](/docs/get-started/mapbox-tokens.md) for your options.**
53-
54-
To show maps from a service such as Mapbox you will need to register on their website in order to retrieve an access token required by the map component, which will be used to identify you and start serving up map tiles. The service will be free until a certain level of traffic is exceeded.
50+
To show maps from Goong you will need to [register](https://account.goong.io) on our website in order to retrieve a map tiles key required by the map component, which will be used to identify you and start serving up map tiles. The service will be free until a certain level of traffic is exceeded.
5551

5652
There are several ways to provide a token to your app, as showcased in some of the example folders:
5753

58-
* Provide a `mapboxApiAccessToken` prop to the map component
59-
* Set the `MapboxAccessToken` environment variable (or set `REACT_APP_MAPBOX_ACCESS_TOKEN` if you are using Create React App)
60-
* Provide it in the URL, e.g `?access_token=TOKEN`
61-
* Provide `mapboxApiUrl` prop to the map component to override the default mapbox API URL
54+
* Provide a `goongApiAccessToken` prop to the map component
55+
* Set the `GoongAccessToken` environment variable (or set `REACT_APP_GOONG_ACCESS_TOKEN` if you are using Create React App)
6256

6357
But we would recommend using something like [dotenv](https://github.com/motdotla/dotenv) and put your key in an untracked `.env` file, that will then expose it as a `process.env` variable, with much less leaking risks.
6458

6559

6660
### Limitations
6761

68-
This library provides convenient wrappers around initializing and (to some degree) tracking the state of a Mapbox WebGL map. Because most of the functionality of Mapbox's JS API depends on the use of HTML5 canvases and WebGL, which React is not built to manipulate, the React component does not mirror all the functionality of Mapbox GL JS's Map class. You may access the native Mapbox API exposed by the `getMap()` function in this library. However, proceed with caution as calling the native APIs may break the connection between the React layer props and the underlying map state.
62+
This library provides convenient wrappers around initializing and (to some degree) tracking the state of a Goong WebGL map. Because most of the functionality of Goong's JS API depends on the use of HTML5 canvases and WebGL, which React is not built to manipulate, the React component does not mirror all the functionality of Goong GL JS's Map class. You may access the native Goong API exposed by the `getMap()` function in this library. However, proceed with caution as calling the native APIs may break the connection between the React layer props and the underlying map state.
6963

7064
Examples of replacing common native API calls with their React equivalents can be found on the [FAQ](/docs/get-started/faq.md) page.
7165

TESTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ npm run test
1212
npm run test-browser
1313
```
1414

15-
**You'll need to specify a valid Mapbox Access Token in the URL** for the tests to pass.
15+
**You'll need to specify a valid Goong Maptiles Key in the URL** for the tests to pass.
1616

1717
```
18-
http://localhost:8080/?access_token=MAPBOX_ACCESS_TOKEN
18+
http://localhost:8080/?access_token=YOUR_MAPTILES_KEY
1919
```
2020

21-
# Bumping Mapbox Version
21+
# Bumping Goong Version
2222

23-
Always pin Mapbox to a specific release.
23+
Always pin Goong to a specific release.
2424

2525
The React controls (`NavigationControl`, `Popup` and `Marker`) are dependent on
26-
the Mapbox stylesheet, and may be broken by Mapbox updates.
27-
Always run `examples/controls` after bumping Mapbox version to make sure they
26+
the Goong stylesheet, and may be broken by Goong updates.
27+
Always run `examples/controls` after bumping Goong version to make sure they
2828
still work.

aliases.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const {resolve} = require('path');
2424
const ALIASES = {
2525
'react-map-gl/test': resolve('./test'),
2626
'react-map-gl': resolve('./src'),
27-
'mapbox-gl$': resolve('./node_modules/mapbox-gl/dist/mapbox-gl.js'),
27+
'mapbox-gl$': resolve('./node_modules/@goongmaps/goong-js/dist/goong-js.js'),
2828
webworkify: 'webworkify-webpack-dropin'
2929
};
3030

docs/README.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
# Introduction
22

3-
react-map-gl is a suite of [React](http://facebook.github.io/react/) components for
4-
Mapbox GL JS-compatible libraries.
5-
6-
| Library | Description |
7-
| --- | --- |
8-
| [MapLibre](https://github.com/MapLibre/maplibre-gl-js) | An open fork of mapbox-gl v1, that can be used without a mapbox token. |
9-
| [Mapbox GL JS v1](https://github.com/mapbox/mapbox-gl-js) | The previous version of mapbox GL JS. This version is free open source and can be used with non-mapbox basemaps without a mapbox token. |
10-
| [Mapbox GL JS v2](https://github.com/mapbox/mapbox-gl-js) | The latest version of Mapbox GL JS. Note that version 2 is not free open source, and a mapbox token is required and billable events are generated even if you do not use mapbox hosted basemaps. |
11-
| Other mapbox-gl forks | It may be possible to use react-map-gl with other mapbox forks, but this is not a supported use case. Minor PRs to enable other forks to be used may be accepted. |
3+
`@goongmaps/goong-map-react` is a suite of [React](http://facebook.github.io/react/) components for
4+
[Goong GL JS](https://github.com/goong-io/goong-js).
125

136
For basemaps:
14-
- You can load map data from Mapbox's own service.
15-
- You can create and host your own map data using one of the many [open source tools](https://github.com/mapbox/awesome-vector-tiles).
7+
- You can load map data from Goong's own service.
8+
- You can create and host your own map data using one of the many [open source tools](https://github.com/Goong/awesome-vector-tiles).
169

17-
New to react-map-gl? [Get Started](/docs/get-started/get-started.md)
10+
New to `@goongmaps/goong-map-react`? [Get Started](/docs/get-started/get-started.md)
1811

1912
Want to contribute? See our [Developer Guide](/docs/developer-guide.md)
2013

@@ -23,17 +16,17 @@ Want to contribute? See our [Developer Guide](/docs/developer-guide.md)
2316

2417
At Uber, we make powerful web tools that contain maps. To manage the complexity of our applications, we fully embrace React and reactive programming.
2518

26-
The stock mapbox-gl APIs are [imperative](https://en.wikipedia.org/wiki/Imperative_programming). That is, you instruct the map to do something (for example, [map.flyTo](https://docs.mapbox.com/mapbox-gl-js/api/#map#flyto)), and it will execute the command at its own pace.
19+
The stock `goong-js` APIs are [imperative](https://en.wikipedia.org/wiki/Imperative_programming). That is, you instruct the map to do something (for example, [map.flyTo](https://docs.goong.io/javascript/#map#flyto)), and it will execute the command at its own pace.
2720

28-
This does not scale when we have many components that need to synchronize with each other. One use case we have is to render two maps side by side, and when the user interacts with one, update both cameras. We draw UI on top of the map using React, pinned to a given geolocation. We also render visualization layers on top of the map using WebGL, most notably with [deck.gl](https://deck.gl). The mapbox maps, the deck.gl canvas, and React controls' render cycles are all asynchronous. If we listen to the [move](https://docs.mapbox.com/mapbox-gl-js/api/#map.event:move) event in the map and tell the other components to update, the other components would always be one frame behind.
21+
This does not scale when we have many components that need to synchronize with each other. One use case we have is to render two maps side by side, and when the user interacts with one, update both cameras. We draw UI on top of the map using React, pinned to a given geolocation. We also render visualization layers on top of the map using WebGL, most notably with [deck.gl](https://deck.gl). The goong-js maps, the deck.gl canvas, and React controls' render cycles are all asynchronous. If we listen to the [move](https://docs.goong.io/javascript/#map.event:move) event in the map and tell the other components to update, the other components would always be one frame behind.
2922

30-
Ultimately, in the spirit of the [reactive programming paradigm](https://en.wikipedia.org/wiki/Reactive_programming), data always flows **down**. In a complex application, any user input or data fetch can affect the rendering of many components. We might store the **source of truth** in a parent component state, or Redux store, or hooks, and let it propagate down to the map as well as its peers. As long as the map manages its own state, as mapbox-gl is designed to do, we risk the components going out of sync.
23+
Ultimately, in the spirit of the [reactive programming paradigm](https://en.wikipedia.org/wiki/Reactive_programming), data always flows **down**. In a complex application, any user input or data fetch can affect the rendering of many components. We might store the **source of truth** in a parent component state, or Redux store, or hooks, and let it propagate down to the map as well as its peers. As long as the map manages its own state, as goong-js is designed to do, we risk the components going out of sync.
3124

32-
react-map-gl creates a fully reactive wrapper for mapbox-gl. The [InteractiveMap](/docs/api-reference/interactive-map) component is stateless. To move the map camera in anyway, the application must update the component's props. The application can also be confident that the map's camera would never deviate from the props that it's assigned. At first glance, its API may seem verbose to those who come from the imperative world of mapbox-gl. However, it is essential for the correctness of large applications.
25+
`@goongmaps/goong-map-react` creates a fully reactive wrapper for `goong-js`. The [InteractiveMap](/docs/api-reference/interactive-map) component is stateless. To move the map camera in anyway, the application must update the component's props. The application can also be confident that the map's camera would never deviate from the props that it's assigned. At first glance, its API may seem verbose to those who come from the imperative world of goong-js. However, it is essential for the correctness of large applications.
3326

3427

3528
## Limitations
3629

37-
This library provides convenient wrappers around initializing and (to some degree) tracking the state of a Mapbox WebGL map. Because most of the functionality of Mapbox's JS API depends on the use of HTML5 canvases and WebGL, which React is not built to manipulate, the React component does not mirror all the functionality of Mapbox GL JS's Map class. You may access the native Mapbox API exposed by the [getMap()](/docs/api-reference/static-map.md#getmap) function in this library. However, proceed with caution as calling the native APIs may break the connection between the React layer props and the underlying map state.
30+
This library provides convenient wrappers around initializing and (to some degree) tracking the state of a Goong WebGL map. Because most of the functionality of Goong's JS API depends on the use of HTML5 canvases and WebGL, which React is not built to manipulate, the React component does not mirror all the functionality of Goong GL JS's Map class. You may access the native Goong API exposed by the [getMap()](/docs/api-reference/static-map.md#getmap) function in this library. However, proceed with caution as calling the native APIs may break the connection between the React layer props and the underlying map state.
3831

3932
Examples of replacing common native API calls with their React equivalents can be found on the [FAQ](/docs/get-started/faq.md) page.

docs/advanced/custom-components.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The following component renders a label "(longitude, latitude)" at the given coo
88

99
```js
1010
import * as React from 'react';
11-
import MapGL, {MapContext} from 'react-map-gl';
11+
import MapGL, {MapContext} from '@goongmaps/goong-map-react';
1212

1313
function CustomMarker(props) {
1414
const context = React.useContext(MapContext);
@@ -33,7 +33,7 @@ function CustomMarker(props) {
3333

3434
function App() {
3535
return (
36-
<MapGL longitude={-122.45} latitude={37.78} zoom={12} mapboxApiAccessToken={MAPBOX_TOKEN}>
36+
<MapGL longitude={-122.45} latitude={37.78} zoom={12} goongApiAccessToken={GOONG_MAPTILES_KEY}>
3737
<CustomeMarker longitude={-122.45} latitude={37.78} />
3838
</MapGL>
3939
)
@@ -46,7 +46,7 @@ function App() {
4646

4747
```js
4848
import * as React from 'react';
49-
import MapGL, {_useMapControl as useMapControl} from 'react-map-gl';
49+
import MapGL, {_useMapControl as useMapControl} from '@goongmaps/goong-map-react';
5050

5151
function CustomControl(props) {
5252
const [counter, setCounter] = React.useState(0);
@@ -71,7 +71,7 @@ function CustomControl(props) {
7171

7272
function App() {
7373
return (
74-
<MapGL longitude={-122.45} latitude={37.78} zoom={12} mapboxApiAccessToken={MAPBOX_TOKEN}>
74+
<MapGL longitude={-122.45} latitude={37.78} zoom={12} goongApiAccessToken={GOONG_MAPTILES_KEY}>
7575
<CustomControl />
7676
</MapGL>
7777
)

docs/advanced/custom-map-controller.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ A simple example to swap drag pan and drag rotate:
2525

2626
```js
2727
/// my-map-controller.js
28-
import {MapController} from 'react-map-gl';
28+
import {MapController} from '@goongmaps/goong-map-react';
2929

3030
export default class MyMapController extends MapController {
3131

@@ -42,7 +42,7 @@ Overwrite existing event handling:
4242

4343
```js
4444
/// my-map-controller.js
45-
import {MapController} from 'react-map-gl';
45+
import {MapController} from '@goongmaps/goong-map-react';
4646

4747
export default class MyMapController extends MapController {
4848

@@ -62,7 +62,7 @@ Listen to additional events:
6262

6363
```js
6464
/// my-map-controller.js
65-
import {MapController} from 'react-map-gl';
65+
import {MapController} from '@goongmaps/goong-map-react';
6666

6767
export default class MyMapController extends MapController {
6868

@@ -86,7 +86,7 @@ Add a custom callback:
8686

8787
```js
8888
/// my-map-controller.js
89-
import {MapController} from 'react-map-gl';
89+
import {MapController} from '@goongmaps/goong-map-react';
9090

9191
export default class MyMapController extends MapController {
9292

0 commit comments

Comments
 (0)