emotion-theming
Advanced tools
Comparing version 9.1.2 to 9.2.0
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","prop-types"],t):t(e["emotion-theming"]={},e.React,e.PropTypes)}(this,function(e,t,r){"use strict";function n(){return(n=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}).apply(this,arguments)}function o(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function i(){var e=this;void 0!==this.context[d]&&(this.unsubscribeToOuterId=this.context[d].subscribe(function(t){e.outerTheme=t,void 0!==e.broadcast&&e.publish(e.props.theme)})),this.broadcast=m(this.getTheme(this.props.theme))}function s(){var e;return e={},e[d]={subscribe:this.broadcast.subscribe,unsubscribe:this.broadcast.unsubscribe},e}function c(e){this.props.theme!==e.theme&&this.publish(e.theme)}function u(){var e=this.context[d];void 0!==e&&e.unsubscribe(this.unsubscribeToOuterId)}function p(e){if("function"==typeof e){var t=e(this.outerTheme);if(!v(t))throw new Error("[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!");return t}if(!v(e))throw new Error("[ThemeProvider] Please make your theme prop a plain object");return void 0===this.outerTheme?e:n({},this.outerTheme,e)}function h(e){this.broadcast.publish(this.getTheme(e))}function a(){return this.props.children?t.Children.only(this.props.children):null}function b(){var e=this,t=this.context[d];void 0!==t?this.unsubscribeId=t.subscribe(function(t){e.setState({theme:t})}):console.error("[withTheme] Please use ThemeProvider to be able to use withTheme")}function f(){-1!==this.unsubscribeId&&this.context[d].unsubscribe(this.unsubscribeId)}r=r&&r.hasOwnProperty("default")?r.default:r;var l,m=function(e){var t={},r=0,n=e;return{publish:function(e){n=e;for(var r in t){var o=t[r];void 0!==o&&o(n)}},subscribe:function(e){var o=r;return t[o]=e,r+=1,e(n),o},unsubscribe:function(e){t[e]=void 0}}},d="__EMOTION_THEMING__",y=(l={},l[d]=r.object,l),v=function(e){return"[object Object]"===Object.prototype.toString.call(e)},T=function(e){function t(){var t;return t=e.call(this)||this,t.getTheme=t.getTheme.bind(t),t}o(t,e);var r=t.prototype;return r.componentWillMount=i,r.getChildContext=s,r.componentWillReceiveProps=c,r.componentWillUnmount=u,r.getTheme=p,r.publish=h,r.render=a,t}(t.Component);T.childContextTypes=y,T.contextTypes=y;var O={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},g={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},P=Object.defineProperty,j=Object.getOwnPropertyNames,x=Object.getOwnPropertySymbols,w=Object.getOwnPropertyDescriptor,_=Object.getPrototypeOf,C=_&&_(Object),I=function e(t,r,n){if("string"!=typeof r){if(C){var o=_(r);o&&o!==C&&e(t,o,n)}var i=j(r);x&&(i=i.concat(x(r)));for(var s=0;s<i.length;++s){var c=i[s];if(!(O[c]||g[c]||n&&n[c])){var u=w(r,c);try{P(t,c,u)}catch(e){}}}return t}return t};e.ThemeProvider=T,e.withTheme=function(e){function r(){return t.createElement(e,n({theme:this.state.theme},this.props))}var i=e.displayName||e.name||"Component",s=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.componentWillMount=b,n.componentWillUnmount=f,n.render=r,t}(t.Component);return s.displayName="WithTheme("+i+")",s.contextTypes=y,I(s,e)},e.channel=d,e.contextTypes=y,e.createBroadcast=m,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","prop-types"],t):t(e["emotion-theming"]={},e.React,e.PropTypes)}(this,function(e,o,t){"use strict";function i(){return(i=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}).apply(this,arguments)}function s(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t}t=t&&t.hasOwnProperty("default")?t.default:t;var r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e};"object"==typeof Reflect&&Reflect.construct;var n,c=function(e){var n={},r=0,o=e;return{publish:function(e){for(var t in o=e,n){var r=n[t];void 0!==r&&r(o)}},subscribe:function(e){var t=r;return n[t]=e,r+=1,e(o),t},unsubscribe:function(e){n[e]=void 0}}},u="__EMOTION_THEMING__",p=((n={})[u]=t.object,n),a=function(e){return"[object Object]"===Object.prototype.toString.call(e)};function h(){var t=this;void 0!==this.context[u]&&(this.unsubscribeToOuterId=this.context[u].subscribe(function(e){t.outerTheme=e,void 0!==t.broadcast&&t.publish(t.props.theme)})),this.broadcast=c(this.getTheme(this.props.theme))}function f(){var e;return(e={})[u]={subscribe:this.broadcast.subscribe,unsubscribe:this.broadcast.unsubscribe},e}function l(e){this.props.theme!==e.theme&&this.publish(e.theme)}function b(){var e=this.context[u];void 0!==e&&e.unsubscribe(this.unsubscribeToOuterId)}function d(e){if("function"==typeof e){var t=e(this.outerTheme);if(!a(t))throw new Error("[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!");return t}if(!a(e))throw new Error("[ThemeProvider] Please make your theme prop a plain object");return void 0===this.outerTheme?e:i({},this.outerTheme,e)}function m(e){this.broadcast.publish(this.getTheme(e))}function y(){return this.props.children?o.Children.only(this.props.children):null}var v=function(t){function e(){var e;return(e=t.call(this)||this).getTheme=e.getTheme.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)),e}s(e,t);var r=e.prototype;return r.componentWillMount=h,r.getChildContext=f,r.componentWillReceiveProps=l,r.componentWillUnmount=b,r.getTheme=d,r.publish=m,r.render=y,e}(o.Component);v.childContextTypes=p,v.contextTypes=p;"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function T(){var p={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},h=Object.defineProperty,f=Object.getOwnPropertyNames,l=Object.getOwnPropertySymbols,b=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,m=d&&d(Object);return function e(t,r,n){if("string"!=typeof r){if(m){var o=d(r);o&&o!==m&&e(t,o,n)}var i=f(r);l&&(i=i.concat(l(r)));for(var s=0;s<i.length;++s){var c=i[s];if(!(p[c]||a[c]||n&&n[c])){var u=b(r,c);try{h(t,c,u)}catch(e){}}}return t}return t}}var O,g=(function(e,t){var r;r=T,e.exports=r()}(O={exports:{}},O.exports),O.exports);function P(){var t=this,e=this.context[u];void 0!==e?this.unsubscribeId=e.subscribe(function(e){t.setState({theme:e})}):console.error("[withTheme] Please use ThemeProvider to be able to use withTheme")}function x(){-1!==this.unsubscribeId&&this.context[u].unsubscribe(this.unsubscribeId)}e.ThemeProvider=v,e.withTheme=function(e){var t=e.displayName||e.name||"Component";function n(){return o.createElement(e,i({theme:this.state.theme},this.props))}var r=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var r=t.prototype;return r.componentWillMount=P,r.componentWillUnmount=x,r.render=n,t}(o.Component);return r.displayName="WithTheme("+t+")",r.contextTypes=p,g(r,e)},e.channel=u,e.contextTypes=p,e.createBroadcast=c,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=emotion.umd.min.js.map |
@@ -35,2 +35,23 @@ 'use strict'; | ||
var _sPO = Object.setPrototypeOf || function _sPO(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
var _construct = typeof Reflect === "object" && Reflect.construct || function _construct(Parent, args, Class) { | ||
var Constructor, | ||
a = [null]; | ||
a.push.apply(a, args); | ||
Constructor = Parent.bind.apply(Parent, a); | ||
return _sPO(new Constructor(), Class.prototype); | ||
}; | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return self; | ||
} | ||
// https://github.com/styled-components/styled-components/blob/e05b3fe247e9d956bcde786cec376e32afb85bca/src/utils/create-broadcast.js | ||
@@ -174,3 +195,3 @@ var createBroadcast = function createBroadcast(initialState) { | ||
_this = _Component.call(this) || this; | ||
_this.getTheme = _this.getTheme.bind(_this); | ||
_this.getTheme = _this.getTheme.bind(_assertThisInitialized(_this)); | ||
return _this; | ||
@@ -177,0 +198,0 @@ } |
@@ -29,2 +29,23 @@ import { Children, Component, createElement } from 'react'; | ||
var _sPO = Object.setPrototypeOf || function _sPO(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
var _construct = typeof Reflect === "object" && Reflect.construct || function _construct(Parent, args, Class) { | ||
var Constructor, | ||
a = [null]; | ||
a.push.apply(a, args); | ||
Constructor = Parent.bind.apply(Parent, a); | ||
return _sPO(new Constructor(), Class.prototype); | ||
}; | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return self; | ||
} | ||
// https://github.com/styled-components/styled-components/blob/e05b3fe247e9d956bcde786cec376e32afb85bca/src/utils/create-broadcast.js | ||
@@ -168,3 +189,3 @@ var createBroadcast = function createBroadcast(initialState) { | ||
_this = _Component.call(this) || this; | ||
_this.getTheme = _this.getTheme.bind(_this); | ||
_this.getTheme = _this.getTheme.bind(_assertThisInitialized(_this)); | ||
return _this; | ||
@@ -171,0 +192,0 @@ } |
{ | ||
"name": "emotion-theming", | ||
"version": "9.1.2", | ||
"version": "9.2.0", | ||
"description": "A CSS-in-JS theming solution, inspired by styled-components", | ||
@@ -41,4 +41,4 @@ "main": "dist/index.cjs.js", | ||
"cross-env": "^5.0.1", | ||
"dtslint": "^0.2.0", | ||
"prop-types": "^15.5.8", | ||
"dtslint": "^0.3.0", | ||
"prop-types": "^15.6.1", | ||
"rimraf": "^2.6.1", | ||
@@ -51,5 +51,5 @@ "rollup": "^0.51.3" | ||
"peerDependencies": { | ||
"prop-types": ">= 15", | ||
"react": ">= 15" | ||
"prop-types": "15.x", | ||
"react": "15.x || 16.x" | ||
} | ||
} |
@@ -6,2 +6,2 @@ { | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
125022
673