source: trip-planner-front/node_modules/@angular/platform-browser/__ivy_ngcc__/fesm2015/animations.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 21.5 KB
Line 
1/**
2 * @license Angular v12.2.9
3 * (c) 2010-2021 Google LLC. https://angular.io/
4 * License: MIT
5 */
6
7import { ViewEncapsulation, Injectable, RendererFactory2, Inject, NgZone, InjectionToken, NgModule } from '@angular/core';
8import { ɵDomRendererFactory2, BrowserModule } from '@angular/platform-browser';
9import { AnimationBuilder, sequence, AnimationFactory } from '@angular/animations';
10import { ɵAnimationEngine, AnimationDriver, ɵAnimationStyleNormalizer, ɵsupportsWebAnimations, ɵWebAnimationsDriver, ɵCssKeyframesDriver, ɵWebAnimationsStyleNormalizer, ɵNoopAnimationDriver } from '@angular/animations/browser';
11import { DOCUMENT } from '@angular/common';
12
13/**
14 * @license
15 * Copyright Google LLC All Rights Reserved.
16 *
17 * Use of this source code is governed by an MIT-style license that can be
18 * found in the LICENSE file at https://angular.io/license
19 */
20import * as ɵngcc0 from '@angular/core';
21import * as ɵngcc1 from '@angular/animations/browser';
22class BrowserAnimationBuilder extends AnimationBuilder {
23 constructor(rootRenderer, doc) {
24 super();
25 this._nextAnimationId = 0;
26 const typeData = { id: '0', encapsulation: ViewEncapsulation.None, styles: [], data: { animation: [] } };
27 this._renderer = rootRenderer.createRenderer(doc.body, typeData);
28 }
29 build(animation) {
30 const id = this._nextAnimationId.toString();
31 this._nextAnimationId++;
32 const entry = Array.isArray(animation) ? sequence(animation) : animation;
33 issueAnimationCommand(this._renderer, null, id, 'register', [entry]);
34 return new BrowserAnimationFactory(id, this._renderer);
35 }
36}
37BrowserAnimationBuilder.ɵfac = function BrowserAnimationBuilder_Factory(t) { return new (t || BrowserAnimationBuilder)(ɵngcc0.ɵɵinject(ɵngcc0.RendererFactory2), ɵngcc0.ɵɵinject(DOCUMENT)); };
38BrowserAnimationBuilder.ɵprov = /*@__PURE__*/ ɵngcc0.ɵɵdefineInjectable({ token: BrowserAnimationBuilder, factory: BrowserAnimationBuilder.ɵfac });
39BrowserAnimationBuilder.ctorParameters = () => [
40 { type: RendererFactory2 },
41 { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
42];
43(function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(BrowserAnimationBuilder, [{
44 type: Injectable
45 }], function () { return [{ type: ɵngcc0.RendererFactory2 }, { type: undefined, decorators: [{
46 type: Inject,
47 args: [DOCUMENT]
48 }] }]; }, null); })();
49class BrowserAnimationFactory extends AnimationFactory {
50 constructor(_id, _renderer) {
51 super();
52 this._id = _id;
53 this._renderer = _renderer;
54 }
55 create(element, options) {
56 return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer);
57 }
58}
59class RendererAnimationPlayer {
60 constructor(id, element, options, _renderer) {
61 this.id = id;
62 this.element = element;
63 this._renderer = _renderer;
64 this.parentPlayer = null;
65 this._started = false;
66 this.totalTime = 0;
67 this._command('create', options);
68 }
69 _listen(eventName, callback) {
70 return this._renderer.listen(this.element, `@@${this.id}:${eventName}`, callback);
71 }
72 _command(command, ...args) {
73 return issueAnimationCommand(this._renderer, this.element, this.id, command, args);
74 }
75 onDone(fn) {
76 this._listen('done', fn);
77 }
78 onStart(fn) {
79 this._listen('start', fn);
80 }
81 onDestroy(fn) {
82 this._listen('destroy', fn);
83 }
84 init() {
85 this._command('init');
86 }
87 hasStarted() {
88 return this._started;
89 }
90 play() {
91 this._command('play');
92 this._started = true;
93 }
94 pause() {
95 this._command('pause');
96 }
97 restart() {
98 this._command('restart');
99 }
100 finish() {
101 this._command('finish');
102 }
103 destroy() {
104 this._command('destroy');
105 }
106 reset() {
107 this._command('reset');
108 this._started = false;
109 }
110 setPosition(p) {
111 this._command('setPosition', p);
112 }
113 getPosition() {
114 var _a, _b;
115 return (_b = (_a = this._renderer.engine.players[+this.id]) === null || _a === void 0 ? void 0 : _a.getPosition()) !== null && _b !== void 0 ? _b : 0;
116 }
117}
118function issueAnimationCommand(renderer, element, id, command, args) {
119 return renderer.setProperty(element, `@@${id}:${command}`, args);
120}
121
122const ANIMATION_PREFIX = '@';
123const DISABLE_ANIMATIONS_FLAG = '@.disabled';
124class AnimationRendererFactory {
125 constructor(delegate, engine, _zone) {
126 this.delegate = delegate;
127 this.engine = engine;
128 this._zone = _zone;
129 this._currentId = 0;
130 this._microtaskId = 1;
131 this._animationCallbacksBuffer = [];
132 this._rendererCache = new Map();
133 this._cdRecurDepth = 0;
134 this.promise = Promise.resolve(0);
135 engine.onRemovalComplete = (element, delegate) => {
136 // Note: if an component element has a leave animation, and the component
137 // a host leave animation, the view engine will call `removeChild` for the parent
138 // component renderer as well as for the child component renderer.
139 // Therefore, we need to check if we already removed the element.
140 if (delegate && delegate.parentNode(element)) {
141 delegate.removeChild(element.parentNode, element);
142 }
143 };
144 }
145 createRenderer(hostElement, type) {
146 const EMPTY_NAMESPACE_ID = '';
147 // cache the delegates to find out which cached delegate can
148 // be used by which cached renderer
149 const delegate = this.delegate.createRenderer(hostElement, type);
150 if (!hostElement || !type || !type.data || !type.data['animation']) {
151 let renderer = this._rendererCache.get(delegate);
152 if (!renderer) {
153 renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine);
154 // only cache this result when the base renderer is used
155 this._rendererCache.set(delegate, renderer);
156 }
157 return renderer;
158 }
159 const componentId = type.id;
160 const namespaceId = type.id + '-' + this._currentId;
161 this._currentId++;
162 this.engine.register(namespaceId, hostElement);
163 const registerTrigger = (trigger) => {
164 if (Array.isArray(trigger)) {
165 trigger.forEach(registerTrigger);
166 }
167 else {
168 this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger);
169 }
170 };
171 const animationTriggers = type.data['animation'];
172 animationTriggers.forEach(registerTrigger);
173 return new AnimationRenderer(this, namespaceId, delegate, this.engine);
174 }
175 begin() {
176 this._cdRecurDepth++;
177 if (this.delegate.begin) {
178 this.delegate.begin();
179 }
180 }
181 _scheduleCountTask() {
182 // always use promise to schedule microtask instead of use Zone
183 this.promise.then(() => {
184 this._microtaskId++;
185 });
186 }
187 /** @internal */
188 scheduleListenerCallback(count, fn, data) {
189 if (count >= 0 && count < this._microtaskId) {
190 this._zone.run(() => fn(data));
191 return;
192 }
193 if (this._animationCallbacksBuffer.length == 0) {
194 Promise.resolve(null).then(() => {
195 this._zone.run(() => {
196 this._animationCallbacksBuffer.forEach(tuple => {
197 const [fn, data] = tuple;
198 fn(data);
199 });
200 this._animationCallbacksBuffer = [];
201 });
202 });
203 }
204 this._animationCallbacksBuffer.push([fn, data]);
205 }
206 end() {
207 this._cdRecurDepth--;
208 // this is to prevent animations from running twice when an inner
209 // component does CD when a parent component instead has inserted it
210 if (this._cdRecurDepth == 0) {
211 this._zone.runOutsideAngular(() => {
212 this._scheduleCountTask();
213 this.engine.flush(this._microtaskId);
214 });
215 }
216 if (this.delegate.end) {
217 this.delegate.end();
218 }
219 }
220 whenRenderingDone() {
221 return this.engine.whenRenderingDone();
222 }
223}
224AnimationRendererFactory.ɵfac = function AnimationRendererFactory_Factory(t) { return new (t || AnimationRendererFactory)(ɵngcc0.ɵɵinject(ɵngcc0.RendererFactory2), ɵngcc0.ɵɵinject(ɵngcc1.ɵAnimationEngine), ɵngcc0.ɵɵinject(ɵngcc0.NgZone)); };
225AnimationRendererFactory.ɵprov = /*@__PURE__*/ ɵngcc0.ɵɵdefineInjectable({ token: AnimationRendererFactory, factory: AnimationRendererFactory.ɵfac });
226AnimationRendererFactory.ctorParameters = () => [
227 { type: RendererFactory2 },
228 { type: ɵAnimationEngine },
229 { type: NgZone }
230];
231(function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(AnimationRendererFactory, [{
232 type: Injectable
233 }], function () { return [{ type: ɵngcc0.RendererFactory2 }, { type: ɵngcc1.ɵAnimationEngine }, { type: ɵngcc0.NgZone }]; }, null); })();
234class BaseAnimationRenderer {
235 constructor(namespaceId, delegate, engine) {
236 this.namespaceId = namespaceId;
237 this.delegate = delegate;
238 this.engine = engine;
239 this.destroyNode = this.delegate.destroyNode ? (n) => delegate.destroyNode(n) : null;
240 }
241 get data() {
242 return this.delegate.data;
243 }
244 destroy() {
245 this.engine.destroy(this.namespaceId, this.delegate);
246 this.delegate.destroy();
247 }
248 createElement(name, namespace) {
249 return this.delegate.createElement(name, namespace);
250 }
251 createComment(value) {
252 return this.delegate.createComment(value);
253 }
254 createText(value) {
255 return this.delegate.createText(value);
256 }
257 appendChild(parent, newChild) {
258 this.delegate.appendChild(parent, newChild);
259 this.engine.onInsert(this.namespaceId, newChild, parent, false);
260 }
261 insertBefore(parent, newChild, refChild, isMove = true) {
262 this.delegate.insertBefore(parent, newChild, refChild);
263 // If `isMove` true than we should animate this insert.
264 this.engine.onInsert(this.namespaceId, newChild, parent, isMove);
265 }
266 removeChild(parent, oldChild, isHostElement) {
267 this.engine.onRemove(this.namespaceId, oldChild, this.delegate, isHostElement);
268 }
269 selectRootElement(selectorOrNode, preserveContent) {
270 return this.delegate.selectRootElement(selectorOrNode, preserveContent);
271 }
272 parentNode(node) {
273 return this.delegate.parentNode(node);
274 }
275 nextSibling(node) {
276 return this.delegate.nextSibling(node);
277 }
278 setAttribute(el, name, value, namespace) {
279 this.delegate.setAttribute(el, name, value, namespace);
280 }
281 removeAttribute(el, name, namespace) {
282 this.delegate.removeAttribute(el, name, namespace);
283 }
284 addClass(el, name) {
285 this.delegate.addClass(el, name);
286 }
287 removeClass(el, name) {
288 this.delegate.removeClass(el, name);
289 }
290 setStyle(el, style, value, flags) {
291 this.delegate.setStyle(el, style, value, flags);
292 }
293 removeStyle(el, style, flags) {
294 this.delegate.removeStyle(el, style, flags);
295 }
296 setProperty(el, name, value) {
297 if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) {
298 this.disableAnimations(el, !!value);
299 }
300 else {
301 this.delegate.setProperty(el, name, value);
302 }
303 }
304 setValue(node, value) {
305 this.delegate.setValue(node, value);
306 }
307 listen(target, eventName, callback) {
308 return this.delegate.listen(target, eventName, callback);
309 }
310 disableAnimations(element, value) {
311 this.engine.disableAnimations(element, value);
312 }
313}
314class AnimationRenderer extends BaseAnimationRenderer {
315 constructor(factory, namespaceId, delegate, engine) {
316 super(namespaceId, delegate, engine);
317 this.factory = factory;
318 this.namespaceId = namespaceId;
319 }
320 setProperty(el, name, value) {
321 if (name.charAt(0) == ANIMATION_PREFIX) {
322 if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) {
323 value = value === undefined ? true : !!value;
324 this.disableAnimations(el, value);
325 }
326 else {
327 this.engine.process(this.namespaceId, el, name.substr(1), value);
328 }
329 }
330 else {
331 this.delegate.setProperty(el, name, value);
332 }
333 }
334 listen(target, eventName, callback) {
335 if (eventName.charAt(0) == ANIMATION_PREFIX) {
336 const element = resolveElementFromTarget(target);
337 let name = eventName.substr(1);
338 let phase = '';
339 // @listener.phase is for trigger animation callbacks
340 // @@listener is for animation builder callbacks
341 if (name.charAt(0) != ANIMATION_PREFIX) {
342 [name, phase] = parseTriggerCallbackName(name);
343 }
344 return this.engine.listen(this.namespaceId, element, name, phase, event => {
345 const countId = event['_data'] || -1;
346 this.factory.scheduleListenerCallback(countId, callback, event);
347 });
348 }
349 return this.delegate.listen(target, eventName, callback);
350 }
351}
352function resolveElementFromTarget(target) {
353 switch (target) {
354 case 'body':
355 return document.body;
356 case 'document':
357 return document;
358 case 'window':
359 return window;
360 default:
361 return target;
362 }
363}
364function parseTriggerCallbackName(triggerName) {
365 const dotIndex = triggerName.indexOf('.');
366 const trigger = triggerName.substring(0, dotIndex);
367 const phase = triggerName.substr(dotIndex + 1);
368 return [trigger, phase];
369}
370
371/**
372 * @license
373 * Copyright Google LLC All Rights Reserved.
374 *
375 * Use of this source code is governed by an MIT-style license that can be
376 * found in the LICENSE file at https://angular.io/license
377 */
378class InjectableAnimationEngine extends ɵAnimationEngine {
379 constructor(doc, driver, normalizer) {
380 super(doc.body, driver, normalizer);
381 }
382 ngOnDestroy() {
383 this.flush();
384 }
385}
386InjectableAnimationEngine.ɵfac = function InjectableAnimationEngine_Factory(t) { return new (t || InjectableAnimationEngine)(ɵngcc0.ɵɵinject(DOCUMENT), ɵngcc0.ɵɵinject(ɵngcc1.AnimationDriver), ɵngcc0.ɵɵinject(ɵngcc1.ɵAnimationStyleNormalizer)); };
387InjectableAnimationEngine.ɵprov = /*@__PURE__*/ ɵngcc0.ɵɵdefineInjectable({ token: InjectableAnimationEngine, factory: InjectableAnimationEngine.ɵfac });
388InjectableAnimationEngine.ctorParameters = () => [
389 { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
390 { type: AnimationDriver },
391 { type: ɵAnimationStyleNormalizer }
392];
393(function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(InjectableAnimationEngine, [{
394 type: Injectable
395 }], function () { return [{ type: undefined, decorators: [{
396 type: Inject,
397 args: [DOCUMENT]
398 }] }, { type: ɵngcc1.AnimationDriver }, { type: ɵngcc1.ɵAnimationStyleNormalizer }]; }, null); })();
399function instantiateSupportedAnimationDriver() {
400 return ɵsupportsWebAnimations() ? new ɵWebAnimationsDriver() : new ɵCssKeyframesDriver();
401}
402function instantiateDefaultStyleNormalizer() {
403 return new ɵWebAnimationsStyleNormalizer();
404}
405function instantiateRendererFactory(renderer, engine, zone) {
406 return new AnimationRendererFactory(renderer, engine, zone);
407}
408/**
409 * @publicApi
410 */
411const ANIMATION_MODULE_TYPE = new InjectionToken('AnimationModuleType');
412const SHARED_ANIMATION_PROVIDERS = [
413 { provide: AnimationBuilder, useClass: BrowserAnimationBuilder },
414 { provide: ɵAnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer },
415 { provide: ɵAnimationEngine, useClass: InjectableAnimationEngine }, {
416 provide: RendererFactory2,
417 useFactory: instantiateRendererFactory,
418 deps: [ɵDomRendererFactory2, ɵAnimationEngine, NgZone]
419 }
420];
421/**
422 * Separate providers from the actual module so that we can do a local modification in Google3 to
423 * include them in the BrowserModule.
424 */
425const BROWSER_ANIMATIONS_PROVIDERS = [
426 { provide: AnimationDriver, useFactory: instantiateSupportedAnimationDriver },
427 { provide: ANIMATION_MODULE_TYPE, useValue: 'BrowserAnimations' }, ...SHARED_ANIMATION_PROVIDERS
428];
429/**
430 * Separate providers from the actual module so that we can do a local modification in Google3 to
431 * include them in the BrowserTestingModule.
432 */
433const BROWSER_NOOP_ANIMATIONS_PROVIDERS = [
434 { provide: AnimationDriver, useClass: ɵNoopAnimationDriver },
435 { provide: ANIMATION_MODULE_TYPE, useValue: 'NoopAnimations' }, ...SHARED_ANIMATION_PROVIDERS
436];
437
438/**
439 * @license
440 * Copyright Google LLC All Rights Reserved.
441 *
442 * Use of this source code is governed by an MIT-style license that can be
443 * found in the LICENSE file at https://angular.io/license
444 */
445/**
446 * Exports `BrowserModule` with additional [dependency-injection providers](guide/glossary#provider)
447 * for use with animations. See [Animations](guide/animations).
448 * @publicApi
449 */
450class BrowserAnimationsModule {
451 /**
452 * Configures the module based on the specified object.
453 *
454 * @param config Object used to configure the behavior of the `BrowserAnimationsModule`.
455 * @see `BrowserAnimationsModuleConfig`
456 *
457 * @usageNotes
458 * When registering the `BrowserAnimationsModule`, you can use the `withConfig`
459 * function as follows:
460 * ```
461 * @NgModule({
462 * imports: [BrowserAnimationsModule.withConfig(config)]
463 * })
464 * class MyNgModule {}
465 * ```
466 */
467 static withConfig(config) {
468 return {
469 ngModule: BrowserAnimationsModule,
470 providers: config.disableAnimations ? BROWSER_NOOP_ANIMATIONS_PROVIDERS :
471 BROWSER_ANIMATIONS_PROVIDERS
472 };
473 }
474}
475BrowserAnimationsModule.ɵfac = function BrowserAnimationsModule_Factory(t) { return new (t || BrowserAnimationsModule)(); };
476BrowserAnimationsModule.ɵmod = /*@__PURE__*/ ɵngcc0.ɵɵdefineNgModule({ type: BrowserAnimationsModule });
477BrowserAnimationsModule.ɵinj = /*@__PURE__*/ ɵngcc0.ɵɵdefineInjector({ providers: BROWSER_ANIMATIONS_PROVIDERS, imports: [BrowserModule] });
478(function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(BrowserAnimationsModule, [{
479 type: NgModule,
480 args: [{
481 exports: [BrowserModule],
482 providers: BROWSER_ANIMATIONS_PROVIDERS
483 }]
484 }], null, null); })();
485(function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵngcc0.ɵɵsetNgModuleScope(BrowserAnimationsModule, { exports: function () { return [BrowserModule]; } }); })();
486/**
487 * A null player that must be imported to allow disabling of animations.
488 * @publicApi
489 */
490class NoopAnimationsModule {
491}
492NoopAnimationsModule.ɵfac = function NoopAnimationsModule_Factory(t) { return new (t || NoopAnimationsModule)(); };
493NoopAnimationsModule.ɵmod = /*@__PURE__*/ ɵngcc0.ɵɵdefineNgModule({ type: NoopAnimationsModule });
494NoopAnimationsModule.ɵinj = /*@__PURE__*/ ɵngcc0.ɵɵdefineInjector({ providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS, imports: [BrowserModule] });
495(function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(NoopAnimationsModule, [{
496 type: NgModule,
497 args: [{
498 exports: [BrowserModule],
499 providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS
500 }]
501 }], null, null); })();
502(function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵngcc0.ɵɵsetNgModuleScope(NoopAnimationsModule, { exports: function () { return [BrowserModule]; } }); })();
503
504/**
505 * @license
506 * Copyright Google LLC All Rights Reserved.
507 *
508 * Use of this source code is governed by an MIT-style license that can be
509 * found in the LICENSE file at https://angular.io/license
510 */
511
512/**
513 * @license
514 * Copyright Google LLC 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
520/**
521 * @license
522 * Copyright Google LLC All Rights Reserved.
523 *
524 * Use of this source code is governed by an MIT-style license that can be
525 * found in the LICENSE file at https://angular.io/license
526 */
527
528/**
529 * @license
530 * Copyright Google LLC All Rights Reserved.
531 *
532 * Use of this source code is governed by an MIT-style license that can be
533 * found in the LICENSE file at https://angular.io/license
534 */
535
536/**
537 * Generated bundle index. Do not edit.
538 */
539
540export { ANIMATION_MODULE_TYPE, BrowserAnimationsModule, NoopAnimationsModule, AnimationRenderer as ɵAnimationRenderer, AnimationRendererFactory as ɵAnimationRendererFactory, BrowserAnimationBuilder as ɵBrowserAnimationBuilder, BrowserAnimationFactory as ɵBrowserAnimationFactory, InjectableAnimationEngine as ɵInjectableAnimationEngine, instantiateSupportedAnimationDriver as ɵangular_packages_platform_browser_animations_animations_a, instantiateDefaultStyleNormalizer as ɵangular_packages_platform_browser_animations_animations_b, instantiateRendererFactory as ɵangular_packages_platform_browser_animations_animations_c, BROWSER_ANIMATIONS_PROVIDERS as ɵangular_packages_platform_browser_animations_animations_d, BROWSER_NOOP_ANIMATIONS_PROVIDERS as ɵangular_packages_platform_browser_animations_animations_e, BaseAnimationRenderer as ɵangular_packages_platform_browser_animations_animations_f };
541
542//# sourceMappingURL=animations.js.map
Note: See TracBrowser for help on using the repository browser.