fela-bindings
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -0,5 +1,5 @@ | ||
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 _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; }; }(); | ||
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; } | ||
@@ -16,2 +16,3 @@ | ||
import { combineMultiRules } from 'fela-tools'; | ||
import shallowCompare from 'react-addons-shallow-compare'; | ||
@@ -21,4 +22,12 @@ import generateDisplayName from './generateDisplayName'; | ||
var defaultConfig = { | ||
pure: true | ||
}; | ||
export default function connectFactory(BaseComponent, createElement, withTheme, contextTypes) { | ||
return function connect(rules) { | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var connectConfig = _extends({}, defaultConfig, config); | ||
return function (component) { | ||
@@ -35,2 +44,10 @@ var EnhancedComponent = function (_BaseComponent) { | ||
_createClass(EnhancedComponent, [{ | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
if (connectConfig.pure) { | ||
return shallowCompare(this, nextProps, nextState); | ||
} | ||
return true; | ||
} | ||
}, { | ||
key: 'render', | ||
@@ -37,0 +54,0 @@ value: function render() { |
@@ -7,6 +7,6 @@ 'use strict'; | ||
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 _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; }; }(); | ||
exports.default = connectFactory; | ||
@@ -24,2 +24,6 @@ | ||
var _reactAddonsShallowCompare = require('react-addons-shallow-compare'); | ||
var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare); | ||
var _generateDisplayName = require('./generateDisplayName'); | ||
@@ -43,4 +47,12 @@ | ||
var defaultConfig = { | ||
pure: true | ||
}; | ||
function connectFactory(BaseComponent, createElement, withTheme, contextTypes) { | ||
return function connect(rules) { | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var connectConfig = _extends({}, defaultConfig, config); | ||
return function (component) { | ||
@@ -57,2 +69,10 @@ var EnhancedComponent = function (_BaseComponent) { | ||
_createClass(EnhancedComponent, [{ | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
if (connectConfig.pure) { | ||
return (0, _reactAddonsShallowCompare2.default)(this, nextProps, nextState); | ||
} | ||
return true; | ||
} | ||
}, { | ||
key: 'render', | ||
@@ -59,0 +79,0 @@ value: function render() { |
{ | ||
"name": "fela-bindings", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Abstract binding factories for Fela", | ||
@@ -26,10 +26,11 @@ "main": "lib/index.js", | ||
"fast-loops": "^1.0.0", | ||
"fela-dom": "^7.0.6", | ||
"fela-tools": "^5.1.4", | ||
"fela-dom": "^7.0.7", | ||
"fela-tools": "^5.1.5", | ||
"react-addons-shallow-compare": "^15.6.2", | ||
"shallow-equal": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"fela": "^6.1.5", | ||
"fela-monolithic": "^5.0.20" | ||
"fela": "^6.1.7", | ||
"fela-monolithic": "^5.0.21" | ||
} | ||
} |
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
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
70727
1275
5
1
+ Addedobject-assign@4.1.1(transitive)
+ Addedreact-addons-shallow-compare@15.6.3(transitive)
Updatedfela-dom@^7.0.7
Updatedfela-tools@^5.1.5