bacon.react.base
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -12,3 +12,3 @@ "use strict"; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
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; }; }(); | ||
@@ -21,3 +21,3 @@ var _baconjs = require("baconjs"); | ||
var _ramda2 = _interopRequireDefault(_ramda); | ||
var R = _interopRequireWildcard(_ramda); | ||
@@ -28,4 +28,12 @@ var _react = require("react"); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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; } | ||
// Lifting | ||
@@ -42,29 +50,52 @@ | ||
var common = { | ||
getInitialState: function getInitialState() { | ||
return nullState; | ||
}, | ||
tryDispose: function tryDispose() { | ||
var dispose = this.state.dispose; | ||
var LiftedComponent = function (_React$Component) { | ||
_inherits(LiftedComponent, _React$Component); | ||
if (dispose) dispose(); | ||
}, | ||
componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | ||
this.trySubscribe(nextProps); | ||
}, | ||
componentWillMount: function componentWillMount() { | ||
this.trySubscribe(this.props); | ||
}, | ||
shouldComponentUpdate: function shouldComponentUpdate(np, ns) { | ||
return ns.rendered !== this.state.rendered; | ||
}, | ||
componentWillUnmount: function componentWillUnmount() { | ||
this.tryDispose(); | ||
this.setState(nullState); | ||
}, | ||
render: function render() { | ||
return this.state.rendered; | ||
function LiftedComponent(props) { | ||
_classCallCheck(this, LiftedComponent); | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LiftedComponent).call(this, props)); | ||
_this.state = nullState; | ||
return _this; | ||
} | ||
}; | ||
_createClass(LiftedComponent, [{ | ||
key: "tryDispose", | ||
value: function tryDispose() { | ||
var dispose = this.state.dispose; | ||
if (dispose) dispose(); | ||
} | ||
}, { | ||
key: "componentWillReceiveProps", | ||
value: function componentWillReceiveProps(nextProps) { | ||
this.trySubscribe(nextProps); | ||
} | ||
}, { | ||
key: "componentWillMount", | ||
value: function componentWillMount() { | ||
this.trySubscribe(this.props); | ||
} | ||
}, { | ||
key: "shouldComponentUpdate", | ||
value: function shouldComponentUpdate(np, ns) { | ||
return ns.rendered !== this.state.rendered; | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.tryDispose(); | ||
this.setState(nullState); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
return this.state.rendered; | ||
} | ||
}]); | ||
return LiftedComponent; | ||
}(_react2.default.Component); | ||
var toProperty = function toProperty(obs) { | ||
@@ -74,22 +105,35 @@ return obs instanceof _baconjs2.default.EventStream ? obs.toProperty() : obs; | ||
var FromBacon = _react2.default.createClass(_extends({}, common, { | ||
trySubscribe: function trySubscribe(_ref) { | ||
var _this = this; | ||
var FromBacon = function (_LiftedComponent) { | ||
_inherits(FromBacon, _LiftedComponent); | ||
var bacon = _ref.bacon; | ||
function FromBacon(props) { | ||
_classCallCheck(this, FromBacon); | ||
this.tryDispose(); | ||
this.setState({ dispose: bacon.subscribe(function (ev) { | ||
if (ev.hasValue()) { | ||
_this.setState({ rendered: ev.value() }); | ||
} else if (ev.isError()) { | ||
config.onError(ev.error); | ||
} else { | ||
_this.setState(nullDispose); | ||
} | ||
}) }); | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(FromBacon).call(this, props)); | ||
} | ||
})); | ||
_createClass(FromBacon, [{ | ||
key: "trySubscribe", | ||
value: function trySubscribe(_ref) { | ||
var _this3 = this; | ||
var bacon = _ref.bacon; | ||
this.tryDispose(); | ||
this.setState({ dispose: bacon.subscribe(function (ev) { | ||
if (ev.hasValue()) { | ||
_this3.setState({ rendered: ev.value() }); | ||
} else if (ev.isError()) { | ||
config.onError(ev.error); | ||
} else { | ||
_this3.setState(nullDispose); | ||
} | ||
}) }); | ||
} | ||
}]); | ||
return FromBacon; | ||
}(LiftedComponent); | ||
var fromBacon = exports.fromBacon = function fromBacon(bacon) { | ||
@@ -105,62 +149,75 @@ return _react2.default.createElement(FromBacon, { bacon: bacon }); | ||
var FromClass = _react2.default.createClass(_extends({}, common, { | ||
trySubscribe: function trySubscribe(_ref2) { | ||
var _this2 = this; | ||
var FromClass = function (_LiftedComponent2) { | ||
_inherits(FromClass, _LiftedComponent2); | ||
var props = _ref2.props; | ||
function FromClass(props) { | ||
_classCallCheck(this, FromClass); | ||
this.tryDispose(); | ||
return _possibleConstructorReturn(this, Object.getPrototypeOf(FromClass).call(this, props)); | ||
} | ||
var vals = {}; | ||
var obsKeys = []; | ||
var obsStreams = []; | ||
_createClass(FromClass, [{ | ||
key: "trySubscribe", | ||
value: function trySubscribe(_ref2) { | ||
var _this5 = this; | ||
for (var key in props) { | ||
var val = props[key]; | ||
var keyOut = "mount" === key ? "ref" : key; | ||
if (val instanceof _baconjs2.default.Observable) { | ||
obsKeys.push(keyOut); | ||
obsStreams.push(val); | ||
} else if ("children" === key && val instanceof Array && val.find(function (c) { | ||
return c instanceof _baconjs2.default.Observable; | ||
})) { | ||
obsKeys.push(keyOut); | ||
obsStreams.push(_baconjs2.default.combineAsArray(val)); | ||
} else { | ||
vals[keyOut] = val; | ||
var props = _ref2.props; | ||
this.tryDispose(); | ||
var vals = {}; | ||
var obsKeys = []; | ||
var obsStreams = []; | ||
for (var key in props) { | ||
var val = props[key]; | ||
var keyOut = "mount" === key ? "ref" : key; | ||
if (val instanceof _baconjs2.default.Observable) { | ||
obsKeys.push(keyOut); | ||
obsStreams.push(val); | ||
} else if ("children" === key && val instanceof Array && val.find(function (c) { | ||
return c instanceof _baconjs2.default.Observable; | ||
})) { | ||
obsKeys.push(keyOut); | ||
obsStreams.push(_baconjs2.default.combineAsArray(val)); | ||
} else { | ||
vals[keyOut] = val; | ||
} | ||
} | ||
} | ||
this.setState({ dispose: combineAsArray(obsStreams).subscribe(function (ev) { | ||
if (ev.hasValue()) { | ||
var obsVals = ev.value(); | ||
var _props = {}; | ||
var children = null; | ||
for (var _key in vals) { | ||
var _val = vals[_key]; | ||
if ("children" === _key) { | ||
children = _val; | ||
} else { | ||
_props[_key] = _val; | ||
this.setState({ dispose: combineAsArray(obsStreams).subscribe(function (ev) { | ||
if (ev.hasValue()) { | ||
var obsVals = ev.value(); | ||
var _props = {}; | ||
var children = null; | ||
for (var _key in vals) { | ||
var _val = vals[_key]; | ||
if ("children" === _key) { | ||
children = _val; | ||
} else { | ||
_props[_key] = _val; | ||
} | ||
} | ||
} | ||
for (var i = 0, n = obsKeys.length; i < n; ++i) { | ||
var _key2 = obsKeys[i]; | ||
var _val2 = obsVals[i]; | ||
if ("children" === _key2) { | ||
children = _val2; | ||
} else { | ||
_props[_key2] = _val2; | ||
for (var i = 0, n = obsKeys.length; i < n; ++i) { | ||
var _key2 = obsKeys[i]; | ||
var _val2 = obsVals[i]; | ||
if ("children" === _key2) { | ||
children = _val2; | ||
} else { | ||
_props[_key2] = _val2; | ||
} | ||
} | ||
_this5.setState({ rendered: _react2.default.createElement(_this5.props.Class, _props, children) }); | ||
} else if (ev.isError()) { | ||
config.onError(ev.error); | ||
} else { | ||
_this5.setState(nullDispose); | ||
} | ||
_this2.setState({ rendered: _react2.default.createElement(_this2.props.Class, _props, children) }); | ||
} else if (ev.isError()) { | ||
config.onError(ev.error); | ||
} else { | ||
_this2.setState(nullDispose); | ||
} | ||
}) }); | ||
} | ||
})); | ||
}) }); | ||
} | ||
}]); | ||
return FromClass; | ||
}(LiftedComponent); | ||
var fromClass = exports.fromClass = function fromClass(Class) { | ||
@@ -224,6 +281,6 @@ return function (props) { | ||
if (2 === n) { | ||
if (arguments[0] instanceof _baconjs2.default.Observable) return toProperty(arguments[0]).map(arguments[1]).skipDuplicates(_ramda2.default.equals); | ||
if (arguments[1] instanceof _baconjs2.default.Observable) return toProperty(arguments[1]).map(arguments[0]).skipDuplicates(_ramda2.default.equals); | ||
if (arguments[0] instanceof _baconjs2.default.Observable) return toProperty(arguments[0]).map(arguments[1]).skipDuplicates(R.equals); | ||
if (arguments[1] instanceof _baconjs2.default.Observable) return toProperty(arguments[1]).map(arguments[0]).skipDuplicates(R.equals); | ||
} | ||
return _baconjs2.default.combineWith.apply(_baconjs2.default, arguments).skipDuplicates(_ramda2.default.equals); | ||
return _baconjs2.default.combineWith.apply(_baconjs2.default, arguments).skipDuplicates(R.equals); | ||
} | ||
@@ -233,2 +290,2 @@ } | ||
exports.default = B; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9iYWNvbi5yZWFjdC5iYXNlLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7QUFBQTs7OztBQUNBOzs7O0FBQ0E7Ozs7Ozs7O0FB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nNTdHJlYW1zLnB1c2godmFsKVxuICAgICAgfSBlbHNlIGlmIChcImNoaWxkcmVuXCIgPT09IGtleSAmJlxuICAgICAgICAgICAgICAgICB2YWwgaW5zdGFuY2VvZiBBcnJheSAmJlxuICAgICAgICAgICAgICAgICB2YWwuZmluZChjID0+IGMgaW5zdGFuY2VvZiBCYWNvbi5PYnNlcnZhYmxlKSkge1xuICAgICAgICBvYnNLZXlzLnB1c2goa2V5T3V0KVxuICAgICAgICBvYnNTdHJlYW1zLnB1c2goQmFjb24uY29tYmluZUFzQXJyYXkodmFsKSlcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHZhbHNba2V5T3V0XSA9IHZhbFxuICAgICAgfVxuICAgIH1cblxuICAgIHRoaXMuc2V0U3RhdGUoe2Rpc3Bvc2U6IGNvbWJpbmVBc0FycmF5KG9ic1N0cmVhbXMpLnN1YnNjcmliZShldiA9PiB7XG4gICAgICBpZiAoZXYuaGFzVmFsdWUoKSkge1xuICAgICAgICBjb25zdCBvYnNWYWxzID0gZXYudmFsdWUoKVxuICAgICAgICBjb25zdCBwcm9wcyA9IHt9XG4gICAgICAgIGxldCBjaGlsZHJlbiA9IG51bGxcbiAgICAgICAgZm9yIChjb25zdCBrZXkgaW4gdmFscykge1xuICAgICAgICAgIGNvbnN0IHZhbCA9IHZhbHNba2V5XVxuICAgICAgICAgIGlmIChcImNoaWxkcmVuXCIgPT09IGtleSkge2NoaWxkcmVuID0gdmFsfSBlbHNlIHtwcm9wc1trZXldID0gdmFsfVxuICAgICAgICB9XG4gICAgICAgIGZvciAobGV0IGk9MCwgbj1vYnNLZXlzLmxlbmd0aDsgaTxuOyArK2kpIHtcbiAgICAgICAgICBjb25zdCBrZXkgPSBvYnNLZXlzW2ldXG4gICAgICAgICAgY29uc3QgdmFsID0gb2JzVmFsc1tpXVxuICAgICAgICAgIGlmIChcImNoaWxkcmVuXCIgPT09IGtleSkge2NoaWxkcmVuID0gdmFsfSBlbHNlIHtwcm9wc1trZXldID0gdmFsfVxuICAgICAgICB9XG4gICAgICAgIHRoaXMuc2V0U3RhdGUoe3JlbmRlcmVkOiBSZWFjdC5jcmVhdGVFbGVtZW50KHRoaXMucHJvcHMuQ2xhc3MsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BzLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZHJlbil9KVxuICAgICAgfSBlbHNlIGlmIChldi5pc0Vycm9yKCkpIHtcbiAgICAgICAgY29uZmlnLm9uRXJyb3IoZXYuZXJyb3IpXG4gICAgICB9IGVsc2Uge1xuICAgICAgICB0aGlzLnNldFN0YXRlKG51bGxEaXNwb3NlKVxuICAgICAgfVxuICAgIH0pfSlcbiAgfVxufVxuXG5leHBvcnQgY29uc3QgZnJvbUNsYXNzID1cbiAgQ2xhc3MgPT4gcHJvcHMgPT4gUmVhY3QuY3JlYXRlRWxlbWVudChGcm9tQ2xhc3MsIHtDbGFzcywgcHJvcHN9KVxuXG5leHBvcnQgY29uc3QgZnJvbUNsYXNzZXMgPSBjbGFzc2VzID0+IHtcbiAgY29uc3QgcmVzdWx0ID0ge31cbiAgZm9yIChjb25zdCBrIGluIGNsYXNzZXMpXG4gICAgcmVzdWx0W2tdID0gZnJvbUNsYXNzKGNsYXNzZXNba10pXG4gIHJldHVybiByZXN1bHRcbn1cblxuZXhwb3J0IGNvbnN0IGZyb21JZHMgPSAoaWRzLCBmcm9tSWQpID0+IGlkcy5zY2FuKFt7fSwgW11dLCAoW29sZElkc10sIGlkcykgPT4ge1xuICBjb25zdCBuZXdJZHMgPSB7fVxuICBjb25zdCBuZXdWcyA9IEFycmF5KGlkcy5sZW5ndGgpXG4gIGZvciAobGV0IGk9MCwgbj1pZHMubGVuZ3RoOyBpPG47ICsraSkge1xuICAgIGNvbnN0IGlkID0gaWRzW2ldXG4gICAgY29uc3QgayA9IGlkLnRvU3RyaW5nKClcbi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uIEJhY29uLmNvbWJpbmVXaXRoLmFwcGx5KEJhY29uLCBhcmd1bWVudHMpLnNraXBEdXBsaWNhdGVzKFIuZXF1YWxzKVxuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IEJcbiJdfQ== |
{ | ||
"name": "bacon.react.base", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "JSX with Bacon, yummy?", | ||
@@ -5,0 +5,0 @@ "main": "lib/bacon.react.base.js", |
@@ -1,4 +0,4 @@ | ||
import Bacon from "baconjs" | ||
import R from "ramda" | ||
import React from "react" | ||
import Bacon from "baconjs" | ||
import * as R from "ramda" | ||
import React from "react" | ||
@@ -14,6 +14,7 @@ // Lifting | ||
const common = { | ||
getInitialState() { | ||
return nullState | ||
}, | ||
class LiftedComponent extends React.Component { | ||
constructor(props) { | ||
super(props) | ||
this.state = nullState | ||
} | ||
tryDispose() { | ||
@@ -23,16 +24,16 @@ const {dispose} = this.state | ||
dispose() | ||
}, | ||
} | ||
componentWillReceiveProps(nextProps) { | ||
this.trySubscribe(nextProps) | ||
}, | ||
} | ||
componentWillMount() { | ||
this.trySubscribe(this.props) | ||
}, | ||
} | ||
shouldComponentUpdate(np, ns) { | ||
return ns.rendered !== this.state.rendered | ||
}, | ||
} | ||
componentWillUnmount() { | ||
this.tryDispose() | ||
this.setState(nullState) | ||
}, | ||
} | ||
render() { | ||
@@ -46,4 +47,6 @@ return this.state.rendered | ||
const FromBacon = React.createClass({ | ||
...common, | ||
class FromBacon extends LiftedComponent { | ||
constructor(props) { | ||
super(props) | ||
} | ||
trySubscribe({bacon}) { | ||
@@ -62,3 +65,3 @@ this.tryDispose() | ||
} | ||
}) | ||
} | ||
@@ -71,4 +74,6 @@ export const fromBacon = bacon => | ||
const FromClass = React.createClass({ | ||
...common, | ||
class FromClass extends LiftedComponent { | ||
constructor(props) { | ||
super(props) | ||
} | ||
trySubscribe({props}) { | ||
@@ -121,3 +126,3 @@ this.tryDispose() | ||
} | ||
}) | ||
} | ||
@@ -124,0 +129,0 @@ export const fromClass = |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48501
412