UNPKG

rmwc

Version:

A thin React wrapper for Material Design (Web) Components

23 lines (22 loc) 7.32 kB
/** @license React v16.4.1 * react-test-renderer-shallow.production.min.js * * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict';(function(e,g){"object"===typeof exports&&"undefined"!==typeof module?module.exports=g(require("react")):"function"===typeof define&&define.amd?define(["react"],g):e.ReactShallowRenderer=g(e.React)})(this,function(e){function g(a){for(var b=arguments.length-1,f="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)f+="&args[]="+encodeURIComponent(arguments[c+1]);v(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ", f)}function p(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case w:switch(a=a.type,a){case x:case y:case z:case A:return a;default:switch(a=a&&a.$$typeof,a){case B:case n:case C:return a;default:return b}}case D:return b}}}function q(a,b){return a===b?0!==a||0!==b||1/a===1/b:a!==a&&b!==b}function r(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}var t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,v=function(a,b,f,c,d,h,g,F){if(!a){if(void 0=== b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var E=[f,c,d,h,g,F],e=0;a=Error(b.replace(/%s/g,function(){return E[e++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}},d="function"===typeof Symbol&&Symbol.for,w=d?Symbol.for("react.element"):60103,D=d?Symbol.for("react.portal"):60106,y=d?Symbol.for("react.fragment"):60107,A=d?Symbol.for("react.strict_mode"):60108,z=d?Symbol.for("react.profiler"): 60114,C=d?Symbol.for("react.provider"):60109,B=d?Symbol.for("react.context"):60110,x=d?Symbol.for("react.async_mode"):60111,n=d?Symbol.for("react.forward_ref"):60112;d&&Symbol.for("react.timeout");var l={},G=Object.prototype.hasOwnProperty,u=function(a,b){if(q(a,b))return!0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return!1;var f=Object.keys(a),c=Object.keys(b);if(f.length!==c.length)return!1;for(c=0;c<f.length;c++)if(!G.call(b,f[c])||!q(a[f[c]],b[f[c]]))return!1;return!0},m= function(){function a(){r(this,a);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new H(this)}a.prototype.getMountedInstance=function(){return this._instance};a.prototype.getRenderOutput=function(){return this._rendered};a.prototype.render=function(b){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:l;e.isValidElement(b)?void 0:g("12","function"===typeof b?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.": "");"string"===typeof b.type?g("13",b.type):void 0;p(b)!==n&&"function"!==typeof b.type?g("249",Array.isArray(b.type)?"array":null===b.type?"null":typeof b.type):void 0;if(!this._rendering){this._rendering=!0;this._element=b;var c=b.type.contextTypes;if(c){var d={},h;for(h in c)d[h]=a[h];a=d}else a=l;this._context=a;this._instance?this._updateClassComponent(b,this._context):p(b)===n?this._rendered=b.type.render(b.props,b.ref):(a=b.type,a.prototype&&a.prototype.isReactComponent?(this._instance=new b.type(b.props, this._context,this._updater),this._updateStateFromStaticLifecycle(b.props),b.type.hasOwnProperty("contextTypes"),this._mountClassComponent(b,this._context)):this._rendered=b.type(b.props,this._context));this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};a.prototype.unmount=function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._instance=this._rendered=this._newState=this._element=this._context= null};a.prototype._mountClassComponent=function(b,a){this._instance.context=a;this._instance.props=b.props;this._instance.state=this._instance.state||null;this._instance.updater=this._updater;if("function"===typeof this._instance.UNSAFE_componentWillMount||"function"===typeof this._instance.componentWillMount)a=this._newState,"function"!==typeof b.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&this._instance.componentWillMount(), "function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),a!==this._newState&&(this._instance.state=this._newState||l);this._rendered=this._instance.render()};a.prototype._updateClassComponent=function(b,a){var c=b.props,f=b.type,d=this._instance.state||l,g=this._instance.props;g!==c&&"function"!==typeof b.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillReceiveProps&& this._instance.componentWillReceiveProps(c,a),"function"===typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(c,a));this._updateStateFromStaticLifecycle(c);var e=this._newState||d,k=!0;this._forcedUpdate?(k=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?k=!!this._instance.shouldComponentUpdate(c,e,a):f.prototype&&f.prototype.isPureReactComponent&&(k=!u(g,c)||!u(d,e));k&&"function"!==typeof b.type.getDerivedStateFromProps&& "function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(c,e,a),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&this._instance.UNSAFE_componentWillUpdate(c,e,a));this._instance.context=a;this._instance.props=c;this._instance.state=e;k&&(this._rendered=this._instance.render())};a.prototype._updateStateFromStaticLifecycle=function(b){var a=this._element.type;if("function"===typeof a.getDerivedStateFromProps){var c= this._newState||this._instance.state;b=a.getDerivedStateFromProps.call(null,b,c);null!=b&&(c=t({},c,b),this._instance.state=this._newState=c)}};return a}();m.createRenderer=function(){return new m};var H=function(){function a(b){r(this,a);this._renderer=b;this._callbacks=[]}a.prototype._enqueueCallback=function(b,a){"function"===typeof b&&a&&this._callbacks.push({callback:b,publicInstance:a})};a.prototype._invokeCallbacks=function(){var a=this._callbacks;this._callbacks=[];a.forEach(function(a){a.callback.call(a.publicInstance)})}; a.prototype.isMounted=function(a){return!!this._renderer._element};a.prototype.enqueueForceUpdate=function(a,d,c){this._enqueueCallback(d,a);this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueReplaceState=function(a,d,c,e){this._enqueueCallback(c,a);this._renderer._newState=d;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueSetState=function(a,d,c,e){this._enqueueCallback(c,a);c=this._renderer._newState|| a.state;"function"===typeof d&&(d=d.call(a,c,a.props));null!==d&&void 0!==d&&(this._renderer._newState=t({},c,d),this._renderer.render(this._renderer._element,this._renderer._context))};return a}();d=(d={default:m},m)||d;return d.default?d.default:d});