Comparing version 0.5.0 to 0.6.0
@@ -70,6 +70,2 @@ 'use strict'; | ||
function identity(x) { | ||
x; | ||
} | ||
/** | ||
@@ -104,2 +100,3 @@ * @summary A derivable class for creating React components that can transparently | ||
var ReactiveComponent = function (_React$Component2) { | ||
@@ -126,3 +123,2 @@ _inherits(ReactiveComponent, _React$Component2); | ||
var bonds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var propTransforms = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
@@ -135,4 +131,4 @@ _classCallCheck(this, ReactiveComponent); | ||
_this2.bonds = bonds; | ||
_this2.propTransforms = propTransforms; | ||
_this2.allBondKeys = [].concat(reactiveProps).concat(Object.keys(bonds)); | ||
_this2.state = {}; | ||
return _this2; | ||
@@ -186,3 +182,5 @@ } | ||
var bonds = this.bonds; | ||
var bondKeys = Object.keys(bonds); | ||
var bondKeys = Object.keys(bonds).filter(function (k) { | ||
return typeof bonds[k] !== 'function'; | ||
}); | ||
this._consolidatedExtraBonds = new ReactiveBond(bondKeys.map(function (f) { | ||
@@ -209,2 +207,6 @@ return bonds[f]; | ||
} | ||
if (this._derivedBonds) { | ||
this._derivedBonds.drop(); | ||
delete this._derivedBonds; | ||
} | ||
} | ||
@@ -222,2 +224,11 @@ }, { | ||
var that = this; | ||
var bonds = this.bonds; | ||
var derivedBondKeys = Object.keys(bonds).filter(function (k) { | ||
return typeof bonds[k] === 'function'; | ||
}); | ||
if (this._derivedBonds) { | ||
this._derivedBonds.drop(); | ||
delete this._derivedBonds; | ||
} | ||
if (this._consolidatedBonds) { | ||
@@ -227,11 +238,31 @@ this._consolidatedBonds.drop(); | ||
} | ||
this._consolidatedBonds = new ReactiveBond(this.reactiveProps.map(function (f) { | ||
return (_this3.reactiveProps[f] || identity)(nextProps[f]); | ||
}), [], function (a) { | ||
var s = that.state || {}; | ||
that.reactiveProps.forEach(function (f, i) { | ||
s[f] = a[i]; | ||
}); | ||
that.setState(s); | ||
}).use(); | ||
if (that.reactiveProps.length > 0) { | ||
this._consolidatedBonds = new TransformBond(function () { | ||
for (var _len = arguments.length, a = Array(_len), _key = 0; _key < _len; _key++) { | ||
a[_key] = arguments[_key]; | ||
} | ||
var s = {}; | ||
that.reactiveProps.forEach(function (f, i) { | ||
s[f] = a[i]; | ||
}); | ||
that.setState(s); | ||
return s; | ||
}, this.reactiveProps.map(function (f) { | ||
return nextProps[f]; | ||
}), []).subscriptable().use(); | ||
} | ||
if (derivedBondKeys.length > 0) { | ||
this._derivedBonds = new ReactiveBond(derivedBondKeys.map(function (f) { | ||
return bonds[f](_this3._consolidatedBonds); | ||
}), [], function (a) { | ||
var s = {}; | ||
derivedBondKeys.forEach(function (f, i) { | ||
return s[f] = a[i]; | ||
}); | ||
that.setState(s); | ||
}).use(); | ||
} | ||
} | ||
@@ -238,0 +269,0 @@ |
{ | ||
"name": "oo7-react", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "The Reactive Bond API", | ||
@@ -33,3 +33,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"oo7": "^0.5.9", | ||
"oo7": "file:../oo7", | ||
"react": "^15.4.2" | ||
@@ -36,0 +36,0 @@ }, |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
30307
461
0
- Removedoo7@0.5.9(transitive)
Updatedoo7@file:../oo7