@angular/cdk 18.2.1 → 19.0.0-next.1

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 (37) hide show
  1. package/drag-drop/index.d.ts +1 -4
  2. package/esm2022/drag-drop/drag-drop-registry.mjs +6 -24
  3. package/esm2022/platform/platform.mjs +6 -9
  4. package/esm2022/private/index.mjs +9 -0
  5. package/esm2022/private/private_public_index.mjs +5 -0
  6. package/esm2022/private/public-api.mjs +9 -0
  7. package/esm2022/private/style-loader.mjs +50 -0
  8. package/esm2022/testing/testbed/task-state-zone-interceptor.mjs +4 -3
  9. package/esm2022/tree/tree.mjs +14 -1
  10. package/esm2022/version.mjs +1 -1
  11. package/fesm2022/cdk.mjs +1 -1
  12. package/fesm2022/cdk.mjs.map +1 -1
  13. package/fesm2022/drag-drop.mjs +4 -22
  14. package/fesm2022/drag-drop.mjs.map +1 -1
  15. package/fesm2022/platform.mjs +5 -8
  16. package/fesm2022/platform.mjs.map +1 -1
  17. package/fesm2022/private.mjs +50 -0
  18. package/fesm2022/private.mjs.map +1 -0
  19. package/fesm2022/testing/testbed.mjs +3 -2
  20. package/fesm2022/testing/testbed.mjs.map +1 -1
  21. package/fesm2022/tree.mjs +13 -0
  22. package/fesm2022/tree.mjs.map +1 -1
  23. package/package.json +9 -3
  24. package/platform/index.d.ts +2 -1
  25. package/private/index.d.ts +20 -0
  26. package/schematics/migration.json +4 -4
  27. package/schematics/ng-add/index.js +1 -1
  28. package/schematics/ng-add/index.mjs +1 -1
  29. package/schematics/ng-update/index.d.ts +1 -1
  30. package/schematics/ng-update/index.js +4 -4
  31. package/schematics/ng-update/index.mjs +4 -4
  32. package/schematics/ng-update/migrations/misc-template.js +2 -2
  33. package/schematics/ng-update/migrations/misc-template.mjs +2 -2
  34. package/schematics/update-tool/target-version.d.ts +1 -1
  35. package/schematics/update-tool/target-version.js +2 -2
  36. package/schematics/update-tool/target-version.mjs +2 -2
  37. package/tree/index.d.ts +1 -0
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, Component, ViewEncapsulation, ChangeDetectionStrategy, inject, ApplicationRef, EnvironmentInjector, createComponent, Injectable, Inject, InjectionToken, booleanAttribute, Directive, Optional, SkipSelf, Input, EventEmitter, Injector, afterNextRender, numberAttribute, Self, Output, NgModule } from '@angular/core';
2
+ import { signal, Component, ViewEncapsulation, ChangeDetectionStrategy, inject, Injectable, Inject, InjectionToken, booleanAttribute, Directive, Optional, SkipSelf, Input, EventEmitter, Injector, afterNextRender, numberAttribute, Self, Output, NgModule } from '@angular/core';
3
3
  import { DOCUMENT } from '@angular/common';
4
4
  import * as i1 from '@angular/cdk/scrolling';
5
5
  import { CdkScrollableModule } from '@angular/cdk/scrolling';
@@ -8,6 +8,7 @@ import { coerceElement, coerceNumberProperty, coerceArray } from '@angular/cdk/c
8
8
  import { _getEventTarget, normalizePassiveListenerOptions, _getShadowRoot } from '@angular/cdk/platform';
9
9
  import { Subject, Subscription, interval, animationFrameScheduler, Observable, merge, BehaviorSubject } from 'rxjs';
10
10
  import { takeUntil, map, take, tap, switchMap, startWith } from 'rxjs/operators';
11
+ import { _CdkPrivateStyleLoader } from '@angular/cdk/private';
11
12
  import * as i1$1 from '@angular/cdk/bidi';
12
13
 
13
14
  /** Creates a deep clone of an element. */
@@ -2795,8 +2796,6 @@ const activeCapturingEventOptions = normalizePassiveListenerOptions({
2795
2796
  passive: false,
2796
2797
  capture: true,
2797
2798
  });
2798
- /** Keeps track of the apps currently containing drag items. */
2799
- const activeApps = new Set();
2800
2799
  /**
2801
2800
  * Component used to load the drag&drop reset styles.
2802
2801
  * @docs-private
@@ -2818,8 +2817,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0-next.2",
2818
2817
  class DragDropRegistry {
2819
2818
  constructor(_ngZone, _document) {
2820
2819
  this._ngZone = _ngZone;
2821
- this._appRef = inject(ApplicationRef);
2822
- this._environmentInjector = inject(EnvironmentInjector);
2820
+ this._styleLoader = inject(_CdkPrivateStyleLoader);
2823
2821
  /** Registered drop container instances. */
2824
2822
  this._dropInstances = new Set();
2825
2823
  /** Registered drag item instances. */
@@ -2914,7 +2912,7 @@ class DragDropRegistry {
2914
2912
  if (this._activeDragInstances().indexOf(drag) > -1) {
2915
2913
  return;
2916
2914
  }
2917
- this._loadResets();
2915
+ this._styleLoader.load(_ResetsLoader);
2918
2916
  this._activeDragInstances.update(instances => [...instances, drag]);
2919
2917
  if (this._activeDragInstances().length === 1) {
2920
2918
  const isTouchEvent = event.type.startsWith('touch');
@@ -3017,22 +3015,6 @@ class DragDropRegistry {
3017
3015
  });
3018
3016
  this._globalListeners.clear();
3019
3017
  }
3020
- // TODO(crisbeto): abstract this away into something reusable.
3021
- /** Loads the CSS resets needed for the module to work correctly. */
3022
- _loadResets() {
3023
- if (!activeApps.has(this._appRef)) {
3024
- activeApps.add(this._appRef);
3025
- const componentRef = createComponent(_ResetsLoader, {
3026
- environmentInjector: this._environmentInjector,
3027
- });
3028
- this._appRef.onDestroy(() => {
3029
- activeApps.delete(this._appRef);
3030
- if (activeApps.size === 0) {
3031
- componentRef.destroy();
3032
- }
3033
- });
3034
- }
3035
- }
3036
3018
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0-next.2", ngImport: i0, type: DragDropRegistry, deps: [{ token: i0.NgZone }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
3037
3019
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0-next.2", ngImport: i0, type: DragDropRegistry, providedIn: 'root' }); }
3038
3020
  }