You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

2 lines
4.6 KiB

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("preact")):"function"==typeof define&&define.amd?define(["preact"],n):e.PreactTransitionGroup=n(e.preact)}(this,function(e){function n(e,n){for(var t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);return e}function t(e,n){var t=e.attributes&&e.attributes.key;return null===t||void 0===t?n:t}function r(e,n){var t=e._ptgLinkedRefs||(e._ptgLinkedRefs={});return t[n]||(t[n]=function(t){e.refs[n]=t})}function o(e){for(var n={},r=0;r<e.length;r++)if(null!=e[r]){var o=t(e[r],r.toString(36));n[o]=e[r]}return n}function i(e,n){e=e||{},n=n||{};var t=function(t){return n.hasOwnProperty(t)?n[t]:e[t]},r={},o=[];for(var i in e)n.hasOwnProperty(i)?o.length&&(r[i]=o,o=[]):o.push(i);var a={};for(var s in n){if(r.hasOwnProperty(s))for(var p=0;p<r[s].length;p++){var c=r[s][p];a[r[s][p]]=t(c)}a[s]=t(s)}for(var h=0;h<o.length;h++)a[o[h]]=t(o[h]);return a}var a=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},s=function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)},p=function(e,n){var t={};for(var r in e)n.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},c=function(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n},h=function(e){return e},f=function(t){function h(){var e,n,r;a(this,h);for(var i=arguments.length,s=Array(i),p=0;i>p;p++)s[p]=arguments[p];return e=n=c(this,t.call.apply(t,[this].concat(s))),n.refs={},n.state={children:o(n.props.children||[])},n.performEnter=function(e){n.currentlyTransitioningKeys[e]=!0;var t=n.refs[e];t.componentWillEnter?t.componentWillEnter(n._handleDoneEntering.bind(n,e)):n._handleDoneEntering(e)},n.performLeave=function(e){n.currentlyTransitioningKeys[e]=!0;var t=n.refs[e];t.componentWillLeave?t.componentWillLeave(n._handleDoneLeaving.bind(n,e)):n._handleDoneLeaving(e)},r=e,c(n,r)}return s(h,t),h.prototype.componentWillMount=function(){this.currentlyTransitioningKeys={},this.keysToEnter=[],this.keysToLeave=[]},h.prototype.componentDidMount=function(){var e=this.state.children;for(var n in e)e[n]&&this.performAppear(n)},h.prototype.componentWillReceiveProps=function(e){var n=o(e.children||[]),t=this.state.children;this.setState({children:i(t,n)});var r=void 0;for(r in n)if(n.hasOwnProperty(r)){var a=t&&t.hasOwnProperty(r);!n[r]||a||this.currentlyTransitioningKeys[r]||this.keysToEnter.push(r)}for(r in t)if(t.hasOwnProperty(r)){var s=n&&n.hasOwnProperty(r);!t[r]||s||this.currentlyTransitioningKeys[r]||this.keysToLeave.push(r)}},h.prototype.componentDidUpdate=function(){var e=this.keysToEnter;this.keysToEnter=[],e.forEach(this.performEnter);var n=this.keysToLeave;this.keysToLeave=[],n.forEach(this.performLeave)},h.prototype.performAppear=function(e){this.currentlyTransitioningKeys[e]=!0;var n=this.refs[e];n.componentWillAppear?n.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)},h.prototype._handleDoneAppearing=function(e){var n=this.refs[e];n.componentDidAppear&&n.componentDidAppear(),delete this.currentlyTransitioningKeys[e];var t=o(this.props.children||[]);t&&t.hasOwnProperty(e)||this.performLeave(e)},h.prototype._handleDoneEntering=function(e){var n=this.refs[e];n.componentDidEnter&&n.componentDidEnter(),delete this.currentlyTransitioningKeys[e];var t=o(this.props.children||[]);t&&t.hasOwnProperty(e)||this.performLeave(e)},h.prototype._handleDoneLeaving=function(e){var t=this.refs[e];t.componentDidLeave&&t.componentDidLeave(),delete this.currentlyTransitioningKeys[e];var r=o(this.props.children||[]);if(r&&r.hasOwnProperty(e))this.performEnter(e);else{var i=n({},this.state.children);delete i[e],this.setState({children:i})}},h.prototype.render=function(n,t){var o=n.childFactory,i=(n.transitionLeave,n.transitionName,n.transitionAppear,n.transitionEnter,n.transitionLeaveTimeout,n.transitionEnterTimeout,n.transitionAppearTimeout,n.component),a=p(n,["childFactory","transitionLeave","transitionName","transitionAppear","transitionEnter","transitionLeaveTimeout","transitionEnterTimeout","transitionAppearTimeout","component"]),s=t.children,c=[];for(var h in s)if(s.hasOwnProperty(h)){var f=s[h];if(f){var l=r(this,h),u=e.cloneElement(o(f),{ref:l,key:h});c.push(u)}}return e.h(i,a,c)},h}(e.Component);return f.defaultProps={component:"span",childFactory:h},f});
//# sourceMappingURL=preact-transition-group.min.js.map