1 | /**
|
---|
2 | * @license Angular v12.2.13
|
---|
3 | * (c) 2010-2021 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.
|
---|
15 |
|
---|
16 | Permission to use, copy, modify, and/or distribute this software for any
|
---|
17 | purpose with or without fee is hereby granted.
|
---|
18 |
|
---|
19 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
---|
20 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
---|
21 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
---|
22 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
---|
23 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
---|
24 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
---|
25 | PERFORMANCE OF THIS SOFTWARE.
|
---|
26 | ***************************************************************************** */
|
---|
27 | /* global Reflect, Promise */
|
---|
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 (Object.prototype.hasOwnProperty.call(b, p))
|
---|
33 | d[p] = b[p]; };
|
---|
34 | return extendStatics(d, b);
|
---|
35 | };
|
---|
36 | function __extends(d, b) {
|
---|
37 | if (typeof b !== "function" && b !== null)
|
---|
38 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
---|
39 | extendStatics(d, b);
|
---|
40 | function __() { this.constructor = d; }
|
---|
41 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
---|
42 | }
|
---|
43 | var __assign = function () {
|
---|
44 | __assign = Object.assign || function __assign(t) {
|
---|
45 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
---|
46 | s = arguments[i];
|
---|
47 | for (var p in s)
|
---|
48 | if (Object.prototype.hasOwnProperty.call(s, p))
|
---|
49 | t[p] = s[p];
|
---|
50 | }
|
---|
51 | return t;
|
---|
52 | };
|
---|
53 | return __assign.apply(this, arguments);
|
---|
54 | };
|
---|
55 | function __rest(s, e) {
|
---|
56 | var t = {};
|
---|
57 | for (var p in s)
|
---|
58 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
---|
59 | t[p] = s[p];
|
---|
60 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
---|
61 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
---|
62 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
---|
63 | t[p[i]] = s[p[i]];
|
---|
64 | }
|
---|
65 | return t;
|
---|
66 | }
|
---|
67 | function __decorate(decorators, target, key, desc) {
|
---|
68 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
---|
69 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
---|
70 | r = Reflect.decorate(decorators, target, key, desc);
|
---|
71 | else
|
---|
72 | for (var i = decorators.length - 1; i >= 0; i--)
|
---|
73 | if (d = decorators[i])
|
---|
74 | r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
---|
75 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
---|
76 | }
|
---|
77 | function __param(paramIndex, decorator) {
|
---|
78 | return function (target, key) { decorator(target, key, paramIndex); };
|
---|
79 | }
|
---|
80 | function __metadata(metadataKey, metadataValue) {
|
---|
81 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
---|
82 | return Reflect.metadata(metadataKey, metadataValue);
|
---|
83 | }
|
---|
84 | function __awaiter(thisArg, _arguments, P, generator) {
|
---|
85 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
---|
86 | return new (P || (P = Promise))(function (resolve, reject) {
|
---|
87 | function fulfilled(value) { try {
|
---|
88 | step(generator.next(value));
|
---|
89 | }
|
---|
90 | catch (e) {
|
---|
91 | reject(e);
|
---|
92 | } }
|
---|
93 | function rejected(value) { try {
|
---|
94 | step(generator["throw"](value));
|
---|
95 | }
|
---|
96 | catch (e) {
|
---|
97 | reject(e);
|
---|
98 | } }
|
---|
99 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
---|
100 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
---|
101 | });
|
---|
102 | }
|
---|
103 | function __generator(thisArg, body) {
|
---|
104 | var _ = { label: 0, sent: function () { if (t[0] & 1)
|
---|
105 | throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
---|
106 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
---|
107 | function verb(n) { return function (v) { return step([n, v]); }; }
|
---|
108 | function step(op) {
|
---|
109 | if (f)
|
---|
110 | throw new TypeError("Generator is already executing.");
|
---|
111 | while (_)
|
---|
112 | try {
|
---|
113 | 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)
|
---|
114 | return t;
|
---|
115 | if (y = 0, t)
|
---|
116 | op = [op[0] & 2, t.value];
|
---|
117 | switch (op[0]) {
|
---|
118 | case 0:
|
---|
119 | case 1:
|
---|
120 | t = op;
|
---|
121 | break;
|
---|
122 | case 4:
|
---|
123 | _.label++;
|
---|
124 | return { value: op[1], done: false };
|
---|
125 | case 5:
|
---|
126 | _.label++;
|
---|
127 | y = op[1];
|
---|
128 | op = [0];
|
---|
129 | continue;
|
---|
130 | case 7:
|
---|
131 | op = _.ops.pop();
|
---|
132 | _.trys.pop();
|
---|
133 | continue;
|
---|
134 | default:
|
---|
135 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
---|
136 | _ = 0;
|
---|
137 | continue;
|
---|
138 | }
|
---|
139 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
---|
140 | _.label = op[1];
|
---|
141 | break;
|
---|
142 | }
|
---|
143 | if (op[0] === 6 && _.label < t[1]) {
|
---|
144 | _.label = t[1];
|
---|
145 | t = op;
|
---|
146 | break;
|
---|
147 | }
|
---|
148 | if (t && _.label < t[2]) {
|
---|
149 | _.label = t[2];
|
---|
150 | _.ops.push(op);
|
---|
151 | break;
|
---|
152 | }
|
---|
153 | if (t[2])
|
---|
154 | _.ops.pop();
|
---|
155 | _.trys.pop();
|
---|
156 | continue;
|
---|
157 | }
|
---|
158 | op = body.call(thisArg, _);
|
---|
159 | }
|
---|
160 | catch (e) {
|
---|
161 | op = [6, e];
|
---|
162 | y = 0;
|
---|
163 | }
|
---|
164 | finally {
|
---|
165 | f = t = 0;
|
---|
166 | }
|
---|
167 | if (op[0] & 5)
|
---|
168 | throw op[1];
|
---|
169 | return { value: op[0] ? op[1] : void 0, done: true };
|
---|
170 | }
|
---|
171 | }
|
---|
172 | var __createBinding = Object.create ? (function (o, m, k, k2) {
|
---|
173 | if (k2 === undefined)
|
---|
174 | k2 = k;
|
---|
175 | Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
---|
176 | }) : (function (o, m, k, k2) {
|
---|
177 | if (k2 === undefined)
|
---|
178 | k2 = k;
|
---|
179 | o[k2] = m[k];
|
---|
180 | });
|
---|
181 | function __exportStar(m, o) {
|
---|
182 | for (var p in m)
|
---|
183 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
---|
184 | __createBinding(o, m, p);
|
---|
185 | }
|
---|
186 | function __values(o) {
|
---|
187 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
---|
188 | if (m)
|
---|
189 | return m.call(o);
|
---|
190 | if (o && typeof o.length === "number")
|
---|
191 | return {
|
---|
192 | next: function () {
|
---|
193 | if (o && i >= o.length)
|
---|
194 | o = void 0;
|
---|
195 | return { value: o && o[i++], done: !o };
|
---|
196 | }
|
---|
197 | };
|
---|
198 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
---|
199 | }
|
---|
200 | function __read(o, n) {
|
---|
201 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
---|
202 | if (!m)
|
---|
203 | return o;
|
---|
204 | var i = m.call(o), r, ar = [], e;
|
---|
205 | try {
|
---|
206 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
---|
207 | ar.push(r.value);
|
---|
208 | }
|
---|
209 | catch (error) {
|
---|
210 | e = { error: error };
|
---|
211 | }
|
---|
212 | finally {
|
---|
213 | try {
|
---|
214 | if (r && !r.done && (m = i["return"]))
|
---|
215 | m.call(i);
|
---|
216 | }
|
---|
217 | finally {
|
---|
218 | if (e)
|
---|
219 | throw e.error;
|
---|
220 | }
|
---|
221 | }
|
---|
222 | return ar;
|
---|
223 | }
|
---|
224 | /** @deprecated */
|
---|
225 | function __spread() {
|
---|
226 | for (var ar = [], i = 0; i < arguments.length; i++)
|
---|
227 | ar = ar.concat(__read(arguments[i]));
|
---|
228 | return ar;
|
---|
229 | }
|
---|
230 | /** @deprecated */
|
---|
231 | function __spreadArrays() {
|
---|
232 | for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
---|
233 | s += arguments[i].length;
|
---|
234 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
---|
235 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
---|
236 | r[k] = a[j];
|
---|
237 | return r;
|
---|
238 | }
|
---|
239 | function __spreadArray(to, from, pack) {
|
---|
240 | if (pack || arguments.length === 2)
|
---|
241 | for (var i = 0, l = from.length, ar; i < l; i++) {
|
---|
242 | if (ar || !(i in from)) {
|
---|
243 | if (!ar)
|
---|
244 | ar = Array.prototype.slice.call(from, 0, i);
|
---|
245 | ar[i] = from[i];
|
---|
246 | }
|
---|
247 | }
|
---|
248 | return to.concat(ar || Array.prototype.slice.call(from));
|
---|
249 | }
|
---|
250 | function __await(v) {
|
---|
251 | return this instanceof __await ? (this.v = v, this) : new __await(v);
|
---|
252 | }
|
---|
253 | function __asyncGenerator(thisArg, _arguments, generator) {
|
---|
254 | if (!Symbol.asyncIterator)
|
---|
255 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
---|
256 | var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
---|
257 | return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
---|
258 | function verb(n) { if (g[n])
|
---|
259 | i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
---|
260 | function resume(n, v) { try {
|
---|
261 | step(g[n](v));
|
---|
262 | }
|
---|
263 | catch (e) {
|
---|
264 | settle(q[0][3], e);
|
---|
265 | } }
|
---|
266 | function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
---|
267 | function fulfill(value) { resume("next", value); }
|
---|
268 | function reject(value) { resume("throw", value); }
|
---|
269 | function settle(f, v) { if (f(v), q.shift(), q.length)
|
---|
270 | resume(q[0][0], q[0][1]); }
|
---|
271 | }
|
---|
272 | function __asyncDelegator(o) {
|
---|
273 | var i, p;
|
---|
274 | return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
---|
275 | 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; }
|
---|
276 | }
|
---|
277 | function __asyncValues(o) {
|
---|
278 | if (!Symbol.asyncIterator)
|
---|
279 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
---|
280 | var m = o[Symbol.asyncIterator], i;
|
---|
281 | 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);
|
---|
282 | 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); }); }; }
|
---|
283 | function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
---|
284 | }
|
---|
285 | function __makeTemplateObject(cooked, raw) {
|
---|
286 | if (Object.defineProperty) {
|
---|
287 | Object.defineProperty(cooked, "raw", { value: raw });
|
---|
288 | }
|
---|
289 | else {
|
---|
290 | cooked.raw = raw;
|
---|
291 | }
|
---|
292 | return cooked;
|
---|
293 | }
|
---|
294 | ;
|
---|
295 | var __setModuleDefault = Object.create ? (function (o, v) {
|
---|
296 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
---|
297 | }) : function (o, v) {
|
---|
298 | o["default"] = v;
|
---|
299 | };
|
---|
300 | function __importStar(mod) {
|
---|
301 | if (mod && mod.__esModule)
|
---|
302 | return mod;
|
---|
303 | var result = {};
|
---|
304 | if (mod != null)
|
---|
305 | for (var k in mod)
|
---|
306 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
---|
307 | __createBinding(result, mod, k);
|
---|
308 | __setModuleDefault(result, mod);
|
---|
309 | return result;
|
---|
310 | }
|
---|
311 | function __importDefault(mod) {
|
---|
312 | return (mod && mod.__esModule) ? mod : { default: mod };
|
---|
313 | }
|
---|
314 | function __classPrivateFieldGet(receiver, state, kind, f) {
|
---|
315 | if (kind === "a" && !f)
|
---|
316 | throw new TypeError("Private accessor was defined without a getter");
|
---|
317 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
---|
318 | throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
---|
319 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
---|
320 | }
|
---|
321 | function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
---|
322 | if (kind === "m")
|
---|
323 | throw new TypeError("Private method is not writable");
|
---|
324 | if (kind === "a" && !f)
|
---|
325 | throw new TypeError("Private accessor was defined without a setter");
|
---|
326 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
---|
327 | throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
---|
328 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
---|
329 | }
|
---|
330 |
|
---|
331 | var BrowserAnimationBuilder = /** @class */ (function (_super) {
|
---|
332 | __extends(BrowserAnimationBuilder, _super);
|
---|
333 | function BrowserAnimationBuilder(rootRenderer, doc) {
|
---|
334 | var _this = _super.call(this) || this;
|
---|
335 | _this._nextAnimationId = 0;
|
---|
336 | var typeData = { id: '0', encapsulation: core.ViewEncapsulation.None, styles: [], data: { animation: [] } };
|
---|
337 | _this._renderer = rootRenderer.createRenderer(doc.body, typeData);
|
---|
338 | return _this;
|
---|
339 | }
|
---|
340 | BrowserAnimationBuilder.prototype.build = function (animation) {
|
---|
341 | var id = this._nextAnimationId.toString();
|
---|
342 | this._nextAnimationId++;
|
---|
343 | var entry = Array.isArray(animation) ? animations.sequence(animation) : animation;
|
---|
344 | issueAnimationCommand(this._renderer, null, id, 'register', [entry]);
|
---|
345 | return new BrowserAnimationFactory(id, this._renderer);
|
---|
346 | };
|
---|
347 | return BrowserAnimationBuilder;
|
---|
348 | }(animations.AnimationBuilder));
|
---|
349 | BrowserAnimationBuilder.decorators = [
|
---|
350 | { type: core.Injectable }
|
---|
351 | ];
|
---|
352 | BrowserAnimationBuilder.ctorParameters = function () { return [
|
---|
353 | { type: core.RendererFactory2 },
|
---|
354 | { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
|
---|
355 | ]; };
|
---|
356 | var BrowserAnimationFactory = /** @class */ (function (_super) {
|
---|
357 | __extends(BrowserAnimationFactory, _super);
|
---|
358 | function BrowserAnimationFactory(_id, _renderer) {
|
---|
359 | var _this = _super.call(this) || this;
|
---|
360 | _this._id = _id;
|
---|
361 | _this._renderer = _renderer;
|
---|
362 | return _this;
|
---|
363 | }
|
---|
364 | BrowserAnimationFactory.prototype.create = function (element, options) {
|
---|
365 | return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer);
|
---|
366 | };
|
---|
367 | return BrowserAnimationFactory;
|
---|
368 | }(animations.AnimationFactory));
|
---|
369 | var RendererAnimationPlayer = /** @class */ (function () {
|
---|
370 | function RendererAnimationPlayer(id, element, options, _renderer) {
|
---|
371 | this.id = id;
|
---|
372 | this.element = element;
|
---|
373 | this._renderer = _renderer;
|
---|
374 | this.parentPlayer = null;
|
---|
375 | this._started = false;
|
---|
376 | this.totalTime = 0;
|
---|
377 | this._command('create', options);
|
---|
378 | }
|
---|
379 | RendererAnimationPlayer.prototype._listen = function (eventName, callback) {
|
---|
380 | return this._renderer.listen(this.element, "@@" + this.id + ":" + eventName, callback);
|
---|
381 | };
|
---|
382 | RendererAnimationPlayer.prototype._command = function (command) {
|
---|
383 | var args = [];
|
---|
384 | for (var _i = 1; _i < arguments.length; _i++) {
|
---|
385 | args[_i - 1] = arguments[_i];
|
---|
386 | }
|
---|
387 | return issueAnimationCommand(this._renderer, this.element, this.id, command, args);
|
---|
388 | };
|
---|
389 | RendererAnimationPlayer.prototype.onDone = function (fn) {
|
---|
390 | this._listen('done', fn);
|
---|
391 | };
|
---|
392 | RendererAnimationPlayer.prototype.onStart = function (fn) {
|
---|
393 | this._listen('start', fn);
|
---|
394 | };
|
---|
395 | RendererAnimationPlayer.prototype.onDestroy = function (fn) {
|
---|
396 | this._listen('destroy', fn);
|
---|
397 | };
|
---|
398 | RendererAnimationPlayer.prototype.init = function () {
|
---|
399 | this._command('init');
|
---|
400 | };
|
---|
401 | RendererAnimationPlayer.prototype.hasStarted = function () {
|
---|
402 | return this._started;
|
---|
403 | };
|
---|
404 | RendererAnimationPlayer.prototype.play = function () {
|
---|
405 | this._command('play');
|
---|
406 | this._started = true;
|
---|
407 | };
|
---|
408 | RendererAnimationPlayer.prototype.pause = function () {
|
---|
409 | this._command('pause');
|
---|
410 | };
|
---|
411 | RendererAnimationPlayer.prototype.restart = function () {
|
---|
412 | this._command('restart');
|
---|
413 | };
|
---|
414 | RendererAnimationPlayer.prototype.finish = function () {
|
---|
415 | this._command('finish');
|
---|
416 | };
|
---|
417 | RendererAnimationPlayer.prototype.destroy = function () {
|
---|
418 | this._command('destroy');
|
---|
419 | };
|
---|
420 | RendererAnimationPlayer.prototype.reset = function () {
|
---|
421 | this._command('reset');
|
---|
422 | this._started = false;
|
---|
423 | };
|
---|
424 | RendererAnimationPlayer.prototype.setPosition = function (p) {
|
---|
425 | this._command('setPosition', p);
|
---|
426 | };
|
---|
427 | RendererAnimationPlayer.prototype.getPosition = function () {
|
---|
428 | var _a, _b;
|
---|
429 | return (_b = (_a = this._renderer.engine.players[+this.id]) === null || _a === void 0 ? void 0 : _a.getPosition()) !== null && _b !== void 0 ? _b : 0;
|
---|
430 | };
|
---|
431 | return RendererAnimationPlayer;
|
---|
432 | }());
|
---|
433 | function issueAnimationCommand(renderer, element, id, command, args) {
|
---|
434 | return renderer.setProperty(element, "@@" + id + ":" + command, args);
|
---|
435 | }
|
---|
436 |
|
---|
437 | var ANIMATION_PREFIX = '@';
|
---|
438 | var DISABLE_ANIMATIONS_FLAG = '@.disabled';
|
---|
439 | var AnimationRendererFactory = /** @class */ (function () {
|
---|
440 | function AnimationRendererFactory(delegate, engine, _zone) {
|
---|
441 | this.delegate = delegate;
|
---|
442 | this.engine = engine;
|
---|
443 | this._zone = _zone;
|
---|
444 | this._currentId = 0;
|
---|
445 | this._microtaskId = 1;
|
---|
446 | this._animationCallbacksBuffer = [];
|
---|
447 | this._rendererCache = new Map();
|
---|
448 | this._cdRecurDepth = 0;
|
---|
449 | this.promise = Promise.resolve(0);
|
---|
450 | engine.onRemovalComplete = function (element, delegate) {
|
---|
451 | // Note: if an component element has a leave animation, and the component
|
---|
452 | // a host leave animation, the view engine will call `removeChild` for the parent
|
---|
453 | // component renderer as well as for the child component renderer.
|
---|
454 | // Therefore, we need to check if we already removed the element.
|
---|
455 | if (delegate && delegate.parentNode(element)) {
|
---|
456 | delegate.removeChild(element.parentNode, element);
|
---|
457 | }
|
---|
458 | };
|
---|
459 | }
|
---|
460 | AnimationRendererFactory.prototype.createRenderer = function (hostElement, type) {
|
---|
461 | var _this = this;
|
---|
462 | var EMPTY_NAMESPACE_ID = '';
|
---|
463 | // cache the delegates to find out which cached delegate can
|
---|
464 | // be used by which cached renderer
|
---|
465 | var delegate = this.delegate.createRenderer(hostElement, type);
|
---|
466 | if (!hostElement || !type || !type.data || !type.data['animation']) {
|
---|
467 | var renderer = this._rendererCache.get(delegate);
|
---|
468 | if (!renderer) {
|
---|
469 | renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine);
|
---|
470 | // only cache this result when the base renderer is used
|
---|
471 | this._rendererCache.set(delegate, renderer);
|
---|
472 | }
|
---|
473 | return renderer;
|
---|
474 | }
|
---|
475 | var componentId = type.id;
|
---|
476 | var namespaceId = type.id + '-' + this._currentId;
|
---|
477 | this._currentId++;
|
---|
478 | this.engine.register(namespaceId, hostElement);
|
---|
479 | var registerTrigger = function (trigger) {
|
---|
480 | if (Array.isArray(trigger)) {
|
---|
481 | trigger.forEach(registerTrigger);
|
---|
482 | }
|
---|
483 | else {
|
---|
484 | _this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger);
|
---|
485 | }
|
---|
486 | };
|
---|
487 | var animationTriggers = type.data['animation'];
|
---|
488 | animationTriggers.forEach(registerTrigger);
|
---|
489 | return new AnimationRenderer(this, namespaceId, delegate, this.engine);
|
---|
490 | };
|
---|
491 | AnimationRendererFactory.prototype.begin = function () {
|
---|
492 | this._cdRecurDepth++;
|
---|
493 | if (this.delegate.begin) {
|
---|
494 | this.delegate.begin();
|
---|
495 | }
|
---|
496 | };
|
---|
497 | AnimationRendererFactory.prototype._scheduleCountTask = function () {
|
---|
498 | var _this = this;
|
---|
499 | // always use promise to schedule microtask instead of use Zone
|
---|
500 | this.promise.then(function () {
|
---|
501 | _this._microtaskId++;
|
---|
502 | });
|
---|
503 | };
|
---|
504 | /** @internal */
|
---|
505 | AnimationRendererFactory.prototype.scheduleListenerCallback = function (count, fn, data) {
|
---|
506 | var _this = this;
|
---|
507 | if (count >= 0 && count < this._microtaskId) {
|
---|
508 | this._zone.run(function () { return fn(data); });
|
---|
509 | return;
|
---|
510 | }
|
---|
511 | if (this._animationCallbacksBuffer.length == 0) {
|
---|
512 | Promise.resolve(null).then(function () {
|
---|
513 | _this._zone.run(function () {
|
---|
514 | _this._animationCallbacksBuffer.forEach(function (tuple) {
|
---|
515 | var _a = __read(tuple, 2), fn = _a[0], data = _a[1];
|
---|
516 | fn(data);
|
---|
517 | });
|
---|
518 | _this._animationCallbacksBuffer = [];
|
---|
519 | });
|
---|
520 | });
|
---|
521 | }
|
---|
522 | this._animationCallbacksBuffer.push([fn, data]);
|
---|
523 | };
|
---|
524 | AnimationRendererFactory.prototype.end = function () {
|
---|
525 | var _this = this;
|
---|
526 | this._cdRecurDepth--;
|
---|
527 | // this is to prevent animations from running twice when an inner
|
---|
528 | // component does CD when a parent component instead has inserted it
|
---|
529 | if (this._cdRecurDepth == 0) {
|
---|
530 | this._zone.runOutsideAngular(function () {
|
---|
531 | _this._scheduleCountTask();
|
---|
532 | _this.engine.flush(_this._microtaskId);
|
---|
533 | });
|
---|
534 | }
|
---|
535 | if (this.delegate.end) {
|
---|
536 | this.delegate.end();
|
---|
537 | }
|
---|
538 | };
|
---|
539 | AnimationRendererFactory.prototype.whenRenderingDone = function () {
|
---|
540 | return this.engine.whenRenderingDone();
|
---|
541 | };
|
---|
542 | return AnimationRendererFactory;
|
---|
543 | }());
|
---|
544 | AnimationRendererFactory.decorators = [
|
---|
545 | { type: core.Injectable }
|
---|
546 | ];
|
---|
547 | AnimationRendererFactory.ctorParameters = function () { return [
|
---|
548 | { type: core.RendererFactory2 },
|
---|
549 | { type: browser.ɵAnimationEngine },
|
---|
550 | { type: core.NgZone }
|
---|
551 | ]; };
|
---|
552 | var BaseAnimationRenderer = /** @class */ (function () {
|
---|
553 | function BaseAnimationRenderer(namespaceId, delegate, engine) {
|
---|
554 | this.namespaceId = namespaceId;
|
---|
555 | this.delegate = delegate;
|
---|
556 | this.engine = engine;
|
---|
557 | this.destroyNode = this.delegate.destroyNode ? function (n) { return delegate.destroyNode(n); } : null;
|
---|
558 | }
|
---|
559 | Object.defineProperty(BaseAnimationRenderer.prototype, "data", {
|
---|
560 | get: function () {
|
---|
561 | return this.delegate.data;
|
---|
562 | },
|
---|
563 | enumerable: false,
|
---|
564 | configurable: true
|
---|
565 | });
|
---|
566 | BaseAnimationRenderer.prototype.destroy = function () {
|
---|
567 | this.engine.destroy(this.namespaceId, this.delegate);
|
---|
568 | this.delegate.destroy();
|
---|
569 | };
|
---|
570 | BaseAnimationRenderer.prototype.createElement = function (name, namespace) {
|
---|
571 | return this.delegate.createElement(name, namespace);
|
---|
572 | };
|
---|
573 | BaseAnimationRenderer.prototype.createComment = function (value) {
|
---|
574 | return this.delegate.createComment(value);
|
---|
575 | };
|
---|
576 | BaseAnimationRenderer.prototype.createText = function (value) {
|
---|
577 | return this.delegate.createText(value);
|
---|
578 | };
|
---|
579 | BaseAnimationRenderer.prototype.appendChild = function (parent, newChild) {
|
---|
580 | this.delegate.appendChild(parent, newChild);
|
---|
581 | this.engine.onInsert(this.namespaceId, newChild, parent, false);
|
---|
582 | };
|
---|
583 | BaseAnimationRenderer.prototype.insertBefore = function (parent, newChild, refChild, isMove) {
|
---|
584 | if (isMove === void 0) { isMove = true; }
|
---|
585 | this.delegate.insertBefore(parent, newChild, refChild);
|
---|
586 | // If `isMove` true than we should animate this insert.
|
---|
587 | this.engine.onInsert(this.namespaceId, newChild, parent, isMove);
|
---|
588 | };
|
---|
589 | BaseAnimationRenderer.prototype.removeChild = function (parent, oldChild, isHostElement) {
|
---|
590 | this.engine.onRemove(this.namespaceId, oldChild, this.delegate, isHostElement);
|
---|
591 | };
|
---|
592 | BaseAnimationRenderer.prototype.selectRootElement = function (selectorOrNode, preserveContent) {
|
---|
593 | return this.delegate.selectRootElement(selectorOrNode, preserveContent);
|
---|
594 | };
|
---|
595 | BaseAnimationRenderer.prototype.parentNode = function (node) {
|
---|
596 | return this.delegate.parentNode(node);
|
---|
597 | };
|
---|
598 | BaseAnimationRenderer.prototype.nextSibling = function (node) {
|
---|
599 | return this.delegate.nextSibling(node);
|
---|
600 | };
|
---|
601 | BaseAnimationRenderer.prototype.setAttribute = function (el, name, value, namespace) {
|
---|
602 | this.delegate.setAttribute(el, name, value, namespace);
|
---|
603 | };
|
---|
604 | BaseAnimationRenderer.prototype.removeAttribute = function (el, name, namespace) {
|
---|
605 | this.delegate.removeAttribute(el, name, namespace);
|
---|
606 | };
|
---|
607 | BaseAnimationRenderer.prototype.addClass = function (el, name) {
|
---|
608 | this.delegate.addClass(el, name);
|
---|
609 | };
|
---|
610 | BaseAnimationRenderer.prototype.removeClass = function (el, name) {
|
---|
611 | this.delegate.removeClass(el, name);
|
---|
612 | };
|
---|
613 | BaseAnimationRenderer.prototype.setStyle = function (el, style, value, flags) {
|
---|
614 | this.delegate.setStyle(el, style, value, flags);
|
---|
615 | };
|
---|
616 | BaseAnimationRenderer.prototype.removeStyle = function (el, style, flags) {
|
---|
617 | this.delegate.removeStyle(el, style, flags);
|
---|
618 | };
|
---|
619 | BaseAnimationRenderer.prototype.setProperty = function (el, name, value) {
|
---|
620 | if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) {
|
---|
621 | this.disableAnimations(el, !!value);
|
---|
622 | }
|
---|
623 | else {
|
---|
624 | this.delegate.setProperty(el, name, value);
|
---|
625 | }
|
---|
626 | };
|
---|
627 | BaseAnimationRenderer.prototype.setValue = function (node, value) {
|
---|
628 | this.delegate.setValue(node, value);
|
---|
629 | };
|
---|
630 | BaseAnimationRenderer.prototype.listen = function (target, eventName, callback) {
|
---|
631 | return this.delegate.listen(target, eventName, callback);
|
---|
632 | };
|
---|
633 | BaseAnimationRenderer.prototype.disableAnimations = function (element, value) {
|
---|
634 | this.engine.disableAnimations(element, value);
|
---|
635 | };
|
---|
636 | return BaseAnimationRenderer;
|
---|
637 | }());
|
---|
638 | var AnimationRenderer = /** @class */ (function (_super) {
|
---|
639 | __extends(AnimationRenderer, _super);
|
---|
640 | function AnimationRenderer(factory, namespaceId, delegate, engine) {
|
---|
641 | var _this = _super.call(this, namespaceId, delegate, engine) || this;
|
---|
642 | _this.factory = factory;
|
---|
643 | _this.namespaceId = namespaceId;
|
---|
644 | return _this;
|
---|
645 | }
|
---|
646 | AnimationRenderer.prototype.setProperty = function (el, name, value) {
|
---|
647 | if (name.charAt(0) == ANIMATION_PREFIX) {
|
---|
648 | if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) {
|
---|
649 | value = value === undefined ? true : !!value;
|
---|
650 | this.disableAnimations(el, value);
|
---|
651 | }
|
---|
652 | else {
|
---|
653 | this.engine.process(this.namespaceId, el, name.substr(1), value);
|
---|
654 | }
|
---|
655 | }
|
---|
656 | else {
|
---|
657 | this.delegate.setProperty(el, name, value);
|
---|
658 | }
|
---|
659 | };
|
---|
660 | AnimationRenderer.prototype.listen = function (target, eventName, callback) {
|
---|
661 | var _a;
|
---|
662 | var _this = this;
|
---|
663 | if (eventName.charAt(0) == ANIMATION_PREFIX) {
|
---|
664 | var element = resolveElementFromTarget(target);
|
---|
665 | var name = eventName.substr(1);
|
---|
666 | var phase = '';
|
---|
667 | // @listener.phase is for trigger animation callbacks
|
---|
668 | // @@listener is for animation builder callbacks
|
---|
669 | if (name.charAt(0) != ANIMATION_PREFIX) {
|
---|
670 | _a = __read(parseTriggerCallbackName(name), 2), name = _a[0], phase = _a[1];
|
---|
671 | }
|
---|
672 | return this.engine.listen(this.namespaceId, element, name, phase, function (event) {
|
---|
673 | var countId = event['_data'] || -1;
|
---|
674 | _this.factory.scheduleListenerCallback(countId, callback, event);
|
---|
675 | });
|
---|
676 | }
|
---|
677 | return this.delegate.listen(target, eventName, callback);
|
---|
678 | };
|
---|
679 | return AnimationRenderer;
|
---|
680 | }(BaseAnimationRenderer));
|
---|
681 | function resolveElementFromTarget(target) {
|
---|
682 | switch (target) {
|
---|
683 | case 'body':
|
---|
684 | return document.body;
|
---|
685 | case 'document':
|
---|
686 | return document;
|
---|
687 | case 'window':
|
---|
688 | return window;
|
---|
689 | default:
|
---|
690 | return target;
|
---|
691 | }
|
---|
692 | }
|
---|
693 | function parseTriggerCallbackName(triggerName) {
|
---|
694 | var dotIndex = triggerName.indexOf('.');
|
---|
695 | var trigger = triggerName.substring(0, dotIndex);
|
---|
696 | var phase = triggerName.substr(dotIndex + 1);
|
---|
697 | return [trigger, phase];
|
---|
698 | }
|
---|
699 |
|
---|
700 | var InjectableAnimationEngine = /** @class */ (function (_super) {
|
---|
701 | __extends(InjectableAnimationEngine, _super);
|
---|
702 | function InjectableAnimationEngine(doc, driver, normalizer) {
|
---|
703 | return _super.call(this, doc.body, driver, normalizer) || this;
|
---|
704 | }
|
---|
705 | InjectableAnimationEngine.prototype.ngOnDestroy = function () {
|
---|
706 | this.flush();
|
---|
707 | };
|
---|
708 | return InjectableAnimationEngine;
|
---|
709 | }(browser.ɵAnimationEngine));
|
---|
710 | InjectableAnimationEngine.decorators = [
|
---|
711 | { type: core.Injectable }
|
---|
712 | ];
|
---|
713 | InjectableAnimationEngine.ctorParameters = function () { return [
|
---|
714 | { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
|
---|
715 | { type: browser.AnimationDriver },
|
---|
716 | { type: browser.ɵAnimationStyleNormalizer }
|
---|
717 | ]; };
|
---|
718 | function instantiateSupportedAnimationDriver() {
|
---|
719 | return browser.ɵsupportsWebAnimations() ? new browser.ɵWebAnimationsDriver() : new browser.ɵCssKeyframesDriver();
|
---|
720 | }
|
---|
721 | function instantiateDefaultStyleNormalizer() {
|
---|
722 | return new browser.ɵWebAnimationsStyleNormalizer();
|
---|
723 | }
|
---|
724 | function instantiateRendererFactory(renderer, engine, zone) {
|
---|
725 | return new AnimationRendererFactory(renderer, engine, zone);
|
---|
726 | }
|
---|
727 | /**
|
---|
728 | * @publicApi
|
---|
729 | */
|
---|
730 | var ANIMATION_MODULE_TYPE = new core.InjectionToken('AnimationModuleType');
|
---|
731 | var SHARED_ANIMATION_PROVIDERS = [
|
---|
732 | { provide: animations.AnimationBuilder, useClass: BrowserAnimationBuilder },
|
---|
733 | { provide: browser.ɵAnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer },
|
---|
734 | { provide: browser.ɵAnimationEngine, useClass: InjectableAnimationEngine }, {
|
---|
735 | provide: core.RendererFactory2,
|
---|
736 | useFactory: instantiateRendererFactory,
|
---|
737 | deps: [platformBrowser.ɵDomRendererFactory2, browser.ɵAnimationEngine, core.NgZone]
|
---|
738 | }
|
---|
739 | ];
|
---|
740 | /**
|
---|
741 | * Separate providers from the actual module so that we can do a local modification in Google3 to
|
---|
742 | * include them in the BrowserModule.
|
---|
743 | */
|
---|
744 | var BROWSER_ANIMATIONS_PROVIDERS = __spreadArray([
|
---|
745 | { provide: browser.AnimationDriver, useFactory: instantiateSupportedAnimationDriver },
|
---|
746 | { provide: ANIMATION_MODULE_TYPE, useValue: 'BrowserAnimations' }
|
---|
747 | ], __read(SHARED_ANIMATION_PROVIDERS));
|
---|
748 | /**
|
---|
749 | * Separate providers from the actual module so that we can do a local modification in Google3 to
|
---|
750 | * include them in the BrowserTestingModule.
|
---|
751 | */
|
---|
752 | var BROWSER_NOOP_ANIMATIONS_PROVIDERS = __spreadArray([
|
---|
753 | { provide: browser.AnimationDriver, useClass: browser.ɵNoopAnimationDriver },
|
---|
754 | { provide: ANIMATION_MODULE_TYPE, useValue: 'NoopAnimations' }
|
---|
755 | ], __read(SHARED_ANIMATION_PROVIDERS));
|
---|
756 |
|
---|
757 | /**
|
---|
758 | * @license
|
---|
759 | * Copyright Google LLC All Rights Reserved.
|
---|
760 | *
|
---|
761 | * Use of this source code is governed by an MIT-style license that can be
|
---|
762 | * found in the LICENSE file at https://angular.io/license
|
---|
763 | */
|
---|
764 | /**
|
---|
765 | * Exports `BrowserModule` with additional [dependency-injection providers](guide/glossary#provider)
|
---|
766 | * for use with animations. See [Animations](guide/animations).
|
---|
767 | * @publicApi
|
---|
768 | */
|
---|
769 | var BrowserAnimationsModule = /** @class */ (function () {
|
---|
770 | function BrowserAnimationsModule() {
|
---|
771 | }
|
---|
772 | /**
|
---|
773 | * Configures the module based on the specified object.
|
---|
774 | *
|
---|
775 | * @param config Object used to configure the behavior of the `BrowserAnimationsModule`.
|
---|
776 | * @see `BrowserAnimationsModuleConfig`
|
---|
777 | *
|
---|
778 | * @usageNotes
|
---|
779 | * When registering the `BrowserAnimationsModule`, you can use the `withConfig`
|
---|
780 | * function as follows:
|
---|
781 | * ```
|
---|
782 | * @NgModule({
|
---|
783 | * imports: [BrowserAnimationsModule.withConfig(config)]
|
---|
784 | * })
|
---|
785 | * class MyNgModule {}
|
---|
786 | * ```
|
---|
787 | */
|
---|
788 | BrowserAnimationsModule.withConfig = function (config) {
|
---|
789 | return {
|
---|
790 | ngModule: BrowserAnimationsModule,
|
---|
791 | providers: config.disableAnimations ? BROWSER_NOOP_ANIMATIONS_PROVIDERS :
|
---|
792 | BROWSER_ANIMATIONS_PROVIDERS
|
---|
793 | };
|
---|
794 | };
|
---|
795 | return BrowserAnimationsModule;
|
---|
796 | }());
|
---|
797 | BrowserAnimationsModule.decorators = [
|
---|
798 | { type: core.NgModule, args: [{
|
---|
799 | exports: [platformBrowser.BrowserModule],
|
---|
800 | providers: BROWSER_ANIMATIONS_PROVIDERS,
|
---|
801 | },] }
|
---|
802 | ];
|
---|
803 | /**
|
---|
804 | * A null player that must be imported to allow disabling of animations.
|
---|
805 | * @publicApi
|
---|
806 | */
|
---|
807 | var NoopAnimationsModule = /** @class */ (function () {
|
---|
808 | function NoopAnimationsModule() {
|
---|
809 | }
|
---|
810 | return NoopAnimationsModule;
|
---|
811 | }());
|
---|
812 | NoopAnimationsModule.decorators = [
|
---|
813 | { type: core.NgModule, args: [{
|
---|
814 | exports: [platformBrowser.BrowserModule],
|
---|
815 | providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS,
|
---|
816 | },] }
|
---|
817 | ];
|
---|
818 |
|
---|
819 | /**
|
---|
820 | * @license
|
---|
821 | * Copyright Google LLC All Rights Reserved.
|
---|
822 | *
|
---|
823 | * Use of this source code is governed by an MIT-style license that can be
|
---|
824 | * found in the LICENSE file at https://angular.io/license
|
---|
825 | */
|
---|
826 |
|
---|
827 | /**
|
---|
828 | * @license
|
---|
829 | * Copyright Google LLC All Rights Reserved.
|
---|
830 | *
|
---|
831 | * Use of this source code is governed by an MIT-style license that can be
|
---|
832 | * found in the LICENSE file at https://angular.io/license
|
---|
833 | */
|
---|
834 |
|
---|
835 | /**
|
---|
836 | * @license
|
---|
837 | * Copyright Google LLC All Rights Reserved.
|
---|
838 | *
|
---|
839 | * Use of this source code is governed by an MIT-style license that can be
|
---|
840 | * found in the LICENSE file at https://angular.io/license
|
---|
841 | */
|
---|
842 |
|
---|
843 | /**
|
---|
844 | * @license
|
---|
845 | * Copyright Google LLC All Rights Reserved.
|
---|
846 | *
|
---|
847 | * Use of this source code is governed by an MIT-style license that can be
|
---|
848 | * found in the LICENSE file at https://angular.io/license
|
---|
849 | */
|
---|
850 |
|
---|
851 | /**
|
---|
852 | * Generated bundle index. Do not edit.
|
---|
853 | */
|
---|
854 |
|
---|
855 | exports.ANIMATION_MODULE_TYPE = ANIMATION_MODULE_TYPE;
|
---|
856 | exports.BrowserAnimationsModule = BrowserAnimationsModule;
|
---|
857 | exports.NoopAnimationsModule = NoopAnimationsModule;
|
---|
858 | exports.ɵAnimationRenderer = AnimationRenderer;
|
---|
859 | exports.ɵAnimationRendererFactory = AnimationRendererFactory;
|
---|
860 | exports.ɵBrowserAnimationBuilder = BrowserAnimationBuilder;
|
---|
861 | exports.ɵBrowserAnimationFactory = BrowserAnimationFactory;
|
---|
862 | exports.ɵInjectableAnimationEngine = InjectableAnimationEngine;
|
---|
863 | exports.ɵangular_packages_platform_browser_animations_animations_a = instantiateSupportedAnimationDriver;
|
---|
864 | exports.ɵangular_packages_platform_browser_animations_animations_b = instantiateDefaultStyleNormalizer;
|
---|
865 | exports.ɵangular_packages_platform_browser_animations_animations_c = instantiateRendererFactory;
|
---|
866 | exports.ɵangular_packages_platform_browser_animations_animations_d = BROWSER_ANIMATIONS_PROVIDERS;
|
---|
867 | exports.ɵangular_packages_platform_browser_animations_animations_e = BROWSER_NOOP_ANIMATIONS_PROVIDERS;
|
---|
868 | exports.ɵangular_packages_platform_browser_animations_animations_f = BaseAnimationRenderer;
|
---|
869 |
|
---|
870 | Object.defineProperty(exports, '__esModule', { value: true });
|
---|
871 |
|
---|
872 | })));
|
---|
873 | //# sourceMappingURL=platform-browser-animations.umd.js.map
|
---|