1 | module.exports =
|
2 | (function(modules) {
|
3 |
|
4 | var installedModules = {};
|
5 |
|
6 |
|
7 | function __webpack_require__(moduleId) {
|
8 |
|
9 |
|
10 | if(installedModules[moduleId]) {
|
11 | return installedModules[moduleId].exports;
|
12 | }
|
13 |
|
14 | var module = installedModules[moduleId] = {
|
15 | i: moduleId,
|
16 | l: false,
|
17 | exports: {}
|
18 | };
|
19 |
|
20 |
|
21 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
22 |
|
23 |
|
24 | module.l = true;
|
25 |
|
26 |
|
27 | return module.exports;
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 | __webpack_require__.m = modules;
|
33 |
|
34 |
|
35 | __webpack_require__.c = installedModules;
|
36 |
|
37 |
|
38 | __webpack_require__.d = function(exports, name, getter) {
|
39 | if(!__webpack_require__.o(exports, name)) {
|
40 | Object.defineProperty(exports, name, {
|
41 | configurable: false,
|
42 | enumerable: true,
|
43 | get: getter
|
44 | /******/ });
|
45 | /******/ }
|
46 | /******/ };
|
47 | /******/
|
48 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
49 | /******/ __webpack_require__.n = function(module) {
|
50 | var getter = module && module.__esModule ?
|
51 | function getDefault() { return module['default']; } :
|
52 | function getModuleExports() { return module; };
|
53 | __webpack_require__.d(getter, 'a', getter);
|
54 | return getter;
|
55 | };
|
56 |
|
57 |
|
58 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
59 |
|
60 |
|
61 | __webpack_require__.p = "";
|
62 |
|
63 |
|
64 | return __webpack_require__(__webpack_require__.s = 0);
|
65 | })
|
66 |
|
67 | ([
|
68 |
|
69 | (function(module, exports, __webpack_require__) {
|
70 |
|
71 | "use strict";
|
72 |
|
73 |
|
74 | Object.defineProperty(exports, "__esModule", {
|
75 | value: true
|
76 | });
|
77 | exports.Anime = undefined;
|
78 |
|
79 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
80 |
|
81 | 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; };
|
82 |
|
83 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
84 |
|
85 | var _react = __webpack_require__(1);
|
86 |
|
87 | var _react2 = _interopRequireDefault(_react);
|
88 |
|
89 | var _lodash = __webpack_require__(2);
|
90 |
|
91 | var _lodash2 = _interopRequireDefault(_lodash);
|
92 |
|
93 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
94 |
|
95 | function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
96 |
|
97 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
98 |
|
99 | 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; }
|
100 |
|
101 | 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; }
|
102 |
|
103 | var anime = typeof window !== 'undefined' ? __webpack_require__(3) : function (_) {
|
104 | return _;
|
105 | };
|
106 |
|
107 | var Anime = exports.Anime = function (_Component) {
|
108 | _inherits(Anime, _Component);
|
109 |
|
110 | function Anime(props) {
|
111 | _classCallCheck(this, Anime);
|
112 |
|
113 |
|
114 | var _this = _possibleConstructorReturn(this, (Anime.__proto__ || Object.getPrototypeOf(Anime)).call(this, props));
|
115 |
|
116 | _initialiseProps.call(_this);
|
117 |
|
118 | _this.targets = [];
|
119 |
|
120 |
|
121 | var children = props.children;
|
122 |
|
123 | if (!Array.isArray(children)) children = [children];
|
124 | _this.children = {
|
125 | cur: children,
|
126 | prev: [],
|
127 | next: []
|
128 | };
|
129 | return _this;
|
130 | }
|
131 |
|
132 | _createClass(Anime, [{
|
133 | key: 'componentDidMount',
|
134 | value: function componentDidMount() {
|
135 | this.createAnime();
|
136 | }
|
137 | }, {
|
138 | key: 'componentWillReceiveProps',
|
139 | value: function componentWillReceiveProps(nextProps) {
|
140 | var children = nextProps.children;
|
141 |
|
142 | var prevChildren = this.props.children;
|
143 |
|
144 | if (!Array.isArray(children)) children = [children];
|
145 | if (!Array.isArray(prevChildren)) prevChildren = [prevChildren];
|
146 |
|
147 |
|
148 | var difChildren = children.filter(function (v) {
|
149 | return !prevChildren.reduce(function (prev, cur) {
|
150 | return prev || (0, _lodash2.default)(v, cur);
|
151 | }, false);
|
152 | });
|
153 |
|
154 |
|
155 | var childrenWereRemoved = difChildren.reduce(function (prev, cur) {
|
156 | return prev || prevChildren.indexOf(cur) > -1;
|
157 | }, false);
|
158 |
|
159 |
|
160 | this.children = {
|
161 | cur: children.filter(function (c) {
|
162 | return difChildren.indexOf(c) < 0;
|
163 | }),
|
164 | prev: childrenWereRemoved ? difChildren : this.children.prev,
|
165 | next: !childrenWereRemoved ? difChildren : this.children.next
|
166 | };
|
167 |
|
168 | this.createAnime(nextProps);
|
169 | }
|
170 | }, {
|
171 | key: 'render',
|
172 |
|
173 |
|
174 | |
175 |
|
176 |
|
177 | value: function render() {
|
178 | var _this2 = this;
|
179 |
|
180 | var style = this.props.style;
|
181 | var _children = this.children,
|
182 | cur = _children.cur,
|
183 | prev = _children.prev,
|
184 | next = _children.next;
|
185 |
|
186 |
|
187 | return _react2.default.createElement(
|
188 | _react.Fragment,
|
189 | null,
|
190 | cur.map(function (child, i) {
|
191 | return _react2.default.cloneElement(child, { key: i, ref: _this2.addTarget });
|
192 | })
|
193 | );
|
194 | }
|
195 | }]);
|
196 |
|
197 | return Anime;
|
198 | }(_react.Component);
|
199 |
|
200 | var _initialiseProps = function _initialiseProps() {
|
201 | var _this3 = this;
|
202 |
|
203 | this.createAnime = function () {
|
204 | var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this3.props;
|
205 |
|
206 |
|
207 | var animeProps = _extends({ targets: _this3.targets }, props);
|
208 |
|
209 | anime.remove(_this3.targets);
|
210 | delete animeProps.children;
|
211 |
|
212 | if (_typeof(_this3.anime) === undefined) _this3.anime = anime(animeProps);else {
|
213 | _this3.anime = anime(animeProps);
|
214 | }
|
215 | };
|
216 |
|
217 | this.addTarget = function (newTarget) {
|
218 | _this3.targets = [].concat(_toConsumableArray(_this3.targets), [newTarget]);
|
219 | };
|
220 | };
|
221 |
|
222 | exports.default = Anime;
|
223 |
|
224 | }),
|
225 |
|
226 | (function(module, exports) {
|
227 |
|
228 | module.exports = require("react");
|
229 |
|
230 | }),
|
231 |
|
232 | (function(module, exports) {
|
233 |
|
234 | module.exports = require("lodash.isequal");
|
235 |
|
236 | }),
|
237 |
|
238 | (function(module, exports) {
|
239 |
|
240 | module.exports = require("animejs");
|
241 |
|
242 | })
|
243 | ]); |
\ | No newline at end of file |