Skip to content

Commit

Permalink
v2 RC1
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulLeCam committed Jun 10, 2018
1 parent b548cb6 commit 5ee17a3
Show file tree
Hide file tree
Showing 23 changed files with 452 additions and 579 deletions.
14 changes: 7 additions & 7 deletions .github/ISSUE_TEMPLATE/bug-in-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ about: Report a bug in version 1 of the library
Please make sure to check the following boxes before submitting an issue.\
**Issues opened without using this template will be closed unless they have a good reason not to follow this template.**

* [ ] All peer dependencies are installed: React, ReactDOM and Leaflet.
* [ ] Using a supported version of React and ReactDOM (v15.x or v16.x).
* [ ] Using the supported version of Leaflet (v1.3.x) and its corresponding CSS file is loaded.
* [ ] Using the [latest stable version of React-Leaflet](https://github.com/PaulLeCam/react-leaflet/releases) - **not v2 beta**.
* [ ] The issue has not already been reported.
* [ ] Make sure you have followed the [quick start guide](http://leafletjs.com/examples/quick-start.html) for Leaflet.
* [ ] Make sure you have fully read the [documentation](https://react-leaflet.js.org/docs/en/v1/intro.html) and that you understand the [limitations](https://react-leaflet.js.org/docs/en/v1/intro.html#limitations).
- [ ] All peer dependencies are installed: React, ReactDOM and Leaflet.
- [ ] Using a supported version of React and ReactDOM (v15.x or v16.x).
- [ ] Using the supported version of Leaflet (v1.3.x) and its corresponding CSS file is loaded.
- [ ] Using the [latest stable version of React-Leaflet](https://github.com/PaulLeCam/react-leaflet/releases) - **not v2 RC**.
- [ ] The issue has not already been reported.
- [ ] Make sure you have followed the [quick start guide](http://leafletjs.com/examples/quick-start.html) for Leaflet.
- [ ] Make sure you have fully read the [documentation](https://react-leaflet.js.org/docs/en/v1/intro.html) and that you understand the [limitations](https://react-leaflet.js.org/docs/en/v1/intro.html#limitations).

### Expected behavior

Expand Down
16 changes: 8 additions & 8 deletions .github/ISSUE_TEMPLATE/bug-in-v2.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Bug in v2
about: Report a bug in version 2 (beta) of the library
about: Report a bug in version 2 (RC) of the library

---

Expand All @@ -9,13 +9,13 @@ about: Report a bug in version 2 (beta) of the library
Please make sure to check the following boxes before submitting an issue.\
**Issues opened without using this template will be closed unless they have a good reason not to follow this template.**

* [ ] All peer dependencies are installed: React, ReactDOM and Leaflet.
* [ ] Using a supported version of React and ReactDOM (v16.3.0 minimum).
* [ ] Using the supported version of Leaflet (v1.3.x) and its corresponding CSS file is loaded.
* [ ] Using the [latest v2 beta version of React-Leaflet](https://github.com/PaulLeCam/react-leaflet/releases) - **not v1**.
* [ ] The issue has not already been reported.
* [ ] Make sure you have followed the [quick start guide](http://leafletjs.com/examples/quick-start.html) for Leaflet.
* [ ] Make sure you have fully read the [documentation](https://react-leaflet.js.org/docs/en/intro.html) and that you understand the [limitations](https://react-leaflet.js.org/docs/en/intro.html#limitations).
- [ ] All peer dependencies are installed: React, ReactDOM and Leaflet.
- [ ] Using a supported version of React and ReactDOM (v16.3.0 minimum).
- [ ] Using the supported version of Leaflet (v1.3.x) and its corresponding CSS file is loaded.
- [ ] Using the [latest v2 RC version of React-Leaflet](https://github.com/PaulLeCam/react-leaflet/releases) - **not v1**.
- [ ] The issue has not already been reported.
- [ ] Make sure you have followed the [quick start guide](http://leafletjs.com/examples/quick-start.html) for Leaflet.
- [ ] Make sure you have fully read the [documentation](https://react-leaflet.js.org/docs/en/intro.html) and that you understand the [limitations](https://react-leaflet.js.org/docs/en/intro.html#limitations).

### Expected behavior

Expand Down
471 changes: 171 additions & 300 deletions CHANGELOG.md

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

⚛️ React components for 🍃 Leaflet maps.

⚠️ The master branch contains the code for version 2 of the library, currently in beta. For the stable version, use the [v1 branch](https://github.com/PaulLeCam/react-leaflet/tree/v1).
⚠️ The master branch contains the code for version 2 of the library, currently published in as release candidate. For the stable version, use the [v1 branch](https://github.com/PaulLeCam/react-leaflet/tree/v1).

## [Documentation](http://react-leaflet.js.org)

* [Getting started](https://react-leaflet.js.org/docs/en/intro.html)
* [API reference](https://react-leaflet.js.org/docs/en/context.html)
- [Getting started](https://react-leaflet.js.org/docs/en/intro.html)
- [API reference](https://react-leaflet.js.org/docs/en/context.html)

## Changes

Expand All @@ -19,9 +19,7 @@ See [CONTRIBUTING](CONTRIBUTING.md) file.

## Support

Please **do not** use GitHub issues for support, but instead post your questions
on [StackOverflow](https://stackoverflow.com/) using the
[`react-leaflet` tag](https://stackoverflow.com/questions/tagged/react-leaflet).
Please **do not** use GitHub issues for support, but instead post your questions on [StackOverflow](https://stackoverflow.com/) using the [`react-leaflet` tag](https://stackoverflow.com/questions/tagged/react-leaflet).

## License

Expand Down
72 changes: 21 additions & 51 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -1,90 +1,60 @@
# Upgrading

## v2 (beta)
## v2 (RC)

This release requires [React v16.3.0+](https://reactjs.org/blog/2018/03/29/react-v-16-3.html) and brings breaking changes in the way the necessary context is propagated. Most third-party plugins and custom components will likely need to be updated in order to access the context.

## v1.8

This release requires
[Leaflet v1.3](http://leafletjs.com/2018/01/15/leaflet-1.3.0.html) as peer
dependency.
This release requires [Leaflet v1.3](http://leafletjs.com/2018/01/15/leaflet-1.3.0.html) as peer dependency.

## v1.6

This release makes internal changes to the folders exposed:

* The `src` folder is no longer exported in the npm package, the added `es` one
should be consumed instead if you want to support modules.
* The `lib` and `dist` folders are no longer exported in the GitHub repository,
use the npm package instead if you need to access them.
- The `src` folder is no longer exported in the npm package, the added `es` one should be consumed instead if you want to support modules.
- The `lib` and `dist` folders are no longer exported in the GitHub repository, use the npm package instead if you need to access them.

## v1.5

This release requires
[Leaflet v1.2](http://leafletjs.com/2017/08/08/leaflet-1.2.0.html) as peer
dependency.
This release requires [Leaflet v1.2](http://leafletjs.com/2017/08/08/leaflet-1.2.0.html) as peer dependency.

## v1.4

This release requires
[Leaflet v1.1](http://leafletjs.com/2017/06/27/leaflet-1.1.0.html) in order to
support the newly added features such as dynamic z-index in `ImageOverlay` and
the `VideoOverlay` layer, exposed by React-Leaflet as a component.
This release requires [Leaflet v1.1](http://leafletjs.com/2017/06/27/leaflet-1.1.0.html) in order to support the newly added features such as dynamic z-index in `ImageOverlay` and the `VideoOverlay` layer, exposed by React-Leaflet as a component.

The `prop-types` package is now set as a peer dependency rather than a direct
dependency, so you will need to add it to your application dependencies if not
already set.
The `prop-types` package is now set as a peer dependency rather than a direct dependency, so you will need to add it to your application dependencies if not already set.

## v1.1

This release changes the way Leaflet elements are created and updated
internally. If you are only using public APIs, nothing should change, however if
you are extending or creating custom components, you should now use the added
`createLeafletElement()` and `updateLeafletElement()` methods described in the
[Extending](https://github.com/PaulLeCam/react-leaflet/blob/master/docs/Extending.md#extending)
section of the documentation rather than overriding the lifecycle hooks
directly.\
See the [relevant commit](https://github.com/PaulLeCam/react-leaflet/commit/b42026f9dc93be45f0b8ffc6638a9d3824751091)
for more details about the changes involved.
This release changes the way Leaflet elements are created and updated internally. If you are only using public APIs, nothing should change, however if you are extending or creating custom components, you should now use the added `createLeafletElement()` and `updateLeafletElement()` methods described in the [Extending](https://github.com/PaulLeCam/react-leaflet/blob/master/docs/Extending.md#extending) section of the documentation rather than overriding the lifecycle hooks directly.\
See the [relevant commit](https://github.com/PaulLeCam/react-leaflet/commit/b42026f9dc93be45f0b8ffc6638a9d3824751091) for more details about the changes involved.

## v1.0

React-Leaflet v1 requires Leaflet v1.0.0 and therefore contains breaking changes
from v0.12, based on Leaflet v0.7.\
React-Leaflet v1 requires Leaflet v1.0.0 and therefore contains breaking changes from v0.12, based on Leaflet v0.7.\
Make sure to update your Leaflet dependency to v1.0.0, as well as its CSS file.

The following list includes breaking changes upgrading to React-Leaflet v1.0
from v0.12, it may not be exhaustive:
The following list includes breaking changes upgrading to React-Leaflet v1.0 from v0.12, it may not be exhaustive:

* Renamed `GeoJson` to `GeoJSON` to match Leaflet's change.
* Removed `MultiPolygon` and `MultiPolyline`, now supported by `Polygon` and
`Polyline` respectively.
* Removed `CanvasTileLayer`, replaced by `GridLayer`. See
[Leaflet's documentation](http://leafletjs.com/reference-1.0.0.html#gridlayer).
* Removed `getLeafletElement()` method in `MapComponent` and `MapControl`,
deprecated since v0.12.0.
* Removed `setIconDefaultImagePath()` helper, set
`Leaflet.Icon.Default.imagePath` directly using Leaflet if you need.
- Renamed `GeoJson` to `GeoJSON` to match Leaflet's change.
- Removed `MultiPolygon` and `MultiPolyline`, now supported by `Polygon` and `Polyline` respectively.
- Removed `CanvasTileLayer`, replaced by `GridLayer`. See [Leaflet's documentation](http://leafletjs.com/reference-1.0.0.html#gridlayer).
- Removed `getLeafletElement()` method in `MapComponent` and `MapControl`, deprecated since v0.12.0.
- Removed `setIconDefaultImagePath()` helper, set `Leaflet.Icon.Default.imagePath` directly using Leaflet if you need.

Read the [changelog](CHANGELOG.md) for more details about these changes.

## v0.12.0

**Drop support for IE <= 10** as explained in
[this comment](https://github.com/PaulLeCam/react-leaflet/issues/215#issuecomment-243996907).
**Drop support for IE <= 10** as explained in [this comment](https://github.com/PaulLeCam/react-leaflet/issues/215#issuecomment-243996907).

**Deprecated:** the `getLeafletElement()` method on components is deprecated,
you can simply use the `leafletElement` property instead.
**Deprecated:** the `getLeafletElement()` method on components is deprecated, you can simply use the `leafletElement` property instead.

The major change in this version is the use of
[context](https://facebook.github.io/react/docs/context.html) instead of props
to pass Leaflet instances from components to their children.\
If you are only using the components provided by React-Leaflet, everything should
continue to work as before.
The major change in this version is the use of [context](https://facebook.github.io/react/docs/context.html) instead of props to pass Leaflet instances from components to their children.\
If you are only using the components provided by React-Leaflet, everything should continue to work as before.

If you are using custom components, you may have to update your code to provide
or access the `map`, `layerContainer` and `popupContainer` using context.\
If you are using custom components, you may have to update your code to provide or access the `map`, `layerContainer` and `popupContainer` using context.\
For example, using React-Leaflet < 0.12, you would need to do:

```js
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ open pull requests to update this list!
| [`react-leaflet-control`](https://www.npmjs.com/package/react-leaflet-control) | unknown
| [`react-leaflet-d3`](https://www.npmjs.com/package/react-leaflet-d3) | unknown
| [`react-leaflet-deflate`](https://www.npmjs.com/package/react-leaflet-deflate) | unknown
| [`react-leaflet-distance-marker`](https://www.npmjs.com/package/react-leaflet-distance-marker) | unknown
| [`react-leaflet-div-icon`](https://www.npmjs.com/package/react-leaflet-div-icon) | unknown
| [`react-leaflet-draggable-polyline`](https://www.npmjs.com/package/react-leaflet-draggable-polyline) | unknown
| [`react-leaflet-distance-marker`](https://www.npmjs.com/package/react-leaflet-distance-marker) | unknown
| [`react-leaflet-draw`](https://www.npmjs.com/package/react-leaflet-draw) | unknown
| [`react-leaflet-easyprint`](https://www.npmjs.com/package/react-leaflet-easyprint) | unknown
| [`react-leaflet-fullscreen-control`](https://www.npmjs.com/package/react-leaflet-fullscreen-control) | unknown
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-leaflet",
"version": "2.0.0-beta.1",
"version": "2.0.0-rc.1",
"description": "React components for Leaflet maps",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down Expand Up @@ -67,38 +67,38 @@
"babel-loader": "^7.1.4",
"babel-plugin-dev-expression": "^0.2.1",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-lodash": "^3.3.2",
"babel-plugin-lodash": "^3.3.3",
"babel-plugin-transform-proto-to-assign": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-1": "^6.24.1",
"cross-env": "^5.1.6",
"eslint": "^4.19.1",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-flowtype": "^2.48.0",
"eslint-plugin-flowtype": "^2.49.3",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-promise": "^3.8.0",
"eslint-plugin-react": "^7.8.2",
"flow-bin": "^0.73.0",
"flow-copy-source": "^1.3.0",
"eslint-plugin-react": "^7.9.1",
"flow-bin": "^0.74.0",
"flow-copy-source": "^2.0.0",
"flow-typed": "^2.4.0",
"jest": "^23.1.0",
"leaflet": "^1.3.1",
"prettier": "^1.13.3",
"prettier": "^1.13.5",
"prettier-eslint": "^8.8.1",
"react": "^16.4.0",
"react-dom": "^16.4.0",
"rimraf": "^2.6.2",
"rollup": "^0.59.4",
"rollup": "^0.60.1",
"rollup-plugin-babel": "^3.0.3",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-uglify": "^4.0.0",
"webpack": "^4.10.2",
"webpack-serve": "^1.0.2"
"webpack": "^4.12.0",
"webpack-serve": "^1.0.4"
},
"jest": {
"collectCoverage": true,
Expand Down
13 changes: 5 additions & 8 deletions src/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ const OTHER_PROPS = [
'whenReady',
]

const normalizeCenter = (pos: LatLng): [number, number] =>
Array.isArray(pos) ? [pos[0], pos[1]] : [pos.lat, pos.lon ? pos.lon : pos.lng]
const normalizeCenter = (pos: LatLng): [number, number] => {
return Array.isArray(pos)
? [pos[0], pos[1]]
: [pos.lat, pos.lon ? pos.lon : pos.lng]
}

type LeafletElement = LeafletMap

Expand Down Expand Up @@ -105,12 +108,6 @@ export default class Map extends MapComponent<LeafletElement, Props> {

_updating: boolean = false

// TODO: check using this.props.className works as expected
// constructor(props: Props, context: Object) {
// super(props, context)
// this.className = props.className
// }

createLeafletElement(props: Props): LeafletElement {
const { viewport, ...options } = props
if (viewport) {
Expand Down
5 changes: 3 additions & 2 deletions src/utils/updateClassName.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import { DomUtil } from 'leaflet'

const splitClassName = (className: string = ''): Array<string> =>
className.split(' ').filter(Boolean)
const splitClassName = (className: string = ''): Array<string> => {
return className.split(' ').filter(Boolean)
}

export default (
container: ?HTMLElement,
Expand Down
6 changes: 2 additions & 4 deletions website/pages/en/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class HomeSplash extends React.Component {
</Button>
</PromoSection>
<PromoSection>
<h2>v2 (beta):</h2>
<h2>v2 (release candidate):</h2>
<Button href={docUrl('intro.html', this.props.language)}>
Getting started
</Button>
Expand Down Expand Up @@ -182,9 +182,7 @@ render(map, document.getElementById('map-container'))`}
▶️ this CodePen (v1 - stable)
</a>{' '}
or{' '}
<a href="https://codepen.io/PaulLeCam/pen/gzVmGw">
the v2 (beta) version
</a>.
<a href="https://codepen.io/PaulLeCam/pen/gzVmGw">the v2 (RC) version</a>.
</p>
<PromoSection>
<Button href={docUrl('intro.html', props.language)}>Get started</Button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
id: version-v2-beta-components
id: version-v2-rc-components
title: Components
original_id: components
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
id: version-v2-beta-context
id: version-v2-rc-context
title: Context
original_id: context
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
id: version-v2-beta-custom-components
id: version-v2-rc-custom-components
title: Creating custom components
original_id: custom-components
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
id: version-v2-beta-events
id: version-v2-rc-events
title: Events
original_id: events
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
id: version-v2-beta-examples
id: version-v2-rc-examples
title: Examples
original_id: examples
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
id: version-v2-beta-installation
id: version-v2-rc-installation
title: Installation
original_id: installation
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
id: version-v2-beta-intro
id: version-v2-rc-intro
title: Introduction
original_id: intro
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
id: version-v2-beta-plugins
id: version-v2-rc-plugins
title: Third-party plugins
original_id: plugins
---
Expand All @@ -18,13 +18,16 @@ open pull requests to update this list!
| [`react-leaflet-control`](https://www.npmjs.com/package/react-leaflet-control) | unknown
| [`react-leaflet-d3`](https://www.npmjs.com/package/react-leaflet-d3) | unknown
| [`react-leaflet-deflate`](https://www.npmjs.com/package/react-leaflet-deflate) | unknown
| [`react-leaflet-distance-marker`](https://www.npmjs.com/package/react-leaflet-distance-marker) | unknown
| [`react-leaflet-div-icon`](https://www.npmjs.com/package/react-leaflet-div-icon) | unknown
| [`react-leaflet-draggable-polyline`](https://www.npmjs.com/package/react-leaflet-draggable-polyline) | unknown
| [`react-leaflet-draw`](https://www.npmjs.com/package/react-leaflet-draw) | unknown
| [`react-leaflet-easyprint`](https://www.npmjs.com/package/react-leaflet-easyprint) | unknown
| [`react-leaflet-fullscreen-control`](https://www.npmjs.com/package/react-leaflet-fullscreen-control) | unknown
| [`react-leaflet-geojson-cluster`](https://www.npmjs.com/package/react-leaflet-geojson-cluster) | unknown
| [`react-leaflet-google`](https://www.npmjs.com/package/react-leaflet-google) | unknown
| [`react-leaflet-heatmap-layer`](https://www.npmjs.com/package/react-leaflet-heatmap-layer) | unknown
| [`react-leaflet-locate-control`](https://www.npmjs.com/package/react-leaflet-locate-control) | unknown
| [`react-leaflet-markercluster`](https://www.npmjs.com/package/react-leaflet-markercluster) | unknown
| [`react-leaflet-marker-layer`](https://www.npmjs.com/package/react-leaflet-marker-layer) | unknown
| [`react-leaflet-measure`](https://www.npmjs.com/package/react-leaflet-measure) | unknown
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
id: version-v2-beta-setup
id: version-v2-rc-setup
title: Leaflet setup
original_id: setup
---
Expand Down
Loading

0 comments on commit 5ee17a3

Please sign in to comment.