Skip to content

Commit

Permalink
Update Babel to v5
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulLeCam committed Apr 6, 2015
1 parent 06e2092 commit 4d48fe0
Show file tree
Hide file tree
Showing 42 changed files with 2,751 additions and 2,140 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ These components are base classes used by other components. They can be extended
##### MapComponent

Base class extending `React.Component` and handling events binding and unbind.
It exposes a `leafletElement` property to access the `Leaflet` object created for the component.
It exposes a `getLeafletElement()` method to access the `Leaflet` object created for the component.

##### MapLayer

Expand Down Expand Up @@ -193,6 +193,15 @@ The Popup children will be rendered as its content using `React.renderToStaticMa

## Changelog

### v0.4.1 (06/04/15)

- Removed `getLeafletElement()` deprecation.
- Updated Babel to v5.

### v0.4.0 (28/03/15)

Released v0.4.

### v0.4.0-rc.1 (11/03/15)

React 0.13.0.
Expand Down
339 changes: 175 additions & 164 deletions example/build/app.js

Large diffs are not rendered by default.

22 changes: 14 additions & 8 deletions example/build/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -4544,7 +4544,7 @@ if ("production" !== process.env.NODE_ENV) {
}
}

React.version = '0.13.0';
React.version = '0.13.1';

module.exports = React;

Expand Down Expand Up @@ -8268,6 +8268,7 @@ ReactDOMComponent.Mixin = {
styleUpdates[styleName] = '';
}
}
this._previousStyleCopy = null;
} else if (registrationNameModules.hasOwnProperty(propKey)) {
deleteListener(this._rootNodeID, propKey);
} else if (
Expand Down Expand Up @@ -9047,7 +9048,9 @@ function updateOptions(component, propValue) {
return;
}
}
options[0].selected = true;
if (options.length) {
options[0].selected = true;
}
}
}

Expand Down Expand Up @@ -10000,8 +10003,8 @@ var ReactDefaultPerf = {
ReactDefaultPerf._allMeasurements.length - 1
].totalTime = performanceNow() - start;
return rv;
} else if (moduleName === 'ReactDOMIDOperations' ||
moduleName === 'ReactComponentBrowserEnvironment') {
} else if (fnName === '_mountImageIntoNode' ||
moduleName === 'ReactDOMIDOperations') {
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
Expand Down Expand Up @@ -10047,6 +10050,10 @@ var ReactDefaultPerf = {
(fnName === 'mountComponent' ||
fnName === 'updateComponent' || fnName === '_renderValidatedComponent')))) {

if (typeof this._currentElement.type === 'string') {
return func.apply(this, args);
}

var rootNodeID = fnName === 'mountComponent' ?
args[0] :
this._rootNodeID;
Expand Down Expand Up @@ -10080,9 +10087,7 @@ var ReactDefaultPerf = {
}

entry.displayNames[rootNodeID] = {
current: typeof this._currentElement.type === 'string' ?
this._currentElement.type :
this.getName(),
current: this.getName(),
owner: this._currentElement._owner ?
this._currentElement._owner.getName() :
'<root>'
Expand Down Expand Up @@ -15357,7 +15362,7 @@ var ReactTestUtils = {
isDOMComponent: function(inst) {
// TODO: Fix this heuristic. It's just here because composites can currently
// pretend to be DOM components.
return !!(inst && inst.getDOMNode && inst.tagName);
return !!(inst && inst.tagName && inst.getDOMNode);
},

isDOMComponentElement: function(inst) {
Expand Down Expand Up @@ -19017,6 +19022,7 @@ function createFullPageComponent(tag) {
var elementFactory = ReactElement.createFactory(tag);

var FullPageComponent = ReactClass.createClass({
tagName: tag.toUpperCase(),
displayName: 'ReactFullPageComponent' + tag,

componentWillUnmount: function() {
Expand Down
2,349 changes: 1,313 additions & 1,036 deletions example/build/lib.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions example/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Map, TileLayer, Marker, Popup} from "react-leaflet";

export default class EventsExample extends React.Component {
constructor() {
super();
this.state = {
hasLocation: false,
latlng: {
Expand Down
1 change: 1 addition & 0 deletions example/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Map, TileLayer, Marker, Popup} from "react-leaflet";

export default class SimpleExample extends React.Component {
constructor() {
super();
this.state = {
lat: 51.505,
lng: -0.09,
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ simpleBundler = browserify(exampleSrc + "/app.js", watchify.args)
.external("react/addons")
.external("leaflet")
.external("react-leaflet")
.transform(babelify, {experimental: true});
.transform(babelify, {stage: 1});

gulp.task("example:deps", function() {
var bundler = browserify()
Expand Down
64 changes: 36 additions & 28 deletions lib/BaseTileLayer.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
"use strict";

var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };

var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

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 _inherits = function (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) subClass.__proto__ = superClass; };

var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Object.defineProperty(exports, "__esModule", {
value: true
});

var _React = require("react");

var React = _interopRequire(require("react"));
var _React2 = _interopRequireWildcard(_React);

var MapLayer = _interopRequire(require("./MapLayer"));
var _MapLayer2 = require("./MapLayer");

var _MapLayer3 = _interopRequireWildcard(_MapLayer2);

var BaseTileLayer = (function (_MapLayer) {
function BaseTileLayer() {
Expand All @@ -23,34 +31,34 @@ var BaseTileLayer = (function (_MapLayer) {

_inherits(BaseTileLayer, _MapLayer);

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

if (opacity && opacity !== prevProps.opacity) {
this.leafletElement.setOpacity(opacity);
}
if (zIndex && zIndex !== prevProps.zIndex) {
this.leafletElement.setZIndex(zIndex);
}
_createClass(BaseTileLayer, [{
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
var _props = this.props;
var opacity = _props.opacity;
var zIndex = _props.zIndex;

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

return BaseTileLayer;
})(MapLayer);
})(_MapLayer3["default"]);

module.exports = BaseTileLayer;
exports["default"] = BaseTileLayer;

BaseTileLayer.propTypes = {
opacity: React.PropTypes.number,
zIndex: React.PropTypes.number
};
opacity: _React2["default"].PropTypes.number,
zIndex: _React2["default"].PropTypes.number
};
module.exports = exports["default"];
44 changes: 26 additions & 18 deletions lib/CanvasTileLayer.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
"use strict";

var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };

var _objectWithoutProperties = function (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; };

var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

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) { 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 && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _get = function get(object, property, receiver) { 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); } };

var _inherits = function (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) subClass.__proto__ = superClass; };

var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Object.defineProperty(exports, "__esModule", {
value: true
});

var _Leaflet = require("leaflet");

var _Leaflet2 = _interopRequireWildcard(_Leaflet);

var Leaflet = _interopRequire(require("leaflet"));
var _BaseTileLayer2 = require("./BaseTileLayer");

var BaseTileLayer = _interopRequire(require("./BaseTileLayer"));
var _BaseTileLayer3 = _interopRequireWildcard(_BaseTileLayer2);

var CanvasTileLayer = (function (_BaseTileLayer) {
function CanvasTileLayer() {
Expand All @@ -27,21 +35,21 @@ var CanvasTileLayer = (function (_BaseTileLayer) {

_inherits(CanvasTileLayer, _BaseTileLayer);

_createClass(CanvasTileLayer, {
componentWillMount: {
value: function componentWillMount() {
_get(Object.getPrototypeOf(CanvasTileLayer.prototype), "componentWillMount", this).call(this);
var _props = this.props;
var map = _props.map;
_createClass(CanvasTileLayer, [{
key: "componentWillMount",
value: function componentWillMount() {
_get(Object.getPrototypeOf(CanvasTileLayer.prototype), "componentWillMount", this).call(this);
var _props = this.props;
var map = _props.map;

var props = _objectWithoutProperties(_props, ["map"]);
var props = _objectWithoutProperties(_props, ["map"]);

this.leafletElement = Leaflet.tileLayer.canvas(props);
}
this.leafletElement = _Leaflet2["default"].tileLayer.canvas(props);
}
});
}]);

return CanvasTileLayer;
})(BaseTileLayer);
})(_BaseTileLayer3["default"]);

module.exports = CanvasTileLayer;
exports["default"] = CanvasTileLayer;
module.exports = exports["default"];
78 changes: 45 additions & 33 deletions lib/Circle.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
"use strict";

var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };

var _objectWithoutProperties = function (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; };

var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

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) { 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 && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _get = function get(object, property, receiver) { 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); } };

var _inherits = function (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) subClass.__proto__ = superClass; };

var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Object.defineProperty(exports, "__esModule", {
value: true
});

var _React = require("react");

var React = _interopRequire(require("react"));
var _React2 = _interopRequireWildcard(_React);

var Leaflet = _interopRequire(require("leaflet"));
var _Leaflet = require("leaflet");

var latlngType = _interopRequire(require("./types/latlng"));
var _Leaflet2 = _interopRequireWildcard(_Leaflet);

var PopupContainer = _interopRequire(require("./PopupContainer"));
var _latlngType = require("./types/latlng");

var _latlngType2 = _interopRequireWildcard(_latlngType);

var _PopupContainer2 = require("./PopupContainer");

var _PopupContainer3 = _interopRequireWildcard(_PopupContainer2);

var Circle = (function (_PopupContainer) {
function Circle() {
Expand All @@ -31,38 +43,38 @@ var Circle = (function (_PopupContainer) {

_inherits(Circle, _PopupContainer);

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

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

this.leafletElement = Leaflet.circle(center, radius, props);
this.leafletElement = _Leaflet2["default"].circle(center, radius, props);
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (this.props.center !== prevProps.center) {
this.leafletElement.setLatLng(this.props.center);
}
},
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);
}
if (this.props.radius !== prevProps.radius) {
this.leafletElement.setRadius(this.props.radius);
}
}
});
}]);

return Circle;
})(PopupContainer);
})(_PopupContainer3["default"]);

module.exports = Circle;
exports["default"] = Circle;

Circle.propTypes = {
center: latlngType.isRequired,
radius: React.PropTypes.number.isRequired
};
center: _latlngType2["default"].isRequired,
radius: _React2["default"].PropTypes.number.isRequired
};
module.exports = exports["default"];
Loading

0 comments on commit 4d48fe0

Please sign in to comment.