Skip to content

Commit

Permalink
turn on loose mode options, add proto-to-assign transform for IE9 and…
Browse files Browse the repository at this point in the history
… IE10 support (#235)
  • Loading branch information
dettier authored and PaulLeCam committed Oct 17, 2016
1 parent 2853dff commit 7ee4538
Show file tree
Hide file tree
Showing 39 changed files with 1,735 additions and 2,167 deletions.
4 changes: 2 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"plugins": ["dev-expression", "lodash"],
"presets": ["es2015", "react", "stage-0"]
"plugins": ["dev-expression", "lodash", "transform-proto-to-assign"],
"presets": [ ["es2015", { "loose" : true} ], "react", "stage-0"]
}
2,146 changes: 982 additions & 1,164 deletions dist/react-leaflet.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/react-leaflet.min.js

Large diffs are not rendered by default.

21 changes: 8 additions & 13 deletions lib/AttributionControl.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

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; }; }();
exports.__esModule = true;

var _leaflet = require('leaflet');

Expand All @@ -16,27 +12,26 @@ var _MapControl3 = _interopRequireDefault(_MapControl2);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

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; }

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; }
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) : _defaults(subClass, superClass); }

var AttributionControl = function (_MapControl) {
_inherits(AttributionControl, _MapControl);

function AttributionControl() {
_classCallCheck(this, AttributionControl);

return _possibleConstructorReturn(this, (AttributionControl.__proto__ || Object.getPrototypeOf(AttributionControl)).apply(this, arguments));
return _possibleConstructorReturn(this, _MapControl.apply(this, arguments));
}

_createClass(AttributionControl, [{
key: 'componentWillMount',
value: function componentWillMount() {
this.leafletElement = _leaflet.control.attribution(this.props);
}
}]);
AttributionControl.prototype.componentWillMount = function componentWillMount() {
this.leafletElement = _leaflet.control.attribution(this.props);
};

return AttributionControl;
}(_MapControl3.default);
Expand Down
44 changes: 19 additions & 25 deletions lib/BaseTileLayer.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

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; }; }();
exports.__esModule = true;

var _react = require('react');

Expand All @@ -14,41 +10,39 @@ var _MapLayer3 = _interopRequireDefault(_MapLayer2);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

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; }

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; }
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) : _defaults(subClass, superClass); }

var BaseTileLayer = function (_MapLayer) {
_inherits(BaseTileLayer, _MapLayer);

function BaseTileLayer() {
_classCallCheck(this, BaseTileLayer);

return _possibleConstructorReturn(this, (BaseTileLayer.__proto__ || Object.getPrototypeOf(BaseTileLayer)).apply(this, arguments));
return _possibleConstructorReturn(this, _MapLayer.apply(this, arguments));
}

_createClass(BaseTileLayer, [{
key: 'componentDidUpdate',
value: function componentDidUpdate(prevProps) {
var _props = this.props;
var opacity = _props.opacity;
var zIndex = _props.zIndex;

if (opacity !== prevProps.opacity) {
this.leafletElement.setOpacity(opacity);
}
if (zIndex !== prevProps.zIndex) {
this.leafletElement.setZIndex(zIndex);
}
BaseTileLayer.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
var _props = this.props;
var opacity = _props.opacity;
var zIndex = _props.zIndex;

if (opacity !== prevProps.opacity) {
this.leafletElement.setOpacity(opacity);
}
}, {
key: 'render',
value: function render() {
return null;
if (zIndex !== prevProps.zIndex) {
this.leafletElement.setZIndex(zIndex);
}
}]);
};

BaseTileLayer.prototype.render = function render() {
return null;
};

return BaseTileLayer;
}(_MapLayer3.default);
Expand Down
25 changes: 9 additions & 16 deletions lib/CanvasTileLayer.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

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; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
exports.__esModule = true;

var _leaflet = require('leaflet');

Expand All @@ -16,28 +10,27 @@ var _BaseTileLayer3 = _interopRequireDefault(_BaseTileLayer2);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

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; }

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; }
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) : _defaults(subClass, superClass); }

var CanvasTileLayer = function (_BaseTileLayer) {
_inherits(CanvasTileLayer, _BaseTileLayer);

function CanvasTileLayer() {
_classCallCheck(this, CanvasTileLayer);

return _possibleConstructorReturn(this, (CanvasTileLayer.__proto__ || Object.getPrototypeOf(CanvasTileLayer)).apply(this, arguments));
return _possibleConstructorReturn(this, _BaseTileLayer.apply(this, arguments));
}

_createClass(CanvasTileLayer, [{
key: 'componentWillMount',
value: function componentWillMount() {
_get(CanvasTileLayer.prototype.__proto__ || Object.getPrototypeOf(CanvasTileLayer.prototype), 'componentWillMount', this).call(this);
this.leafletElement = _leaflet.tileLayer.canvas(this.props);
}
}]);
CanvasTileLayer.prototype.componentWillMount = function componentWillMount() {
_BaseTileLayer.prototype.componentWillMount.call(this);
this.leafletElement = _leaflet.tileLayer.canvas(this.props);
};

return CanvasTileLayer;
}(_BaseTileLayer3.default);
Expand Down
50 changes: 21 additions & 29 deletions lib/Circle.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});

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; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
exports.__esModule = true;

var _leaflet = require('leaflet');

Expand All @@ -22,47 +16,45 @@ var _Path3 = _interopRequireDefault(_Path2);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

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; }

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; }
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) : _defaults(subClass, superClass); }

var Circle = function (_Path) {
_inherits(Circle, _Path);

function Circle() {
_classCallCheck(this, Circle);

return _possibleConstructorReturn(this, (Circle.__proto__ || Object.getPrototypeOf(Circle)).apply(this, arguments));
return _possibleConstructorReturn(this, _Path.apply(this, arguments));
}

_createClass(Circle, [{
key: 'componentWillMount',
value: function componentWillMount() {
_get(Circle.prototype.__proto__ || Object.getPrototypeOf(Circle.prototype), 'componentWillMount', this).call(this);
var _props = this.props;
var center = _props.center;
var radius = _props.radius;
Circle.prototype.componentWillMount = function componentWillMount() {
_Path.prototype.componentWillMount.call(this);
var _props = this.props;
var center = _props.center;
var radius = _props.radius;

var props = _objectWithoutProperties(_props, ['center', 'radius']);

var props = _objectWithoutProperties(_props, ['center', 'radius']);
this.leafletElement = (0, _leaflet.circle)(center, radius, props);
};

this.leafletElement = (0, _leaflet.circle)(center, radius, props);
Circle.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
if (this.props.center !== prevProps.center) {
this.leafletElement.setLatLng(this.props.center);
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate(prevProps) {
if (this.props.center !== prevProps.center) {
this.leafletElement.setLatLng(this.props.center);
}
if (this.props.radius !== prevProps.radius) {
this.leafletElement.setRadius(this.props.radius);
}
this.setStyleIfChanged(prevProps, this.props);
if (this.props.radius !== prevProps.radius) {
this.leafletElement.setRadius(this.props.radius);
}
}]);
this.setStyleIfChanged(prevProps, this.props);
};

return Circle;
}(_Path3.default);
Expand Down
Loading

0 comments on commit 7ee4538

Please sign in to comment.