UNPKG

32.6 kBJavaScriptView Raw
1/**
2 * @license Angular v8.2.12
3 * (c) 2010-2019 Google LLC. https://angular.io/
4 * License: MIT
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 Copyright (c) Microsoft Corporation. All rights reserved.
15 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
16 this file except in compliance with the License. You may obtain a copy of the
17 License at http://www.apache.org/licenses/LICENSE-2.0
18
19 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
21 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
22 MERCHANTABLITY OR NON-INFRINGEMENT.
23
24 See the Apache Version 2.0 License for specific language governing permissions
25 and limitations under the License.
26 ***************************************************************************** */
27 /* global Reflect, Promise */
28
29 var extendStatics = function(d, b) {
30 extendStatics = Object.setPrototypeOf ||
31 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
32 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
33 return extendStatics(d, b);
34 };
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
42 var __assign = function() {
43 __assign = Object.assign || function __assign(t) {
44 for (var s, i = 1, n = arguments.length; i < n; i++) {
45 s = arguments[i];
46 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
47 }
48 return t;
49 };
50 return __assign.apply(this, arguments);
51 };
52
53 function __rest(s, e) {
54 var t = {};
55 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
56 t[p] = s[p];
57 if (s != null && typeof Object.getOwnPropertySymbols === "function")
58 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
59 t[p[i]] = s[p[i]];
60 return t;
61 }
62
63 function __decorate(decorators, target, key, desc) {
64 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
65 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
66 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
67 return c > 3 && r && Object.defineProperty(target, key, r), r;
68 }
69
70 function __param(paramIndex, decorator) {
71 return function (target, key) { decorator(target, key, paramIndex); }
72 }
73
74 function __metadata(metadataKey, metadataValue) {
75 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
76 }
77
78 function __awaiter(thisArg, _arguments, P, generator) {
79 return new (P || (P = Promise))(function (resolve, reject) {
80 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
81 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
82 function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
83 step((generator = generator.apply(thisArg, _arguments || [])).next());
84 });
85 }
86
87 function __generator(thisArg, body) {
88 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
89 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
90 function verb(n) { return function (v) { return step([n, v]); }; }
91 function step(op) {
92 if (f) throw new TypeError("Generator is already executing.");
93 while (_) try {
94 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) return t;
95 if (y = 0, t) op = [op[0] & 2, t.value];
96 switch (op[0]) {
97 case 0: case 1: t = op; break;
98 case 4: _.label++; return { value: op[1], done: false };
99 case 5: _.label++; y = op[1]; op = [0]; continue;
100 case 7: op = _.ops.pop(); _.trys.pop(); continue;
101 default:
102 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
103 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
104 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
105 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
106 if (t[2]) _.ops.pop();
107 _.trys.pop(); continue;
108 }
109 op = body.call(thisArg, _);
110 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
111 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
112 }
113 }
114
115 function __exportStar(m, exports) {
116 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
117 }
118
119 function __values(o) {
120 var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
121 if (m) return m.call(o);
122 return {
123 next: function () {
124 if (o && i >= o.length) o = void 0;
125 return { value: o && o[i++], done: !o };
126 }
127 };
128 }
129
130 function __read(o, n) {
131 var m = typeof Symbol === "function" && o[Symbol.iterator];
132 if (!m) return o;
133 var i = m.call(o), r, ar = [], e;
134 try {
135 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
136 }
137 catch (error) { e = { error: error }; }
138 finally {
139 try {
140 if (r && !r.done && (m = i["return"])) m.call(i);
141 }
142 finally { if (e) throw e.error; }
143 }
144 return ar;
145 }
146
147 function __spread() {
148 for (var ar = [], i = 0; i < arguments.length; i++)
149 ar = ar.concat(__read(arguments[i]));
150 return ar;
151 }
152
153 function __await(v) {
154 return this instanceof __await ? (this.v = v, this) : new __await(v);
155 }
156
157 function __asyncGenerator(thisArg, _arguments, generator) {
158 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
159 var g = generator.apply(thisArg, _arguments || []), i, q = [];
160 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
161 function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
162 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
163 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
164 function fulfill(value) { resume("next", value); }
165 function reject(value) { resume("throw", value); }
166 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
167 }
168
169 function __asyncDelegator(o) {
170 var i, p;
171 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
172 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; }
173 }
174
175 function __asyncValues(o) {
176 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
177 var m = o[Symbol.asyncIterator], i;
178 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);
179 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); }); }; }
180 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
181 }
182
183 function __makeTemplateObject(cooked, raw) {
184 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
185 return cooked;
186 };
187
188 function __importStar(mod) {
189 if (mod && mod.__esModule) return mod;
190 var result = {};
191 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
192 result.default = mod;
193 return result;
194 }
195
196 function __importDefault(mod) {
197 return (mod && mod.__esModule) ? mod : { default: mod };
198 }
199
200 var BrowserAnimationBuilder = /** @class */ (function (_super) {
201 __extends(BrowserAnimationBuilder, _super);
202 function BrowserAnimationBuilder(rootRenderer, doc) {
203 var _this = _super.call(this) || this;
204 _this._nextAnimationId = 0;
205 var typeData = {
206 id: '0',
207 encapsulation: core.ViewEncapsulation.None,
208 styles: [],
209 data: { animation: [] }
210 };
211 _this._renderer = rootRenderer.createRenderer(doc.body, typeData);
212 return _this;
213 }
214 BrowserAnimationBuilder.prototype.build = function (animation) {
215 var id = this._nextAnimationId.toString();
216 this._nextAnimationId++;
217 var entry = Array.isArray(animation) ? animations.sequence(animation) : animation;
218 issueAnimationCommand(this._renderer, null, id, 'register', [entry]);
219 return new BrowserAnimationFactory(id, this._renderer);
220 };
221 BrowserAnimationBuilder = __decorate([
222 core.Injectable(),
223 __param(1, core.Inject(common.DOCUMENT)),
224 __metadata("design:paramtypes", [core.RendererFactory2, Object])
225 ], BrowserAnimationBuilder);
226 return BrowserAnimationBuilder;
227 }(animations.AnimationBuilder));
228 var BrowserAnimationFactory = /** @class */ (function (_super) {
229 __extends(BrowserAnimationFactory, _super);
230 function BrowserAnimationFactory(_id, _renderer) {
231 var _this = _super.call(this) || this;
232 _this._id = _id;
233 _this._renderer = _renderer;
234 return _this;
235 }
236 BrowserAnimationFactory.prototype.create = function (element, options) {
237 return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer);
238 };
239 return BrowserAnimationFactory;
240 }(animations.AnimationFactory));
241 var RendererAnimationPlayer = /** @class */ (function () {
242 function RendererAnimationPlayer(id, element, options, _renderer) {
243 this.id = id;
244 this.element = element;
245 this._renderer = _renderer;
246 this.parentPlayer = null;
247 this._started = false;
248 this.totalTime = 0;
249 this._command('create', options);
250 }
251 RendererAnimationPlayer.prototype._listen = function (eventName, callback) {
252 return this._renderer.listen(this.element, "@@" + this.id + ":" + eventName, callback);
253 };
254 RendererAnimationPlayer.prototype._command = function (command) {
255 var args = [];
256 for (var _i = 1; _i < arguments.length; _i++) {
257 args[_i - 1] = arguments[_i];
258 }
259 return issueAnimationCommand(this._renderer, this.element, this.id, command, args);
260 };
261 RendererAnimationPlayer.prototype.onDone = function (fn) { this._listen('done', fn); };
262 RendererAnimationPlayer.prototype.onStart = function (fn) { this._listen('start', fn); };
263 RendererAnimationPlayer.prototype.onDestroy = function (fn) { this._listen('destroy', fn); };
264 RendererAnimationPlayer.prototype.init = function () { this._command('init'); };
265 RendererAnimationPlayer.prototype.hasStarted = function () { return this._started; };
266 RendererAnimationPlayer.prototype.play = function () {
267 this._command('play');
268 this._started = true;
269 };
270 RendererAnimationPlayer.prototype.pause = function () { this._command('pause'); };
271 RendererAnimationPlayer.prototype.restart = function () { this._command('restart'); };
272 RendererAnimationPlayer.prototype.finish = function () { this._command('finish'); };
273 RendererAnimationPlayer.prototype.destroy = function () { this._command('destroy'); };
274 RendererAnimationPlayer.prototype.reset = function () { this._command('reset'); };
275 RendererAnimationPlayer.prototype.setPosition = function (p) { this._command('setPosition', p); };
276 RendererAnimationPlayer.prototype.getPosition = function () { return 0; };
277 return RendererAnimationPlayer;
278 }());
279 function issueAnimationCommand(renderer, element, id, command, args) {
280 return renderer.setProperty(element, "@@" + id + ":" + command, args);
281 }
282
283 var ANIMATION_PREFIX = '@';
284 var DISABLE_ANIMATIONS_FLAG = '@.disabled';
285 var AnimationRendererFactory = /** @class */ (function () {
286 function AnimationRendererFactory(delegate, engine, _zone) {
287 this.delegate = delegate;
288 this.engine = engine;
289 this._zone = _zone;
290 this._currentId = 0;
291 this._microtaskId = 1;
292 this._animationCallbacksBuffer = [];
293 this._rendererCache = new Map();
294 this._cdRecurDepth = 0;
295 this.promise = Promise.resolve(0);
296 engine.onRemovalComplete = function (element, delegate) {
297 // Note: if an component element has a leave animation, and the component
298 // a host leave animation, the view engine will call `removeChild` for the parent
299 // component renderer as well as for the child component renderer.
300 // Therefore, we need to check if we already removed the element.
301 if (delegate && delegate.parentNode(element)) {
302 delegate.removeChild(element.parentNode, element);
303 }
304 };
305 }
306 AnimationRendererFactory.prototype.createRenderer = function (hostElement, type) {
307 var _this = this;
308 var EMPTY_NAMESPACE_ID = '';
309 // cache the delegates to find out which cached delegate can
310 // be used by which cached renderer
311 var delegate = this.delegate.createRenderer(hostElement, type);
312 if (!hostElement || !type || !type.data || !type.data['animation']) {
313 var renderer = this._rendererCache.get(delegate);
314 if (!renderer) {
315 renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine);
316 // only cache this result when the base renderer is used
317 this._rendererCache.set(delegate, renderer);
318 }
319 return renderer;
320 }
321 var componentId = type.id;
322 var namespaceId = type.id + '-' + this._currentId;
323 this._currentId++;
324 this.engine.register(namespaceId, hostElement);
325 var animationTriggers = type.data['animation'];
326 animationTriggers.forEach(function (trigger) { return _this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger); });
327 return new AnimationRenderer(this, namespaceId, delegate, this.engine);
328 };
329 AnimationRendererFactory.prototype.begin = function () {
330 this._cdRecurDepth++;
331 if (this.delegate.begin) {
332 this.delegate.begin();
333 }
334 };
335 AnimationRendererFactory.prototype._scheduleCountTask = function () {
336 var _this = this;
337 // always use promise to schedule microtask instead of use Zone
338 this.promise.then(function () { _this._microtaskId++; });
339 };
340 /** @internal */
341 AnimationRendererFactory.prototype.scheduleListenerCallback = function (count, fn, data) {
342 var _this = this;
343 if (count >= 0 && count < this._microtaskId) {
344 this._zone.run(function () { return fn(data); });
345 return;
346 }
347 if (this._animationCallbacksBuffer.length == 0) {
348 Promise.resolve(null).then(function () {
349 _this._zone.run(function () {
350 _this._animationCallbacksBuffer.forEach(function (tuple) {
351 var _a = __read(tuple, 2), fn = _a[0], data = _a[1];
352 fn(data);
353 });
354 _this._animationCallbacksBuffer = [];
355 });
356 });
357 }
358 this._animationCallbacksBuffer.push([fn, data]);
359 };
360 AnimationRendererFactory.prototype.end = function () {
361 var _this = this;
362 this._cdRecurDepth--;
363 // this is to prevent animations from running twice when an inner
364 // component does CD when a parent component instead has inserted it
365 if (this._cdRecurDepth == 0) {
366 this._zone.runOutsideAngular(function () {
367 _this._scheduleCountTask();
368 _this.engine.flush(_this._microtaskId);
369 });
370 }
371 if (this.delegate.end) {
372 this.delegate.end();
373 }
374 };
375 AnimationRendererFactory.prototype.whenRenderingDone = function () { return this.engine.whenRenderingDone(); };
376 AnimationRendererFactory = __decorate([
377 core.Injectable(),
378 __metadata("design:paramtypes", [core.RendererFactory2, browser.ɵAnimationEngine, core.NgZone])
379 ], AnimationRendererFactory);
380 return AnimationRendererFactory;
381 }());
382 var BaseAnimationRenderer = /** @class */ (function () {
383 function BaseAnimationRenderer(namespaceId, delegate, engine) {
384 this.namespaceId = namespaceId;
385 this.delegate = delegate;
386 this.engine = engine;
387 this.destroyNode = this.delegate.destroyNode ? function (n) { return delegate.destroyNode(n); } : null;
388 }
389 Object.defineProperty(BaseAnimationRenderer.prototype, "data", {
390 get: function () { return this.delegate.data; },
391 enumerable: true,
392 configurable: true
393 });
394 BaseAnimationRenderer.prototype.destroy = function () {
395 this.engine.destroy(this.namespaceId, this.delegate);
396 this.delegate.destroy();
397 };
398 BaseAnimationRenderer.prototype.createElement = function (name, namespace) {
399 return this.delegate.createElement(name, namespace);
400 };
401 BaseAnimationRenderer.prototype.createComment = function (value) { return this.delegate.createComment(value); };
402 BaseAnimationRenderer.prototype.createText = function (value) { return this.delegate.createText(value); };
403 BaseAnimationRenderer.prototype.appendChild = function (parent, newChild) {
404 this.delegate.appendChild(parent, newChild);
405 this.engine.onInsert(this.namespaceId, newChild, parent, false);
406 };
407 BaseAnimationRenderer.prototype.insertBefore = function (parent, newChild, refChild) {
408 this.delegate.insertBefore(parent, newChild, refChild);
409 this.engine.onInsert(this.namespaceId, newChild, parent, true);
410 };
411 BaseAnimationRenderer.prototype.removeChild = function (parent, oldChild, isHostElement) {
412 this.engine.onRemove(this.namespaceId, oldChild, this.delegate, isHostElement);
413 };
414 BaseAnimationRenderer.prototype.selectRootElement = function (selectorOrNode, preserveContent) {
415 return this.delegate.selectRootElement(selectorOrNode, preserveContent);
416 };
417 BaseAnimationRenderer.prototype.parentNode = function (node) { return this.delegate.parentNode(node); };
418 BaseAnimationRenderer.prototype.nextSibling = function (node) { return this.delegate.nextSibling(node); };
419 BaseAnimationRenderer.prototype.setAttribute = function (el, name, value, namespace) {
420 this.delegate.setAttribute(el, name, value, namespace);
421 };
422 BaseAnimationRenderer.prototype.removeAttribute = function (el, name, namespace) {
423 this.delegate.removeAttribute(el, name, namespace);
424 };
425 BaseAnimationRenderer.prototype.addClass = function (el, name) { this.delegate.addClass(el, name); };
426 BaseAnimationRenderer.prototype.removeClass = function (el, name) { this.delegate.removeClass(el, name); };
427 BaseAnimationRenderer.prototype.setStyle = function (el, style, value, flags) {
428 this.delegate.setStyle(el, style, value, flags);
429 };
430 BaseAnimationRenderer.prototype.removeStyle = function (el, style, flags) {
431 this.delegate.removeStyle(el, style, flags);
432 };
433 BaseAnimationRenderer.prototype.setProperty = function (el, name, value) {
434 if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) {
435 this.disableAnimations(el, !!value);
436 }
437 else {
438 this.delegate.setProperty(el, name, value);
439 }
440 };
441 BaseAnimationRenderer.prototype.setValue = function (node, value) { this.delegate.setValue(node, value); };
442 BaseAnimationRenderer.prototype.listen = function (target, eventName, callback) {
443 return this.delegate.listen(target, eventName, callback);
444 };
445 BaseAnimationRenderer.prototype.disableAnimations = function (element, value) {
446 this.engine.disableAnimations(element, value);
447 };
448 return BaseAnimationRenderer;
449 }());
450 var AnimationRenderer = /** @class */ (function (_super) {
451 __extends(AnimationRenderer, _super);
452 function AnimationRenderer(factory, namespaceId, delegate, engine) {
453 var _this = _super.call(this, namespaceId, delegate, engine) || this;
454 _this.factory = factory;
455 _this.namespaceId = namespaceId;
456 return _this;
457 }
458 AnimationRenderer.prototype.setProperty = function (el, name, value) {
459 if (name.charAt(0) == ANIMATION_PREFIX) {
460 if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) {
461 value = value === undefined ? true : !!value;
462 this.disableAnimations(el, value);
463 }
464 else {
465 this.engine.process(this.namespaceId, el, name.substr(1), value);
466 }
467 }
468 else {
469 this.delegate.setProperty(el, name, value);
470 }
471 };
472 AnimationRenderer.prototype.listen = function (target, eventName, callback) {
473 var _a;
474 var _this = this;
475 if (eventName.charAt(0) == ANIMATION_PREFIX) {
476 var element = resolveElementFromTarget(target);
477 var name_1 = eventName.substr(1);
478 var phase = '';
479 // @listener.phase is for trigger animation callbacks
480 // @@listener is for animation builder callbacks
481 if (name_1.charAt(0) != ANIMATION_PREFIX) {
482 _a = __read(parseTriggerCallbackName(name_1), 2), name_1 = _a[0], phase = _a[1];
483 }
484 return this.engine.listen(this.namespaceId, element, name_1, phase, function (event) {
485 var countId = event['_data'] || -1;
486 _this.factory.scheduleListenerCallback(countId, callback, event);
487 });
488 }
489 return this.delegate.listen(target, eventName, callback);
490 };
491 return AnimationRenderer;
492 }(BaseAnimationRenderer));
493 function resolveElementFromTarget(target) {
494 switch (target) {
495 case 'body':
496 return document.body;
497 case 'document':
498 return document;
499 case 'window':
500 return window;
501 default:
502 return target;
503 }
504 }
505 function parseTriggerCallbackName(triggerName) {
506 var dotIndex = triggerName.indexOf('.');
507 var trigger = triggerName.substring(0, dotIndex);
508 var phase = triggerName.substr(dotIndex + 1);
509 return [trigger, phase];
510 }
511
512 /**
513 * @license
514 * Copyright Google Inc. All Rights Reserved.
515 *
516 * Use of this source code is governed by an MIT-style license that can be
517 * found in the LICENSE file at https://angular.io/license
518 */
519 var InjectableAnimationEngine = /** @class */ (function (_super) {
520 __extends(InjectableAnimationEngine, _super);
521 function InjectableAnimationEngine(doc, driver, normalizer) {
522 return _super.call(this, doc.body, driver, normalizer) || this;
523 }
524 InjectableAnimationEngine = __decorate([
525 core.Injectable(),
526 __param(0, core.Inject(common.DOCUMENT)),
527 __metadata("design:paramtypes", [Object, browser.AnimationDriver, browser.ɵAnimationStyleNormalizer])
528 ], InjectableAnimationEngine);
529 return InjectableAnimationEngine;
530 }(browser.ɵAnimationEngine));
531 function instantiateSupportedAnimationDriver() {
532 return browser.ɵsupportsWebAnimations() ? new browser.ɵWebAnimationsDriver() : new browser.ɵCssKeyframesDriver();
533 }
534 function instantiateDefaultStyleNormalizer() {
535 return new browser.ɵWebAnimationsStyleNormalizer();
536 }
537 function instantiateRendererFactory(renderer, engine, zone) {
538 return new AnimationRendererFactory(renderer, engine, zone);
539 }
540 /**
541 * @publicApi
542 */
543 var ANIMATION_MODULE_TYPE = new core.InjectionToken('AnimationModuleType');
544 var SHARED_ANIMATION_PROVIDERS = [
545 { provide: animations.AnimationBuilder, useClass: BrowserAnimationBuilder },
546 { provide: browser.ɵAnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer },
547 { provide: browser.ɵAnimationEngine, useClass: InjectableAnimationEngine }, {
548 provide: core.RendererFactory2,
549 useFactory: instantiateRendererFactory,
550 deps: [platformBrowser.ɵDomRendererFactory2, browser.ɵAnimationEngine, core.NgZone]
551 }
552 ];
553 /**
554 * Separate providers from the actual module so that we can do a local modification in Google3 to
555 * include them in the BrowserModule.
556 */
557 var BROWSER_ANIMATIONS_PROVIDERS = __spread([
558 { provide: browser.AnimationDriver, useFactory: instantiateSupportedAnimationDriver },
559 { provide: ANIMATION_MODULE_TYPE, useValue: 'BrowserAnimations' }
560 ], SHARED_ANIMATION_PROVIDERS);
561 /**
562 * Separate providers from the actual module so that we can do a local modification in Google3 to
563 * include them in the BrowserTestingModule.
564 */
565 var BROWSER_NOOP_ANIMATIONS_PROVIDERS = __spread([
566 { provide: browser.AnimationDriver, useClass: browser.ɵNoopAnimationDriver },
567 { provide: ANIMATION_MODULE_TYPE, useValue: 'NoopAnimations' }
568 ], SHARED_ANIMATION_PROVIDERS);
569
570 /**
571 * Exports `BrowserModule` with additional [dependency-injection providers](guide/glossary#provider)
572 * for use with animations. See [Animations](guide/animations).
573 * @publicApi
574 */
575 var BrowserAnimationsModule = /** @class */ (function () {
576 function BrowserAnimationsModule() {
577 }
578 BrowserAnimationsModule = __decorate([
579 core.NgModule({
580 exports: [platformBrowser.BrowserModule],
581 providers: BROWSER_ANIMATIONS_PROVIDERS,
582 })
583 ], BrowserAnimationsModule);
584 return BrowserAnimationsModule;
585 }());
586 /**
587 * A null player that must be imported to allow disabling of animations.
588 * @publicApi
589 */
590 var NoopAnimationsModule = /** @class */ (function () {
591 function NoopAnimationsModule() {
592 }
593 NoopAnimationsModule = __decorate([
594 core.NgModule({
595 exports: [platformBrowser.BrowserModule],
596 providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS,
597 })
598 ], NoopAnimationsModule);
599 return NoopAnimationsModule;
600 }());
601
602 /**
603 * @license
604 * Copyright Google Inc. All Rights Reserved.
605 *
606 * Use of this source code is governed by an MIT-style license that can be
607 * found in the LICENSE file at https://angular.io/license
608 */
609
610 /**
611 * @license
612 * Copyright Google Inc. All Rights Reserved.
613 *
614 * Use of this source code is governed by an MIT-style license that can be
615 * found in the LICENSE file at https://angular.io/license
616 */
617
618 /**
619 * @license
620 * Copyright Google Inc. All Rights Reserved.
621 *
622 * Use of this source code is governed by an MIT-style license that can be
623 * found in the LICENSE file at https://angular.io/license
624 */
625
626 /**
627 * @license
628 * Copyright Google Inc. All Rights Reserved.
629 *
630 * Use of this source code is governed by an MIT-style license that can be
631 * found in the LICENSE file at https://angular.io/license
632 */
633
634 /**
635 * Generated bundle index. Do not edit.
636 */
637
638 exports.ɵangular_packages_platform_browser_animations_animations_f = BaseAnimationRenderer;
639 exports.ɵangular_packages_platform_browser_animations_animations_d = BROWSER_ANIMATIONS_PROVIDERS;
640 exports.ɵangular_packages_platform_browser_animations_animations_e = BROWSER_NOOP_ANIMATIONS_PROVIDERS;
641 exports.ɵangular_packages_platform_browser_animations_animations_b = instantiateDefaultStyleNormalizer;
642 exports.ɵangular_packages_platform_browser_animations_animations_c = instantiateRendererFactory;
643 exports.ɵangular_packages_platform_browser_animations_animations_a = instantiateSupportedAnimationDriver;
644 exports.BrowserAnimationsModule = BrowserAnimationsModule;
645 exports.NoopAnimationsModule = NoopAnimationsModule;
646 exports.ANIMATION_MODULE_TYPE = ANIMATION_MODULE_TYPE;
647 exports.ɵBrowserAnimationBuilder = BrowserAnimationBuilder;
648 exports.ɵBrowserAnimationFactory = BrowserAnimationFactory;
649 exports.ɵAnimationRenderer = AnimationRenderer;
650 exports.ɵAnimationRendererFactory = AnimationRendererFactory;
651 exports.ɵInjectableAnimationEngine = InjectableAnimationEngine;
652
653 Object.defineProperty(exports, '__esModule', { value: true });
654
655}));
656//# sourceMappingURL=platform-browser-animations.umd.js.map