rmwc
Version:
A thin React wrapper for Material Design (Web) Components
20 lines (19 loc) • 4.87 kB
JavaScript
/** @license React v16.1.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"),g=require("react"),k=require("fbjs/lib/emptyObject"),l=require("fbjs/lib/shallowEqual"),n=require("prop-types/checkPropTypes");
function p(b){for(var a=arguments.length-1,c="Minified React error #"+b+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant\x3d"+b,d=0;d<a;d++)c+="\x26args[]\x3d"+encodeURIComponent(arguments[d+1]);a=Error(c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");a.name="Invariant Violation";a.framesToPop=1;throw a;}function q(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function");}
var w=function(){function b(){q(this,b);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new t(this)}b.prototype.getMountedInstance=function(){return this._instance};b.prototype.getRenderOutput=function(){return this._rendered};b.prototype.render=function(a){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:k;g.isValidElement(a)?void 0:p("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?p("13",a.type):void 0;"function"!==typeof a.type?p("249",Array.isArray(a.type)?"array":null===a.type?"null":typeof a.type):void 0;if(!this._rendering){this._rendering=!0;this._element=a;this._context=c;if(this._instance)this._updateClassComponent(a.type,a.props,c);else{var d=a.type;if(d.prototype&&d.prototype.isReactComponent){this._instance=new a.type(a.props,c,this._updater);if(a.type.hasOwnProperty("contextTypes")){u=a;d=a.type;var b=this._instance;b=b&&b.constructor;
n(a.type.contextTypes,c,"context",d.displayName||b&&b.displayName||d.name||b&&b.name||null,v);u=null}this._mountClassComponent(a.props,c)}else this._rendered=a.type(a.props,c)}this._rendering=!1;return this.getRenderOutput()}};b.prototype.unmount=function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._instance=this._rendered=this._newState=this._element=this._context=null};b.prototype._mountClassComponent=function(a,c){this._instance.context=
c;this._instance.props=a;this._instance.state=this._instance.state||k;this._instance.updater=this._updater;"function"===typeof this._instance.componentWillMount&&(a=this._newState,this._instance.componentWillMount(),a!==this._newState&&(this._instance.state=this._newState||k));this._rendered=this._instance.render()};b.prototype._updateClassComponent=function(a,c,b){var d=this._instance.state||k,r=this._instance.props;r!==c&&"function"===typeof this._instance.componentWillReceiveProps&&this._instance.componentWillReceiveProps(c,
b);var h=this._newState||d,f=!0;this._forcedUpdate?(f=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?f=!!this._instance.shouldComponentUpdate(c,h,b):a.prototype&&a.prototype.isPureReactComponent&&(f=!l(r,c)||!l(d,h));f&&"function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(c,h,b);this._instance.context=b;this._instance.props=c;this._instance.state=h;f&&(this._rendered=this._instance.render())};return b}();w.createRenderer=function(){return new w};
var t=function(){function b(a){q(this,b);this._renderer=a}b.prototype.isMounted=function(){return!!this._renderer._element};b.prototype.enqueueForceUpdate=function(a,c){this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,this._renderer._context);"function"===typeof c&&c.call(a)};b.prototype.enqueueReplaceState=function(a,c,b){this._renderer._newState=c;this._renderer.render(this._renderer._element,this._renderer._context);"function"===typeof b&&b.call(a)};b.prototype.enqueueSetState=
function(a,c,b){var 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);"function"===typeof b&&b.call(a)};return b}(),u=null;
function v(){var b="";if(u){var a=null==u?"#empty":"string"===typeof u||"number"===typeof u?"#text":"string"===typeof u.type?u.type:u.type.displayName||u.type.name||"Unknown",c=u._owner,d=u._source,m;if(m=c)c=c.type,m="string"===typeof c?c:"function"===typeof c?c.displayName||c.name:null;c=m;a="\n in "+(a||"Unknown")+(d?" (at "+d.fileName.replace(/^.*[\\\/]/,"")+":"+d.lineNumber+")":c?" (created by "+c+")":"");b+=a}return b}var x=Object.freeze({default:w}),y=x&&w||x;
module.exports=y["default"]?y["default"]:y;