Front end of the Slack clone application.

animations.js 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910
  1. /**
  2. * @license Angular v5.2.11
  3. * (c) 2010-2018 Google, Inc. https://angular.io/
  4. * License: MIT
  5. */
  6. import { Inject, Injectable, NgModule, NgZone, RendererFactory2, ViewEncapsulation } from '@angular/core';
  7. import { BrowserModule, DOCUMENT, ɵDomRendererFactory2 } from '@angular/platform-browser';
  8. import { __extends } from 'tslib';
  9. import { AnimationBuilder, AnimationFactory, sequence } from '@angular/animations';
  10. import { AnimationDriver, ɵAnimationEngine, ɵAnimationStyleNormalizer, ɵNoopAnimationDriver, ɵWebAnimationsDriver, ɵWebAnimationsStyleNormalizer, ɵsupportsWebAnimations } from '@angular/animations/browser';
  11. /**
  12. * @fileoverview added by tsickle
  13. * @suppress {checkTypes} checked by tsc
  14. */
  15. var BrowserAnimationBuilder = /** @class */ (function (_super) {
  16. __extends(BrowserAnimationBuilder, _super);
  17. function BrowserAnimationBuilder(rootRenderer, doc) {
  18. var _this = _super.call(this) || this;
  19. _this._nextAnimationId = 0;
  20. var /** @type {?} */ typeData = /** @type {?} */ ({
  21. id: '0',
  22. encapsulation: ViewEncapsulation.None,
  23. styles: [],
  24. data: { animation: [] }
  25. });
  26. _this._renderer = /** @type {?} */ (rootRenderer.createRenderer(doc.body, typeData));
  27. return _this;
  28. }
  29. /**
  30. * @param {?} animation
  31. * @return {?}
  32. */
  33. BrowserAnimationBuilder.prototype.build = /**
  34. * @param {?} animation
  35. * @return {?}
  36. */
  37. function (animation) {
  38. var /** @type {?} */ id = this._nextAnimationId.toString();
  39. this._nextAnimationId++;
  40. var /** @type {?} */ entry = Array.isArray(animation) ? sequence(animation) : animation;
  41. issueAnimationCommand(this._renderer, null, id, 'register', [entry]);
  42. return new BrowserAnimationFactory(id, this._renderer);
  43. };
  44. BrowserAnimationBuilder.decorators = [
  45. { type: Injectable },
  46. ];
  47. /** @nocollapse */
  48. BrowserAnimationBuilder.ctorParameters = function () { return [
  49. { type: RendererFactory2, },
  50. { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] },] },
  51. ]; };
  52. return BrowserAnimationBuilder;
  53. }(AnimationBuilder));
  54. var BrowserAnimationFactory = /** @class */ (function (_super) {
  55. __extends(BrowserAnimationFactory, _super);
  56. function BrowserAnimationFactory(_id, _renderer) {
  57. var _this = _super.call(this) || this;
  58. _this._id = _id;
  59. _this._renderer = _renderer;
  60. return _this;
  61. }
  62. /**
  63. * @param {?} element
  64. * @param {?=} options
  65. * @return {?}
  66. */
  67. BrowserAnimationFactory.prototype.create = /**
  68. * @param {?} element
  69. * @param {?=} options
  70. * @return {?}
  71. */
  72. function (element, options) {
  73. return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer);
  74. };
  75. return BrowserAnimationFactory;
  76. }(AnimationFactory));
  77. var RendererAnimationPlayer = /** @class */ (function () {
  78. function RendererAnimationPlayer(id, element, options, _renderer) {
  79. this.id = id;
  80. this.element = element;
  81. this._renderer = _renderer;
  82. this.parentPlayer = null;
  83. this._started = false;
  84. this.totalTime = 0;
  85. this._command('create', options);
  86. }
  87. /**
  88. * @param {?} eventName
  89. * @param {?} callback
  90. * @return {?}
  91. */
  92. RendererAnimationPlayer.prototype._listen = /**
  93. * @param {?} eventName
  94. * @param {?} callback
  95. * @return {?}
  96. */
  97. function (eventName, callback) {
  98. return this._renderer.listen(this.element, "@@" + this.id + ":" + eventName, callback);
  99. };
  100. /**
  101. * @param {?} command
  102. * @param {...?} args
  103. * @return {?}
  104. */
  105. RendererAnimationPlayer.prototype._command = /**
  106. * @param {?} command
  107. * @param {...?} args
  108. * @return {?}
  109. */
  110. function (command) {
  111. var args = [];
  112. for (var _i = 1; _i < arguments.length; _i++) {
  113. args[_i - 1] = arguments[_i];
  114. }
  115. return issueAnimationCommand(this._renderer, this.element, this.id, command, args);
  116. };
  117. /**
  118. * @param {?} fn
  119. * @return {?}
  120. */
  121. RendererAnimationPlayer.prototype.onDone = /**
  122. * @param {?} fn
  123. * @return {?}
  124. */
  125. function (fn) { this._listen('done', fn); };
  126. /**
  127. * @param {?} fn
  128. * @return {?}
  129. */
  130. RendererAnimationPlayer.prototype.onStart = /**
  131. * @param {?} fn
  132. * @return {?}
  133. */
  134. function (fn) { this._listen('start', fn); };
  135. /**
  136. * @param {?} fn
  137. * @return {?}
  138. */
  139. RendererAnimationPlayer.prototype.onDestroy = /**
  140. * @param {?} fn
  141. * @return {?}
  142. */
  143. function (fn) { this._listen('destroy', fn); };
  144. /**
  145. * @return {?}
  146. */
  147. RendererAnimationPlayer.prototype.init = /**
  148. * @return {?}
  149. */
  150. function () { this._command('init'); };
  151. /**
  152. * @return {?}
  153. */
  154. RendererAnimationPlayer.prototype.hasStarted = /**
  155. * @return {?}
  156. */
  157. function () { return this._started; };
  158. /**
  159. * @return {?}
  160. */
  161. RendererAnimationPlayer.prototype.play = /**
  162. * @return {?}
  163. */
  164. function () {
  165. this._command('play');
  166. this._started = true;
  167. };
  168. /**
  169. * @return {?}
  170. */
  171. RendererAnimationPlayer.prototype.pause = /**
  172. * @return {?}
  173. */
  174. function () { this._command('pause'); };
  175. /**
  176. * @return {?}
  177. */
  178. RendererAnimationPlayer.prototype.restart = /**
  179. * @return {?}
  180. */
  181. function () { this._command('restart'); };
  182. /**
  183. * @return {?}
  184. */
  185. RendererAnimationPlayer.prototype.finish = /**
  186. * @return {?}
  187. */
  188. function () { this._command('finish'); };
  189. /**
  190. * @return {?}
  191. */
  192. RendererAnimationPlayer.prototype.destroy = /**
  193. * @return {?}
  194. */
  195. function () { this._command('destroy'); };
  196. /**
  197. * @return {?}
  198. */
  199. RendererAnimationPlayer.prototype.reset = /**
  200. * @return {?}
  201. */
  202. function () { this._command('reset'); };
  203. /**
  204. * @param {?} p
  205. * @return {?}
  206. */
  207. RendererAnimationPlayer.prototype.setPosition = /**
  208. * @param {?} p
  209. * @return {?}
  210. */
  211. function (p) { this._command('setPosition', p); };
  212. /**
  213. * @return {?}
  214. */
  215. RendererAnimationPlayer.prototype.getPosition = /**
  216. * @return {?}
  217. */
  218. function () { return 0; };
  219. return RendererAnimationPlayer;
  220. }());
  221. /**
  222. * @param {?} renderer
  223. * @param {?} element
  224. * @param {?} id
  225. * @param {?} command
  226. * @param {?} args
  227. * @return {?}
  228. */
  229. function issueAnimationCommand(renderer, element, id, command, args) {
  230. return renderer.setProperty(element, "@@" + id + ":" + command, args);
  231. }
  232. /**
  233. * @fileoverview added by tsickle
  234. * @suppress {checkTypes} checked by tsc
  235. */
  236. var ANIMATION_PREFIX = '@';
  237. var DISABLE_ANIMATIONS_FLAG = '@.disabled';
  238. var AnimationRendererFactory = /** @class */ (function () {
  239. function AnimationRendererFactory(delegate, engine, _zone) {
  240. this.delegate = delegate;
  241. this.engine = engine;
  242. this._zone = _zone;
  243. this._currentId = 0;
  244. this._microtaskId = 1;
  245. this._animationCallbacksBuffer = [];
  246. this._rendererCache = new Map();
  247. this._cdRecurDepth = 0;
  248. this.promise = Promise.resolve(0);
  249. engine.onRemovalComplete = function (element, delegate) {
  250. // Note: if an component element has a leave animation, and the component
  251. // a host leave animation, the view engine will call `removeChild` for the parent
  252. // component renderer as well as for the child component renderer.
  253. // Therefore, we need to check if we already removed the element.
  254. if (delegate && delegate.parentNode(element)) {
  255. delegate.removeChild(element.parentNode, element);
  256. }
  257. };
  258. }
  259. /**
  260. * @param {?} hostElement
  261. * @param {?} type
  262. * @return {?}
  263. */
  264. AnimationRendererFactory.prototype.createRenderer = /**
  265. * @param {?} hostElement
  266. * @param {?} type
  267. * @return {?}
  268. */
  269. function (hostElement, type) {
  270. var _this = this;
  271. var /** @type {?} */ EMPTY_NAMESPACE_ID = '';
  272. // cache the delegates to find out which cached delegate can
  273. // be used by which cached renderer
  274. var /** @type {?} */ delegate = this.delegate.createRenderer(hostElement, type);
  275. if (!hostElement || !type || !type.data || !type.data['animation']) {
  276. var /** @type {?} */ renderer = this._rendererCache.get(delegate);
  277. if (!renderer) {
  278. renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine);
  279. // only cache this result when the base renderer is used
  280. this._rendererCache.set(delegate, renderer);
  281. }
  282. return renderer;
  283. }
  284. var /** @type {?} */ componentId = type.id;
  285. var /** @type {?} */ namespaceId = type.id + '-' + this._currentId;
  286. this._currentId++;
  287. this.engine.register(namespaceId, hostElement);
  288. var /** @type {?} */ animationTriggers = /** @type {?} */ (type.data['animation']);
  289. animationTriggers.forEach(function (trigger) {
  290. return _this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger);
  291. });
  292. return new AnimationRenderer(this, namespaceId, delegate, this.engine);
  293. };
  294. /**
  295. * @return {?}
  296. */
  297. AnimationRendererFactory.prototype.begin = /**
  298. * @return {?}
  299. */
  300. function () {
  301. this._cdRecurDepth++;
  302. if (this.delegate.begin) {
  303. this.delegate.begin();
  304. }
  305. };
  306. /**
  307. * @return {?}
  308. */
  309. AnimationRendererFactory.prototype._scheduleCountTask = /**
  310. * @return {?}
  311. */
  312. function () {
  313. var _this = this;
  314. // always use promise to schedule microtask instead of use Zone
  315. this.promise.then(function () { _this._microtaskId++; });
  316. };
  317. /* @internal */
  318. /**
  319. * @param {?} count
  320. * @param {?} fn
  321. * @param {?} data
  322. * @return {?}
  323. */
  324. AnimationRendererFactory.prototype.scheduleListenerCallback = /**
  325. * @param {?} count
  326. * @param {?} fn
  327. * @param {?} data
  328. * @return {?}
  329. */
  330. function (count, fn, data) {
  331. var _this = this;
  332. if (count >= 0 && count < this._microtaskId) {
  333. this._zone.run(function () { return fn(data); });
  334. return;
  335. }
  336. if (this._animationCallbacksBuffer.length == 0) {
  337. Promise.resolve(null).then(function () {
  338. _this._zone.run(function () {
  339. _this._animationCallbacksBuffer.forEach(function (tuple) {
  340. var fn = tuple[0], data = tuple[1];
  341. fn(data);
  342. });
  343. _this._animationCallbacksBuffer = [];
  344. });
  345. });
  346. }
  347. this._animationCallbacksBuffer.push([fn, data]);
  348. };
  349. /**
  350. * @return {?}
  351. */
  352. AnimationRendererFactory.prototype.end = /**
  353. * @return {?}
  354. */
  355. function () {
  356. var _this = this;
  357. this._cdRecurDepth--;
  358. // this is to prevent animations from running twice when an inner
  359. // component does CD when a parent component insted has inserted it
  360. if (this._cdRecurDepth == 0) {
  361. this._zone.runOutsideAngular(function () {
  362. _this._scheduleCountTask();
  363. _this.engine.flush(_this._microtaskId);
  364. });
  365. }
  366. if (this.delegate.end) {
  367. this.delegate.end();
  368. }
  369. };
  370. /**
  371. * @return {?}
  372. */
  373. AnimationRendererFactory.prototype.whenRenderingDone = /**
  374. * @return {?}
  375. */
  376. function () { return this.engine.whenRenderingDone(); };
  377. AnimationRendererFactory.decorators = [
  378. { type: Injectable },
  379. ];
  380. /** @nocollapse */
  381. AnimationRendererFactory.ctorParameters = function () { return [
  382. { type: RendererFactory2, },
  383. { type: ɵAnimationEngine, },
  384. { type: NgZone, },
  385. ]; };
  386. return AnimationRendererFactory;
  387. }());
  388. var BaseAnimationRenderer = /** @class */ (function () {
  389. function BaseAnimationRenderer(namespaceId, delegate, engine) {
  390. this.namespaceId = namespaceId;
  391. this.delegate = delegate;
  392. this.engine = engine;
  393. this.destroyNode = this.delegate.destroyNode ? function (n) { return ((delegate.destroyNode))(n); } : null;
  394. }
  395. Object.defineProperty(BaseAnimationRenderer.prototype, "data", {
  396. get: /**
  397. * @return {?}
  398. */
  399. function () { return this.delegate.data; },
  400. enumerable: true,
  401. configurable: true
  402. });
  403. /**
  404. * @return {?}
  405. */
  406. BaseAnimationRenderer.prototype.destroy = /**
  407. * @return {?}
  408. */
  409. function () {
  410. this.engine.destroy(this.namespaceId, this.delegate);
  411. this.delegate.destroy();
  412. };
  413. /**
  414. * @param {?} name
  415. * @param {?=} namespace
  416. * @return {?}
  417. */
  418. BaseAnimationRenderer.prototype.createElement = /**
  419. * @param {?} name
  420. * @param {?=} namespace
  421. * @return {?}
  422. */
  423. function (name, namespace) {
  424. return this.delegate.createElement(name, namespace);
  425. };
  426. /**
  427. * @param {?} value
  428. * @return {?}
  429. */
  430. BaseAnimationRenderer.prototype.createComment = /**
  431. * @param {?} value
  432. * @return {?}
  433. */
  434. function (value) { return this.delegate.createComment(value); };
  435. /**
  436. * @param {?} value
  437. * @return {?}
  438. */
  439. BaseAnimationRenderer.prototype.createText = /**
  440. * @param {?} value
  441. * @return {?}
  442. */
  443. function (value) { return this.delegate.createText(value); };
  444. /**
  445. * @param {?} parent
  446. * @param {?} newChild
  447. * @return {?}
  448. */
  449. BaseAnimationRenderer.prototype.appendChild = /**
  450. * @param {?} parent
  451. * @param {?} newChild
  452. * @return {?}
  453. */
  454. function (parent, newChild) {
  455. this.delegate.appendChild(parent, newChild);
  456. this.engine.onInsert(this.namespaceId, newChild, parent, false);
  457. };
  458. /**
  459. * @param {?} parent
  460. * @param {?} newChild
  461. * @param {?} refChild
  462. * @return {?}
  463. */
  464. BaseAnimationRenderer.prototype.insertBefore = /**
  465. * @param {?} parent
  466. * @param {?} newChild
  467. * @param {?} refChild
  468. * @return {?}
  469. */
  470. function (parent, newChild, refChild) {
  471. this.delegate.insertBefore(parent, newChild, refChild);
  472. this.engine.onInsert(this.namespaceId, newChild, parent, true);
  473. };
  474. /**
  475. * @param {?} parent
  476. * @param {?} oldChild
  477. * @return {?}
  478. */
  479. BaseAnimationRenderer.prototype.removeChild = /**
  480. * @param {?} parent
  481. * @param {?} oldChild
  482. * @return {?}
  483. */
  484. function (parent, oldChild) {
  485. this.engine.onRemove(this.namespaceId, oldChild, this.delegate);
  486. };
  487. /**
  488. * @param {?} selectorOrNode
  489. * @return {?}
  490. */
  491. BaseAnimationRenderer.prototype.selectRootElement = /**
  492. * @param {?} selectorOrNode
  493. * @return {?}
  494. */
  495. function (selectorOrNode) { return this.delegate.selectRootElement(selectorOrNode); };
  496. /**
  497. * @param {?} node
  498. * @return {?}
  499. */
  500. BaseAnimationRenderer.prototype.parentNode = /**
  501. * @param {?} node
  502. * @return {?}
  503. */
  504. function (node) { return this.delegate.parentNode(node); };
  505. /**
  506. * @param {?} node
  507. * @return {?}
  508. */
  509. BaseAnimationRenderer.prototype.nextSibling = /**
  510. * @param {?} node
  511. * @return {?}
  512. */
  513. function (node) { return this.delegate.nextSibling(node); };
  514. /**
  515. * @param {?} el
  516. * @param {?} name
  517. * @param {?} value
  518. * @param {?=} namespace
  519. * @return {?}
  520. */
  521. BaseAnimationRenderer.prototype.setAttribute = /**
  522. * @param {?} el
  523. * @param {?} name
  524. * @param {?} value
  525. * @param {?=} namespace
  526. * @return {?}
  527. */
  528. function (el, name, value, namespace) {
  529. this.delegate.setAttribute(el, name, value, namespace);
  530. };
  531. /**
  532. * @param {?} el
  533. * @param {?} name
  534. * @param {?=} namespace
  535. * @return {?}
  536. */
  537. BaseAnimationRenderer.prototype.removeAttribute = /**
  538. * @param {?} el
  539. * @param {?} name
  540. * @param {?=} namespace
  541. * @return {?}
  542. */
  543. function (el, name, namespace) {
  544. this.delegate.removeAttribute(el, name, namespace);
  545. };
  546. /**
  547. * @param {?} el
  548. * @param {?} name
  549. * @return {?}
  550. */
  551. BaseAnimationRenderer.prototype.addClass = /**
  552. * @param {?} el
  553. * @param {?} name
  554. * @return {?}
  555. */
  556. function (el, name) { this.delegate.addClass(el, name); };
  557. /**
  558. * @param {?} el
  559. * @param {?} name
  560. * @return {?}
  561. */
  562. BaseAnimationRenderer.prototype.removeClass = /**
  563. * @param {?} el
  564. * @param {?} name
  565. * @return {?}
  566. */
  567. function (el, name) { this.delegate.removeClass(el, name); };
  568. /**
  569. * @param {?} el
  570. * @param {?} style
  571. * @param {?} value
  572. * @param {?=} flags
  573. * @return {?}
  574. */
  575. BaseAnimationRenderer.prototype.setStyle = /**
  576. * @param {?} el
  577. * @param {?} style
  578. * @param {?} value
  579. * @param {?=} flags
  580. * @return {?}
  581. */
  582. function (el, style, value, flags) {
  583. this.delegate.setStyle(el, style, value, flags);
  584. };
  585. /**
  586. * @param {?} el
  587. * @param {?} style
  588. * @param {?=} flags
  589. * @return {?}
  590. */
  591. BaseAnimationRenderer.prototype.removeStyle = /**
  592. * @param {?} el
  593. * @param {?} style
  594. * @param {?=} flags
  595. * @return {?}
  596. */
  597. function (el, style, flags) {
  598. this.delegate.removeStyle(el, style, flags);
  599. };
  600. /**
  601. * @param {?} el
  602. * @param {?} name
  603. * @param {?} value
  604. * @return {?}
  605. */
  606. BaseAnimationRenderer.prototype.setProperty = /**
  607. * @param {?} el
  608. * @param {?} name
  609. * @param {?} value
  610. * @return {?}
  611. */
  612. function (el, name, value) {
  613. if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) {
  614. this.disableAnimations(el, !!value);
  615. }
  616. else {
  617. this.delegate.setProperty(el, name, value);
  618. }
  619. };
  620. /**
  621. * @param {?} node
  622. * @param {?} value
  623. * @return {?}
  624. */
  625. BaseAnimationRenderer.prototype.setValue = /**
  626. * @param {?} node
  627. * @param {?} value
  628. * @return {?}
  629. */
  630. function (node, value) { this.delegate.setValue(node, value); };
  631. /**
  632. * @param {?} target
  633. * @param {?} eventName
  634. * @param {?} callback
  635. * @return {?}
  636. */
  637. BaseAnimationRenderer.prototype.listen = /**
  638. * @param {?} target
  639. * @param {?} eventName
  640. * @param {?} callback
  641. * @return {?}
  642. */
  643. function (target, eventName, callback) {
  644. return this.delegate.listen(target, eventName, callback);
  645. };
  646. /**
  647. * @param {?} element
  648. * @param {?} value
  649. * @return {?}
  650. */
  651. BaseAnimationRenderer.prototype.disableAnimations = /**
  652. * @param {?} element
  653. * @param {?} value
  654. * @return {?}
  655. */
  656. function (element, value) {
  657. this.engine.disableAnimations(element, value);
  658. };
  659. return BaseAnimationRenderer;
  660. }());
  661. var AnimationRenderer = /** @class */ (function (_super) {
  662. __extends(AnimationRenderer, _super);
  663. function AnimationRenderer(factory, namespaceId, delegate, engine) {
  664. var _this = _super.call(this, namespaceId, delegate, engine) || this;
  665. _this.factory = factory;
  666. _this.namespaceId = namespaceId;
  667. return _this;
  668. }
  669. /**
  670. * @param {?} el
  671. * @param {?} name
  672. * @param {?} value
  673. * @return {?}
  674. */
  675. AnimationRenderer.prototype.setProperty = /**
  676. * @param {?} el
  677. * @param {?} name
  678. * @param {?} value
  679. * @return {?}
  680. */
  681. function (el, name, value) {
  682. if (name.charAt(0) == ANIMATION_PREFIX) {
  683. if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) {
  684. value = value === undefined ? true : !!value;
  685. this.disableAnimations(el, /** @type {?} */ (value));
  686. }
  687. else {
  688. this.engine.process(this.namespaceId, el, name.substr(1), value);
  689. }
  690. }
  691. else {
  692. this.delegate.setProperty(el, name, value);
  693. }
  694. };
  695. /**
  696. * @param {?} target
  697. * @param {?} eventName
  698. * @param {?} callback
  699. * @return {?}
  700. */
  701. AnimationRenderer.prototype.listen = /**
  702. * @param {?} target
  703. * @param {?} eventName
  704. * @param {?} callback
  705. * @return {?}
  706. */
  707. function (target, eventName, callback) {
  708. var _this = this;
  709. if (eventName.charAt(0) == ANIMATION_PREFIX) {
  710. var /** @type {?} */ element = resolveElementFromTarget(target);
  711. var /** @type {?} */ name_1 = eventName.substr(1);
  712. var /** @type {?} */ phase = '';
  713. // @listener.phase is for trigger animation callbacks
  714. // @@listener is for animation builder callbacks
  715. if (name_1.charAt(0) != ANIMATION_PREFIX) {
  716. _a = parseTriggerCallbackName(name_1), name_1 = _a[0], phase = _a[1];
  717. }
  718. return this.engine.listen(this.namespaceId, element, name_1, phase, function (event) {
  719. var /** @type {?} */ countId = (/** @type {?} */ (event))['_data'] || -1;
  720. _this.factory.scheduleListenerCallback(countId, callback, event);
  721. });
  722. }
  723. return this.delegate.listen(target, eventName, callback);
  724. var _a;
  725. };
  726. return AnimationRenderer;
  727. }(BaseAnimationRenderer));
  728. /**
  729. * @param {?} target
  730. * @return {?}
  731. */
  732. function resolveElementFromTarget(target) {
  733. switch (target) {
  734. case 'body':
  735. return document.body;
  736. case 'document':
  737. return document;
  738. case 'window':
  739. return window;
  740. default:
  741. return target;
  742. }
  743. }
  744. /**
  745. * @param {?} triggerName
  746. * @return {?}
  747. */
  748. function parseTriggerCallbackName(triggerName) {
  749. var /** @type {?} */ dotIndex = triggerName.indexOf('.');
  750. var /** @type {?} */ trigger = triggerName.substring(0, dotIndex);
  751. var /** @type {?} */ phase = triggerName.substr(dotIndex + 1);
  752. return [trigger, phase];
  753. }
  754. /**
  755. * @fileoverview added by tsickle
  756. * @suppress {checkTypes} checked by tsc
  757. */
  758. /**
  759. * @license
  760. * Copyright Google Inc. All Rights Reserved.
  761. *
  762. * Use of this source code is governed by an MIT-style license that can be
  763. * found in the LICENSE file at https://angular.io/license
  764. */
  765. var InjectableAnimationEngine = /** @class */ (function (_super) {
  766. __extends(InjectableAnimationEngine, _super);
  767. function InjectableAnimationEngine(driver, normalizer) {
  768. return _super.call(this, driver, normalizer) || this;
  769. }
  770. InjectableAnimationEngine.decorators = [
  771. { type: Injectable },
  772. ];
  773. /** @nocollapse */
  774. InjectableAnimationEngine.ctorParameters = function () { return [
  775. { type: AnimationDriver, },
  776. { type: ɵAnimationStyleNormalizer, },
  777. ]; };
  778. return InjectableAnimationEngine;
  779. }(ɵAnimationEngine));
  780. /**
  781. * @return {?}
  782. */
  783. function instantiateSupportedAnimationDriver() {
  784. if (ɵsupportsWebAnimations()) {
  785. return new ɵWebAnimationsDriver();
  786. }
  787. return new ɵNoopAnimationDriver();
  788. }
  789. /**
  790. * @return {?}
  791. */
  792. function instantiateDefaultStyleNormalizer() {
  793. return new ɵWebAnimationsStyleNormalizer();
  794. }
  795. /**
  796. * @param {?} renderer
  797. * @param {?} engine
  798. * @param {?} zone
  799. * @return {?}
  800. */
  801. function instantiateRendererFactory(renderer, engine, zone) {
  802. return new AnimationRendererFactory(renderer, engine, zone);
  803. }
  804. var SHARED_ANIMATION_PROVIDERS = [
  805. { provide: AnimationBuilder, useClass: BrowserAnimationBuilder },
  806. { provide: ɵAnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer },
  807. { provide: ɵAnimationEngine, useClass: InjectableAnimationEngine }, {
  808. provide: RendererFactory2,
  809. useFactory: instantiateRendererFactory,
  810. deps: [ɵDomRendererFactory2, ɵAnimationEngine, NgZone]
  811. }
  812. ];
  813. /**
  814. * Separate providers from the actual module so that we can do a local modification in Google3 to
  815. * include them in the BrowserModule.
  816. */
  817. var BROWSER_ANIMATIONS_PROVIDERS = [
  818. { provide: AnimationDriver, useFactory: instantiateSupportedAnimationDriver }
  819. ].concat(SHARED_ANIMATION_PROVIDERS);
  820. /**
  821. * Separate providers from the actual module so that we can do a local modification in Google3 to
  822. * include them in the BrowserTestingModule.
  823. */
  824. var BROWSER_NOOP_ANIMATIONS_PROVIDERS = [{ provide: AnimationDriver, useClass: ɵNoopAnimationDriver }].concat(SHARED_ANIMATION_PROVIDERS);
  825. /**
  826. * @fileoverview added by tsickle
  827. * @suppress {checkTypes} checked by tsc
  828. */
  829. /**
  830. * \@experimental Animation support is experimental.
  831. */
  832. var BrowserAnimationsModule = /** @class */ (function () {
  833. function BrowserAnimationsModule() {
  834. }
  835. BrowserAnimationsModule.decorators = [
  836. { type: NgModule, args: [{
  837. exports: [BrowserModule],
  838. providers: BROWSER_ANIMATIONS_PROVIDERS,
  839. },] },
  840. ];
  841. /** @nocollapse */
  842. BrowserAnimationsModule.ctorParameters = function () { return []; };
  843. return BrowserAnimationsModule;
  844. }());
  845. /**
  846. * \@experimental Animation support is experimental.
  847. */
  848. var NoopAnimationsModule = /** @class */ (function () {
  849. function NoopAnimationsModule() {
  850. }
  851. NoopAnimationsModule.decorators = [
  852. { type: NgModule, args: [{
  853. exports: [BrowserModule],
  854. providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS,
  855. },] },
  856. ];
  857. /** @nocollapse */
  858. NoopAnimationsModule.ctorParameters = function () { return []; };
  859. return NoopAnimationsModule;
  860. }());
  861. /**
  862. * @fileoverview added by tsickle
  863. * @suppress {checkTypes} checked by tsc
  864. */
  865. /**
  866. * @fileoverview added by tsickle
  867. * @suppress {checkTypes} checked by tsc
  868. */
  869. /**
  870. * @license
  871. * Copyright Google Inc. All Rights Reserved.
  872. *
  873. * Use of this source code is governed by an MIT-style license that can be
  874. * found in the LICENSE file at https://angular.io/license
  875. */
  876. /**
  877. * @fileoverview added by tsickle
  878. * @suppress {checkTypes} checked by tsc
  879. */
  880. /**
  881. * @license
  882. * Copyright Google Inc. All Rights Reserved.
  883. *
  884. * Use of this source code is governed by an MIT-style license that can be
  885. * found in the LICENSE file at https://angular.io/license
  886. */
  887. /**
  888. * @module
  889. * @description
  890. * Entry point for all public APIs of this package.
  891. */
  892. /**
  893. * @fileoverview added by tsickle
  894. * @suppress {checkTypes} checked by tsc
  895. */
  896. /**
  897. * Generated bundle index. Do not edit.
  898. */
  899. export { BrowserAnimationsModule, NoopAnimationsModule, BrowserAnimationBuilder as ɵBrowserAnimationBuilder, BrowserAnimationFactory as ɵBrowserAnimationFactory, AnimationRenderer as ɵAnimationRenderer, AnimationRendererFactory as ɵAnimationRendererFactory, BaseAnimationRenderer as ɵa, BROWSER_ANIMATIONS_PROVIDERS as ɵf, BROWSER_NOOP_ANIMATIONS_PROVIDERS as ɵg, InjectableAnimationEngine as ɵb, instantiateDefaultStyleNormalizer as ɵd, instantiateRendererFactory as ɵe, instantiateSupportedAnimationDriver as ɵc };
  900. //# sourceMappingURL=animations.js.map