1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | (function (global, factory) {
|
8 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/platform-browser'), require('@angular/animations'), require('@angular/animations/browser'), require('@angular/common')) :
|
9 | typeof define === 'function' && define.amd ? define('@angular/platform-browser/animations', ['exports', '@angular/core', '@angular/platform-browser', '@angular/animations', '@angular/animations/browser', '@angular/common'], factory) :
|
10 | (global = global || self, factory((global.ng = global.ng || {}, global.ng.platformBrowser = global.ng.platformBrowser || {}, global.ng.platformBrowser.animations = {}), global.ng.core, global.ng.platformBrowser, global.ng.animations, global.ng.animations.browser, global.ng.common));
|
11 | }(this, (function (exports, core, platformBrowser, animations, browser, common) { 'use strict';
|
12 |
|
13 | |
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | var extendStatics = function (d, b) {
|
29 | extendStatics = Object.setPrototypeOf ||
|
30 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
31 | function (d, b) { for (var p in b)
|
32 | if (b.hasOwnProperty(p))
|
33 | d[p] = b[p]; };
|
34 | return extendStatics(d, b);
|
35 | };
|
36 | function __extends(d, b) {
|
37 | extendStatics(d, b);
|
38 | function __() { this.constructor = d; }
|
39 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
40 | }
|
41 | var __assign = function () {
|
42 | __assign = Object.assign || function __assign(t) {
|
43 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
44 | s = arguments[i];
|
45 | for (var p in s)
|
46 | if (Object.prototype.hasOwnProperty.call(s, p))
|
47 | t[p] = s[p];
|
48 | }
|
49 | return t;
|
50 | };
|
51 | return __assign.apply(this, arguments);
|
52 | };
|
53 | function __rest(s, e) {
|
54 | var t = {};
|
55 | for (var p in s)
|
56 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
57 | t[p] = s[p];
|
58 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
59 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
60 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
61 | t[p[i]] = s[p[i]];
|
62 | }
|
63 | return t;
|
64 | }
|
65 | function __decorate(decorators, target, key, desc) {
|
66 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
67 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
68 | r = Reflect.decorate(decorators, target, key, desc);
|
69 | else
|
70 | for (var i = decorators.length - 1; i >= 0; i--)
|
71 | if (d = decorators[i])
|
72 | r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
73 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
74 | }
|
75 | function __param(paramIndex, decorator) {
|
76 | return function (target, key) { decorator(target, key, paramIndex); };
|
77 | }
|
78 | function __metadata(metadataKey, metadataValue) {
|
79 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
80 | return Reflect.metadata(metadataKey, metadataValue);
|
81 | }
|
82 | function __awaiter(thisArg, _arguments, P, generator) {
|
83 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
84 | return new (P || (P = Promise))(function (resolve, reject) {
|
85 | function fulfilled(value) { try {
|
86 | step(generator.next(value));
|
87 | }
|
88 | catch (e) {
|
89 | reject(e);
|
90 | } }
|
91 | function rejected(value) { try {
|
92 | step(generator["throw"](value));
|
93 | }
|
94 | catch (e) {
|
95 | reject(e);
|
96 | } }
|
97 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
98 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
99 | });
|
100 | }
|
101 | function __generator(thisArg, body) {
|
102 | var _ = { label: 0, sent: function () { if (t[0] & 1)
|
103 | throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
104 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
105 | function verb(n) { return function (v) { return step([n, v]); }; }
|
106 | function step(op) {
|
107 | if (f)
|
108 | throw new TypeError("Generator is already executing.");
|
109 | while (_)
|
110 | try {
|
111 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
112 | return t;
|
113 | if (y = 0, t)
|
114 | op = [op[0] & 2, t.value];
|
115 | switch (op[0]) {
|
116 | case 0:
|
117 | case 1:
|
118 | t = op;
|
119 | break;
|
120 | case 4:
|
121 | _.label++;
|
122 | return { value: op[1], done: false };
|
123 | case 5:
|
124 | _.label++;
|
125 | y = op[1];
|
126 | op = [0];
|
127 | continue;
|
128 | case 7:
|
129 | op = _.ops.pop();
|
130 | _.trys.pop();
|
131 | continue;
|
132 | default:
|
133 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
134 | _ = 0;
|
135 | continue;
|
136 | }
|
137 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
138 | _.label = op[1];
|
139 | break;
|
140 | }
|
141 | if (op[0] === 6 && _.label < t[1]) {
|
142 | _.label = t[1];
|
143 | t = op;
|
144 | break;
|
145 | }
|
146 | if (t && _.label < t[2]) {
|
147 | _.label = t[2];
|
148 | _.ops.push(op);
|
149 | break;
|
150 | }
|
151 | if (t[2])
|
152 | _.ops.pop();
|
153 | _.trys.pop();
|
154 | continue;
|
155 | }
|
156 | op = body.call(thisArg, _);
|
157 | }
|
158 | catch (e) {
|
159 | op = [6, e];
|
160 | y = 0;
|
161 | }
|
162 | finally {
|
163 | f = t = 0;
|
164 | }
|
165 | if (op[0] & 5)
|
166 | throw op[1];
|
167 | return { value: op[0] ? op[1] : void 0, done: true };
|
168 | }
|
169 | }
|
170 | var __createBinding = Object.create ? (function (o, m, k, k2) {
|
171 | if (k2 === undefined)
|
172 | k2 = k;
|
173 | Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
174 | }) : (function (o, m, k, k2) {
|
175 | if (k2 === undefined)
|
176 | k2 = k;
|
177 | o[k2] = m[k];
|
178 | });
|
179 | function __exportStar(m, exports) {
|
180 | for (var p in m)
|
181 | if (p !== "default" && !exports.hasOwnProperty(p))
|
182 | __createBinding(exports, m, p);
|
183 | }
|
184 | function __values(o) {
|
185 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
186 | if (m)
|
187 | return m.call(o);
|
188 | if (o && typeof o.length === "number")
|
189 | return {
|
190 | next: function () {
|
191 | if (o && i >= o.length)
|
192 | o = void 0;
|
193 | return { value: o && o[i++], done: !o };
|
194 | }
|
195 | };
|
196 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
197 | }
|
198 | function __read(o, n) {
|
199 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
200 | if (!m)
|
201 | return o;
|
202 | var i = m.call(o), r, ar = [], e;
|
203 | try {
|
204 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
205 | ar.push(r.value);
|
206 | }
|
207 | catch (error) {
|
208 | e = { error: error };
|
209 | }
|
210 | finally {
|
211 | try {
|
212 | if (r && !r.done && (m = i["return"]))
|
213 | m.call(i);
|
214 | }
|
215 | finally {
|
216 | if (e)
|
217 | throw e.error;
|
218 | }
|
219 | }
|
220 | return ar;
|
221 | }
|
222 | function __spread() {
|
223 | for (var ar = [], i = 0; i < arguments.length; i++)
|
224 | ar = ar.concat(__read(arguments[i]));
|
225 | return ar;
|
226 | }
|
227 | function __spreadArrays() {
|
228 | for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
229 | s += arguments[i].length;
|
230 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
231 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
232 | r[k] = a[j];
|
233 | return r;
|
234 | }
|
235 | ;
|
236 | function __await(v) {
|
237 | return this instanceof __await ? (this.v = v, this) : new __await(v);
|
238 | }
|
239 | function __asyncGenerator(thisArg, _arguments, generator) {
|
240 | if (!Symbol.asyncIterator)
|
241 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
242 | var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
243 | return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
244 | function verb(n) { if (g[n])
|
245 | i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
246 | function resume(n, v) { try {
|
247 | step(g[n](v));
|
248 | }
|
249 | catch (e) {
|
250 | settle(q[0][3], e);
|
251 | } }
|
252 | function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
253 | function fulfill(value) { resume("next", value); }
|
254 | function reject(value) { resume("throw", value); }
|
255 | function settle(f, v) { if (f(v), q.shift(), q.length)
|
256 | resume(q[0][0], q[0][1]); }
|
257 | }
|
258 | function __asyncDelegator(o) {
|
259 | var i, p;
|
260 | return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
261 | function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
262 | }
|
263 | function __asyncValues(o) {
|
264 | if (!Symbol.asyncIterator)
|
265 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
266 | var m = o[Symbol.asyncIterator], i;
|
267 | return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
268 | function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
269 | function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
270 | }
|
271 | function __makeTemplateObject(cooked, raw) {
|
272 | if (Object.defineProperty) {
|
273 | Object.defineProperty(cooked, "raw", { value: raw });
|
274 | }
|
275 | else {
|
276 | cooked.raw = raw;
|
277 | }
|
278 | return cooked;
|
279 | }
|
280 | ;
|
281 | var __setModuleDefault = Object.create ? (function (o, v) {
|
282 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
283 | }) : function (o, v) {
|
284 | o["default"] = v;
|
285 | };
|
286 | function __importStar(mod) {
|
287 | if (mod && mod.__esModule)
|
288 | return mod;
|
289 | var result = {};
|
290 | if (mod != null)
|
291 | for (var k in mod)
|
292 | if (Object.hasOwnProperty.call(mod, k))
|
293 | __createBinding(result, mod, k);
|
294 | __setModuleDefault(result, mod);
|
295 | return result;
|
296 | }
|
297 | function __importDefault(mod) {
|
298 | return (mod && mod.__esModule) ? mod : { default: mod };
|
299 | }
|
300 | function __classPrivateFieldGet(receiver, privateMap) {
|
301 | if (!privateMap.has(receiver)) {
|
302 | throw new TypeError("attempted to get private field on non-instance");
|
303 | }
|
304 | return privateMap.get(receiver);
|
305 | }
|
306 | function __classPrivateFieldSet(receiver, privateMap, value) {
|
307 | if (!privateMap.has(receiver)) {
|
308 | throw new TypeError("attempted to set private field on non-instance");
|
309 | }
|
310 | privateMap.set(receiver, value);
|
311 | return value;
|
312 | }
|
313 |
|
314 | var BrowserAnimationBuilder = (function (_super) {
|
315 | __extends(BrowserAnimationBuilder, _super);
|
316 | function BrowserAnimationBuilder(rootRenderer, doc) {
|
317 | var _this = _super.call(this) || this;
|
318 | _this._nextAnimationId = 0;
|
319 | var typeData = { id: '0', encapsulation: core.ViewEncapsulation.None, styles: [], data: { animation: [] } };
|
320 | _this._renderer = rootRenderer.createRenderer(doc.body, typeData);
|
321 | return _this;
|
322 | }
|
323 | BrowserAnimationBuilder.prototype.build = function (animation) {
|
324 | var id = this._nextAnimationId.toString();
|
325 | this._nextAnimationId++;
|
326 | var entry = Array.isArray(animation) ? animations.sequence(animation) : animation;
|
327 | issueAnimationCommand(this._renderer, null, id, 'register', [entry]);
|
328 | return new BrowserAnimationFactory(id, this._renderer);
|
329 | };
|
330 | return BrowserAnimationBuilder;
|
331 | }(animations.AnimationBuilder));
|
332 | BrowserAnimationBuilder.decorators = [
|
333 | { type: core.Injectable }
|
334 | ];
|
335 | BrowserAnimationBuilder.ctorParameters = function () { return [
|
336 | { type: core.RendererFactory2 },
|
337 | { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
|
338 | ]; };
|
339 | var BrowserAnimationFactory = (function (_super) {
|
340 | __extends(BrowserAnimationFactory, _super);
|
341 | function BrowserAnimationFactory(_id, _renderer) {
|
342 | var _this = _super.call(this) || this;
|
343 | _this._id = _id;
|
344 | _this._renderer = _renderer;
|
345 | return _this;
|
346 | }
|
347 | BrowserAnimationFactory.prototype.create = function (element, options) {
|
348 | return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer);
|
349 | };
|
350 | return BrowserAnimationFactory;
|
351 | }(animations.AnimationFactory));
|
352 | var RendererAnimationPlayer = (function () {
|
353 | function RendererAnimationPlayer(id, element, options, _renderer) {
|
354 | this.id = id;
|
355 | this.element = element;
|
356 | this._renderer = _renderer;
|
357 | this.parentPlayer = null;
|
358 | this._started = false;
|
359 | this.totalTime = 0;
|
360 | this._command('create', options);
|
361 | }
|
362 | RendererAnimationPlayer.prototype._listen = function (eventName, callback) {
|
363 | return this._renderer.listen(this.element, "@@" + this.id + ":" + eventName, callback);
|
364 | };
|
365 | RendererAnimationPlayer.prototype._command = function (command) {
|
366 | var args = [];
|
367 | for (var _i = 1; _i < arguments.length; _i++) {
|
368 | args[_i - 1] = arguments[_i];
|
369 | }
|
370 | return issueAnimationCommand(this._renderer, this.element, this.id, command, args);
|
371 | };
|
372 | RendererAnimationPlayer.prototype.onDone = function (fn) {
|
373 | this._listen('done', fn);
|
374 | };
|
375 | RendererAnimationPlayer.prototype.onStart = function (fn) {
|
376 | this._listen('start', fn);
|
377 | };
|
378 | RendererAnimationPlayer.prototype.onDestroy = function (fn) {
|
379 | this._listen('destroy', fn);
|
380 | };
|
381 | RendererAnimationPlayer.prototype.init = function () {
|
382 | this._command('init');
|
383 | };
|
384 | RendererAnimationPlayer.prototype.hasStarted = function () {
|
385 | return this._started;
|
386 | };
|
387 | RendererAnimationPlayer.prototype.play = function () {
|
388 | this._command('play');
|
389 | this._started = true;
|
390 | };
|
391 | RendererAnimationPlayer.prototype.pause = function () {
|
392 | this._command('pause');
|
393 | };
|
394 | RendererAnimationPlayer.prototype.restart = function () {
|
395 | this._command('restart');
|
396 | };
|
397 | RendererAnimationPlayer.prototype.finish = function () {
|
398 | this._command('finish');
|
399 | };
|
400 | RendererAnimationPlayer.prototype.destroy = function () {
|
401 | this._command('destroy');
|
402 | };
|
403 | RendererAnimationPlayer.prototype.reset = function () {
|
404 | this._command('reset');
|
405 | };
|
406 | RendererAnimationPlayer.prototype.setPosition = function (p) {
|
407 | this._command('setPosition', p);
|
408 | };
|
409 | RendererAnimationPlayer.prototype.getPosition = function () {
|
410 | return 0;
|
411 | };
|
412 | return RendererAnimationPlayer;
|
413 | }());
|
414 | function issueAnimationCommand(renderer, element, id, command, args) {
|
415 | return renderer.setProperty(element, "@@" + id + ":" + command, args);
|
416 | }
|
417 |
|
418 | var ANIMATION_PREFIX = '@';
|
419 | var DISABLE_ANIMATIONS_FLAG = '@.disabled';
|
420 | var AnimationRendererFactory = (function () {
|
421 | function AnimationRendererFactory(delegate, engine, _zone) {
|
422 | this.delegate = delegate;
|
423 | this.engine = engine;
|
424 | this._zone = _zone;
|
425 | this._currentId = 0;
|
426 | this._microtaskId = 1;
|
427 | this._animationCallbacksBuffer = [];
|
428 | this._rendererCache = new Map();
|
429 | this._cdRecurDepth = 0;
|
430 | this.promise = Promise.resolve(0);
|
431 | engine.onRemovalComplete = function (element, delegate) {
|
432 |
|
433 |
|
434 |
|
435 |
|
436 | if (delegate && delegate.parentNode(element)) {
|
437 | delegate.removeChild(element.parentNode, element);
|
438 | }
|
439 | };
|
440 | }
|
441 | AnimationRendererFactory.prototype.createRenderer = function (hostElement, type) {
|
442 | var _this = this;
|
443 | var EMPTY_NAMESPACE_ID = '';
|
444 |
|
445 |
|
446 | var delegate = this.delegate.createRenderer(hostElement, type);
|
447 | if (!hostElement || !type || !type.data || !type.data['animation']) {
|
448 | var renderer = this._rendererCache.get(delegate);
|
449 | if (!renderer) {
|
450 | renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine);
|
451 |
|
452 | this._rendererCache.set(delegate, renderer);
|
453 | }
|
454 | return renderer;
|
455 | }
|
456 | var componentId = type.id;
|
457 | var namespaceId = type.id + '-' + this._currentId;
|
458 | this._currentId++;
|
459 | this.engine.register(namespaceId, hostElement);
|
460 | var registerTrigger = function (trigger) {
|
461 | if (Array.isArray(trigger)) {
|
462 | trigger.forEach(registerTrigger);
|
463 | }
|
464 | else {
|
465 | _this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger);
|
466 | }
|
467 | };
|
468 | var animationTriggers = type.data['animation'];
|
469 | animationTriggers.forEach(registerTrigger);
|
470 | return new AnimationRenderer(this, namespaceId, delegate, this.engine);
|
471 | };
|
472 | AnimationRendererFactory.prototype.begin = function () {
|
473 | this._cdRecurDepth++;
|
474 | if (this.delegate.begin) {
|
475 | this.delegate.begin();
|
476 | }
|
477 | };
|
478 | AnimationRendererFactory.prototype._scheduleCountTask = function () {
|
479 | var _this = this;
|
480 |
|
481 | this.promise.then(function () {
|
482 | _this._microtaskId++;
|
483 | });
|
484 | };
|
485 |
|
486 | AnimationRendererFactory.prototype.scheduleListenerCallback = function (count, fn, data) {
|
487 | var _this = this;
|
488 | if (count >= 0 && count < this._microtaskId) {
|
489 | this._zone.run(function () { return fn(data); });
|
490 | return;
|
491 | }
|
492 | if (this._animationCallbacksBuffer.length == 0) {
|
493 | Promise.resolve(null).then(function () {
|
494 | _this._zone.run(function () {
|
495 | _this._animationCallbacksBuffer.forEach(function (tuple) {
|
496 | var _a = __read(tuple, 2), fn = _a[0], data = _a[1];
|
497 | fn(data);
|
498 | });
|
499 | _this._animationCallbacksBuffer = [];
|
500 | });
|
501 | });
|
502 | }
|
503 | this._animationCallbacksBuffer.push([fn, data]);
|
504 | };
|
505 | AnimationRendererFactory.prototype.end = function () {
|
506 | var _this = this;
|
507 | this._cdRecurDepth--;
|
508 |
|
509 |
|
510 | if (this._cdRecurDepth == 0) {
|
511 | this._zone.runOutsideAngular(function () {
|
512 | _this._scheduleCountTask();
|
513 | _this.engine.flush(_this._microtaskId);
|
514 | });
|
515 | }
|
516 | if (this.delegate.end) {
|
517 | this.delegate.end();
|
518 | }
|
519 | };
|
520 | AnimationRendererFactory.prototype.whenRenderingDone = function () {
|
521 | return this.engine.whenRenderingDone();
|
522 | };
|
523 | return AnimationRendererFactory;
|
524 | }());
|
525 | AnimationRendererFactory.decorators = [
|
526 | { type: core.Injectable }
|
527 | ];
|
528 | AnimationRendererFactory.ctorParameters = function () { return [
|
529 | { type: core.RendererFactory2 },
|
530 | { type: browser.ɵAnimationEngine },
|
531 | { type: core.NgZone }
|
532 | ]; };
|
533 | var BaseAnimationRenderer = (function () {
|
534 | function BaseAnimationRenderer(namespaceId, delegate, engine) {
|
535 | this.namespaceId = namespaceId;
|
536 | this.delegate = delegate;
|
537 | this.engine = engine;
|
538 | this.destroyNode = this.delegate.destroyNode ? function (n) { return delegate.destroyNode(n); } : null;
|
539 | }
|
540 | Object.defineProperty(BaseAnimationRenderer.prototype, "data", {
|
541 | get: function () {
|
542 | return this.delegate.data;
|
543 | },
|
544 | enumerable: false,
|
545 | configurable: true
|
546 | });
|
547 | BaseAnimationRenderer.prototype.destroy = function () {
|
548 | this.engine.destroy(this.namespaceId, this.delegate);
|
549 | this.delegate.destroy();
|
550 | };
|
551 | BaseAnimationRenderer.prototype.createElement = function (name, namespace) {
|
552 | return this.delegate.createElement(name, namespace);
|
553 | };
|
554 | BaseAnimationRenderer.prototype.createComment = function (value) {
|
555 | return this.delegate.createComment(value);
|
556 | };
|
557 | BaseAnimationRenderer.prototype.createText = function (value) {
|
558 | return this.delegate.createText(value);
|
559 | };
|
560 | BaseAnimationRenderer.prototype.appendChild = function (parent, newChild) {
|
561 | this.delegate.appendChild(parent, newChild);
|
562 | this.engine.onInsert(this.namespaceId, newChild, parent, false);
|
563 | };
|
564 | BaseAnimationRenderer.prototype.insertBefore = function (parent, newChild, refChild) {
|
565 | this.delegate.insertBefore(parent, newChild, refChild);
|
566 | this.engine.onInsert(this.namespaceId, newChild, parent, true);
|
567 | };
|
568 | BaseAnimationRenderer.prototype.removeChild = function (parent, oldChild, isHostElement) {
|
569 | this.engine.onRemove(this.namespaceId, oldChild, this.delegate, isHostElement);
|
570 | };
|
571 | BaseAnimationRenderer.prototype.selectRootElement = function (selectorOrNode, preserveContent) {
|
572 | return this.delegate.selectRootElement(selectorOrNode, preserveContent);
|
573 | };
|
574 | BaseAnimationRenderer.prototype.parentNode = function (node) {
|
575 | return this.delegate.parentNode(node);
|
576 | };
|
577 | BaseAnimationRenderer.prototype.nextSibling = function (node) {
|
578 | return this.delegate.nextSibling(node);
|
579 | };
|
580 | BaseAnimationRenderer.prototype.setAttribute = function (el, name, value, namespace) {
|
581 | this.delegate.setAttribute(el, name, value, namespace);
|
582 | };
|
583 | BaseAnimationRenderer.prototype.removeAttribute = function (el, name, namespace) {
|
584 | this.delegate.removeAttribute(el, name, namespace);
|
585 | };
|
586 | BaseAnimationRenderer.prototype.addClass = function (el, name) {
|
587 | this.delegate.addClass(el, name);
|
588 | };
|
589 | BaseAnimationRenderer.prototype.removeClass = function (el, name) {
|
590 | this.delegate.removeClass(el, name);
|
591 | };
|
592 | BaseAnimationRenderer.prototype.setStyle = function (el, style, value, flags) {
|
593 | this.delegate.setStyle(el, style, value, flags);
|
594 | };
|
595 | BaseAnimationRenderer.prototype.removeStyle = function (el, style, flags) {
|
596 | this.delegate.removeStyle(el, style, flags);
|
597 | };
|
598 | BaseAnimationRenderer.prototype.setProperty = function (el, name, value) {
|
599 | if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) {
|
600 | this.disableAnimations(el, !!value);
|
601 | }
|
602 | else {
|
603 | this.delegate.setProperty(el, name, value);
|
604 | }
|
605 | };
|
606 | BaseAnimationRenderer.prototype.setValue = function (node, value) {
|
607 | this.delegate.setValue(node, value);
|
608 | };
|
609 | BaseAnimationRenderer.prototype.listen = function (target, eventName, callback) {
|
610 | return this.delegate.listen(target, eventName, callback);
|
611 | };
|
612 | BaseAnimationRenderer.prototype.disableAnimations = function (element, value) {
|
613 | this.engine.disableAnimations(element, value);
|
614 | };
|
615 | return BaseAnimationRenderer;
|
616 | }());
|
617 | var AnimationRenderer = (function (_super) {
|
618 | __extends(AnimationRenderer, _super);
|
619 | function AnimationRenderer(factory, namespaceId, delegate, engine) {
|
620 | var _this = _super.call(this, namespaceId, delegate, engine) || this;
|
621 | _this.factory = factory;
|
622 | _this.namespaceId = namespaceId;
|
623 | return _this;
|
624 | }
|
625 | AnimationRenderer.prototype.setProperty = function (el, name, value) {
|
626 | if (name.charAt(0) == ANIMATION_PREFIX) {
|
627 | if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) {
|
628 | value = value === undefined ? true : !!value;
|
629 | this.disableAnimations(el, value);
|
630 | }
|
631 | else {
|
632 | this.engine.process(this.namespaceId, el, name.substr(1), value);
|
633 | }
|
634 | }
|
635 | else {
|
636 | this.delegate.setProperty(el, name, value);
|
637 | }
|
638 | };
|
639 | AnimationRenderer.prototype.listen = function (target, eventName, callback) {
|
640 | var _a;
|
641 | var _this = this;
|
642 | if (eventName.charAt(0) == ANIMATION_PREFIX) {
|
643 | var element = resolveElementFromTarget(target);
|
644 | var name = eventName.substr(1);
|
645 | var phase = '';
|
646 |
|
647 |
|
648 | if (name.charAt(0) != ANIMATION_PREFIX) {
|
649 | _a = __read(parseTriggerCallbackName(name), 2), name = _a[0], phase = _a[1];
|
650 | }
|
651 | return this.engine.listen(this.namespaceId, element, name, phase, function (event) {
|
652 | var countId = event['_data'] || -1;
|
653 | _this.factory.scheduleListenerCallback(countId, callback, event);
|
654 | });
|
655 | }
|
656 | return this.delegate.listen(target, eventName, callback);
|
657 | };
|
658 | return AnimationRenderer;
|
659 | }(BaseAnimationRenderer));
|
660 | function resolveElementFromTarget(target) {
|
661 | switch (target) {
|
662 | case 'body':
|
663 | return document.body;
|
664 | case 'document':
|
665 | return document;
|
666 | case 'window':
|
667 | return window;
|
668 | default:
|
669 | return target;
|
670 | }
|
671 | }
|
672 | function parseTriggerCallbackName(triggerName) {
|
673 | var dotIndex = triggerName.indexOf('.');
|
674 | var trigger = triggerName.substring(0, dotIndex);
|
675 | var phase = triggerName.substr(dotIndex + 1);
|
676 | return [trigger, phase];
|
677 | }
|
678 |
|
679 | var InjectableAnimationEngine = (function (_super) {
|
680 | __extends(InjectableAnimationEngine, _super);
|
681 | function InjectableAnimationEngine(doc, driver, normalizer) {
|
682 | return _super.call(this, doc.body, driver, normalizer) || this;
|
683 | }
|
684 | return InjectableAnimationEngine;
|
685 | }(browser.ɵAnimationEngine));
|
686 | InjectableAnimationEngine.decorators = [
|
687 | { type: core.Injectable }
|
688 | ];
|
689 | InjectableAnimationEngine.ctorParameters = function () { return [
|
690 | { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
|
691 | { type: browser.AnimationDriver },
|
692 | { type: browser.ɵAnimationStyleNormalizer }
|
693 | ]; };
|
694 | function instantiateSupportedAnimationDriver() {
|
695 | return browser.ɵsupportsWebAnimations() ? new browser.ɵWebAnimationsDriver() : new browser.ɵCssKeyframesDriver();
|
696 | }
|
697 | function instantiateDefaultStyleNormalizer() {
|
698 | return new browser.ɵWebAnimationsStyleNormalizer();
|
699 | }
|
700 | function instantiateRendererFactory(renderer, engine, zone) {
|
701 | return new AnimationRendererFactory(renderer, engine, zone);
|
702 | }
|
703 | |
704 |
|
705 |
|
706 | var ANIMATION_MODULE_TYPE = new core.InjectionToken('AnimationModuleType');
|
707 | var SHARED_ANIMATION_PROVIDERS = [
|
708 | { provide: animations.AnimationBuilder, useClass: BrowserAnimationBuilder },
|
709 | { provide: browser.ɵAnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer },
|
710 | { provide: browser.ɵAnimationEngine, useClass: InjectableAnimationEngine }, {
|
711 | provide: core.RendererFactory2,
|
712 | useFactory: instantiateRendererFactory,
|
713 | deps: [platformBrowser.ɵDomRendererFactory2, browser.ɵAnimationEngine, core.NgZone]
|
714 | }
|
715 | ];
|
716 | |
717 |
|
718 |
|
719 |
|
720 | var BROWSER_ANIMATIONS_PROVIDERS = __spread([
|
721 | { provide: browser.AnimationDriver, useFactory: instantiateSupportedAnimationDriver },
|
722 | { provide: ANIMATION_MODULE_TYPE, useValue: 'BrowserAnimations' }
|
723 | ], SHARED_ANIMATION_PROVIDERS);
|
724 | |
725 |
|
726 |
|
727 |
|
728 | var BROWSER_NOOP_ANIMATIONS_PROVIDERS = __spread([
|
729 | { provide: browser.AnimationDriver, useClass: browser.ɵNoopAnimationDriver },
|
730 | { provide: ANIMATION_MODULE_TYPE, useValue: 'NoopAnimations' }
|
731 | ], SHARED_ANIMATION_PROVIDERS);
|
732 |
|
733 | |
734 |
|
735 |
|
736 |
|
737 |
|
738 |
|
739 |
|
740 | |
741 |
|
742 |
|
743 |
|
744 |
|
745 | var BrowserAnimationsModule = (function () {
|
746 | function BrowserAnimationsModule() {
|
747 | }
|
748 | return BrowserAnimationsModule;
|
749 | }());
|
750 | BrowserAnimationsModule.decorators = [
|
751 | { type: core.NgModule, args: [{
|
752 | exports: [platformBrowser.BrowserModule],
|
753 | providers: BROWSER_ANIMATIONS_PROVIDERS,
|
754 | },] }
|
755 | ];
|
756 | |
757 |
|
758 |
|
759 |
|
760 | var NoopAnimationsModule = (function () {
|
761 | function NoopAnimationsModule() {
|
762 | }
|
763 | return NoopAnimationsModule;
|
764 | }());
|
765 | NoopAnimationsModule.decorators = [
|
766 | { type: core.NgModule, args: [{
|
767 | exports: [platformBrowser.BrowserModule],
|
768 | providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS,
|
769 | },] }
|
770 | ];
|
771 |
|
772 | |
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 | |
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 |
|
787 |
|
788 | |
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 |
|
795 |
|
796 | |
797 |
|
798 |
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 | |
805 |
|
806 |
|
807 |
|
808 | exports.ANIMATION_MODULE_TYPE = ANIMATION_MODULE_TYPE;
|
809 | exports.BrowserAnimationsModule = BrowserAnimationsModule;
|
810 | exports.NoopAnimationsModule = NoopAnimationsModule;
|
811 | exports.ɵAnimationRenderer = AnimationRenderer;
|
812 | exports.ɵAnimationRendererFactory = AnimationRendererFactory;
|
813 | exports.ɵBrowserAnimationBuilder = BrowserAnimationBuilder;
|
814 | exports.ɵBrowserAnimationFactory = BrowserAnimationFactory;
|
815 | exports.ɵInjectableAnimationEngine = InjectableAnimationEngine;
|
816 | exports.ɵangular_packages_platform_browser_animations_animations_a = instantiateSupportedAnimationDriver;
|
817 | exports.ɵangular_packages_platform_browser_animations_animations_b = instantiateDefaultStyleNormalizer;
|
818 | exports.ɵangular_packages_platform_browser_animations_animations_c = instantiateRendererFactory;
|
819 | exports.ɵangular_packages_platform_browser_animations_animations_d = BROWSER_ANIMATIONS_PROVIDERS;
|
820 | exports.ɵangular_packages_platform_browser_animations_animations_e = BROWSER_NOOP_ANIMATIONS_PROVIDERS;
|
821 | exports.ɵangular_packages_platform_browser_animations_animations_f = BaseAnimationRenderer;
|
822 |
|
823 | Object.defineProperty(exports, '__esModule', { value: true });
|
824 |
|
825 | })));
|
826 |
|