@angular/animations 17.0.0-next.5 → 17.0.0-next.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,5 +11,5 @@
11
11
  * Entry point for all public APIs of the animation package.
12
12
  */
13
13
  import { Version } from '@angular/core';
14
- export const VERSION = new Version('17.0.0-next.5');
14
+ export const VERSION = new Version('17.0.0-next.6');
15
15
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2FuaW1hdGlvbnMvc3JjL3ZlcnNpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUg7Ozs7R0FJRztBQUNILE9BQU8sRUFBQyxPQUFPLEVBQUMsTUFBTSxlQUFlLENBQUM7QUFFdEMsTUFBTSxDQUFDLE1BQU0sT0FBTyxHQUFHLElBQUksT0FBTyxDQUFDLG1CQUFtQixDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBsaWNlbnNlXG4gKiBDb3B5cmlnaHQgR29vZ2xlIExMQyBBbGwgUmlnaHRzIFJlc2VydmVkLlxuICpcbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGFuIE1JVC1zdHlsZSBsaWNlbnNlIHRoYXQgY2FuIGJlXG4gKiBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlIGF0IGh0dHBzOi8vYW5ndWxhci5pby9saWNlbnNlXG4gKi9cblxuLyoqXG4gKiBAbW9kdWxlXG4gKiBAZGVzY3JpcHRpb25cbiAqIEVudHJ5IHBvaW50IGZvciBhbGwgcHVibGljIEFQSXMgb2YgdGhlIGFuaW1hdGlvbiBwYWNrYWdlLlxuICovXG5pbXBvcnQge1ZlcnNpb259IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuXG5leHBvcnQgY29uc3QgVkVSU0lPTiA9IG5ldyBWZXJzaW9uKCcwLjAuMC1QTEFDRUhPTERFUicpO1xuIl19
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.0.0-next.5
2
+ * @license Angular v17.0.0-next.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.0.0-next.5
2
+ * @license Angular v17.0.0-next.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.0.0-next.5
2
+ * @license Angular v17.0.0-next.6
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -494,39 +494,70 @@ function hypenatePropsKeys(original) {
494
494
  return newMap;
495
495
  }
496
496
 
497
+ /**
498
+ * @publicApi
499
+ *
500
+ * `AnimationDriver` implentation for Noop animations
501
+ */
497
502
  class NoopAnimationDriver {
503
+ /**
504
+ * @returns Whether `prop` is a valid CSS property
505
+ */
498
506
  validateStyleProperty(prop) {
499
507
  return validateStyleProperty(prop);
500
508
  }
509
+ /**
510
+ * @deprecated unused
511
+ */
501
512
  matchesElement(_element, _selector) {
502
513
  // This method is deprecated and no longer in use so we return false.
503
514
  return false;
504
515
  }
516
+ /**
517
+ *
518
+ * @returns Whether elm1 contains elm2.
519
+ */
505
520
  containsElement(elm1, elm2) {
506
521
  return containsElement(elm1, elm2);
507
522
  }
523
+ /**
524
+ * @returns Rhe parent of the given element or `null` if the element is the `document`
525
+ */
508
526
  getParentElement(element) {
509
527
  return getParentElement(element);
510
528
  }
529
+ /**
530
+ * @returns The result of the query selector on the element. The array will contain up to 1 item
531
+ * if `multi` is `false`.
532
+ */
511
533
  query(element, selector, multi) {
512
534
  return invokeQuery(element, selector, multi);
513
535
  }
536
+ /**
537
+ * @returns The `defaultValue` or empty string
538
+ */
514
539
  computeStyle(element, prop, defaultValue) {
515
540
  return defaultValue || '';
516
541
  }
542
+ /**
543
+ * @returns An `NoopAnimationPlayer`
544
+ */
517
545
  animate(element, keyframes, duration, delay, easing, previousPlayers = [], scrubberAccessRequested) {
518
546
  return new NoopAnimationPlayer(duration, delay);
519
547
  }
520
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: NoopAnimationDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
521
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: NoopAnimationDriver }); }
548
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.6", ngImport: i0, type: NoopAnimationDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
549
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.6", ngImport: i0, type: NoopAnimationDriver }); }
522
550
  }
523
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: NoopAnimationDriver, decorators: [{
551
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.6", ngImport: i0, type: NoopAnimationDriver, decorators: [{
524
552
  type: Injectable
525
553
  }] });
526
554
  /**
527
555
  * @publicApi
528
556
  */
529
557
  class AnimationDriver {
558
+ /**
559
+ * @deprecated Use the NoopAnimationDriver class.
560
+ */
530
561
  static { this.NOOP = ( /* @__PURE__ */new NoopAnimationDriver()); }
531
562
  }
532
563
 
@@ -4179,6 +4210,263 @@ class AnimationEngine {
4179
4210
  }
4180
4211
  }
4181
4212
 
4213
+ const ANIMATION_PREFIX = '@';
4214
+ const DISABLE_ANIMATIONS_FLAG = '@.disabled';
4215
+ class AnimationRendererFactory {
4216
+ constructor(delegate, engine, _zone) {
4217
+ this.delegate = delegate;
4218
+ this.engine = engine;
4219
+ this._zone = _zone;
4220
+ this._currentId = 0;
4221
+ this._microtaskId = 1;
4222
+ this._animationCallbacksBuffer = [];
4223
+ this._rendererCache = new Map();
4224
+ this._cdRecurDepth = 0;
4225
+ engine.onRemovalComplete = (element, delegate) => {
4226
+ // Note: if a component element has a leave animation, and a host leave animation,
4227
+ // the view engine will call `removeChild` for the parent
4228
+ // component renderer as well as for the child component renderer.
4229
+ // Therefore, we need to check if we already removed the element.
4230
+ const parentNode = delegate?.parentNode(element);
4231
+ if (parentNode) {
4232
+ delegate.removeChild(parentNode, element);
4233
+ }
4234
+ };
4235
+ }
4236
+ createRenderer(hostElement, type) {
4237
+ const EMPTY_NAMESPACE_ID = '';
4238
+ // cache the delegates to find out which cached delegate can
4239
+ // be used by which cached renderer
4240
+ const delegate = this.delegate.createRenderer(hostElement, type);
4241
+ if (!hostElement || !type || !type.data || !type.data['animation']) {
4242
+ let renderer = this._rendererCache.get(delegate);
4243
+ if (!renderer) {
4244
+ // Ensure that the renderer is removed from the cache on destroy
4245
+ // since it may contain references to detached DOM nodes.
4246
+ const onRendererDestroy = () => this._rendererCache.delete(delegate);
4247
+ renderer =
4248
+ new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine, onRendererDestroy);
4249
+ // only cache this result when the base renderer is used
4250
+ this._rendererCache.set(delegate, renderer);
4251
+ }
4252
+ return renderer;
4253
+ }
4254
+ const componentId = type.id;
4255
+ const namespaceId = type.id + '-' + this._currentId;
4256
+ this._currentId++;
4257
+ this.engine.register(namespaceId, hostElement);
4258
+ const registerTrigger = (trigger) => {
4259
+ if (Array.isArray(trigger)) {
4260
+ trigger.forEach(registerTrigger);
4261
+ }
4262
+ else {
4263
+ this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger);
4264
+ }
4265
+ };
4266
+ const animationTriggers = type.data['animation'];
4267
+ animationTriggers.forEach(registerTrigger);
4268
+ return new AnimationRenderer(this, namespaceId, delegate, this.engine);
4269
+ }
4270
+ begin() {
4271
+ this._cdRecurDepth++;
4272
+ if (this.delegate.begin) {
4273
+ this.delegate.begin();
4274
+ }
4275
+ }
4276
+ _scheduleCountTask() {
4277
+ queueMicrotask(() => {
4278
+ this._microtaskId++;
4279
+ });
4280
+ }
4281
+ /** @internal */
4282
+ scheduleListenerCallback(count, fn, data) {
4283
+ if (count >= 0 && count < this._microtaskId) {
4284
+ this._zone.run(() => fn(data));
4285
+ return;
4286
+ }
4287
+ if (this._animationCallbacksBuffer.length == 0) {
4288
+ queueMicrotask(() => {
4289
+ this._zone.run(() => {
4290
+ this._animationCallbacksBuffer.forEach(tuple => {
4291
+ const [fn, data] = tuple;
4292
+ fn(data);
4293
+ });
4294
+ this._animationCallbacksBuffer = [];
4295
+ });
4296
+ });
4297
+ }
4298
+ this._animationCallbacksBuffer.push([fn, data]);
4299
+ }
4300
+ end() {
4301
+ this._cdRecurDepth--;
4302
+ // this is to prevent animations from running twice when an inner
4303
+ // component does CD when a parent component instead has inserted it
4304
+ if (this._cdRecurDepth == 0) {
4305
+ this._zone.runOutsideAngular(() => {
4306
+ this._scheduleCountTask();
4307
+ this.engine.flush(this._microtaskId);
4308
+ });
4309
+ }
4310
+ if (this.delegate.end) {
4311
+ this.delegate.end();
4312
+ }
4313
+ }
4314
+ whenRenderingDone() {
4315
+ return this.engine.whenRenderingDone();
4316
+ }
4317
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.6", ngImport: i0, type: AnimationRendererFactory, deps: [{ token: i0.RendererFactory2 }, { token: AnimationEngine }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
4318
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.6", ngImport: i0, type: AnimationRendererFactory }); }
4319
+ }
4320
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.6", ngImport: i0, type: AnimationRendererFactory, decorators: [{
4321
+ type: Injectable
4322
+ }], ctorParameters: () => [{ type: i0.RendererFactory2 }, { type: AnimationEngine }, { type: i0.NgZone }] });
4323
+ class BaseAnimationRenderer {
4324
+ constructor(namespaceId, delegate, engine, _onDestroy) {
4325
+ this.namespaceId = namespaceId;
4326
+ this.delegate = delegate;
4327
+ this.engine = engine;
4328
+ this._onDestroy = _onDestroy;
4329
+ }
4330
+ get data() {
4331
+ return this.delegate.data;
4332
+ }
4333
+ destroyNode(node) {
4334
+ this.delegate.destroyNode?.(node);
4335
+ }
4336
+ destroy() {
4337
+ this.engine.destroy(this.namespaceId, this.delegate);
4338
+ this.engine.afterFlushAnimationsDone(() => {
4339
+ // Call the renderer destroy method after the animations has finished as otherwise
4340
+ // styles will be removed too early which will cause an unstyled animation.
4341
+ queueMicrotask(() => {
4342
+ this.delegate.destroy();
4343
+ });
4344
+ });
4345
+ this._onDestroy?.();
4346
+ }
4347
+ createElement(name, namespace) {
4348
+ return this.delegate.createElement(name, namespace);
4349
+ }
4350
+ createComment(value) {
4351
+ return this.delegate.createComment(value);
4352
+ }
4353
+ createText(value) {
4354
+ return this.delegate.createText(value);
4355
+ }
4356
+ appendChild(parent, newChild) {
4357
+ this.delegate.appendChild(parent, newChild);
4358
+ this.engine.onInsert(this.namespaceId, newChild, parent, false);
4359
+ }
4360
+ insertBefore(parent, newChild, refChild, isMove = true) {
4361
+ this.delegate.insertBefore(parent, newChild, refChild);
4362
+ // If `isMove` true than we should animate this insert.
4363
+ this.engine.onInsert(this.namespaceId, newChild, parent, isMove);
4364
+ }
4365
+ removeChild(parent, oldChild, isHostElement) {
4366
+ this.engine.onRemove(this.namespaceId, oldChild, this.delegate);
4367
+ }
4368
+ selectRootElement(selectorOrNode, preserveContent) {
4369
+ return this.delegate.selectRootElement(selectorOrNode, preserveContent);
4370
+ }
4371
+ parentNode(node) {
4372
+ return this.delegate.parentNode(node);
4373
+ }
4374
+ nextSibling(node) {
4375
+ return this.delegate.nextSibling(node);
4376
+ }
4377
+ setAttribute(el, name, value, namespace) {
4378
+ this.delegate.setAttribute(el, name, value, namespace);
4379
+ }
4380
+ removeAttribute(el, name, namespace) {
4381
+ this.delegate.removeAttribute(el, name, namespace);
4382
+ }
4383
+ addClass(el, name) {
4384
+ this.delegate.addClass(el, name);
4385
+ }
4386
+ removeClass(el, name) {
4387
+ this.delegate.removeClass(el, name);
4388
+ }
4389
+ setStyle(el, style, value, flags) {
4390
+ this.delegate.setStyle(el, style, value, flags);
4391
+ }
4392
+ removeStyle(el, style, flags) {
4393
+ this.delegate.removeStyle(el, style, flags);
4394
+ }
4395
+ setProperty(el, name, value) {
4396
+ if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) {
4397
+ this.disableAnimations(el, !!value);
4398
+ }
4399
+ else {
4400
+ this.delegate.setProperty(el, name, value);
4401
+ }
4402
+ }
4403
+ setValue(node, value) {
4404
+ this.delegate.setValue(node, value);
4405
+ }
4406
+ listen(target, eventName, callback) {
4407
+ return this.delegate.listen(target, eventName, callback);
4408
+ }
4409
+ disableAnimations(element, value) {
4410
+ this.engine.disableAnimations(element, value);
4411
+ }
4412
+ }
4413
+ class AnimationRenderer extends BaseAnimationRenderer {
4414
+ constructor(factory, namespaceId, delegate, engine, onDestroy) {
4415
+ super(namespaceId, delegate, engine, onDestroy);
4416
+ this.factory = factory;
4417
+ this.namespaceId = namespaceId;
4418
+ }
4419
+ setProperty(el, name, value) {
4420
+ if (name.charAt(0) == ANIMATION_PREFIX) {
4421
+ if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) {
4422
+ value = value === undefined ? true : !!value;
4423
+ this.disableAnimations(el, value);
4424
+ }
4425
+ else {
4426
+ this.engine.process(this.namespaceId, el, name.slice(1), value);
4427
+ }
4428
+ }
4429
+ else {
4430
+ this.delegate.setProperty(el, name, value);
4431
+ }
4432
+ }
4433
+ listen(target, eventName, callback) {
4434
+ if (eventName.charAt(0) == ANIMATION_PREFIX) {
4435
+ const element = resolveElementFromTarget(target);
4436
+ let name = eventName.slice(1);
4437
+ let phase = '';
4438
+ // @listener.phase is for trigger animation callbacks
4439
+ // @@listener is for animation builder callbacks
4440
+ if (name.charAt(0) != ANIMATION_PREFIX) {
4441
+ [name, phase] = parseTriggerCallbackName(name);
4442
+ }
4443
+ return this.engine.listen(this.namespaceId, element, name, phase, event => {
4444
+ const countId = event['_data'] || -1;
4445
+ this.factory.scheduleListenerCallback(countId, callback, event);
4446
+ });
4447
+ }
4448
+ return this.delegate.listen(target, eventName, callback);
4449
+ }
4450
+ }
4451
+ function resolveElementFromTarget(target) {
4452
+ switch (target) {
4453
+ case 'body':
4454
+ return document.body;
4455
+ case 'document':
4456
+ return document;
4457
+ case 'window':
4458
+ return window;
4459
+ default:
4460
+ return target;
4461
+ }
4462
+ }
4463
+ function parseTriggerCallbackName(triggerName) {
4464
+ const dotIndex = triggerName.indexOf('.');
4465
+ const trigger = triggerName.substring(0, dotIndex);
4466
+ const phase = triggerName.slice(dotIndex + 1);
4467
+ return [trigger, phase];
4468
+ }
4469
+
4182
4470
  /**
4183
4471
  * Returns an instance of `SpecialCasedStyles` if and when any special (non animateable) styles are
4184
4472
  * detected.
@@ -4517,5 +4805,5 @@ class WebAnimationsDriver {
4517
4805
  * Generated bundle index. Do not edit.
4518
4806
  */
4519
4807
 
4520
- export { AnimationDriver, Animation as ɵAnimation, AnimationEngine as ɵAnimationEngine, AnimationStyleNormalizer as ɵAnimationStyleNormalizer, NoopAnimationDriver as ɵNoopAnimationDriver, NoopAnimationStyleNormalizer as ɵNoopAnimationStyleNormalizer, WebAnimationsDriver as ɵWebAnimationsDriver, WebAnimationsPlayer as ɵWebAnimationsPlayer, WebAnimationsStyleNormalizer as ɵWebAnimationsStyleNormalizer, allowPreviousPlayerStylesMerge as ɵallowPreviousPlayerStylesMerge, camelCaseToDashCase as ɵcamelCaseToDashCase, containsElement as ɵcontainsElement, getParentElement as ɵgetParentElement, invokeQuery as ɵinvokeQuery, normalizeKeyframes as ɵnormalizeKeyframes, validateStyleProperty as ɵvalidateStyleProperty, validateWebAnimatableStyleProperty as ɵvalidateWebAnimatableStyleProperty };
4808
+ export { AnimationDriver, NoopAnimationDriver, Animation as ɵAnimation, AnimationEngine as ɵAnimationEngine, AnimationRenderer as ɵAnimationRenderer, AnimationRendererFactory as ɵAnimationRendererFactory, AnimationStyleNormalizer as ɵAnimationStyleNormalizer, NoopAnimationStyleNormalizer as ɵNoopAnimationStyleNormalizer, WebAnimationsDriver as ɵWebAnimationsDriver, WebAnimationsPlayer as ɵWebAnimationsPlayer, WebAnimationsStyleNormalizer as ɵWebAnimationsStyleNormalizer, allowPreviousPlayerStylesMerge as ɵallowPreviousPlayerStylesMerge, camelCaseToDashCase as ɵcamelCaseToDashCase, containsElement as ɵcontainsElement, getParentElement as ɵgetParentElement, invokeQuery as ɵinvokeQuery, normalizeKeyframes as ɵnormalizeKeyframes, validateStyleProperty as ɵvalidateStyleProperty, validateWebAnimatableStyleProperty as ɵvalidateWebAnimatableStyleProperty };
4521
4809
  //# sourceMappingURL=browser.mjs.map