react-leaflet-d3 0.1.4 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,74 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
8
-
9
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
10
-
11
- var _reactLeaflet = require('react-leaflet');
12
-
13
- var _leaflet = require('leaflet');
14
-
15
- var _leaflet2 = _interopRequireDefault(_leaflet);
16
-
17
- require('@asymmetrik/leaflet-d3');
18
-
19
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
-
21
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
22
-
23
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
24
-
25
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
26
-
27
- var HexbinLayer = function (_MapLayer) {
28
- _inherits(HexbinLayer, _MapLayer);
29
-
30
- function HexbinLayer() {
31
- _classCallCheck(this, HexbinLayer);
32
-
33
- return _possibleConstructorReturn(this, (HexbinLayer.__proto__ || Object.getPrototypeOf(HexbinLayer)).apply(this, arguments));
34
- }
35
-
36
- _createClass(HexbinLayer, [{
37
- key: 'createLeafletElement',
38
- value: function createLeafletElement(props) {
39
- var tooltip = props.tooltip;
40
-
41
- return _leaflet2.default.hexbinLayer(props).hoverHandler(_leaflet2.default.HexbinHoverHandler.tooltip(tooltip));
42
- }
43
- }, {
44
- key: 'componentDidMount',
45
- value: function componentDidMount() {
46
- var layerContainer = this.context.layerContainer;
47
- var data = this.props.data;
48
-
49
- var points = data.features.filter(function (feat) {
50
- return feat.hasOwnProperty('geometry') && feat.geometry && _typeof(feat.geometry) === 'object' && feat.geometry.hasOwnProperty('type') && feat.geometry.type === 'Point';
51
- });
52
- var coordinates = points.map(function (feat) {
53
- return feat.geometry.coordinates;
54
- });
55
- this.leafletElement.addTo(layerContainer);
56
- if (coordinates.length) this.leafletElement.data(coordinates);
57
- }
58
- }, {
59
- key: 'componentWillUnmount',
60
- value: function componentWillUnmount() {
61
- var _context = this.context,
62
- layerContainer = _context.layerContainer,
63
- map = _context.map;
64
-
65
- this.leafletElement.data(null);
66
- map.removeLayer(this.leafletElement);
67
- layerContainer.removeLayer(this.leafletElement);
68
- }
69
- }]);
70
-
71
- return HexbinLayer;
72
- }(_reactLeaflet.MapLayer);
73
-
74
- exports.default = HexbinLayer;
package/lib/PingLayer.js DELETED
@@ -1,56 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
-
9
- var _reactLeaflet = require('react-leaflet');
10
-
11
- var _leaflet = require('leaflet');
12
-
13
- var _leaflet2 = _interopRequireDefault(_leaflet);
14
-
15
- require('@asymmetrik/leaflet-d3');
16
-
17
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
-
19
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20
-
21
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
22
-
23
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
24
-
25
- var PingLayer = function (_MapLayer) {
26
- _inherits(PingLayer, _MapLayer);
27
-
28
- function PingLayer() {
29
- _classCallCheck(this, PingLayer);
30
-
31
- return _possibleConstructorReturn(this, (PingLayer.__proto__ || Object.getPrototypeOf(PingLayer)).apply(this, arguments));
32
- }
33
-
34
- _createClass(PingLayer, [{
35
- key: 'createLeafletElement',
36
- value: function createLeafletElement(props) {
37
- return _leaflet2.default.pingLayer(props);
38
- }
39
- }, {
40
- key: 'componentDidMount',
41
- value: function componentDidMount() {
42
- var layerContainer = this.context.layerContainer;
43
-
44
- this.leafletElement.addTo(layerContainer);
45
- }
46
- }, {
47
- key: 'ping',
48
- value: function ping(coordinates, customClass) {
49
- this.leafletElement.ping(coordinates, customClass);
50
- }
51
- }]);
52
-
53
- return PingLayer;
54
- }(_reactLeaflet.MapLayer);
55
-
56
- exports.default = PingLayer;
package/lib/index.js DELETED
@@ -1,19 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.HexbinLayer = exports.PingLayer = undefined;
7
-
8
- var _PingLayer = require('./PingLayer');
9
-
10
- var _PingLayer2 = _interopRequireDefault(_PingLayer);
11
-
12
- var _HexbinLayer = require('./HexbinLayer');
13
-
14
- var _HexbinLayer2 = _interopRequireDefault(_HexbinLayer);
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- exports.PingLayer = _PingLayer2.default;
19
- exports.HexbinLayer = _HexbinLayer2.default;
@@ -1,26 +0,0 @@
1
- import { MapLayer } from 'react-leaflet';
2
- import L from 'leaflet';
3
- import '@asymmetrik/leaflet-d3';
4
-
5
- export default class HexbinLayer extends MapLayer {
6
- createLeafletElement(props) {
7
- const { tooltip } = props;
8
- return L.hexbinLayer(props).hoverHandler(L.HexbinHoverHandler.tooltip(tooltip));
9
- }
10
-
11
- componentDidMount() {
12
- const { layerContainer } = this.context;
13
- const { data } = this.props;
14
- const points = data.features.filter((feat) => feat.hasOwnProperty('geometry') && feat.geometry && typeof feat.geometry === 'object' && feat.geometry.hasOwnProperty('type') && feat.geometry.type === 'Point');
15
- const coordinates = points.map(feat => feat.geometry.coordinates);
16
- this.leafletElement.addTo(layerContainer);
17
- if (coordinates.length) this.leafletElement.data(coordinates);
18
- }
19
-
20
- componentWillUnmount() {
21
- const { layerContainer, map } = this.context;
22
- this.leafletElement.data(null);
23
- map.removeLayer(this.leafletElement);
24
- layerContainer.removeLayer(this.leafletElement);
25
- }
26
- }
package/src/PingLayer.js DELETED
@@ -1,18 +0,0 @@
1
- import { MapLayer } from 'react-leaflet';
2
- import L from 'leaflet';
3
- import '@asymmetrik/leaflet-d3';
4
-
5
- export default class PingLayer extends MapLayer {
6
- createLeafletElement(props) {
7
- return L.pingLayer(props);
8
- }
9
-
10
- componentDidMount() {
11
- const { layerContainer } = this.context;
12
- this.leafletElement.addTo(layerContainer);
13
- }
14
-
15
- ping(coordinates, customClass) {
16
- this.leafletElement.ping(coordinates, customClass);
17
- }
18
- }
package/src/hexbin.css DELETED
@@ -1,16 +0,0 @@
1
- .hexbin-hexagon {
2
- stroke: #000;
3
- stroke-width: 1px;
4
- }
5
- .hexbin-container:hover .hexbin-hexagon {
6
- transition: 200ms;
7
- stroke: orange;
8
- stroke-width: 1px;
9
- stroke-opacity: 1;
10
- }
11
- .hexbin-tooltip {
12
- padding: 8px;
13
- border-radius: 4px;
14
- border: 1px solid black;
15
- background-color: white;
16
- }
package/src/index.js DELETED
@@ -1,4 +0,0 @@
1
- import PingLayer from './PingLayer';
2
- import HexbinLayer from './HexbinLayer';
3
-
4
- export { PingLayer, HexbinLayer };
package/src/ping.css DELETED
@@ -1,5 +0,0 @@
1
- .ping {
2
- fill: #f00;
3
- stroke: #222;
4
- stroke-width: 0.5px;
5
- }
package/webpack.config.js DELETED
@@ -1,48 +0,0 @@
1
- /* eslint-disable */
2
- module.exports = {
3
- output: {
4
- library: 'ReactLeafletD3',
5
- libraryTarget: 'umd'
6
- },
7
- externals: [
8
- {
9
- leaflet: {
10
- amd: 'leaflet',
11
- commonjs: 'leaflet',
12
- commonjs2: 'leaflet',
13
- root: 'L'
14
- }
15
- },
16
- {
17
- jquery: {
18
- amd: 'jquery',
19
- commonjs: 'jquery',
20
- commonjs2: 'jquery',
21
- root: 'JQuery'
22
- }
23
- },
24
- {
25
- 'react-leaflet': {
26
- amd: 'react-leaflet',
27
- commonjs: 'react-leaflet',
28
- commonjs2: 'react-leaflet',
29
- root: 'ReactLeaflet'
30
- }
31
- },
32
- {
33
- react: {
34
- amd: 'react',
35
- commonjs: 'react',
36
- commonjs2: 'react',
37
- root: 'React'
38
- }
39
- },
40
- ],
41
- module: {
42
- loaders: [
43
- { test: /\.js$/, exclude: /node_modules/, loader: 'babel' },
44
- { test: /\.css$/, exclude: /node_modules/, loader: 'style-loader!css-loader'}
45
- ]
46
- }
47
- };
48
-