@jfrolich/emotion-theming
Advanced tools
Comparing version 9.2.9 to 9.2.10
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("prop-types"),require("react"),require("assert")):"function"==typeof define&&define.amd?define(["exports","prop-types","react","assert"],t):t(e.jfrolichEmotionTheming={},null,e.React,null)}(this,function(e,t,n,o){"use strict";function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}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,u=function(e){var o={},r=0,n=e;return{publish:function(e){for(var t in n=e,o){var r=o[t];void 0!==r&&r(n)}},subscribe:function(e){var t=r;return o[t]=e,r+=1,e(n),t},unsubscribe:function(e){o[e]=void 0}}},c="__EMOTION_THEMING__",p=((r={})[c]=t.object,r),a=function(e){return"[object Object]"===Object.prototype.toString.call(e)};function h(e,t){if("function"==typeof e){var r=e(t);if(!a(r))throw new Error("[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!");return r}if(!a(e))throw new Error("[ThemeProvider] Please make your theme prop a plain object");return void 0===t?e:i({},t,e)}var f=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var r=t.prototype;return r.componentDidMount=function(){var t=this;void 0!==this.context[c]&&(this.unsubscribeToOuterId=this.context[c].subscribe(function(e){t.outerTheme=e,void 0!==t.broadcast&&t.publish(t.props.theme)})),this.broadcast=u(h(this.props.theme,this.outerTheme))},r.getChildContext=function(){var e;return(e={})[c]={subscribe:this.broadcast.subscribe,unsubscribe:this.broadcast.unsubscribe},e},r.componentDidUpdate=function(e){e.theme!==o.throws.props.theme&&this.publish(this.props.theme)},r.componentWillUnmount=function(){var e=this.context[c];void 0!==e&&e.unsubscribe(this.unsubscribeToOuterId)},r.publish=function(e){this.broadcast.publish(h(e,this.outerTheme))},r.render=function(){return this.props.children?n.Children.only(this.props.children):null},t.childContextTypes=p,t.contextTypes=p,t}(n.Component);"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var l,b=(function(e,t){var p,a,h,f,l,b,d,m;e.exports=(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),function e(t,r,o){if("string"!=typeof r){if(m){var n=d(r);n&&n!==m&&e(t,n,o)}var i=f(r);l&&(i=i.concat(l(r)));for(var s=0;s<i.length;++s){var u=i[s];if(!(p[u]||a[u]||o&&o[u])){var c=b(r,u);try{h(t,u,c)}catch(e){}}}return t}return t})}(l={exports:{}},l.exports),l.exports);e.ThemeProvider=f,e.withTheme=function(o){var e=o.displayName||o.name||"Component",t=function(t){function e(e){return t.call(this,e)||this}s(e,t);var r=e.prototype;return r.componentDidMount=function(){var t=this,e=this.context[c];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")},r.componentWillUnmount=function(){-1!==this.unsubscribeId&&this.context[c].unsubscribe(this.unsubscribeId)},r.render=function(){return n.createElement(o,i({theme:this.state.theme},this.props))},e}(n.Component);return t.displayName="WithTheme("+e+")",t.contextTypes=p,b(t,o)},e.channel=c,e.contextTypes=p,e.createBroadcast=u,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("prop-types"),require("react"),require("assert")):"function"==typeof define&&define.amd?define(["exports","prop-types","react","assert"],t):t(e.jfrolichEmotionTheming={},null,e.React,null)}(this,function(e,t,n,r){"use strict";function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}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 o,u=function(e){var o={},r=0,n=e;return{publish:function(e){for(var t in n=e,o){var r=o[t];void 0!==r&&r(n)}},subscribe:function(e){var t=r;return o[t]=e,r+=1,e(n),t},unsubscribe:function(e){o[e]=void 0}}},c="__EMOTION_THEMING__",p=((o={})[c]=t.object,o),a=function(e){return"[object Object]"===Object.prototype.toString.call(e)};function h(e,t){if("function"==typeof e){var r=e(t);if(!a(r))throw new Error("[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!");return r}if(!a(e))throw new Error("[ThemeProvider] Please make your theme prop a plain object");return void 0===t?e:i({},t,e)}var f=function(o){function e(e,t){var r;return void 0!==(r=o.call(this,e,t)||this).context[c]&&(r.unsubscribeToOuterId=r.context[c].subscribe(function(e){r.outerTheme=e,void 0!==r.broadcast&&r.publish(r.props.theme)})),r.broadcast=u(h(r.props.theme,r.outerTheme)),r}s(e,o);var t=e.prototype;return t.getChildContext=function(){var e;return(e={})[c]={subscribe:this.broadcast.subscribe,unsubscribe:this.broadcast.unsubscribe},e},t.componentDidUpdate=function(e){e.theme!==r.throws.props.theme&&this.publish(this.props.theme)},t.componentWillUnmount=function(){var e=this.context[c];void 0!==e&&e.unsubscribe(this.unsubscribeToOuterId)},t.publish=function(e){this.broadcast.publish(h(e,this.outerTheme))},t.render=function(){return this.props.children?n.Children.only(this.props.children):null},e.childContextTypes=p,e.contextTypes=p,e}(n.Component);"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var l,b=(function(e,t){var p,a,h,f,l,b,d,m;e.exports=(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),function e(t,r,o){if("string"!=typeof r){if(m){var n=d(r);n&&n!==m&&e(t,n,o)}var i=f(r);l&&(i=i.concat(l(r)));for(var s=0;s<i.length;++s){var u=i[s];if(!(p[u]||a[u]||o&&o[u])){var c=b(r,u);try{h(t,u,c)}catch(e){}}}return t}return t})}(l={exports:{}},l.exports),l.exports);e.ThemeProvider=f,e.withTheme=function(o){var e=o.displayName||o.name||"Component",t=function(t){function e(e){return t.call(this,e)||this}s(e,t);var r=e.prototype;return r.componentDidMount=function(){var t=this,e=this.context[c];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")},r.componentWillUnmount=function(){-1!==this.unsubscribeId&&this.context[c].unsubscribe(this.unsubscribeId)},r.render=function(){return n.createElement(o,i({theme:this.state.theme},this.props))},e}(n.Component);return t.displayName="WithTheme("+e+")",t.contextTypes=p,b(t,o)},e.channel=c,e.contextTypes=p,e.createBroadcast=u,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=emotion.umd.min.js.map |
@@ -113,15 +113,10 @@ 'use strict'; | ||
function ThemeProvider() { | ||
return _Component.apply(this, arguments) || this; | ||
} | ||
function ThemeProvider(props, context) { | ||
var _this; | ||
var _proto = ThemeProvider.prototype; | ||
_this = _Component.call(this, props, context) || this; // If there is a ThemeProvider wrapper anywhere around this theme provider, merge this theme | ||
// with the outer theme | ||
_proto.componentDidMount = function componentDidMount() { | ||
var _this = this; | ||
// If there is a ThemeProvider wrapper anywhere around this theme provider, merge this theme | ||
// with the outer theme | ||
if (this.context[channel] !== undefined) { | ||
this.unsubscribeToOuterId = this.context[channel].subscribe(function (theme) { | ||
if (_this.context[channel] !== undefined) { | ||
_this.unsubscribeToOuterId = _this.context[channel].subscribe(function (theme) { | ||
_this.outerTheme = theme; | ||
@@ -135,5 +130,8 @@ | ||
this.broadcast = createBroadcast(getTheme(this.props.theme, this.outerTheme)); | ||
}; | ||
_this.broadcast = createBroadcast(getTheme(_this.props.theme, _this.outerTheme)); | ||
return _this; | ||
} | ||
var _proto = ThemeProvider.prototype; | ||
_proto.getChildContext = function getChildContext() { | ||
@@ -140,0 +138,0 @@ var _ref; |
@@ -107,15 +107,10 @@ import PropTypes from 'prop-types'; | ||
function ThemeProvider() { | ||
return _Component.apply(this, arguments) || this; | ||
} | ||
function ThemeProvider(props, context) { | ||
var _this; | ||
var _proto = ThemeProvider.prototype; | ||
_this = _Component.call(this, props, context) || this; // If there is a ThemeProvider wrapper anywhere around this theme provider, merge this theme | ||
// with the outer theme | ||
_proto.componentDidMount = function componentDidMount() { | ||
var _this = this; | ||
// If there is a ThemeProvider wrapper anywhere around this theme provider, merge this theme | ||
// with the outer theme | ||
if (this.context[channel] !== undefined) { | ||
this.unsubscribeToOuterId = this.context[channel].subscribe(function (theme) { | ||
if (_this.context[channel] !== undefined) { | ||
_this.unsubscribeToOuterId = _this.context[channel].subscribe(function (theme) { | ||
_this.outerTheme = theme; | ||
@@ -129,5 +124,8 @@ | ||
this.broadcast = createBroadcast(getTheme(this.props.theme, this.outerTheme)); | ||
}; | ||
_this.broadcast = createBroadcast(getTheme(_this.props.theme, _this.outerTheme)); | ||
return _this; | ||
} | ||
var _proto = ThemeProvider.prototype; | ||
_proto.getChildContext = function getChildContext() { | ||
@@ -134,0 +132,0 @@ var _ref; |
{ | ||
"name": "@jfrolich/emotion-theming", | ||
"version": "9.2.9", | ||
"version": "9.2.10", | ||
"description": "A CSS-in-JS theming solution, inspired by styled-components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -46,3 +46,4 @@ // @flow | ||
unsubscribeToOuterId: number | ||
componentDidMount() { | ||
constructor(props, context) { | ||
super(props, context) | ||
// If there is a ThemeProvider wrapper anywhere around this theme provider, merge this theme | ||
@@ -49,0 +50,0 @@ // with the outer theme |
Sorry, the diff of this file is not supported yet
43520
633