diff --git a/README.md b/README.md index e4b211ac..c745ddc4 100644 --- a/README.md +++ b/README.md @@ -193,12 +193,16 @@ The Popup children will be rendered as its content using `React.renderToStaticMa ## Changelog -v0.4.0-beta.1 +### v0.4.0-rc.1 (11/03/15) -- Updated React dependency to 0.13: +React 0.13.0. + +### v0.4.0-beta.1 (08/03/15) + +- Updated React dependency to 0.13.0-rc2: - Components are defined as ES6 classes. - Mixins are replaced by the base components `MapComponent`, `MapLayer`, `BaseTileLayer` and `PopupContainer`. All components extend from these. - - The new [`React.cloneElement()`](https://facebook.github.io/react/blog/2015/03/03/react-v0.13-rc2.html#react.cloneelement) API is used instead of `React.cloneWithProps()` to pass the `map` property to the components. + - The new [`React.cloneElement()`](https://facebook.github.io/react/blog/2015/03/03/react-v0.13-rc2.html#react.cloneelement) API is used instead of the deprecated `React.addons.cloneWithProps()` to pass the `map` property to the components. - The `map` property has been removed from the components `propTypes` definition as it is dynamically injected to its children by the `Map` component, React would [now warn it is not set](https://facebook.github.io/react/blog/2015/02/24/streamlining-react-elements.html#solution-early-proptype-warnings). It is still required by components to have access to the Leaflet object. - Events can now be set as `on{Event}` rather than `onLeaflet{Event}`, ex `onClick` instead of `onLeafletClick`, as all events are proxied to Leaflet. - Deprecated `getLeafletElement()` method, simply use the `leafletElement` property instead to access the Leaflet object created for a component. diff --git a/example/build/app.js b/example/build/app.js index 2d5d6fec..91120ff4 100755 --- a/example/build/app.js +++ b/example/build/app.js @@ -51,7 +51,7 @@ React.render(examples, document.getElementById("app")); var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; -var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; +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 _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; }; @@ -81,13 +81,11 @@ var EventsExample = (function (_React$Component) { _inherits(EventsExample, _React$Component); - _prototypeProperties(EventsExample, null, { + _createClass(EventsExample, { handleClick: { value: function handleClick() { this.refs.map.leafletElement.locate(); - }, - writable: true, - configurable: true + } }, handleLocationFound: { value: function handleLocationFound(e) { @@ -95,9 +93,7 @@ var EventsExample = (function (_React$Component) { hasLocation: true, latlng: e.latlng }); - }, - writable: true, - configurable: true + } }, render: { value: function render() { @@ -128,9 +124,7 @@ var EventsExample = (function (_React$Component) { }), marker ); - }, - writable: true, - configurable: true + } } }); @@ -144,7 +138,7 @@ module.exports = EventsExample; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; -var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; +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 _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; }; @@ -172,7 +166,7 @@ var SimpleExample = (function (_React$Component) { _inherits(SimpleExample, _React$Component); - _prototypeProperties(SimpleExample, null, { + _createClass(SimpleExample, { render: { value: function render() { var position = [this.state.lat, this.state.lng]; @@ -199,9 +193,7 @@ var SimpleExample = (function (_React$Component) { ) ) ); - }, - writable: true, - configurable: true + } } }); @@ -215,7 +207,7 @@ module.exports = SimpleExample; var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; -var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; +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 _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; }; @@ -247,7 +239,7 @@ var VectorLayersExample = (function (_React$Component) { _inherits(VectorLayersExample, _React$Component); - _prototypeProperties(VectorLayersExample, null, { + _createClass(VectorLayersExample, { render: { value: function render() { var center = [51.505, -0.09]; @@ -289,9 +281,7 @@ var VectorLayersExample = (function (_React$Component) { React.createElement(MultiPolygon, { polygons: multiPolygon, color: "purple" }), React.createElement(Rectangle, { bounds: rectangle, color: "black" }) ); - }, - writable: true, - configurable: true + } } }); diff --git a/example/build/dependencies.js b/example/build/dependencies.js index bba0cb5b..4a77321a 100755 --- a/example/build/dependencies.js +++ b/example/build/dependencies.js @@ -35,6 +35,7 @@ process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues +process.versions = {}; function noop() {} @@ -4543,7 +4544,7 @@ if ("production" !== process.env.NODE_ENV) { } } -React.version = '0.13.0-rc2'; +React.version = '0.13.0'; module.exports = React; @@ -6459,7 +6460,7 @@ ReactComponent.prototype.setState = function(partialState, callback) { * You may want to call this when you know that some deeper aspect of the * component's state has changed but `setState` was not called. * - * This will not invoke `shouldUpdateComponent`, but it will invoke + * This will not invoke `shouldComponentUpdate`, but it will invoke * `componentWillUpdate` and `componentDidUpdate`. * * @param {?function} callback Called after update is complete. @@ -6482,6 +6483,7 @@ if ("production" !== process.env.NODE_ENV) { var deprecatedAPIs = { getDOMNode: 'getDOMNode', isMounted: 'isMounted', + replaceProps: 'replaceProps', replaceState: 'replaceState', setProps: 'setProps' }; @@ -6805,6 +6807,20 @@ var ReactCompositeComponentMixin = { // Initialize the public class var inst = new Component(publicProps, publicContext); + + if ("production" !== process.env.NODE_ENV) { + // This will throw later in _renderValidatedComponent, but add an early + // warning now to help debugging + ("production" !== process.env.NODE_ENV ? warning( + inst.render != null, + '%s(...): No `render` method found on the returned component ' + + 'instance: you may have forgotten to define `render` in your ' + + 'component or you may have accidentally tried to render an element ' + + 'whose type is a function that isn\'t a React component.', + Component.displayName || Component.name || 'Component' + ) : null); + } + // These should be set up in the constructor, but as a convenience for // simpler class abstractions, we set them up after the fact. inst.props = publicProps; @@ -10063,17 +10079,12 @@ var ReactDefaultPerf = { addValue(entry.inclusive, rootNodeID, totalTime); } - var displayName = null; - if (this._instance.constructor.displayName) { - displayName = this._instance.constructor.displayName; - } else if (this._currentElement.type) { - displayName = this._currentElement.type; - } - entry.displayNames[rootNodeID] = { - current: displayName, + current: typeof this._currentElement.type === 'string' ? + this._currentElement.type : + this.getName(), owner: this._currentElement._owner ? - this._currentElement._owner._instance.constructor.displayName : + this._currentElement._owner.getName() : '' }; @@ -14465,6 +14476,7 @@ function isNode(propValue) { switch (typeof propValue) { case 'number': case 'string': + case 'undefined': return true; case 'boolean': return !propValue; @@ -14472,7 +14484,7 @@ function isNode(propValue) { if (Array.isArray(propValue)) { return propValue.every(isNode); } - if (ReactElement.isValidElement(propValue)) { + if (propValue === null || ReactElement.isValidElement(propValue)) { return true; } propValue = ReactFragment.extractIfFragment(propValue); diff --git a/example/build/lib.js b/example/build/lib.js index 031b6842..ea28ff0f 100755 --- a/example/build/lib.js +++ b/example/build/lib.js @@ -1611,7 +1611,7 @@ function baseAssign(object, source, customizer) { value = object[key], result = customizer(value, source[key], key, object, source); - if ((result === result ? result !== value : value === value) || + if ((result === result ? (result !== value) : (value === value)) || (typeof value == 'undefined' && !(key in object))) { object[key] = result; } @@ -2572,8 +2572,10 @@ function equalObjects(object, other, equalFunc, customizer, isWhere, stackA, sta othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { return false; } } @@ -2785,7 +2787,7 @@ function isIterateeCall(value, index, object) { } if (prereq) { var other = object[index]; - return value === value ? value === other : other !== other; + return value === value ? (value === other) : (other !== other); } return false; } @@ -3320,7 +3322,7 @@ var keys = !nativeKeys ? shimKeys : function(object) { length = object.length; } if ((typeof Ctor == 'function' && Ctor.prototype === object) || - (typeof object != 'function' && (length && isLength(length)))) { + (typeof object != 'function' && (length && isLength(length)))) { return shimKeys(object); } return isObject(object) ? nativeKeys(object) : []; diff --git a/package.json b/package.json index 874bed8f..cc05fda4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-leaflet", - "version": "0.4.0-beta.1", + "version": "0.4.0-rc.1", "description": "React components for Leaflet maps", "main": "lib/index.js", "scripts": { @@ -30,14 +30,14 @@ }, "homepage": "https://github.com/PaulLeCam/react-leaflet", "dependencies": { - "lodash": "^3.4.0" + "lodash": "^3.0.0" }, "peerDependencies": { "leaflet": "^0.7.0", - "react": "^0.13.0-rc2" + "react": "^0.13.0" }, "devDependencies": { - "babel": "^4.7.3", + "babel": "^4.7.8", "babelify": "^5.0.3", "browserify": "^9.0.3", "gulp": "^3.8.10", @@ -47,7 +47,7 @@ "jest-cli": "^0.4.0", "leaflet": "^0.7.3", "onchange": "^1.0.0", - "react": "^0.13.0-rc2", + "react": "^0.13.0", "vinyl-source-stream2": "^0.1.1", "watchify": "^2.4.0" },