@jfrolich/emotion-theming
Advanced tools
Comparing version
@@ -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,i,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 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 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}}},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:n({},t,e)}var f=function(n){function e(e,t){var r;return void 0!==(r=n.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,n);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?i.Children.only(this.props.children):null},e.childContextTypes=p,e.contextTypes=p,e}(i.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,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 u=i[s];if(!(p[u]||a[u]||n&&n[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(r){var e=r.displayName||r.name||"Component",t=function(o){function e(e,t){var r,n=(r=o.call(this,e,t)||this).context[c];return void 0===n?(console.error("[withTheme] Please use ThemeProvider to be able to use withTheme"),function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r)):(r.unsubscribeId=n.subscribe(function(e){r.mounted?r.setState({theme:e}):r.state=e}),r)}s(e,o);var t=e.prototype;return t.componentDidMount=function(){this.mounted=!0},t.componentWillUnmount=function(){-1!==this.unsubscribeId&&this.context[c].unsubscribe(this.unsubscribeId)},t.render=function(){return i.createElement(r,n({theme:this.state.theme},this.props))},e}(i.Component);return t.displayName="WithTheme("+e+")",t.contextTypes=p,b(t,r)},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,i,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 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 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}}},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:n({},t,e)}var f=function(n){function e(e,t){var r;return void 0!==(r=n.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,n);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?i.Children.only(this.props.children):null},e.childContextTypes=p,e.contextTypes=p,e}(i.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,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 u=i[s];if(!(p[u]||a[u]||n&&n[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(r){var e=r.displayName||r.name||"Component",t=function(o){function e(e,t){var r,n=(r=o.call(this,e,t)||this).context[c];return void 0===n?(console.error("[withTheme] Please use ThemeProvider to be able to use withTheme"),function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r)):(r.unsubscribeId=n.subscribe(function(e){r.mounted?r.setState({theme:e}):r.state={theme:e}}),r)}s(e,o);var t=e.prototype;return t.componentDidMount=function(){this.mounted=!0},t.componentWillUnmount=function(){-1!==this.unsubscribeId&&this.context[c].unsubscribe(this.unsubscribeId)},t.render=function(){return i.createElement(r,n({theme:this.state.theme},this.props))},e}(i.Component);return t.displayName="WithTheme("+e+")",t.contextTypes=p,b(t,r)},e.channel=c,e.contextTypes=p,e.createBroadcast=u,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=emotion.umd.min.js.map |
@@ -209,3 +209,5 @@ 'use strict'; | ||
} else { | ||
_this.state = theme; | ||
_this.state = { | ||
theme: theme | ||
}; | ||
} | ||
@@ -212,0 +214,0 @@ }); |
@@ -203,3 +203,5 @@ import PropTypes from 'prop-types'; | ||
} else { | ||
_this.state = theme; | ||
_this.state = { | ||
theme: theme | ||
}; | ||
} | ||
@@ -206,0 +208,0 @@ }); |
{ | ||
"name": "@jfrolich/emotion-theming", | ||
"version": "9.2.12", | ||
"version": "9.2.13", | ||
"description": "A CSS-in-JS theming solution, inspired by styled-components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -46,2 +46,3 @@ // @flow | ||
unsubscribeToOuterId: number | ||
constructor(props, context) { | ||
@@ -48,0 +49,0 @@ super(props, context) |
@@ -13,2 +13,3 @@ // @flow | ||
unsubscribeId: number | ||
constructor(props, context) { | ||
@@ -28,3 +29,3 @@ super(props, context) | ||
} else { | ||
this.state = theme | ||
this.state = { theme } | ||
} | ||
@@ -31,0 +32,0 @@ }) |
Sorry, the diff of this file is not supported yet
44940
0.22%669
0.6%