@angular/cdk 14.0.0-next.1 → 14.0.0-next.4

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.
Files changed (56) hide show
  1. package/a11y/a11y-module.d.ts +2 -3
  2. package/drag-drop/parent-position-tracker.d.ts +11 -3
  3. package/esm2020/a11y/a11y-module.mjs +4 -5
  4. package/esm2020/a11y/high-contrast-mode/high-contrast-mode-detector.mjs +4 -9
  5. package/esm2020/drag-drop/drag-ref.mjs +15 -6
  6. package/esm2020/drag-drop/drop-list-ref.mjs +2 -2
  7. package/esm2020/drag-drop/parent-position-tracker.mjs +13 -5
  8. package/esm2020/scrolling/scrolling-module.mjs +4 -5
  9. package/esm2020/scrolling/virtual-scroll-viewport.mjs +3 -1
  10. package/esm2020/stepper/stepper.mjs +4 -17
  11. package/esm2020/testing/component-harness.mjs +7 -1
  12. package/esm2020/testing/harness-environment.mjs +9 -1
  13. package/esm2020/text-field/text-field-module.mjs +3 -5
  14. package/esm2020/version.mjs +1 -1
  15. package/fesm2015/a11y.mjs +7 -12
  16. package/fesm2015/a11y.mjs.map +1 -1
  17. package/fesm2015/cdk.mjs +1 -1
  18. package/fesm2015/cdk.mjs.map +1 -1
  19. package/fesm2015/drag-drop.mjs +28 -10
  20. package/fesm2015/drag-drop.mjs.map +1 -1
  21. package/fesm2015/scrolling.mjs +6 -4
  22. package/fesm2015/scrolling.mjs.map +1 -1
  23. package/fesm2015/stepper.mjs +3 -16
  24. package/fesm2015/stepper.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +20 -0
  26. package/fesm2015/testing.mjs.map +1 -1
  27. package/fesm2015/text-field.mjs +3 -4
  28. package/fesm2015/text-field.mjs.map +1 -1
  29. package/fesm2020/a11y.mjs +7 -12
  30. package/fesm2020/a11y.mjs.map +1 -1
  31. package/fesm2020/cdk.mjs +1 -1
  32. package/fesm2020/cdk.mjs.map +1 -1
  33. package/fesm2020/drag-drop.mjs +27 -10
  34. package/fesm2020/drag-drop.mjs.map +1 -1
  35. package/fesm2020/scrolling.mjs +6 -4
  36. package/fesm2020/scrolling.mjs.map +1 -1
  37. package/fesm2020/stepper.mjs +3 -16
  38. package/fesm2020/stepper.mjs.map +1 -1
  39. package/fesm2020/testing.mjs +14 -0
  40. package/fesm2020/testing.mjs.map +1 -1
  41. package/fesm2020/text-field.mjs +3 -4
  42. package/fesm2020/text-field.mjs.map +1 -1
  43. package/package.json +3 -3
  44. package/schematics/ng-add/index.js +1 -1
  45. package/schematics/ng-add/index.mjs +1 -1
  46. package/schematics/ng-generate/drag-drop/schema.json +1 -1
  47. package/schematics/ng-update/data/constructor-checks.js +7 -1
  48. package/schematics/ng-update/data/constructor-checks.mjs +7 -1
  49. package/schematics/ng-update/devkit-migration.js +1 -1
  50. package/schematics/ng-update/devkit-migration.mjs +1 -1
  51. package/schematics/tsconfig.json +2 -10
  52. package/scrolling/scrolling-module.d.ts +1 -2
  53. package/stepper/stepper.d.ts +3 -12
  54. package/testing/component-harness.d.ts +18 -0
  55. package/testing/harness-environment.d.ts +2 -0
  56. package/text-field/text-field-module.d.ts +1 -2
package/fesm2015/cdk.mjs CHANGED
@@ -8,7 +8,7 @@ import { Version } from '@angular/core';
8
8
  * found in the LICENSE file at https://angular.io/license
9
9
  */
10
10
  /** Current version of the Angular Component Development Kit. */
11
- const VERSION = new Version('14.0.0-next.1');
11
+ const VERSION = new Version('14.0.0-next.4');
12
12
 
13
13
  /**
14
14
  * @license
@@ -1 +1 @@
1
- {"version":3,"file":"cdk.mjs","sources":["../../../../../../src/cdk/version.ts","../../../../../../src/cdk/public-api.ts","../../../../../../src/cdk/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('14.0.0-next.1');\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './version';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;;;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;ACXtD;;;;;;;;ACAA;;;;;;;;;;"}
1
+ {"version":3,"file":"cdk.mjs","sources":["../../../../../../src/cdk/version.ts","../../../../../../src/cdk/public-api.ts","../../../../../../src/cdk/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('14.0.0-next.4');\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './version';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;;;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;ACXtD;;;;;;;;ACAA;;;;;;;;;;"}
@@ -188,9 +188,8 @@ function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
188
188
  */
189
189
  /** Keeps track of the scroll position and dimensions of the parents of an element. */
190
190
  class ParentPositionTracker {
191
- constructor(_document, _viewportRuler) {
191
+ constructor(_document) {
192
192
  this._document = _document;
193
- this._viewportRuler = _viewportRuler;
194
193
  /** Cached positions of the scrollable parent elements. */
195
194
  this.positions = new Map();
196
195
  }
@@ -202,7 +201,7 @@ class ParentPositionTracker {
202
201
  cache(elements) {
203
202
  this.clear();
204
203
  this.positions.set(this._document, {
205
- scrollPosition: this._viewportRuler.getViewportScrollPosition(),
204
+ scrollPosition: this.getViewportScrollPosition(),
206
205
  });
207
206
  elements.forEach(element => {
208
207
  this.positions.set(element, {
@@ -222,7 +221,7 @@ class ParentPositionTracker {
222
221
  let newTop;
223
222
  let newLeft;
224
223
  if (target === this._document) {
225
- const viewportScrollPosition = this._viewportRuler.getViewportScrollPosition();
224
+ const viewportScrollPosition = this.getViewportScrollPosition();
226
225
  newTop = viewportScrollPosition.top;
227
226
  newLeft = viewportScrollPosition.left;
228
227
  }
@@ -243,6 +242,15 @@ class ParentPositionTracker {
243
242
  scrollPosition.left = newLeft;
244
243
  return { top: topDifference, left: leftDifference };
245
244
  }
245
+ /**
246
+ * Gets the scroll position of the viewport. Note that we use the scrollX and scrollY directly,
247
+ * instead of going through the `ViewportRuler`, because the first value the ruler looks at is
248
+ * the top/left offset of the `document.documentElement` which works for most cases, but breaks
249
+ * if the element is offset by something like the `BlockScrollStrategy`.
250
+ */
251
+ getViewportScrollPosition() {
252
+ return { top: window.scrollY, left: window.scrollX };
253
+ }
246
254
  }
247
255
 
248
256
  /**
@@ -496,7 +504,7 @@ class DragRef {
496
504
  this._endDragSequence(event);
497
505
  };
498
506
  this.withRootElement(element).withParent(_config.parentDragRef || null);
499
- this._parentPositions = new ParentPositionTracker(_document, _viewportRuler);
507
+ this._parentPositions = new ParentPositionTracker(_document);
500
508
  _dragDropRegistry.registerDragItem(this);
501
509
  }
502
510
  /** Whether starting to drag this element is disabled. */
@@ -577,6 +585,9 @@ class DragRef {
577
585
  this._ngZone.runOutsideAngular(() => {
578
586
  element.addEventListener('mousedown', this._pointerDown, activeEventListenerOptions);
579
587
  element.addEventListener('touchstart', this._pointerDown, passiveEventListenerOptions);
588
+ // Usually this isn't necessary since the we prevent the default action in `pointerDown`,
589
+ // but some cases like dragging of links can slip through (see #24403).
590
+ element.addEventListener('dragstart', preventDefault, activeEventListenerOptions);
580
591
  });
581
592
  this._initialTransform = undefined;
582
593
  this._rootElement = element;
@@ -1085,6 +1096,9 @@ class DragRef {
1085
1096
  else {
1086
1097
  placeholder = deepCloneNode(this._rootElement);
1087
1098
  }
1099
+ // Stop pointer events on the preview so the user can't
1100
+ // interact with it while the preview is animating.
1101
+ placeholder.style.pointerEvents = 'none';
1088
1102
  placeholder.classList.add('cdk-drag-placeholder');
1089
1103
  return placeholder;
1090
1104
  }
@@ -1194,6 +1208,7 @@ class DragRef {
1194
1208
  _removeRootElementListeners(element) {
1195
1209
  element.removeEventListener('mousedown', this._pointerDown, activeEventListenerOptions);
1196
1210
  element.removeEventListener('touchstart', this._pointerDown, passiveEventListenerOptions);
1211
+ element.removeEventListener('dragstart', preventDefault, activeEventListenerOptions);
1197
1212
  }
1198
1213
  /**
1199
1214
  * Applies a `transform` to the root element, taking into account any existing transforms on it.
@@ -1331,10 +1346,9 @@ class DragRef {
1331
1346
  }
1332
1347
  /** Gets the scroll position of the viewport. */
1333
1348
  _getViewportScrollPosition() {
1334
- const cachedPosition = this._parentPositions.positions.get(this._document);
1335
- return cachedPosition
1336
- ? cachedPosition.scrollPosition
1337
- : this._viewportRuler.getViewportScrollPosition();
1349
+ var _a;
1350
+ return (((_a = this._parentPositions.positions.get(this._document)) === null || _a === void 0 ? void 0 : _a.scrollPosition) ||
1351
+ this._parentPositions.getViewportScrollPosition());
1338
1352
  }
1339
1353
  /**
1340
1354
  * Lazily resolves and returns the shadow root of the element. We do this in a function, rather
@@ -1413,6 +1427,10 @@ function matchElementSize(target, sourceRect) {
1413
1427
  target.style.height = `${sourceRect.height}px`;
1414
1428
  target.style.transform = getTransform(sourceRect.left, sourceRect.top);
1415
1429
  }
1430
+ /** Utility to prevent the default action of an event. */
1431
+ function preventDefault(event) {
1432
+ event.preventDefault();
1433
+ }
1416
1434
 
1417
1435
  /**
1418
1436
  * @license
@@ -1588,7 +1606,7 @@ class DropListRef {
1588
1606
  this._document = _document;
1589
1607
  this.withScrollableParents([this.element]);
1590
1608
  _dragDropRegistry.registerDropContainer(this);
1591
- this._parentPositions = new ParentPositionTracker(_document, _viewportRuler);
1609
+ this._parentPositions = new ParentPositionTracker(_document);
1592
1610
  }
1593
1611
  /** Removes the drop list functionality from the DOM element. */
1594
1612
  dispose() {