rmwc
Version:
A thin React wrapper for Material Design (Web) Components
26 lines (24 loc) • 7.36 kB
JavaScript
/** @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';var e=require("object-assign"),f=require("fbjs/lib/invariant"),l=require("react"),m=require("react-is"),n=require("fbjs/lib/emptyObject"),p=require("fbjs/lib/shallowEqual"),q=require("prop-types/checkPropTypes");
function r(d){for(var a=arguments.length-1,b="https://reactjs.org/docs/error-decoder.html?invariant="+d,c=0;c<a;c++)b+="&args[]="+encodeURIComponent(arguments[c+1]);f(!1,"Minified React error #"+d+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",b)}
var t="function"===typeof Symbol&&Symbol.for,u=t?Symbol.for("react.portal"):60106,w=t?Symbol.for("react.fragment"):60107,x=t?Symbol.for("react.strict_mode"):60108,y=t?Symbol.for("react.profiler"):60114,z=t?Symbol.for("react.provider"):60109,A=t?Symbol.for("react.context"):60110,B=t?Symbol.for("react.async_mode"):60111,C=t?Symbol.for("react.forward_ref"):60112,D=t?Symbol.for("react.timeout"):60113;
function E(d){var a=d.type;if("function"===typeof a)return a.displayName||a.name;if("string"===typeof a)return a;switch(a){case B:return"AsyncMode";case A:return"Context.Consumer";case w:return"ReactFragment";case u:return"ReactPortal";case y:return"Profiler("+d.pendingProps.id+")";case z:return"Context.Provider";case x:return"StrictMode";case D:return"Timeout"}if("object"===typeof a&&null!==a)switch(a.$$typeof){case C:return d=a.render.displayName||a.render.name||"",""!==d?"ForwardRef("+d+")":"ForwardRef"}return null}
function F(d,a){if(!(d instanceof a))throw new TypeError("Cannot call a class as a function");}
var J=function(){function d(){F(this,d);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new G(this)}d.prototype.getMountedInstance=function(){return this._instance};d.prototype.getRenderOutput=function(){return this._rendered};d.prototype.render=function(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;l.isValidElement(a)?void 0:r("12","function"===typeof a?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":
"");"string"===typeof a.type?r("13",a.type):void 0;m.isForwardRef(a)||"function"===typeof a.type?void 0:r("249",Array.isArray(a.type)?"array":null===a.type?"null":typeof a.type);if(!this._rendering){this._rendering=!0;this._element=a;var c=a.type.contextTypes;if(c){var d={},g;for(g in c)d[g]=b[g];b=d}else b=n;this._context=b;this._instance?this._updateClassComponent(a,this._context):m.isForwardRef(a)?this._rendered=a.type.render(a.props,a.ref):(b=a.type,b.prototype&&b.prototype.isReactComponent?(this._instance=
new a.type(a.props,this._context,this._updater),this._updateStateFromStaticLifecycle(a.props),a.type.hasOwnProperty("contextTypes")&&(H=a,b=a.type,c=(c=this._instance)&&c.constructor,q(a.type.contextTypes,this._context,"context",b.displayName||c&&c.displayName||b.name||c&&c.name||null,I),H=null),this._mountClassComponent(a,this._context)):this._rendered=a.type(a.props,this._context));this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};d.prototype.unmount=function(){this._instance&&
"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._instance=this._rendered=this._newState=this._element=this._context=null};d.prototype._mountClassComponent=function(a,b){this._instance.context=b;this._instance.props=a.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)b=this._newState,"function"!==
typeof a.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()),b!==this._newState&&(this._instance.state=this._newState||n);this._rendered=this._instance.render()};d.prototype._updateClassComponent=function(a,b){var c=a.props,d=a.type,g=this._instance.state||n,v=this._instance.props;
v!==c&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillReceiveProps&&this._instance.componentWillReceiveProps(c,b),"function"===typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(c,b));this._updateStateFromStaticLifecycle(c);var h=this._newState||g,k=!0;this._forcedUpdate?(k=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?
k=!!this._instance.shouldComponentUpdate(c,h,b):d.prototype&&d.prototype.isPureReactComponent&&(k=!p(v,c)||!p(g,h));k&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(c,h,b),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&this._instance.UNSAFE_componentWillUpdate(c,h,b));this._instance.context=b;this._instance.props=c;this._instance.state=
h;k&&(this._rendered=this._instance.render())};d.prototype._updateStateFromStaticLifecycle=function(a){var b=this._element.type;if("function"===typeof b.getDerivedStateFromProps){var c=this._newState||this._instance.state;a=b.getDerivedStateFromProps.call(null,a,c);null!=a&&(c=e({},c,a),this._instance.state=this._newState=c)}};return d}();J.createRenderer=function(){return new J};
var G=function(){function d(a){F(this,d);this._renderer=a;this._callbacks=[]}d.prototype._enqueueCallback=function(a,b){"function"===typeof a&&b&&this._callbacks.push({callback:a,publicInstance:b})};d.prototype._invokeCallbacks=function(){var a=this._callbacks;this._callbacks=[];a.forEach(function(a){a.callback.call(a.publicInstance)})};d.prototype.isMounted=function(){return!!this._renderer._element};d.prototype.enqueueForceUpdate=function(a,b){this._enqueueCallback(b,a);this._renderer._forcedUpdate=
!0;this._renderer.render(this._renderer._element,this._renderer._context)};d.prototype.enqueueReplaceState=function(a,b,c){this._enqueueCallback(c,a);this._renderer._newState=b;this._renderer.render(this._renderer._element,this._renderer._context)};d.prototype.enqueueSetState=function(a,b,c){this._enqueueCallback(c,a);c=this._renderer._newState||a.state;"function"===typeof b&&(b=b.call(a,c,a.props));null!==b&&void 0!==b&&(this._renderer._newState=e({},c,b),this._renderer.render(this._renderer._element,
this._renderer._context))};return d}(),H=null;function I(){var d="";if(H){var a=null==H?"#empty":"string"===typeof H||"number"===typeof H?"#text":"string"===typeof H.type?H.type:H.type.displayName||H.type.name||"Unknown",b=H._owner,c=H._source;b=b&&E(b);a="\n in "+(a||"Unknown")+(c?" (at "+c.fileName.replace(/^.*[\\\/]/,"")+":"+c.lineNumber+")":b?" (created by "+b+")":"");d+=a}return d}var K={default:J},L=K&&J||K;module.exports=L.default?L.default:L;