react-fela
Advanced tools
Comparing version 4.2.2 to 4.2.3
@@ -219,2 +219,11 @@ (function (global, factory) { | ||
var generateDisplayName = function generateDisplayName(Comp) { | ||
var displayName = Comp.displayName || Comp.name; | ||
if (displayName) { | ||
return 'Fela' + displayName; | ||
} | ||
return 'ConnectedFelaComponent'; | ||
}; | ||
function connect(mapStylesToProps) { | ||
@@ -250,3 +259,3 @@ return function (Comp) { | ||
return EnhancedComponent; | ||
}(React.Component), _class.displayName = Comp.displayName || Comp.name || 'ConnectedFelaComponent', _class.contextTypes = babelHelpers.extends({}, Comp.contextTypes, { | ||
}(React.Component), _class.displayName = generateDisplayName(Comp), _class.contextTypes = babelHelpers.extends({}, Comp.contextTypes, { | ||
renderer: React.PropTypes.object, | ||
@@ -276,3 +285,3 @@ theme: React.PropTypes.object | ||
/* weak */ | ||
function assign(base) { | ||
function assignStyles(base) { | ||
for (var _len = arguments.length, extendingStyles = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
@@ -287,8 +296,21 @@ extendingStyles[_key - 1] = arguments[_key]; | ||
var value = style[property]; | ||
var baseValue = base[property]; | ||
if (base[property] instanceof Object && value instanceof Object) { | ||
base[property] = assign({}, base[property], value); | ||
} else { | ||
base[property] = value; | ||
if (baseValue instanceof Object) { | ||
if (Array.isArray(baseValue)) { | ||
if (Array.isArray(value)) { | ||
base[property] = [].concat(babelHelpers.toConsumableArray(baseValue), babelHelpers.toConsumableArray(value)); | ||
} else { | ||
base[property] = [].concat(babelHelpers.toConsumableArray(baseValue), [value]); | ||
} | ||
continue; | ||
} | ||
if (value instanceof Object && !Array.isArray(value)) { | ||
base[property] = assignStyles({}, baseValue, value); | ||
continue; | ||
} | ||
} | ||
base[property] = value; | ||
} | ||
@@ -309,3 +331,3 @@ } | ||
for (var i = 0, len = rules.length; i < len; ++i) { | ||
assign(style, rules[i](props)); | ||
assignStyles(style, rules[i](props)); | ||
} | ||
@@ -312,0 +334,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.ReactFela=t(e.React)}(this,function(e){"use strict";function t(e,t){return function(r){if(r.type!==f||r.media)t.textContent=e.renderToString();else try{t.sheet.insertRule(r.selector+"{"+r.declaration+"}",t.sheet.cssRules.length)}catch(e){}}}function r(e){return e&&1===e.nodeType}function n(e,n){if(!r(n))throw new Error("You need to specify a valid element node (nodeType = 1) to render into.");n.setAttribute("data-fela-stylesheet","");var o=t(e,n);e.subscribe(o);var i=e.renderToString();n.textContent!==i&&(n.textContent=i)}function o(t){return function(r){var n,o;return o=n=function(e){function n(){return p.classCallCheck(this,n),p.possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return p.inherits(n,e),p.createClass(n,[{key:"render",value:function(){var e=this.context,n=e.renderer,o=e.theme,i=t(p.extends({},this.props,{theme:o||{}}))(n);return l.createElement(r,p.extends({},this.props,{styles:i}))}}]),n}(e.Component),n.displayName=r.displayName||r.name||"ConnectedFelaComponent",n.contextTypes=p.extends({},r.contextTypes,{renderer:e.PropTypes.object,theme:e.PropTypes.object}),o}}function i(e,t){return e.reduce(function(e,r){return e[r]=t[r],e},{})}function s(e,t){return e instanceof Function?Object.keys(e(t)):e}function a(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var o=0,i=r.length;o<i;++o){var s=r[o];for(var c in s){var u=s[c];e[c]instanceof Object&&u instanceof Object?e[c]=a({},e[c],u):e[c]=u}}return e}function c(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){for(var r={},n=0,o=t.length;n<o;++n)a(r,t[n](e));return r}}function u(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"div",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=function(o,a){var u=a.renderer,l=a.theme,f=o.children,y=o._felaRule,h=o.passThrough,d=void 0===h?[]:h,b=p.objectWithoutProperties(o,["children","_felaRule","passThrough"]),m=y?c(t,y):t,v=[].concat(p.toConsumableArray(s(n,b)),p.toConsumableArray(s(d,b)));if(r._isFelaComponent)return e.createElement(r,p.extends({_felaRule:m,passThrough:v},b),f);var C=i(v,b);C.style=b.style,C.id=b.id,C.ref=b.innerRef;var T=b.className?b.className+" ":"";return b.theme=l||{},C.className=T+u.renderRule(m,b),e.createElement(r,C,f)};return o.contextTypes={renderer:e.PropTypes.object,theme:e.PropTypes.object},o.displayName=t.name?t.name:"FelaComponent",o._isFelaComponent=!0,o}var l="default"in e?e.default:e,p={};p.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},p.createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),p.defineProperty=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},p.extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},p.inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},p.objectWithoutProperties=function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r},p.possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},p.toConsumableArray=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)};var f=1,y=function(t){function r(){return p.classCallCheck(this,r),p.possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return p.inherits(r,t),p.createClass(r,[{key:"getChildContext",value:function(){return{renderer:this.props.renderer}}},{key:"componentDidMount",value:function(){var e=this.props,t=e.mountNode,r=e.renderer;t&&n(r,t)}},{key:"render",value:function(){return e.Children.only(this.props.children)}}]),r}(e.Component);y.propTypes={renderer:e.PropTypes.object.isRequired},y.childContextTypes={renderer:e.PropTypes.object};var h=function(t){function r(){return p.classCallCheck(this,r),p.possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return p.inherits(r,t),p.createClass(r,[{key:"getChildContext",value:function(){var e=this.props,t=e.overwrite,r=e.theme,n=this.context.theme;return{theme:p.extends({},t?{}:n||{},r)}}},{key:"render",value:function(){return e.Children.only(this.props.children)}}]),r}(e.Component);h.propTypes={theme:e.PropTypes.object.isRequired,overwrite:e.PropTypes.bool},h.childContextTypes={theme:e.PropTypes.object},h.contextTypes={theme:e.PropTypes.object},h.defaultProps={overwrite:!1};var d={Provider:y,connect:o,createComponent:u,ThemeProvider:h};return d}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.ReactFela=t(e.React)}(this,function(e){"use strict";function t(e,t){return function(r){if(r.type!==f||r.media)t.textContent=e.renderToString();else try{t.sheet.insertRule(r.selector+"{"+r.declaration+"}",t.sheet.cssRules.length)}catch(e){}}}function r(e){return e&&1===e.nodeType}function n(e,n){if(!r(n))throw new Error("You need to specify a valid element node (nodeType = 1) to render into.");n.setAttribute("data-fela-stylesheet","");var o=t(e,n);e.subscribe(o);var i=e.renderToString();n.textContent!==i&&(n.textContent=i)}function o(t){return function(r){var n,o;return o=n=function(e){function n(){return p.classCallCheck(this,n),p.possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return p.inherits(n,e),p.createClass(n,[{key:"render",value:function(){var e=this.context,n=e.renderer,o=e.theme,i=t(p.extends({},this.props,{theme:o||{}}))(n);return l.createElement(r,p.extends({},this.props,{styles:i}))}}]),n}(e.Component),n.displayName=h(r),n.contextTypes=p.extends({},r.contextTypes,{renderer:e.PropTypes.object,theme:e.PropTypes.object}),o}}function i(e,t){return e.reduce(function(e,r){return e[r]=t[r],e},{})}function a(e,t){return e instanceof Function?Object.keys(e(t)):e}function s(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var o=0,i=r.length;o<i;++o){var a=r[o];for(var c in a){var u=a[c],l=e[c];if(l instanceof Object){if(Array.isArray(l)){Array.isArray(u)?e[c]=[].concat(p.toConsumableArray(l),p.toConsumableArray(u)):e[c]=[].concat(p.toConsumableArray(l),[u]);continue}if(u instanceof Object&&!Array.isArray(u)){e[c]=s({},l,u);continue}}e[c]=u}}return e}function c(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){for(var r={},n=0,o=t.length;n<o;++n)s(r,t[n](e));return r}}function u(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"div",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=function(o,s){var u=s.renderer,l=s.theme,f=o.children,y=o._felaRule,h=o.passThrough,d=void 0===h?[]:h,b=p.objectWithoutProperties(o,["children","_felaRule","passThrough"]),m=y?c(t,y):t,v=[].concat(p.toConsumableArray(a(n,b)),p.toConsumableArray(a(d,b)));if(r._isFelaComponent)return e.createElement(r,p.extends({_felaRule:m,passThrough:v},b),f);var C=i(v,b);C.style=b.style,C.id=b.id,C.ref=b.innerRef;var T=b.className?b.className+" ":"";return b.theme=l||{},C.className=T+u.renderRule(m,b),e.createElement(r,C,f)};return o.contextTypes={renderer:e.PropTypes.object,theme:e.PropTypes.object},o.displayName=t.name?t.name:"FelaComponent",o._isFelaComponent=!0,o}var l="default"in e?e.default:e,p={};p.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},p.createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),p.defineProperty=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},p.extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},p.inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},p.objectWithoutProperties=function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r},p.possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},p.toConsumableArray=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)};var f=1,y=function(t){function r(){return p.classCallCheck(this,r),p.possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return p.inherits(r,t),p.createClass(r,[{key:"getChildContext",value:function(){return{renderer:this.props.renderer}}},{key:"componentDidMount",value:function(){var e=this.props,t=e.mountNode,r=e.renderer;t&&n(r,t)}},{key:"render",value:function(){return e.Children.only(this.props.children)}}]),r}(e.Component);y.propTypes={renderer:e.PropTypes.object.isRequired},y.childContextTypes={renderer:e.PropTypes.object};var h=function(e){var t=e.displayName||e.name;return t?"Fela"+t:"ConnectedFelaComponent"},d=function(t){function r(){return p.classCallCheck(this,r),p.possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return p.inherits(r,t),p.createClass(r,[{key:"getChildContext",value:function(){var e=this.props,t=e.overwrite,r=e.theme,n=this.context.theme;return{theme:p.extends({},t?{}:n||{},r)}}},{key:"render",value:function(){return e.Children.only(this.props.children)}}]),r}(e.Component);d.propTypes={theme:e.PropTypes.object.isRequired,overwrite:e.PropTypes.bool},d.childContextTypes={theme:e.PropTypes.object},d.contextTypes={theme:e.PropTypes.object},d.defaultProps={overwrite:!1};var b={Provider:y,connect:o,createComponent:u,ThemeProvider:d};return b}); |
{ | ||
"name": "react-fela", | ||
"version": "4.2.2", | ||
"version": "4.2.3", | ||
"description": "React bindings for Fela", | ||
@@ -25,4 +25,4 @@ "main": "index.js", | ||
"react": "^15.3.2", | ||
"fela": "4.2.2" | ||
"fela": "4.2.3" | ||
} | ||
} |
@@ -6,3 +6,3 @@ # React Fela | ||
<img alt="npm downloads" src="https://img.shields.io/npm/dm/react-fela.svg"> | ||
<img alt="gzipped size" src="https://img.shields.io/badge/gzipped-2.07kb-brightgreen.svg"> | ||
<img alt="gzipped size" src="https://img.shields.io/badge/gzipped-2.13kb-brightgreen.svg"> | ||
@@ -23,5 +23,5 @@ This package only includes React bindings for [Fela](http://github.com/rofrischmann/fela).<br> | ||
<!-- Development build (with warnings) --> | ||
<script src="https://unpkg.com/react-fela@4.2.2/dist/react-fela.js"></script> | ||
<script src="https://unpkg.com/react-fela@4.2.3/dist/react-fela.js"></script> | ||
<!-- Production build (minified) --> | ||
<script src="https://unpkg.com/react-fela@4.2.2/dist/react-fela.min.js"></script> | ||
<script src="https://unpkg.com/react-fela@4.2.3/dist/react-fela.min.js"></script> | ||
``` | ||
@@ -28,0 +28,0 @@ |
Sorry, the diff of this file is not supported yet
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
40268
349