rmwc
Version:
A thin React wrapper for Material Design (Web) Components
25 lines (23 loc) • 7.09 kB
JavaScript
/** @license React v16.3.2
* 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"),g=require("fbjs/lib/invariant"),m=require("react"),n=require("react-is"),p=require("fbjs/lib/emptyObject"),q=require("fbjs/lib/shallowEqual"),r=require("prop-types/checkPropTypes");
function t(a){for(var b=arguments.length-1,c="http://reactjs.org/docs/error-decoder.html?invariant\x3d"+a,d=0;d<b;d++)c+="\x26args[]\x3d"+encodeURIComponent(arguments[d+1]);g(!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. ",c)}
var u="function"===typeof Symbol&&Symbol["for"],v=u?Symbol["for"]("react.call"):60104,x=u?Symbol["for"]("react.return"):60105,y=u?Symbol["for"]("react.portal"):60106,z=u?Symbol["for"]("react.fragment"):60107,A=u?Symbol["for"]("react.forward_ref"):60112;
function B(a){a=a.type;if("function"===typeof a)return a.displayName||a.name;if("string"===typeof a)return a;switch(a){case z:return"ReactFragment";case y:return"ReactPortal";case v:return"ReactCall";case x:return"ReactReturn"}if("object"===typeof a&&null!==a)switch(a.$$typeof){case A:return a=a.render.displayName||a.render.name||"",""!==a?"ForwardRef("+a+")":"ForwardRef"}return null}function C(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}
var G=function(){function a(){C(this,a);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new D(this)}a.prototype.getMountedInstance=function(){return this._instance};a.prototype.getRenderOutput=function(){return this._rendered};a.prototype.render=function(b){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:p;m.isValidElement(b)?void 0:t("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?t("13",b.type):void 0;n.isForwardRef(b)||"function"===typeof b.type?void 0:t("249",Array.isArray(b.type)?"array":null===b.type?"null":typeof b.type);if(!this._rendering){this._rendering=!0;this._element=b;var a=b.type.contextTypes;if(a){var h={},f;for(f in a)h[f]=c[f];c=h}else c=p;this._context=c;this._instance?this._updateClassComponent(b,this._context):n.isForwardRef(b)?this._rendered=b.type.render(b.props,b.ref):(c=b.type,c.prototype&&c.prototype.isReactComponent?(this._instance=
new b.type(b.props,this._context,this._updater),this._updateStateFromStaticLifecycle(b.props),b.type.hasOwnProperty("contextTypes")&&(E=b,c=b.type,a=(a=this._instance)&&a.constructor,r(b.type.contextTypes,this._context,"context",c.displayName||a&&a.displayName||c.name||a&&a.name||null,F),E=null),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||p);this._rendered=this._instance.render()};a.prototype._updateClassComponent=function(b,a){var c=b.props,h=b.type,f=this._instance.state||p,w=this._instance.props;
w!==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 k=this._newState||f,l=!0;this._forcedUpdate?(l=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?
l=!!this._instance.shouldComponentUpdate(c,k,a):h.prototype&&h.prototype.isPureReactComponent&&(l=!q(w,c)||!q(f,k));l&&"function"!==typeof b.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(c,k,a),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&this._instance.UNSAFE_componentWillUpdate(c,k,a));this._instance.context=a;this._instance.props=c;this._instance.state=
k;l&&(this._rendered=this._instance.render())};a.prototype._updateStateFromStaticLifecycle=function(b){var a=this._element.type;"function"===typeof a.getDerivedStateFromProps&&(b=a.getDerivedStateFromProps.call(null,b,this._instance.state),null!=b&&(b=e({},this._newState||this._instance.state,b),this._instance.state=this._newState=b))};return a}();G.createRenderer=function(){return new G};
var D=function(){function a(b){C(this,a);this._renderer=b;this._callbacks=[]}a.prototype._enqueueCallback=function(a,c){"function"===typeof a&&c&&this._callbacks.push({callback:a,publicInstance:c})};a.prototype._invokeCallbacks=function(){var a=this._callbacks;this._callbacks=[];a.forEach(function(a){a.callback.call(a.publicInstance)})};a.prototype.isMounted=function(){return!!this._renderer._element};a.prototype.enqueueForceUpdate=function(a,c){this._enqueueCallback(c,a);this._renderer._forcedUpdate=
!0;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueReplaceState=function(a,c,d){this._enqueueCallback(d,a);this._renderer._newState=c;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueSetState=function(a,c,d){this._enqueueCallback(d,a);d=this._renderer._newState||a.state;"function"===typeof c&&(c=c(d,a.props));this._renderer._newState=e({},d,c);this._renderer.render(this._renderer._element,this._renderer._context)};
return a}(),E=null;function F(){var a="";if(E){var b=null==E?"#empty":"string"===typeof E||"number"===typeof E?"#text":"string"===typeof E.type?E.type:E.type.displayName||E.type.name||"Unknown",c=E._owner,d=E._source;c=c&&B(c);b="\n in "+(b||"Unknown")+(d?" (at "+d.fileName.replace(/^.*[\\\/]/,"")+":"+d.lineNumber+")":c?" (created by "+c+")":"");a+=b}return a}var H=Object.freeze({default:G}),I=H&&G||H;module.exports=I["default"]?I["default"]:I;