storybook-prebuilt
Version:
A prebuilt storybook version for web components
3 lines (2 loc) • 2.86 kB
JavaScript
import{i as t}from"./storybook-prebuilt-ef0ce90f.js";import{d as e,t as n,k as o,e as r,h as l}from"./storybook-prebuilt-8f2fc776.js";function i(){var t=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=t&&this.setState(t)}function p(t){this.setState(function(e){var n=this.constructor.getDerivedStateFromProps(t,e);return null!=n?n:null}.bind(this))}function a(t,e){try{var n=this.props,o=this.state;this.props=t,this.state=e,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,o)}finally{this.props=n,this.state=o}}function s(t){var e=t.prototype;if(!e||!e.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof t.getDerivedStateFromProps&&"function"!=typeof e.getSnapshotBeforeUpdate)return t;var n=null,o=null,r=null;if("function"==typeof e.componentWillMount?n="componentWillMount":"function"==typeof e.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof e.componentWillReceiveProps?o="componentWillReceiveProps":"function"==typeof e.UNSAFE_componentWillReceiveProps&&(o="UNSAFE_componentWillReceiveProps"),"function"==typeof e.componentWillUpdate?r="componentWillUpdate":"function"==typeof e.UNSAFE_componentWillUpdate&&(r="UNSAFE_componentWillUpdate"),null!==n||null!==o||null!==r){var l=t.displayName||t.name,s="function"==typeof t.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+l+" uses "+s+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==o?"\n "+o:"")+(null!==r?"\n "+r:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof t.getDerivedStateFromProps&&(e.componentWillMount=i,e.componentWillReceiveProps=p),"function"==typeof e.getSnapshotBeforeUpdate){if("function"!=typeof e.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");e.componentWillUpdate=a;var c=e.componentDidUpdate;e.componentDidUpdate=function(t,e,n){var o=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;c.call(this,t,e,o)}}return t}i.__suppressDeprecationWarning=!0,p.__suppressDeprecationWarning=!0,a.__suppressDeprecationWarning=!0;var c=Object.freeze({__proto__:null,polyfill:s});var f=function(t,e){return null!=t&&e in Object(t)};var u=function(i,p,a){for(var s=-1,c=(p=e(p,i)).length,f=!1;++s<c;){var u=n(p[s]);if(!(f=null!=i&&a(i,u)))break;i=i[u]}return f||++s!=c?f:!!(c=null==i?0:i.length)&&o(c)&&r(u,c)&&(t(i)||l(i))};var h=function(t,e){return null!=t&&u(t,e,f)};export{h,s as p,c as r};
//# sourceMappingURL=storybook-prebuilt-d050466c.js.map