Removed GopherJS, basic frontend completed, need backend changes for

torrent storage
This commit is contained in:
2017-11-30 18:12:11 -05:00
parent 67fdef16b1
commit e98ad2cc88
69321 changed files with 5498914 additions and 337 deletions

View File

@@ -0,0 +1,311 @@
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _propTypes = require('prop-types');
var PropTypes = _interopRequireWildcard(_propTypes);
var _addClass = require('dom-helpers/class/addClass');
var _addClass2 = _interopRequireDefault(_addClass);
var _removeClass = require('dom-helpers/class/removeClass');
var _removeClass2 = _interopRequireDefault(_removeClass);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _Transition = require('./Transition');
var _Transition2 = _interopRequireDefault(_Transition);
var _PropTypes = require('./utils/PropTypes');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var addClass = function addClass(node, classes) {
return classes && classes.split(' ').forEach(function (c) {
return (0, _addClass2.default)(node, c);
});
};
var removeClass = function removeClass(node, classes) {
return classes && classes.split(' ').forEach(function (c) {
return (0, _removeClass2.default)(node, c);
});
};
var propTypes = _extends({}, _Transition2.default.propTypes, {
/**
* The animation classNames applied to the component as it enters or exits.
* A single name can be provided and it will be suffixed for each stage: e.g.
*
* `classNames="fade"` applies `fade-enter`, `fade-enter-active`,
* `fade-exit`, `fade-exit-active`, `fade-appear`, and `fade-appear-active`.
* Each individual classNames can also be specified independently like:
*
* ```js
* classNames={{
* appear: 'my-appear',
* appearActive: 'my-active-appear',
* enter: 'my-enter',
* enterActive: 'my-active-enter',
* exit: 'my-exit',
* exitActive: 'my-active-exit',
* }}
* ```
*
* @type {string | {
* appear?: string,
* appearActive?: string,
* enter?: string,
* enterActive?: string,
* exit?: string,
* exitActive?: string,
* }}
*/
classNames: _PropTypes.classNamesShape,
/**
* A `<Transition>` callback fired immediately after the 'enter' or 'appear' class is
* applied.
*
* @type Function(node: HtmlElement, isAppearing: bool)
*/
onEnter: PropTypes.func,
/**
* A `<Transition>` callback fired immediately after the 'enter-active' or
* 'appear-active' class is applied.
*
* @type Function(node: HtmlElement, isAppearing: bool)
*/
onEntering: PropTypes.func,
/**
* A `<Transition>` callback fired immediately after the 'enter' or
* 'appear' classes are **removed** from the DOM node.
*
* @type Function(node: HtmlElement, isAppearing: bool)
*/
onEntered: PropTypes.func,
/**
* A `<Transition>` callback fired immediately after the 'exit' class is
* applied.
*
* @type Function(node: HtmlElement)
*/
onExit: PropTypes.func,
/**
* A `<Transition>` callback fired immediately after the 'exit-active' is applied.
*
* @type Function(node: HtmlElement
*/
onExiting: PropTypes.func,
/**
* A `<Transition>` callback fired immediately after the 'exit' classes
* are **removed** from the DOM node.
*
* @type Function(node: HtmlElement)
*/
onExited: PropTypes.func
});
/**
* A `Transition` component using CSS transitions and animations.
* It's inspired by the excellent [ng-animate](http://www.nganimate.org/) library.
*
* `CSSTransition` applies a pair of class names during the `appear`, `enter`,
* and `exit` stages of the transition. The first class is applied and then a
* second "active" class in order to activate the css animation.
*
* When the `in` prop is toggled to `true` the Component will get
* the `example-enter` CSS class and the `example-enter-active` CSS class
* added in the next tick. This is a convention based on the `classNames` prop.
*
* ```js
* import CSSTransition from 'react-transition-group/CSSTransition';
*
* const Fade = ({ children, ...props }) => (
* <CSSTransition
* {...props}
* timeout={500}
* classNames="fade"
* >
* {children}
* </CSSTransition>
* );
*
* class FadeInAndOut extends React.Component {
* constructor(...args) {
* super(...args);
* this.state= { show: false }
*
* setInterval(() => {
* this.setState({ show: !this.state.show })
* }, 5000)
* }
* render() {
* return (
* <Fade in={this.state.show}>
* <div>Hello world</div>
* </Fade>
* )
* }
* }
* ```
*
* And the coorresponding CSS for the `<Fade>` component:
*
* ```css
* .fade-enter {
* opacity: 0.01;
* }
*
* .fade-enter.fade-enter-active {
* opacity: 1;
* transition: opacity 500ms ease-in;
* }
*
* .fade-exit {
* opacity: 1;
* }
*
* .fade-exit.fade-exit-active {
* opacity: 0.01;
* transition: opacity 300ms ease-in;
* }
* ```
*/
var CSSTransition = function (_React$Component) {
_inherits(CSSTransition, _React$Component);
function CSSTransition() {
var _temp, _this, _ret;
_classCallCheck(this, CSSTransition);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.onEnter = function (node, appearing) {
var _this$getClassNames = _this.getClassNames(appearing ? 'appear' : 'enter'),
className = _this$getClassNames.className;
_this.removeClasses(node, 'exit');
addClass(node, className);
if (_this.props.onEnter) {
_this.props.onEnter(node);
}
}, _this.onEntering = function (node, appearing) {
var _this$getClassNames2 = _this.getClassNames(appearing ? 'appear' : 'enter'),
activeClassName = _this$getClassNames2.activeClassName;
_this.reflowAndAddClass(node, activeClassName);
if (_this.props.onEntering) {
_this.props.onEntering(node);
}
}, _this.onEntered = function (node, appearing) {
_this.removeClasses(node, appearing ? 'appear' : 'enter');
if (_this.props.onEntered) {
_this.props.onEntered(node);
}
}, _this.onExit = function (node) {
var _this$getClassNames3 = _this.getClassNames('exit'),
className = _this$getClassNames3.className;
_this.removeClasses(node, 'appear');
_this.removeClasses(node, 'enter');
addClass(node, className);
if (_this.props.onExit) {
_this.props.onExit(node);
}
}, _this.onExiting = function (node) {
var _this$getClassNames4 = _this.getClassNames('exit'),
activeClassName = _this$getClassNames4.activeClassName;
_this.reflowAndAddClass(node, activeClassName);
if (_this.props.onExiting) {
_this.props.onExiting(node);
}
}, _this.onExited = function (node) {
_this.removeClasses(node, 'exit');
if (_this.props.onExited) {
_this.props.onExited(node);
}
}, _this.getClassNames = function (type) {
var classNames = _this.props.classNames;
var className = typeof classNames !== 'string' ? classNames[type] : classNames + '-' + type;
var activeClassName = typeof classNames !== 'string' ? classNames[type + 'Active'] : className + '-active';
return { className: className, activeClassName: activeClassName };
}, _temp), _possibleConstructorReturn(_this, _ret);
}
CSSTransition.prototype.removeClasses = function removeClasses(node, type) {
var _getClassNames = this.getClassNames(type),
className = _getClassNames.className,
activeClassName = _getClassNames.activeClassName;
className && removeClass(node, className);
activeClassName && removeClass(node, activeClassName);
};
CSSTransition.prototype.reflowAndAddClass = function reflowAndAddClass(node, className) {
// This is for to force a repaint,
// which is necessary in order to transition styles when adding a class name.
/* eslint-disable no-unused-expressions */
node.scrollTop;
/* eslint-enable no-unused-expressions */
addClass(node, className);
};
CSSTransition.prototype.render = function render() {
var props = _extends({}, this.props);
delete props.classNames;
return _react2.default.createElement(_Transition2.default, _extends({}, props, {
onEnter: this.onEnter,
onEntered: this.onEntered,
onEntering: this.onEntering,
onExit: this.onExit,
onExiting: this.onExiting,
onExited: this.onExited
}));
};
return CSSTransition;
}(_react2.default.Component);
CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
exports.default = CSSTransition;
module.exports = exports['default'];

View File

@@ -0,0 +1,30 @@
BSD 3-Clause License
Copyright (c) 2016, React Community
Forked from React (https://github.com/facebook/react) Copyright 2013-present, Facebook, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,27 @@
# react-transition-group [![npm][npm-badge]][npm]
> **ATTENTION!** To address many issues that have come up over the years, the API in v2 is different from that in the original React addon.
>
> **For a drop-in replacement for `react-addons-transition-group` and `react-addons-css-transition-group`, use the v1 release, which is still actively maintained. Documentation and code for that release are available on the [`v1-stable`](https://github.com/reactjs/react-transition-group/tree/v1-stable) branch.**
>
> You can send pull requests with v1 bugfixes against the `v1-stable` branch.
A set of components for managing component states (including mounting and unmounting) over time, specifically designed with animation in mind.
## Documentation
- [**Main documentation**](https://reactcommunity.org/react-transition-group/)
- [Migration guide from v1](/Migration.md)
## Examples
Clone the repo first:
```
git@github.com:reactjs/react-transition-group.git
```
Then run `npm install` (or `yarn`), and finally `npm run storybook` to start a storybook instance that you can navigate to in your browser to see the examples.
[npm-badge]: https://img.shields.io/npm/v/react-transition-group.svg
[npm]: https://www.npmjs.org/package/react-transition-group

View File

@@ -0,0 +1,557 @@
'use strict';
exports.__esModule = true;
exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = undefined;
var _propTypes = require('prop-types');
var PropTypes = _interopRequireWildcard(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _PropTypes = require('./utils/PropTypes');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var UNMOUNTED = exports.UNMOUNTED = 'unmounted';
var EXITED = exports.EXITED = 'exited';
var ENTERING = exports.ENTERING = 'entering';
var ENTERED = exports.ENTERED = 'entered';
var EXITING = exports.EXITING = 'exiting';
/**
* The Transition component lets you describe a transition from one component
* state to another _over time_ with a simple declarative API. Most commonly
* it's used to animate the mounting and unmounting of a component, but can also
* be used to describe in-place transition states as well.
*
* By default the `Transition` component does not alter the behavior of the
* component it renders, it only tracks "enter" and "exit" states for the components.
* It's up to you to give meaning and effect to those states. For example we can
* add styles to a component when it enters or exits:
*
* ```jsx
* import Transition from 'react-transition-group/Transition';
*
* const duration = 300;
*
* const defaultStyle = {
* transition: `opacity ${duration}ms ease-in-out`,
* opacity: 0,
* }
*
* const transitionStyles = {
* entering: { opacity: 0 },
* entered: { opacity: 1 },
* };
*
* const Fade = ({ in: inProp }) => (
* <Transition in={inProp} timeout={duration}>
* {(state) => (
* <div style={{
* ...defaultStyle,
* ...transitionStyles[state]
* }}>
* I'm A fade Transition!
* </div>
* )}
* </Transition>
* );
* ```
*
* As noted the `Transition` component doesn't _do_ anything by itself to its child component.
* What it does do is track transition states over time so you can update the
* component (such as by adding styles or classes) when it changes states.
*
* There are 4 main states a Transition can be in:
* - `ENTERING`
* - `ENTERED`
* - `EXITING`
* - `EXITED`
*
* Transition state is toggled via the `in` prop. When `true` the component begins the
* "Enter" stage. During this stage, the component will shift from its current transition state,
* to `'entering'` for the duration of the transition and then to the `'entered'` stage once
* it's complete. Let's take the following example:
*
* ```jsx
* state= { in: false };
*
* toggleEnterState = () => {
* this.setState({ in: true });
* }
*
* render() {
* return (
* <div>
* <Transition in={this.state.in} timeout={500} />
* <button onClick={this.toggleEnterState}>Click to Enter</button>
* </div>
* );
* }
* ```
*
* When the button is clicked the component will shift to the `'entering'` state and
* stay there for 500ms (the value of `timeout`) when finally switches to `'entered'`.
*
* When `in` is `false` the same thing happens except the state moves from `'exiting'` to `'exited'`.
*/
var Transition = function (_React$Component) {
_inherits(Transition, _React$Component);
function Transition(props, context) {
_classCallCheck(this, Transition);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
var parentGroup = context.transitionGroup;
// In the context of a TransitionGroup all enters are really appears
var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
var initialStatus = void 0;
_this.nextStatus = null;
if (props.in) {
if (appear) {
initialStatus = EXITED;
_this.nextStatus = ENTERING;
} else {
initialStatus = ENTERED;
}
} else {
if (props.unmountOnExit || props.mountOnEnter) {
initialStatus = UNMOUNTED;
} else {
initialStatus = EXITED;
}
}
_this.state = { status: initialStatus };
_this.nextCallback = null;
return _this;
}
Transition.prototype.getChildContext = function getChildContext() {
return { transitionGroup: null }; // allows for nested Transitions
};
Transition.prototype.componentDidMount = function componentDidMount() {
this.updateStatus(true);
};
Transition.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var _ref = this.pendingState || this.state,
status = _ref.status;
if (nextProps.in) {
if (status === UNMOUNTED) {
this.setState({ status: EXITED });
}
if (status !== ENTERING && status !== ENTERED) {
this.nextStatus = ENTERING;
}
} else {
if (status === ENTERING || status === ENTERED) {
this.nextStatus = EXITING;
}
}
};
Transition.prototype.componentDidUpdate = function componentDidUpdate() {
this.updateStatus();
};
Transition.prototype.componentWillUnmount = function componentWillUnmount() {
this.cancelNextCallback();
};
Transition.prototype.getTimeouts = function getTimeouts() {
var timeout = this.props.timeout;
var exit = void 0,
enter = void 0,
appear = void 0;
exit = enter = appear = timeout;
if (timeout != null && typeof timeout !== 'number') {
exit = timeout.exit;
enter = timeout.enter;
appear = timeout.appear;
}
return { exit: exit, enter: enter, appear: appear };
};
Transition.prototype.updateStatus = function updateStatus() {
var mounting = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var nextStatus = this.nextStatus;
if (nextStatus !== null) {
this.nextStatus = null;
// nextStatus will always be ENTERING or EXITING.
this.cancelNextCallback();
var node = _reactDom2.default.findDOMNode(this);
if (nextStatus === ENTERING) {
this.performEnter(node, mounting);
} else {
this.performExit(node);
}
} else if (this.props.unmountOnExit && this.state.status === EXITED) {
this.setState({ status: UNMOUNTED });
}
};
Transition.prototype.performEnter = function performEnter(node, mounting) {
var _this2 = this;
var enter = this.props.enter;
var appearing = this.context.transitionGroup ? this.context.transitionGroup.isMounting : mounting;
var timeouts = this.getTimeouts();
// no enter animation skip right to ENTERED
// if we are mounting and running this it means appear _must_ be set
if (!mounting && !enter) {
this.safeSetState({ status: ENTERED }, function () {
_this2.props.onEntered(node);
});
return;
}
this.props.onEnter(node, appearing);
this.safeSetState({ status: ENTERING }, function () {
_this2.props.onEntering(node, appearing);
// FIXME: appear timeout?
_this2.onTransitionEnd(node, timeouts.enter, function () {
_this2.safeSetState({ status: ENTERED }, function () {
_this2.props.onEntered(node, appearing);
});
});
});
};
Transition.prototype.performExit = function performExit(node) {
var _this3 = this;
var exit = this.props.exit;
var timeouts = this.getTimeouts();
// no exit animation skip right to EXITED
if (!exit) {
this.safeSetState({ status: EXITED }, function () {
_this3.props.onExited(node);
});
return;
}
this.props.onExit(node);
this.safeSetState({ status: EXITING }, function () {
_this3.props.onExiting(node);
_this3.onTransitionEnd(node, timeouts.exit, function () {
_this3.safeSetState({ status: EXITED }, function () {
_this3.props.onExited(node);
});
});
});
};
Transition.prototype.cancelNextCallback = function cancelNextCallback() {
if (this.nextCallback !== null) {
this.nextCallback.cancel();
this.nextCallback = null;
}
};
Transition.prototype.safeSetState = function safeSetState(nextState, callback) {
var _this4 = this;
// We need to track pending updates for instances where a cWRP fires quickly
// after cDM and before the state flushes, which would double trigger a
// transition
this.pendingState = nextState;
// This shouldn't be necessary, but there are weird race conditions with
// setState callbacks and unmounting in testing, so always make sure that
// we can cancel any pending setState callbacks after we unmount.
callback = this.setNextCallback(callback);
this.setState(nextState, function () {
_this4.pendingState = null;
callback();
});
};
Transition.prototype.setNextCallback = function setNextCallback(callback) {
var _this5 = this;
var active = true;
this.nextCallback = function (event) {
if (active) {
active = false;
_this5.nextCallback = null;
callback(event);
}
};
this.nextCallback.cancel = function () {
active = false;
};
return this.nextCallback;
};
Transition.prototype.onTransitionEnd = function onTransitionEnd(node, timeout, handler) {
this.setNextCallback(handler);
if (node) {
if (this.props.addEndListener) {
this.props.addEndListener(node, this.nextCallback);
}
if (timeout != null) {
setTimeout(this.nextCallback, timeout);
}
} else {
setTimeout(this.nextCallback, 0);
}
};
Transition.prototype.render = function render() {
var status = this.state.status;
if (status === UNMOUNTED) {
return null;
}
var _props = this.props,
children = _props.children,
childProps = _objectWithoutProperties(_props, ['children']);
// filter props for Transtition
delete childProps.in;
delete childProps.mountOnEnter;
delete childProps.unmountOnExit;
delete childProps.appear;
delete childProps.enter;
delete childProps.exit;
delete childProps.timeout;
delete childProps.addEndListener;
delete childProps.onEnter;
delete childProps.onEntering;
delete childProps.onEntered;
delete childProps.onExit;
delete childProps.onExiting;
delete childProps.onExited;
if (typeof children === 'function') {
return children(status, childProps);
}
var child = _react2.default.Children.only(children);
return _react2.default.cloneElement(child, childProps);
};
return Transition;
}(_react2.default.Component);
Transition.contextTypes = {
transitionGroup: PropTypes.object
};
Transition.childContextTypes = {
transitionGroup: function transitionGroup() {}
};
Transition.propTypes = process.env.NODE_ENV !== "production" ? {
/**
* A `function` child can be used instead of a React element.
* This function is called with the current transition status
* ('entering', 'entered', 'exiting', 'exited', 'unmounted'), which can used
* to apply context specific props to a component.
*
* ```jsx
* <Transition timeout={150}>
* {(status) => (
* <MyComponent className={`fade fade-${status}`} />
* )}
* </Transition>
* ```
*/
children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired,
/**
* Show the component; triggers the enter or exit states
*/
in: PropTypes.bool,
/**
* By default the child component is mounted immediately along with
* the parent `Transition` component. If you want to "lazy mount" the component on the
* first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
* mounted, even on "exited", unless you also specify `unmountOnExit`.
*/
mountOnEnter: PropTypes.bool,
/**
* By default the child component stays mounted after it reaches the `'exited'` state.
* Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
*/
unmountOnExit: PropTypes.bool,
/**
* Normally a component is not transitioned if it is shown when the `<Transition>` component mounts.
* If you want to transition on the first mount set `appear` to `true`, and the
* component will transition in as soon as the `<Transition>` mounts.
*
* > Note: there are no specific "appear" states. `appear` only adds an additional `enter` transition.
*/
appear: PropTypes.bool,
/**
* Enable or disable enter transitions.
*/
enter: PropTypes.bool,
/**
* Enable or disable exit transitions.
*/
exit: PropTypes.bool,
/**
* The duration of the transition, in milliseconds.
* Required unless `addEventListener` is provided
*
* You may specify a single timeout for all transitions like: `timeout={500}`,
* or individually like:
*
* ```jsx
* timeout={{
* enter: 300,
* exit: 500,
* }}
* ```
*
* @type {number | { enter?: number, exit?: number }}
*/
timeout: function timeout(props) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var pt = _PropTypes.timeoutsShape;
if (!props.addEndListener) pt = pt.isRequired;
return pt.apply(undefined, [props].concat(args));
},
/**
* Add a custom transition end trigger. Called with the transitioning
* DOM node and a `done` callback. Allows for more fine grained transition end
* logic. **Note:** Timeouts are still used as a fallback if provided.
*
* ```jsx
* addEndListener={(node, done) => {
* // use the css transitionend event to mark the finish of a transition
* node.addEventListener('transitionend', done, false);
* }}
* ```
*/
addEndListener: PropTypes.func,
/**
* Callback fired before the "entering" status is applied. An extra parameter
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
*
* @type Function(node: HtmlElement, isAppearing: bool) -> void
*/
onEnter: PropTypes.func,
/**
* Callback fired after the "entering" status is applied. An extra parameter
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
*
* @type Function(node: HtmlElement, isAppearing: bool)
*/
onEntering: PropTypes.func,
/**
* Callback fired after the "entered" status is applied. An extra parameter
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
*
* @type Function(node: HtmlElement, isAppearing: bool) -> void
*/
onEntered: PropTypes.func,
/**
* Callback fired before the "exiting" status is applied.
*
* @type Function(node: HtmlElement) -> void
*/
onExit: PropTypes.func,
/**
* Callback fired after the "exiting" status is applied.
*
* @type Function(node: HtmlElement) -> void
*/
onExiting: PropTypes.func,
/**
* Callback fired after the "exited" status is applied.
*
* @type Function(node: HtmlElement) -> void
*/
onExited: PropTypes.func
} : {};
// Name the function so it is clearer in the documentation
function noop() {}
Transition.defaultProps = {
in: false,
mountOnEnter: false,
unmountOnExit: false,
appear: false,
enter: true,
exit: true,
onEnter: noop,
onEntering: noop,
onEntered: noop,
onExit: noop,
onExiting: noop,
onExited: noop
};
Transition.UNMOUNTED = 0;
Transition.EXITED = 1;
Transition.ENTERING = 2;
Transition.ENTERED = 3;
Transition.EXITING = 4;
exports.default = Transition;

View File

@@ -0,0 +1,290 @@
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _ChildMapping = require('./utils/ChildMapping');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var values = Object.values || function (obj) {
return Object.keys(obj).map(function (k) {
return obj[k];
});
};
var propTypes = {
/**
* `<TransitionGroup>` renders a `<div>` by default. You can change this
* behavior by providing a `component` prop.
*/
component: _propTypes2.default.any,
/**
* A set of `<Transition>` components, that are toggled `in` and out as they
* leave. the `<TransitionGroup>` will inject specific transition props, so
* remember to spread them through if you are wrapping the `<Transition>` as
* with our `<Fade>` example.
*/
children: _propTypes2.default.node,
/**
* A convenience prop that enables or disabled appear animations
* for all children. Note that specifying this will override any defaults set
* on individual children Transitions.
*/
appear: _propTypes2.default.bool,
/**
* A convenience prop that enables or disabled enter animations
* for all children. Note that specifying this will override any defaults set
* on individual children Transitions.
*/
enter: _propTypes2.default.bool,
/**
* A convenience prop that enables or disabled exit animations
* for all children. Note that specifying this will override any defaults set
* on individual children Transitions.
*/
exit: _propTypes2.default.bool,
/**
* You may need to apply reactive updates to a child as it is exiting.
* This is generally done by using `cloneElement` however in the case of an exiting
* child the element has already been removed and not accessible to the consumer.
*
* If you do need to update a child as it leaves you can provide a `childFactory`
* to wrap every child, even the ones that are leaving.
*
* @type Function(child: ReactElement) -> ReactElement
*/
childFactory: _propTypes2.default.func
};
var defaultProps = {
component: 'div',
childFactory: function childFactory(child) {
return child;
}
};
/**
* The `<TransitionGroup>` component manages a set of `<Transition>` components
* in a list. Like with the `<Transition>` component, `<TransitionGroup>`, is a
* state machine for managing the mounting and unmounting of components over
* time.
*
* Consider the example below using the `Fade` CSS transition from before.
* As items are removed or added to the TodoList the `in` prop is toggled
* automatically by the `<TransitionGroup>`. You can use _any_ `<Transition>`
* component in a `<TransitionGroup>`, not just css.
*
* ```jsx
* import TransitionGroup from 'react-transition-group/TransitionGroup';
*
* class TodoList extends React.Component {
* constructor(props) {
* super(props)
* this.state = {items: ['hello', 'world', 'click', 'me']}
* }
* handleAdd() {
* const newItems = this.state.items.concat([
* prompt('Enter some text')
* ]);
* this.setState({ items: newItems });
* }
* handleRemove(i) {
* let newItems = this.state.items.slice();
* newItems.splice(i, 1);
* this.setState({items: newItems});
* }
* render() {
* return (
* <div>
* <button onClick={() => this.handleAdd()}>Add Item</button>
* <TransitionGroup>
* {this.state.items.map((item, i) => (
* <FadeTransition key={item}>
* <div>
* {item}{' '}
* <button onClick={() => this.handleRemove(i)}>
* remove
* </button>
* </div>
* </FadeTransition>
* ))}
* </TransitionGroup>
* </div>
* );
* }
* }
* ```
*
* Note that `<TransitionGroup>` does not define any animation behavior!
* Exactly _how_ a list item animates is up to the individual `<Transition>`
* components. This means you can mix and match animations across different
* list items.
*/
var TransitionGroup = function (_React$Component) {
_inherits(TransitionGroup, _React$Component);
function TransitionGroup(props, context) {
_classCallCheck(this, TransitionGroup);
// Initial children should all be entering, dependent on appear
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
_this.handleExited = function (key, node, originalHandler) {
var currentChildMapping = (0, _ChildMapping.getChildMapping)(_this.props.children);
if (key in currentChildMapping) return;
if (originalHandler) originalHandler(node);
_this.setState(function (state) {
var children = _extends({}, state.children);
delete children[key];
return { children: children };
});
};
_this.state = {
children: (0, _ChildMapping.getChildMapping)(props.children, function (child) {
var onExited = function onExited(node) {
_this.handleExited(child.key, node, child.props.onExited);
};
return (0, _react.cloneElement)(child, {
onExited: onExited,
in: true,
appear: _this.getProp(child, 'appear'),
enter: _this.getProp(child, 'enter'),
exit: _this.getProp(child, 'exit')
});
})
};
return _this;
}
TransitionGroup.prototype.getChildContext = function getChildContext() {
return {
transitionGroup: { isMounting: !this.appeared }
};
};
// use child config unless explictly set by the Group
TransitionGroup.prototype.getProp = function getProp(child, prop) {
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.props;
return props[prop] != null ? props[prop] : child.props[prop];
};
TransitionGroup.prototype.componentDidMount = function componentDidMount() {
this.appeared = true;
};
TransitionGroup.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var _this2 = this;
var prevChildMapping = this.state.children;
var nextChildMapping = (0, _ChildMapping.getChildMapping)(nextProps.children);
var children = (0, _ChildMapping.mergeChildMappings)(prevChildMapping, nextChildMapping);
Object.keys(children).forEach(function (key) {
var child = children[key];
if (!(0, _react.isValidElement)(child)) return;
var onExited = function onExited(node) {
_this2.handleExited(child.key, node, child.props.onExited);
};
var hasPrev = key in prevChildMapping;
var hasNext = key in nextChildMapping;
var prevChild = prevChildMapping[key];
var isLeaving = (0, _react.isValidElement)(prevChild) && !prevChild.props.in;
// item is new (entering)
if (hasNext && (!hasPrev || isLeaving)) {
// console.log('entering', key)
children[key] = (0, _react.cloneElement)(child, {
onExited: onExited,
in: true,
exit: _this2.getProp(child, 'exit', nextProps),
enter: _this2.getProp(child, 'enter', nextProps)
});
}
// item is old (exiting)
else if (!hasNext && hasPrev && !isLeaving) {
// console.log('leaving', key)
children[key] = (0, _react.cloneElement)(child, { in: false });
}
// item hasn't changed transition states
// copy over the last transition props;
else if (hasNext && hasPrev && (0, _react.isValidElement)(prevChild)) {
// console.log('unchanged', key)
children[key] = (0, _react.cloneElement)(child, {
onExited: onExited,
in: prevChild.props.in,
exit: _this2.getProp(child, 'exit', nextProps),
enter: _this2.getProp(child, 'enter', nextProps)
});
}
});
this.setState({ children: children });
};
TransitionGroup.prototype.render = function render() {
var _props = this.props,
Component = _props.component,
childFactory = _props.childFactory,
props = _objectWithoutProperties(_props, ['component', 'childFactory']);
var children = this.state.children;
delete props.appear;
delete props.enter;
delete props.exit;
return _react2.default.createElement(
Component,
props,
values(children).map(childFactory)
);
};
return TransitionGroup;
}(_react2.default.Component);
TransitionGroup.childContextTypes = {
transitionGroup: _propTypes2.default.object.isRequired
};
TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
TransitionGroup.defaultProps = defaultProps;
exports.default = TransitionGroup;
module.exports = exports['default'];

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,21 @@
'use strict';
var _CSSTransition = require('./CSSTransition');
var _CSSTransition2 = _interopRequireDefault(_CSSTransition);
var _TransitionGroup = require('./TransitionGroup');
var _TransitionGroup2 = _interopRequireDefault(_TransitionGroup);
var _Transition = require('./Transition');
var _Transition2 = _interopRequireDefault(_Transition);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = {
Transition: _Transition2.default,
TransitionGroup: _TransitionGroup2.default,
CSSTransition: _CSSTransition2.default
};

View File

@@ -0,0 +1,79 @@
{
"_args": [
[
"react-transition-group@2.2.1",
"C:\\Users\\deranjer\\GoglandProjects\\torrent-project\\torrent-project"
]
],
"_from": "react-transition-group@2.2.1",
"_id": "react-transition-group@2.2.1",
"_inBundle": false,
"_integrity": "sha512-q54UBM22bs/CekG8r3+vi9TugSqh0t7qcEVycaRc9M0p0aCEu+h6rp/RFiW7fHfgd1IKpd9oILFTl5QK+FpiPA==",
"_location": "/material-ui/react-transition-group",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "react-transition-group@2.2.1",
"name": "react-transition-group",
"escapedName": "react-transition-group",
"rawSpec": "2.2.1",
"saveSpec": null,
"fetchSpec": "2.2.1"
},
"_requiredBy": [
"/material-ui"
],
"_resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-2.2.1.tgz",
"_spec": "2.2.1",
"_where": "C:\\Users\\deranjer\\GoglandProjects\\torrent-project\\torrent-project",
"author": "",
"browserify": {
"transform": [
"loose-envify"
]
},
"bugs": {
"url": "https://github.com/reactjs/react-transition-group/issues"
},
"dependencies": {
"chain-function": "^1.0.0",
"classnames": "^2.2.5",
"dom-helpers": "^3.2.0",
"loose-envify": "^1.3.1",
"prop-types": "^15.5.8",
"warning": "^3.0.0"
},
"description": "A react component toolset for managing animations",
"homepage": "https://github.com/reactjs/react-transition-group#readme",
"jest": {
"testRegex": "-test\\.js",
"setupFiles": [
"./test/setup.js"
],
"roots": [
"<rootDir>/test"
]
},
"keywords": [
"react",
"transition",
"addons",
"transition-group",
"animation",
"css",
"transitions"
],
"license": "BSD-3-Clause",
"main": "index.js",
"name": "react-transition-group",
"peerDependencies": {
"react": ">=15.0.0",
"react-dom": ">=15.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/reactjs/react-transition-group.git"
},
"version": "2.2.1"
}

View File

@@ -0,0 +1,89 @@
'use strict';
exports.__esModule = true;
exports.getChildMapping = getChildMapping;
exports.mergeChildMappings = mergeChildMappings;
var _react = require('react');
/**
* Given `this.props.children`, return an object mapping key to child.
*
* @param {*} children `this.props.children`
* @return {object} Mapping of key to child
*/
function getChildMapping(children, mapFn) {
var mapper = function mapper(child) {
return mapFn && (0, _react.isValidElement)(child) ? mapFn(child) : child;
};
var result = Object.create(null);
if (children) _react.Children.map(children, function (c) {
return c;
}).forEach(function (child) {
// run the map function here instead so that the key is the computed one
result[child.key] = mapper(child);
});
return result;
}
/**
* When you're adding or removing children some may be added or removed in the
* same render pass. We want to show *both* since we want to simultaneously
* animate elements in and out. This function takes a previous set of keys
* and a new set of keys and merges them with its best guess of the correct
* ordering. In the future we may expose some of the utilities in
* ReactMultiChild to make this easy, but for now React itself does not
* directly have this concept of the union of prevChildren and nextChildren
* so we implement it here.
*
* @param {object} prev prev children as returned from
* `ReactTransitionChildMapping.getChildMapping()`.
* @param {object} next next children as returned from
* `ReactTransitionChildMapping.getChildMapping()`.
* @return {object} a key set that contains all keys in `prev` and all keys
* in `next` in a reasonable order.
*/
function mergeChildMappings(prev, next) {
prev = prev || {};
next = next || {};
function getValueForKey(key) {
return key in next ? next[key] : prev[key];
}
// For each key of `next`, the list of keys to insert before that key in
// the combined list
var nextKeysPending = Object.create(null);
var pendingKeys = [];
for (var prevKey in prev) {
if (prevKey in next) {
if (pendingKeys.length) {
nextKeysPending[prevKey] = pendingKeys;
pendingKeys = [];
}
} else {
pendingKeys.push(prevKey);
}
}
var i = void 0;
var childMapping = {};
for (var nextKey in next) {
if (nextKeysPending[nextKey]) {
for (i = 0; i < nextKeysPending[nextKey].length; i++) {
var pendingNextKey = nextKeysPending[nextKey][i];
childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
}
}
childMapping[nextKey] = getValueForKey(nextKey);
}
// Finally, add the keys which didn't appear before any key in `next`
for (i = 0; i < pendingKeys.length; i++) {
childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
}
return childMapping;
}

View File

@@ -0,0 +1,48 @@
'use strict';
exports.__esModule = true;
exports.classNamesShape = exports.timeoutsShape = undefined;
exports.transitionTimeout = transitionTimeout;
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function transitionTimeout(transitionType) {
var timeoutPropName = 'transition' + transitionType + 'Timeout';
var enabledPropName = 'transition' + transitionType;
return function (props) {
// If the transition is enabled
if (props[enabledPropName]) {
// If no timeout duration is provided
if (props[timeoutPropName] == null) {
return new Error(timeoutPropName + ' wasn\'t supplied to CSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.');
// If the duration isn't a number
} else if (typeof props[timeoutPropName] !== 'number') {
return new Error(timeoutPropName + ' must be a number (in milliseconds)');
}
}
return null;
};
}
var timeoutsShape = exports.timeoutsShape = _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.shape({
enter: _propTypes2.default.number,
exit: _propTypes2.default.number
}).isRequired]);
var classNamesShape = exports.classNamesShape = _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({
enter: _propTypes2.default.string,
exit: _propTypes2.default.string,
active: _propTypes2.default.string
}), _propTypes2.default.shape({
enter: _propTypes2.default.string,
enterActive: _propTypes2.default.string,
exit: _propTypes2.default.string,
exitActive: _propTypes2.default.string
})]);

View File

@@ -0,0 +1,38 @@
"use strict";
exports.__esModule = true;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var SimpleSet = function () {
function SimpleSet() {
_classCallCheck(this, SimpleSet);
this.v = [];
}
SimpleSet.prototype.clear = function clear() {
this.v.length = 0;
};
SimpleSet.prototype.has = function has(k) {
return this.v.indexOf(k) !== -1;
};
SimpleSet.prototype.add = function add(k) {
if (this.has(k)) return;
this.v.push(k);
};
SimpleSet.prototype.delete = function _delete(k) {
var idx = this.v.indexOf(k);
if (idx === -1) return false;
this.v.splice(idx, 1);
return true;
};
return SimpleSet;
}();
exports.default = SimpleSet;
module.exports = exports["default"];