@angular/cdk 20.0.0-next.7 → 20.0.0-next.8

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 (86) hide show
  1. package/dialog/index.d.ts +1 -1
  2. package/drag-drop/index.d.ts +4 -0
  3. package/fesm2022/{a11y-module-tRUj0Pog.mjs → a11y-module-CEBjqXuv.mjs} +3 -4
  4. package/fesm2022/a11y-module-CEBjqXuv.mjs.map +1 -0
  5. package/fesm2022/a11y.mjs +5 -5
  6. package/fesm2022/a11y.mjs.map +1 -1
  7. package/fesm2022/accordion.mjs.map +1 -1
  8. package/fesm2022/activedescendant-key-manager-BYiHZAZc.mjs.map +1 -1
  9. package/fesm2022/array-Hg8isvLj.mjs.map +1 -1
  10. package/fesm2022/bidi.mjs +2 -3
  11. package/fesm2022/bidi.mjs.map +1 -1
  12. package/fesm2022/breakpoints-observer-CsCzbYlX.mjs.map +1 -1
  13. package/fesm2022/cdk.mjs +1 -1
  14. package/fesm2022/cdk.mjs.map +1 -1
  15. package/fesm2022/clipboard.mjs +1 -2
  16. package/fesm2022/clipboard.mjs.map +1 -1
  17. package/fesm2022/coercion/private.mjs.map +1 -1
  18. package/fesm2022/coercion.mjs.map +1 -1
  19. package/fesm2022/css-pixel-value-C1yoKJ7R.mjs.map +1 -1
  20. package/fesm2022/data-source-CL6Fasig.mjs.map +1 -1
  21. package/fesm2022/dialog.mjs +22 -8
  22. package/fesm2022/dialog.mjs.map +1 -1
  23. package/fesm2022/{directionality-6lVHj23y.mjs → directionality-kM9GX3mp.mjs} +2 -3
  24. package/fesm2022/directionality-kM9GX3mp.mjs.map +1 -0
  25. package/fesm2022/dispose-view-repeater-strategy-BLw1RSwm.mjs.map +1 -1
  26. package/fesm2022/drag-drop.mjs +55 -3
  27. package/fesm2022/drag-drop.mjs.map +1 -1
  28. package/fesm2022/element-CpqV8p-X.mjs.map +1 -1
  29. package/fesm2022/fake-event-detection-D0_6qVp2.mjs.map +1 -1
  30. package/fesm2022/focus-key-manager-DgyxYbV2.mjs.map +1 -1
  31. package/fesm2022/{focus-monitor-BZnK-7fT.mjs → focus-monitor-jX8r4DY-.mjs} +2 -3
  32. package/fesm2022/focus-monitor-jX8r4DY-.mjs.map +1 -0
  33. package/fesm2022/id-generator-B33AfkWd.mjs.map +1 -1
  34. package/fesm2022/keycodes-DPWmI2Ix.mjs.map +1 -1
  35. package/fesm2022/keycodes.mjs.map +1 -1
  36. package/fesm2022/layout.mjs.map +1 -1
  37. package/fesm2022/list-key-manager-CYBoL_nN.mjs.map +1 -1
  38. package/fesm2022/listbox.mjs +1 -1
  39. package/fesm2022/listbox.mjs.map +1 -1
  40. package/fesm2022/menu.mjs +3 -3
  41. package/fesm2022/menu.mjs.map +1 -1
  42. package/fesm2022/observers/private.mjs.map +1 -1
  43. package/fesm2022/observers.mjs.map +1 -1
  44. package/fesm2022/{overlay-module-UgjfuiDh.mjs → overlay-module-BcjSxQND.mjs} +90 -76
  45. package/fesm2022/overlay-module-BcjSxQND.mjs.map +1 -0
  46. package/fesm2022/overlay.mjs +3 -3
  47. package/fesm2022/overlay.mjs.map +1 -1
  48. package/fesm2022/passive-listeners-ZmZRMx8D.mjs.map +1 -1
  49. package/fesm2022/platform-BInyKIh1.mjs.map +1 -1
  50. package/fesm2022/platform.mjs.map +1 -1
  51. package/fesm2022/portal.mjs +1 -2
  52. package/fesm2022/portal.mjs.map +1 -1
  53. package/fesm2022/private.mjs.map +1 -1
  54. package/fesm2022/recycle-view-repeater-strategy-Ce0p4WhD.mjs.map +1 -1
  55. package/fesm2022/scrolling-BXVcIfjZ.mjs.map +1 -1
  56. package/fesm2022/scrolling.mjs +3 -3
  57. package/fesm2022/scrolling.mjs.map +1 -1
  58. package/fesm2022/selection-model-88BErm4w.mjs.map +1 -1
  59. package/fesm2022/shadow-dom-DFvX9W95.mjs.map +1 -1
  60. package/fesm2022/stepper.mjs +1 -2
  61. package/fesm2022/stepper.mjs.map +1 -1
  62. package/fesm2022/style-loader-DpEDdstc.mjs.map +1 -1
  63. package/fesm2022/table.mjs +3 -3
  64. package/fesm2022/table.mjs.map +1 -1
  65. package/fesm2022/test-environment-BgaaXvCA.mjs.map +1 -1
  66. package/fesm2022/testing/selenium-webdriver.mjs.map +1 -1
  67. package/fesm2022/testing/testbed.mjs.map +1 -1
  68. package/fesm2022/testing.mjs.map +1 -1
  69. package/fesm2022/text-field.mjs +2 -2
  70. package/fesm2022/text-field.mjs.map +1 -1
  71. package/fesm2022/tree-key-manager-DIhQ-v4R.mjs.map +1 -1
  72. package/fesm2022/tree.mjs +1 -2
  73. package/fesm2022/tree.mjs.map +1 -1
  74. package/fesm2022/typeahead-BAa3HZoh.mjs.map +1 -1
  75. package/fesm2022/unique-selection-dispatcher-SqPM2COI.mjs.map +1 -1
  76. package/menu/index.d.ts +1 -1
  77. package/overlay/index.d.ts +67 -70
  78. package/{overlay-module.d-24bhgNtF.d.ts → overlay-module.d-CXZs2tcX.d.ts} +8 -2
  79. package/package.json +1 -1
  80. package/schematics/ng-add/index.js +1 -1
  81. package/schematics/utils/project-targets.js +11 -5
  82. package/schematics/utils/project-targets.js.map +1 -1
  83. package/fesm2022/a11y-module-tRUj0Pog.mjs.map +0 -1
  84. package/fesm2022/directionality-6lVHj23y.mjs.map +0 -1
  85. package/fesm2022/focus-monitor-BZnK-7fT.mjs.map +0 -1
  86. package/fesm2022/overlay-module-UgjfuiDh.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"private.mjs","sources":["../../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk/observers/private/shared-resize-observer.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.dev/license\n */\nimport {inject, Injectable, NgZone, OnDestroy, RendererFactory2} from '@angular/core';\nimport {Observable, Subject} from 'rxjs';\nimport {filter, shareReplay, takeUntil} from 'rxjs/operators';\n\n/**\n * Handler that logs \"ResizeObserver loop limit exceeded\" errors.\n * These errors are not shown in the Chrome console, so we log them to ensure developers are aware.\n * @param e The error\n */\nconst loopLimitExceededErrorHandler = (e: unknown) => {\n if (e instanceof ErrorEvent && e.message === 'ResizeObserver loop limit exceeded') {\n console.error(\n `${e.message}. This could indicate a performance issue with your app. See https://github.com/WICG/resize-observer/blob/master/explainer.md#error-handling`,\n );\n }\n};\n\n/**\n * A shared ResizeObserver to be used for a particular box type (content-box, border-box, or\n * device-pixel-content-box)\n */\nclass SingleBoxSharedResizeObserver {\n /** Stream that emits when the shared observer is destroyed. */\n private _destroyed = new Subject<void>();\n /** Stream of all events from the ResizeObserver. */\n private _resizeSubject = new Subject<ResizeObserverEntry[]>();\n /** ResizeObserver used to observe element resize events. */\n private _resizeObserver?: ResizeObserver;\n /** A map of elements to streams of their resize events. */\n private _elementObservables = new Map<Element, Observable<ResizeObserverEntry[]>>();\n\n constructor(\n /** The box type to observe for resizes. */\n private _box: ResizeObserverBoxOptions,\n ) {\n if (typeof ResizeObserver !== 'undefined') {\n this._resizeObserver = new ResizeObserver(entries => this._resizeSubject.next(entries));\n }\n }\n\n /**\n * Gets a stream of resize events for the given element.\n * @param target The element to observe.\n * @return The stream of resize events for the element.\n */\n observe(target: Element): Observable<ResizeObserverEntry[]> {\n if (!this._elementObservables.has(target)) {\n this._elementObservables.set(\n target,\n new Observable<ResizeObserverEntry[]>(observer => {\n const subscription = this._resizeSubject.subscribe(observer);\n this._resizeObserver?.observe(target, {box: this._box});\n return () => {\n this._resizeObserver?.unobserve(target);\n subscription.unsubscribe();\n this._elementObservables.delete(target);\n };\n }).pipe(\n filter(entries => entries.some(entry => entry.target === target)),\n // Share a replay of the last event so that subsequent calls to observe the same element\n // receive initial sizing info like the first one. Also enable ref counting so the\n // element will be automatically unobserved when there are no more subscriptions.\n shareReplay({bufferSize: 1, refCount: true}),\n takeUntil(this._destroyed),\n ),\n );\n }\n return this._elementObservables.get(target)!;\n }\n\n /** Destroys this instance. */\n destroy() {\n this._destroyed.next();\n this._destroyed.complete();\n this._resizeSubject.complete();\n this._elementObservables.clear();\n }\n}\n\n/**\n * Allows observing resize events on multiple elements using a shared set of ResizeObserver.\n * Sharing a ResizeObserver instance is recommended for better performance (see\n * https://github.com/WICG/resize-observer/issues/59).\n *\n * Rather than share a single `ResizeObserver`, this class creates one `ResizeObserver` per type\n * of observed box ('content-box', 'border-box', and 'device-pixel-content-box'). This avoids\n * later calls to `observe` with a different box type from influencing the events dispatched to\n * earlier calls.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class SharedResizeObserver implements OnDestroy {\n private _cleanupErrorListener: (() => void) | undefined;\n\n /** Map of box type to shared resize observer. */\n private _observers = new Map<ResizeObserverBoxOptions, SingleBoxSharedResizeObserver>();\n\n /** The Angular zone. */\n private _ngZone = inject(NgZone);\n\n constructor() {\n if (typeof ResizeObserver !== 'undefined' && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n this._ngZone.runOutsideAngular(() => {\n const renderer = inject(RendererFactory2).createRenderer(null, null);\n this._cleanupErrorListener = renderer.listen(\n 'window',\n 'error',\n loopLimitExceededErrorHandler,\n );\n });\n }\n }\n\n ngOnDestroy() {\n for (const [, observer] of this._observers) {\n observer.destroy();\n }\n this._observers.clear();\n this._cleanupErrorListener?.();\n }\n\n /**\n * Gets a stream of resize events for the given target element and box type.\n * @param target The element to observe for resizes.\n * @param options Options to pass to the `ResizeObserver`\n * @return The stream of resize events for the element.\n */\n observe(target: Element, options?: ResizeObserverOptions): Observable<ResizeObserverEntry[]> {\n const box = options?.box || 'content-box';\n if (!this._observers.has(box)) {\n this._observers.set(box, new SingleBoxSharedResizeObserver(box));\n }\n return this._observers.get(box)!.observe(target);\n }\n}\n"],"names":[],"mappings":";;;;;AAWA;;;;AAIG;AACH,MAAM,6BAA6B,GAAG,CAAC,CAAU,KAAI;IACnD,IAAI,CAAC,YAAY,UAAU,IAAI,CAAC,CAAC,OAAO,KAAK,oCAAoC,EAAE;QACjF,OA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,CAAC,qBAAqB,IAAI;;AAGhC;;;;;AAKG;IACH,OAAO,CAAC,MAAe,EAAE,OAA+B,EAAA;AACtD,QAAA,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,aAAa;QACzC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AAC7B,YAAA,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,6BAA6B,CAAC,GAAG,CAAC,CAAC;;AAElE,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,OAAO,CAAC,MAAM,CAAC;;8GAzCvC,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAApB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,eAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,cAFnB,MAAM,EAAA,CAAA;;kGAEP,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
1
+ {"version":3,"file":"private.mjs","sources":["../../../../../../k8-fastbuild-ST-46c76129e412/bin/src/cdk/observers/private/shared-resize-observer.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.dev/license\n */\nimport {inject, Injectable, NgZone, OnDestroy, RendererFactory2} from '@angular/core';\nimport {Observable, Subject} from 'rxjs';\nimport {filter, shareReplay, takeUntil} from 'rxjs/operators';\n\n/**\n * Handler that logs \"ResizeObserver loop limit exceeded\" errors.\n * These errors are not shown in the Chrome console, so we log them to ensure developers are aware.\n * @param e The error\n */\nconst loopLimitExceededErrorHandler = (e: unknown) => {\n if (e instanceof ErrorEvent && e.message === 'ResizeObserver loop limit exceeded') {\n console.error(\n `${e.message}. This could indicate a performance issue with your app. See https://github.com/WICG/resize-observer/blob/master/explainer.md#error-handling`,\n );\n }\n};\n\n/**\n * A shared ResizeObserver to be used for a particular box type (content-box, border-box, or\n * device-pixel-content-box)\n */\nclass SingleBoxSharedResizeObserver {\n /** Stream that emits when the shared observer is destroyed. */\n private _destroyed = new Subject<void>();\n /** Stream of all events from the ResizeObserver. */\n private _resizeSubject = new Subject<ResizeObserverEntry[]>();\n /** ResizeObserver used to observe element resize events. */\n private _resizeObserver?: ResizeObserver;\n /** A map of elements to streams of their resize events. */\n private _elementObservables = new Map<Element, Observable<ResizeObserverEntry[]>>();\n\n constructor(\n /** The box type to observe for resizes. */\n private _box: ResizeObserverBoxOptions,\n ) {\n if (typeof ResizeObserver !== 'undefined') {\n this._resizeObserver = new ResizeObserver(entries => this._resizeSubject.next(entries));\n }\n }\n\n /**\n * Gets a stream of resize events for the given element.\n * @param target The element to observe.\n * @return The stream of resize events for the element.\n */\n observe(target: Element): Observable<ResizeObserverEntry[]> {\n if (!this._elementObservables.has(target)) {\n this._elementObservables.set(\n target,\n new Observable<ResizeObserverEntry[]>(observer => {\n const subscription = this._resizeSubject.subscribe(observer);\n this._resizeObserver?.observe(target, {box: this._box});\n return () => {\n this._resizeObserver?.unobserve(target);\n subscription.unsubscribe();\n this._elementObservables.delete(target);\n };\n }).pipe(\n filter(entries => entries.some(entry => entry.target === target)),\n // Share a replay of the last event so that subsequent calls to observe the same element\n // receive initial sizing info like the first one. Also enable ref counting so the\n // element will be automatically unobserved when there are no more subscriptions.\n shareReplay({bufferSize: 1, refCount: true}),\n takeUntil(this._destroyed),\n ),\n );\n }\n return this._elementObservables.get(target)!;\n }\n\n /** Destroys this instance. */\n destroy() {\n this._destroyed.next();\n this._destroyed.complete();\n this._resizeSubject.complete();\n this._elementObservables.clear();\n }\n}\n\n/**\n * Allows observing resize events on multiple elements using a shared set of ResizeObserver.\n * Sharing a ResizeObserver instance is recommended for better performance (see\n * https://github.com/WICG/resize-observer/issues/59).\n *\n * Rather than share a single `ResizeObserver`, this class creates one `ResizeObserver` per type\n * of observed box ('content-box', 'border-box', and 'device-pixel-content-box'). This avoids\n * later calls to `observe` with a different box type from influencing the events dispatched to\n * earlier calls.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class SharedResizeObserver implements OnDestroy {\n private _cleanupErrorListener: (() => void) | undefined;\n\n /** Map of box type to shared resize observer. */\n private _observers = new Map<ResizeObserverBoxOptions, SingleBoxSharedResizeObserver>();\n\n /** The Angular zone. */\n private _ngZone = inject(NgZone);\n\n constructor() {\n if (typeof ResizeObserver !== 'undefined' && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n this._ngZone.runOutsideAngular(() => {\n const renderer = inject(RendererFactory2).createRenderer(null, null);\n this._cleanupErrorListener = renderer.listen(\n 'window',\n 'error',\n loopLimitExceededErrorHandler,\n );\n });\n }\n }\n\n ngOnDestroy() {\n for (const [, observer] of this._observers) {\n observer.destroy();\n }\n this._observers.clear();\n this._cleanupErrorListener?.();\n }\n\n /**\n * Gets a stream of resize events for the given target element and box type.\n * @param target The element to observe for resizes.\n * @param options Options to pass to the `ResizeObserver`\n * @return The stream of resize events for the element.\n */\n observe(target: Element, options?: ResizeObserverOptions): Observable<ResizeObserverEntry[]> {\n const box = options?.box || 'content-box';\n if (!this._observers.has(box)) {\n this._observers.set(box, new SingleBoxSharedResizeObserver(box));\n }\n return this._observers.get(box)!.observe(target);\n }\n}\n"],"names":[],"mappings":";;;;;AAWA;;;;AAIG;AACH,MAAM,6BAA6B,GAAG,CAAC,CAAU,KAAI;IACnD,IAAI,CAAC,YAAY,UAAU,IAAI,CAAC,CAAC,OAAO,KAAK,oCAAoC,EAAE;QACjF,OAAO,CAAC,KAAK,CACX,CAAA,EAAG,CAAC,CAAC,OAAO,CAA8I,4IAAA,CAAA,CAC3J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EAAA;AACtD,QAAA,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,aAAa;QACzC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AAC7B,YAAA,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,6BAA6B,CAAC,GAAG,CAAC,CAAC;;AAElE,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,OAAO,CAAC,MAAM,CAAC;;8GAzCvC,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAApB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,eAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,cAFnB,MAAM,EAAA,CAAA;;kGAEP,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"observers.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk/observers/observe-content.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.dev/license\n */\n\nimport {NumberInput, coerceElement, coerceNumberProperty} from '../coercion';\nimport {\n AfterContentInit,\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n Input,\n NgModule,\n NgZone,\n OnDestroy,\n Output,\n booleanAttribute,\n inject,\n} from '@angular/core';\nimport {Observable, Observer, Subject, Subscription} from 'rxjs';\nimport {debounceTime, filter, map} from 'rxjs/operators';\n\n// Angular may add, remove, or edit comment nodes during change detection. We don't care about\n// these changes because they don't affect the user-preceived content, and worse it can cause\n// infinite change detection cycles where the change detection updates a comment, triggering the\n// MutationObserver, triggering another change detection and kicking the cycle off again.\nfunction shouldIgnoreRecord(record: MutationRecord) {\n // Ignore changes to comment text.\n if (record.type === 'characterData' && record.target instanceof Comment) {\n return true;\n }\n // Ignore addition / removal of comments.\n if (record.type === 'childList') {\n for (let i = 0; i < record.addedNodes.length; i++) {\n if (!(record.addedNodes[i] instanceof Comment)) {\n return false;\n }\n }\n for (let i = 0; i < record.removedNodes.length; i++) {\n if (!(record.removedNodes[i] instanceof Comment)) {\n return false;\n }\n }\n return true;\n }\n // Observe everything else.\n return false;\n}\n\n/**\n * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.\n * @docs-private\n */\n@Injectable({providedIn: 'root'})\nexport class MutationObserverFactory {\n create(callback: MutationCallback): MutationObserver | null {\n return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);\n }\n}\n\n/** An injectable service that allows watching elements for changes to their content. */\n@Injectable({providedIn: 'root'})\nexport class ContentObserver implements OnDestroy {\n private _mutationObserverFactory = inject(MutationObserverFactory);\n\n /** Keeps track of the existing MutationObservers so they can be reused. */\n private _observedElements = new Map<\n Element,\n {\n observer: MutationObserver | null;\n readonly stream: Subject<MutationRecord[]>;\n count: number;\n }\n >();\n\n private _ngZone = inject(NgZone);\n\n constructor(...args: unknown[]);\n constructor() {}\n\n ngOnDestroy() {\n this._observedElements.forEach((_, element) => this._cleanupObserver(element));\n }\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: Element): Observable<MutationRecord[]>;\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: ElementRef<Element>): Observable<MutationRecord[]>;\n\n observe(elementOrRef: Element | ElementRef<Element>): Observable<MutationRecord[]> {\n const element = coerceElement(elementOrRef);\n\n return new Observable((observer: Observer<MutationRecord[]>) => {\n const stream = this._observeElement(element);\n const subscription = stream\n .pipe(\n map(records => records.filter(record => !shouldIgnoreRecord(record))),\n filter(records => !!records.length),\n )\n .subscribe(records => {\n this._ngZone.run(() => {\n observer.next(records);\n });\n });\n\n return () => {\n subscription.unsubscribe();\n this._unobserveElement(element);\n };\n });\n }\n\n /**\n * Observes the given element by using the existing MutationObserver if available, or creating a\n * new one if not.\n */\n private _observeElement(element: Element): Subject<MutationRecord[]> {\n return this._ngZone.runOutsideAngular(() => {\n if (!this._observedElements.has(element)) {\n const stream = new Subject<MutationRecord[]>();\n const observer = this._mutationObserverFactory.create(mutations => stream.next(mutations));\n if (observer) {\n observer.observe(element, {\n characterData: true,\n childList: true,\n subtree: true,\n });\n }\n this._observedElements.set(element, {observer, stream, count: 1});\n } else {\n this._observedElements.get(element)!.count++;\n }\n return this._observedElements.get(element)!.stream;\n });\n }\n\n /**\n * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is\n * observing this element.\n */\n private _unobserveElement(element: Element) {\n if (this._observedElements.has(element)) {\n this._observedElements.get(element)!.count--;\n if (!this._observedElements.get(element)!.count) {\n this._cleanupObserver(element);\n }\n }\n }\n\n /** Clean up the underlying MutationObserver for the specified element. */\n private _cleanupObserver(element: Element) {\n if (this._observedElements.has(element)) {\n const {observer, stream} = this._observedElements.get(element)!;\n if (observer) {\n observer.disconnect();\n }\n stream.complete();\n this._observedElements.delete(element);\n }\n }\n}\n\n/**\n * Directive that triggers a callback whenever the content of\n * its associated element has changed.\n */\n@Directive({\n selector: '[cdkObserveContent]',\n exportAs: 'cdkObserveContent',\n})\nexport class CdkObserveContent implements AfterContentInit, OnDestroy {\n private _contentObserver = inject(ContentObserver);\n private _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Event emitted for each change in the element's content. */\n @Output('cdkObserveContent') readonly event = new EventEmitter<MutationRecord[]>();\n\n /**\n * Whether observing content is disabled. This option can be used\n * to disconnect the underlying MutationObserver until it is needed.\n */\n @Input({alias: 'cdkObserveContentDisabled', transform: booleanAttribute})\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = value;\n this._disabled ? this._unsubscribe() : this._subscribe();\n }\n private _disabled = false;\n\n /** Debounce interval for emitting the changes. */\n @Input()\n get debounce(): number {\n return this._debounce;\n }\n set debounce(value: NumberInput) {\n this._debounce = coerceNumberProperty(value);\n this._subscribe();\n }\n private _debounce: number;\n\n private _currentSubscription: Subscription | null = null;\n\n constructor(...args: unknown[]);\n constructor() {}\n\n ngAfterContentInit() {\n if (!this._currentSubscription && !this.disabled) {\n this._subscribe();\n }\n }\n\n ngOnDestroy() {\n this._unsubscribe();\n }\n\n private _subscribe() {\n this._unsubscribe();\n const stream = this._contentObserver.observe(this._elementRef);\n\n this._currentSubscription = (\n this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream\n ).subscribe(this.event);\n }\n\n private _unsubscribe() {\n this._currentSubscription?.unsubscribe();\n }\n}\n\n@NgModule({\n imports: [CdkObserveContent],\n exports: [CdkObserveContent],\n providers: [MutationObserverFactory],\n})\nexport class ObserversModule {}\n"],"names":[],"mappings":";;;;;;AA0BA;AACA;AACA;AACA;AACA,SAAS,kBAAkB,CAAC,MAAsB,EAAA;;AAEhD,IAAA,IAAI,MAAM,CAAC,IAAI,KAAK,eAAe,IAAI,MAAM,CAAC,MAAM,YAAY,OAAO,EAAE;AACvE,QAAA,OAAO,IAAI;;;AAGb,IAAA,IAAI,MAAM,CAAC,IAAI,KAAK,WAAW,EAAE;AAC/B,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACjD,YAAA,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,OAAO,CAAC,EAAE;AAC9C,gBAAA,OAAO,KAAK;;;AAGhB,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE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,eAAe,EAAA,UAAA,EAAA,CAAA;kBAL3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,iBAAiB,CAAC;oBAC5B,OAAO,EAAE,CAAC,iBAAiB,CAAC;oBAC5B,SAAS,EAAE,CAAC,uBAAuB,CAAC;AACrC,iBAAA;;;;;"}
1
+ {"version":3,"file":"observers.mjs","sources":["../../../../../k8-fastbuild-ST-46c76129e412/bin/src/cdk/observers/observe-content.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.dev/license\n */\n\nimport {NumberInput, coerceElement, coerceNumberProperty} from '../coercion';\nimport {\n AfterContentInit,\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n Input,\n NgModule,\n NgZone,\n OnDestroy,\n Output,\n booleanAttribute,\n inject,\n} from '@angular/core';\nimport {Observable, Observer, Subject, Subscription} from 'rxjs';\nimport {debounceTime, filter, map} from 'rxjs/operators';\n\n// Angular may add, remove, or edit comment nodes during change detection. We don't care about\n// these changes because they don't affect the user-preceived content, and worse it can cause\n// infinite change detection cycles where the change detection updates a comment, triggering the\n// MutationObserver, triggering another change detection and kicking the cycle off again.\nfunction shouldIgnoreRecord(record: MutationRecord) {\n // Ignore changes to comment text.\n if (record.type === 'characterData' && record.target instanceof Comment) {\n return true;\n }\n // Ignore addition / removal of comments.\n if (record.type === 'childList') {\n for (let i = 0; i < record.addedNodes.length; i++) {\n if (!(record.addedNodes[i] instanceof Comment)) {\n return false;\n }\n }\n for (let i = 0; i < record.removedNodes.length; i++) {\n if (!(record.removedNodes[i] instanceof Comment)) {\n return false;\n }\n }\n return true;\n }\n // Observe everything else.\n return false;\n}\n\n/**\n * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.\n * @docs-private\n */\n@Injectable({providedIn: 'root'})\nexport class MutationObserverFactory {\n create(callback: MutationCallback): MutationObserver | null {\n return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);\n }\n}\n\n/** An injectable service that allows watching elements for changes to their content. */\n@Injectable({providedIn: 'root'})\nexport class ContentObserver implements OnDestroy {\n private _mutationObserverFactory = inject(MutationObserverFactory);\n\n /** Keeps track of the existing MutationObservers so they can be reused. */\n private _observedElements = new Map<\n Element,\n {\n observer: MutationObserver | null;\n readonly stream: Subject<MutationRecord[]>;\n count: number;\n }\n >();\n\n private _ngZone = inject(NgZone);\n\n constructor(...args: unknown[]);\n constructor() {}\n\n ngOnDestroy() {\n this._observedElements.forEach((_, element) => this._cleanupObserver(element));\n }\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: Element): Observable<MutationRecord[]>;\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: ElementRef<Element>): Observable<MutationRecord[]>;\n\n observe(elementOrRef: Element | ElementRef<Element>): Observable<MutationRecord[]> {\n const element = coerceElement(elementOrRef);\n\n return new Observable((observer: Observer<MutationRecord[]>) => {\n const stream = this._observeElement(element);\n const subscription = stream\n .pipe(\n map(records => records.filter(record => !shouldIgnoreRecord(record))),\n filter(records => !!records.length),\n )\n .subscribe(records => {\n this._ngZone.run(() => {\n observer.next(records);\n });\n });\n\n return () => {\n subscription.unsubscribe();\n this._unobserveElement(element);\n };\n });\n }\n\n /**\n * Observes the given element by using the existing MutationObserver if available, or creating a\n * new one if not.\n */\n private _observeElement(element: Element): Subject<MutationRecord[]> {\n return this._ngZone.runOutsideAngular(() => {\n if (!this._observedElements.has(element)) {\n const stream = new Subject<MutationRecord[]>();\n const observer = this._mutationObserverFactory.create(mutations => stream.next(mutations));\n if (observer) {\n observer.observe(element, {\n characterData: true,\n childList: true,\n subtree: true,\n });\n }\n this._observedElements.set(element, {observer, stream, count: 1});\n } else {\n this._observedElements.get(element)!.count++;\n }\n return this._observedElements.get(element)!.stream;\n });\n }\n\n /**\n * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is\n * observing this element.\n */\n private _unobserveElement(element: Element) {\n if (this._observedElements.has(element)) {\n this._observedElements.get(element)!.count--;\n if (!this._observedElements.get(element)!.count) {\n this._cleanupObserver(element);\n }\n }\n }\n\n /** Clean up the underlying MutationObserver for the specified element. */\n private _cleanupObserver(element: Element) {\n if (this._observedElements.has(element)) {\n const {observer, stream} = this._observedElements.get(element)!;\n if (observer) {\n observer.disconnect();\n }\n stream.complete();\n this._observedElements.delete(element);\n }\n }\n}\n\n/**\n * Directive that triggers a callback whenever the content of\n * its associated element has changed.\n */\n@Directive({\n selector: '[cdkObserveContent]',\n exportAs: 'cdkObserveContent',\n})\nexport class CdkObserveContent implements AfterContentInit, OnDestroy {\n private _contentObserver = inject(ContentObserver);\n private _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Event emitted for each change in the element's content. */\n @Output('cdkObserveContent') readonly event = new EventEmitter<MutationRecord[]>();\n\n /**\n * Whether observing content is disabled. This option can be used\n * to disconnect the underlying MutationObserver until it is needed.\n */\n @Input({alias: 'cdkObserveContentDisabled', transform: booleanAttribute})\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = value;\n this._disabled ? this._unsubscribe() : this._subscribe();\n }\n private _disabled = false;\n\n /** Debounce interval for emitting the changes. */\n @Input()\n get debounce(): number {\n return this._debounce;\n }\n set debounce(value: NumberInput) {\n this._debounce = coerceNumberProperty(value);\n this._subscribe();\n }\n private _debounce: number;\n\n private _currentSubscription: Subscription | null = null;\n\n constructor(...args: unknown[]);\n constructor() {}\n\n ngAfterContentInit() {\n if (!this._currentSubscription && !this.disabled) {\n this._subscribe();\n }\n }\n\n ngOnDestroy() {\n this._unsubscribe();\n }\n\n private _subscribe() {\n this._unsubscribe();\n const stream = this._contentObserver.observe(this._elementRef);\n\n this._currentSubscription = (\n this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream\n ).subscribe(this.event);\n }\n\n private _unsubscribe() {\n this._currentSubscription?.unsubscribe();\n }\n}\n\n@NgModule({\n imports: [CdkObserveContent],\n exports: [CdkObserveContent],\n providers: [MutationObserverFactory],\n})\nexport class ObserversModule {}\n"],"names":[],"mappings":";;;;;;AA0BA;AACA;AACA;AACA;AACA,SAAS,kBAAkB,CAAC,MAAsB,EAAA;;AAEhD,IAAA,IAAI,MAAM,CAAC,IAAI,KAAK,eAAe,IAAI,MAAM,CAAC,MAAM,YAAY,OAAO,EAAE;AACvE,QAAA,OAAO,IAAI;;;AAGb,IAAA,IAAI,MAAM,CAAC,IAAI,KAAK,WAAW,EAAE;AAC/B,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACjD,YAAA,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,OAAO,CAAC,EAAE;AAC9C,gBAAA,OAAO,KAAK;;;AAGhB,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACnD,YAAA,IAAI,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,OAAO,CAAC,EAAE;AAChD,gBAAA,OAAO,KAAK;;;AAGhB,QAAA,OAAO,IAAI;;;AAGb,IAAA,OAAO,KAAK;AACd;AAEA;;;AAGG;MAEU,uBAAuB,CAAA;AAClC,IAAA,MAAM,CAAC,QAA0B,EAAA;AAC/B,QAAA,OAAO,OAAO,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC;;8GAF7E,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAvB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,eAAA,EAA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AiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,QAAQ,EAAE,mBAAmB;AAC9B,iBAAA;wDAMuC,KAAK,EAAA,CAAA;sBAA1C,MAAM;uBAAC,mBAAmB;gBAOvB,QAAQ,EAAA,CAAA;sBADX,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA,EAAC,KAAK,EAAE,2BAA2B,EAAE,SAAS,EAAE,gBAAgB,EAAC;gBAYpE,QAAQ,EAAA,CAAA;sBADX;;MA4CU,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;+GAAf,eAAe,EAAA,OAAA,EAAA,CAlEf,iBAAiB,CAAA,EAAA,OAAA,EAAA,CAAjB,iBAAiB,CAAA,EAAA,CAAA;+GAkEjB,eAAe,EAAA,SAAA,EAFf,CAAC,uBAAuB,CAAC,EAAA,CAAA;;kGAEzB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAL3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,iBAAiB,CAAC;oBAC5B,OAAO,EAAE,CAAC,iBAAiB,CAAC;oBAC5B,SAAS,EAAE,CAAC,uBAAuB,CAAC;AACrC,iBAAA;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, NgZone, Injectable, RendererFactory2, ViewEncapsulation, ChangeDetectionStrategy, Component, afterNextRender, ElementRef, Injector, ANIMATION_MODULE_TYPE, EnvironmentInjector, ApplicationRef, InjectionToken, EventEmitter, TemplateRef, ViewContainerRef, booleanAttribute, Directive, Output, Input, NgModule } from '@angular/core';
3
- import { DOCUMENT, Location } from '@angular/common';
2
+ import { DOCUMENT, NgZone, inject, Injector, Injectable, RendererFactory2, ViewEncapsulation, ChangeDetectionStrategy, Component, afterNextRender, ElementRef, ApplicationRef, Renderer2, ANIMATION_MODULE_TYPE, EnvironmentInjector, InjectionToken, EventEmitter, TemplateRef, ViewContainerRef, booleanAttribute, Directive, Output, Input, NgModule } from '@angular/core';
3
+ import { Location } from '@angular/common';
4
4
  import { Platform } from './platform-BInyKIh1.mjs';
5
5
  import { _getEventTarget } from './shadow-dom-DFvX9W95.mjs';
6
6
  import { _isTestEnvironment } from './test-environment-BgaaXvCA.mjs';
@@ -8,17 +8,25 @@ import { _CdkPrivateStyleLoader } from './style-loader-DpEDdstc.mjs';
8
8
  import { Subject, Subscription } from 'rxjs';
9
9
  import { coerceCssPixelValue } from './css-pixel-value-C1yoKJ7R.mjs';
10
10
  import { coerceArray } from './array-Hg8isvLj.mjs';
11
- import { ScrollDispatcher, ViewportRuler, ScrollingModule } from './scrolling.mjs';
11
+ import { ViewportRuler, ScrollDispatcher, ScrollingModule } from './scrolling.mjs';
12
12
  import { supportsScrollBehavior } from './scrolling-BXVcIfjZ.mjs';
13
13
  import { filter, takeWhile } from 'rxjs/operators';
14
14
  import { DomPortalOutlet, TemplatePortal, PortalModule } from './portal.mjs';
15
- import { Directionality } from './directionality-6lVHj23y.mjs';
16
15
  import { _IdGenerator } from './id-generator-B33AfkWd.mjs';
16
+ import { Directionality } from './directionality-kM9GX3mp.mjs';
17
17
  import { ESCAPE } from './keycodes-DPWmI2Ix.mjs';
18
18
  import { hasModifierKey } from './keycodes.mjs';
19
19
  import { BidiModule } from './bidi.mjs';
20
20
 
21
21
  const scrollBehaviorSupported = supportsScrollBehavior();
22
+ /**
23
+ * Creates a scroll strategy that prevents the user from scrolling while the overlay is open.
24
+ * @param injector Injector used to resolve dependencies of the scroll strategy.
25
+ * @param config Configuration options for the scroll strategy.
26
+ */
27
+ function createBlockScrollStrategy(injector) {
28
+ return new BlockScrollStrategy(injector.get(ViewportRuler), injector.get(DOCUMENT));
29
+ }
22
30
  /**
23
31
  * Strategy that will prevent the user from scrolling while the overlay is visible.
24
32
  */
@@ -86,9 +94,9 @@ class BlockScrollStrategy {
86
94
  if (html.classList.contains('cdk-global-scrollblock') || this._isEnabled) {
87
95
  return false;
88
96
  }
89
- const body = this._document.body;
97
+ const rootElement = this._document.documentElement;
90
98
  const viewport = this._viewportRuler.getViewportSize();
91
- return body.scrollHeight > viewport.height || body.scrollWidth > viewport.width;
99
+ return rootElement.scrollHeight > viewport.height || rootElement.scrollWidth > viewport.width;
92
100
  }
93
101
  }
94
102
 
@@ -99,6 +107,14 @@ function getMatScrollStrategyAlreadyAttachedError() {
99
107
  return Error(`Scroll strategy has already been attached.`);
100
108
  }
101
109
 
110
+ /**
111
+ * Creates a scroll strategy that closes the overlay when the user starts to scroll.
112
+ * @param injector Injector used to resolve dependencies of the scroll strategy.
113
+ * @param config Configuration options for the scroll strategy.
114
+ */
115
+ function createCloseScrollStrategy(injector, config) {
116
+ return new CloseScrollStrategy(injector.get(ScrollDispatcher), injector.get(NgZone), injector.get(ViewportRuler), config);
117
+ }
102
118
  /**
103
119
  * Strategy that will close the overlay as soon as the user starts scrolling.
104
120
  */
@@ -168,6 +184,10 @@ class CloseScrollStrategy {
168
184
  };
169
185
  }
170
186
 
187
+ /** Creates a scroll strategy that does nothing. */
188
+ function createNoopScrollStrategy() {
189
+ return new NoopScrollStrategy();
190
+ }
171
191
  /** Scroll strategy that doesn't do anything. */
172
192
  class NoopScrollStrategy {
173
193
  /** Does nothing, as this scroll strategy is a no-op. */
@@ -211,6 +231,14 @@ function isElementClippedByScrolling(element, scrollContainers) {
211
231
  });
212
232
  }
213
233
 
234
+ /**
235
+ * Creates a scroll strategy that updates the overlay's position when the user scrolls.
236
+ * @param injector Injector used to resolve dependencies of the scroll strategy.
237
+ * @param config Configuration options for the scroll strategy.
238
+ */
239
+ function createRepositionScrollStrategy(injector, config) {
240
+ return new RepositionScrollStrategy(injector.get(ScrollDispatcher), injector.get(ViewportRuler), injector.get(NgZone), config);
241
+ }
214
242
  /**
215
243
  * Strategy that will update the element position as the user is scrolling.
216
244
  */
@@ -275,10 +303,7 @@ class RepositionScrollStrategy {
275
303
  * behaviors. This class primarily acts as a factory for ScrollStrategy instances.
276
304
  */
277
305
  class ScrollStrategyOptions {
278
- _scrollDispatcher = inject(ScrollDispatcher);
279
- _viewportRuler = inject(ViewportRuler);
280
- _ngZone = inject(NgZone);
281
- _document = inject(DOCUMENT);
306
+ _injector = inject(Injector);
282
307
  constructor() { }
283
308
  /** Do nothing on scroll. */
284
309
  noop = () => new NoopScrollStrategy();
@@ -286,15 +311,15 @@ class ScrollStrategyOptions {
286
311
  * Close the overlay as soon as the user scrolls.
287
312
  * @param config Configuration to be used inside the scroll strategy.
288
313
  */
289
- close = (config) => new CloseScrollStrategy(this._scrollDispatcher, this._ngZone, this._viewportRuler, config);
314
+ close = (config) => createCloseScrollStrategy(this._injector, config);
290
315
  /** Block scrolling. */
291
- block = () => new BlockScrollStrategy(this._viewportRuler, this._document);
316
+ block = () => createBlockScrollStrategy(this._injector);
292
317
  /**
293
318
  * Update the overlay's position on scroll.
294
319
  * @param config Configuration to be used inside the scroll strategy.
295
320
  * Allows debouncing the reposition calls.
296
321
  */
297
- reposition = (config) => new RepositionScrollStrategy(this._scrollDispatcher, this._viewportRuler, this._ngZone, config);
322
+ reposition = (config) => createRepositionScrollStrategy(this._injector, config);
298
323
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: ScrollStrategyOptions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
299
324
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: ScrollStrategyOptions, providedIn: 'root' });
300
325
  }
@@ -1222,6 +1247,14 @@ class OverlayRef {
1222
1247
  const boundingBoxClass = 'cdk-overlay-connected-position-bounding-box';
1223
1248
  /** Regex used to split a string on its CSS units. */
1224
1249
  const cssUnitPattern = /([A-Za-z%]+)$/;
1250
+ /**
1251
+ * Creates a flexible position strategy.
1252
+ * @param injector Injector used to resolve dependnecies for the position strategy.
1253
+ * @param origin Origin relative to which to position the overlay.
1254
+ */
1255
+ function createFlexibleConnectedPositionStrategy(injector, origin) {
1256
+ return new FlexibleConnectedPositionStrategy(origin, injector.get(ViewportRuler), injector.get(DOCUMENT), injector.get(Platform), injector.get(OverlayContainer));
1257
+ }
1225
1258
  /**
1226
1259
  * A strategy for positioning overlays. Using this strategy, an overlay is given an
1227
1260
  * implicit position relative some origin element. The relative position is defined in terms of
@@ -2243,6 +2276,15 @@ const STANDARD_DROPDOWN_ADJACENT_POSITIONS = [
2243
2276
 
2244
2277
  /** Class to be added to the overlay pane wrapper. */
2245
2278
  const wrapperClass = 'cdk-global-overlay-wrapper';
2279
+ /**
2280
+ * Creates a global position strategy.
2281
+ * @param injector Injector used to resolve dependencies for the strategy.
2282
+ */
2283
+ function createGlobalPositionStrategy(_injector) {
2284
+ // Note: `injector` is unused, but we may need it in
2285
+ // the future which would introduce a breaking change.
2286
+ return new GlobalPositionStrategy();
2287
+ }
2246
2288
  /**
2247
2289
  * A strategy for positioning overlays. Using this strategy, an overlay is given an
2248
2290
  * explicit position relative to the browser's viewport. We use flexbox, instead of
@@ -2473,23 +2515,20 @@ class GlobalPositionStrategy {
2473
2515
 
2474
2516
  /** Builder for overlay position strategy. */
2475
2517
  class OverlayPositionBuilder {
2476
- _viewportRuler = inject(ViewportRuler);
2477
- _document = inject(DOCUMENT);
2478
- _platform = inject(Platform);
2479
- _overlayContainer = inject(OverlayContainer);
2518
+ _injector = inject(Injector);
2480
2519
  constructor() { }
2481
2520
  /**
2482
2521
  * Creates a global position strategy.
2483
2522
  */
2484
2523
  global() {
2485
- return new GlobalPositionStrategy();
2524
+ return createGlobalPositionStrategy();
2486
2525
  }
2487
2526
  /**
2488
2527
  * Creates a flexible position strategy.
2489
2528
  * @param origin Origin relative to which to position the overlay.
2490
2529
  */
2491
2530
  flexibleConnectedTo(origin) {
2492
- return new FlexibleConnectedPositionStrategy(origin, this._viewportRuler, this._document, this._platform, this._overlayContainer);
2531
+ return createFlexibleConnectedPositionStrategy(this._injector, origin);
2493
2532
  }
2494
2533
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: OverlayPositionBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2495
2534
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: OverlayPositionBuilder, providedIn: 'root' });
@@ -2499,6 +2538,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.5",
2499
2538
  args: [{ providedIn: 'root' }]
2500
2539
  }], ctorParameters: () => [] });
2501
2540
 
2541
+ /**
2542
+ * Creates an overlay.
2543
+ * @param injector Injector to use when resolving the overlay's dependencies.
2544
+ * @param config Configuration applied to the overlay.
2545
+ * @returns Reference to the created overlay.
2546
+ */
2547
+ function createOverlayRef(injector, config) {
2548
+ // This is done in the overlay container as well, but we have it here
2549
+ // since it's common to mock out the overlay container in tests.
2550
+ injector.get(_CdkPrivateStyleLoader).load(_CdkOverlayStyleLoader);
2551
+ const overlayContainer = injector.get(OverlayContainer);
2552
+ const doc = injector.get(DOCUMENT);
2553
+ const idGenerator = injector.get(_IdGenerator);
2554
+ const appRef = injector.get(ApplicationRef);
2555
+ const directionality = injector.get(Directionality);
2556
+ const host = doc.createElement('div');
2557
+ const pane = doc.createElement('div');
2558
+ pane.id = idGenerator.getId('cdk-overlay-');
2559
+ pane.classList.add('cdk-overlay-pane');
2560
+ host.appendChild(pane);
2561
+ overlayContainer.getContainerElement().appendChild(host);
2562
+ const portalOutlet = new DomPortalOutlet(pane, appRef, injector);
2563
+ const overlayConfig = new OverlayConfig(config);
2564
+ const renderer = injector.get(Renderer2, null, { optional: true }) ||
2565
+ injector.get(RendererFactory2).createRenderer(null, null);
2566
+ overlayConfig.direction = overlayConfig.direction || directionality.value;
2567
+ return new OverlayRef(portalOutlet, host, pane, overlayConfig, injector.get(NgZone), injector.get(OverlayKeyboardDispatcher), doc, injector.get(Location), injector.get(OverlayOutsideClickDispatcher), config?.disableAnimations ??
2568
+ injector.get(ANIMATION_MODULE_TYPE, null, { optional: true }) === 'NoopAnimations', injector.get(EnvironmentInjector), renderer);
2569
+ }
2502
2570
  /**
2503
2571
  * Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be
2504
2572
  * used as a low-level building block for other components. Dialogs, tooltips, menus,
@@ -2509,20 +2577,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.5",
2509
2577
  */
2510
2578
  class Overlay {
2511
2579
  scrollStrategies = inject(ScrollStrategyOptions);
2512
- _overlayContainer = inject(OverlayContainer);
2513
2580
  _positionBuilder = inject(OverlayPositionBuilder);
2514
- _keyboardDispatcher = inject(OverlayKeyboardDispatcher);
2515
2581
  _injector = inject(Injector);
2516
- _ngZone = inject(NgZone);
2517
- _document = inject(DOCUMENT);
2518
- _directionality = inject(Directionality);
2519
- _location = inject(Location);
2520
- _outsideClickDispatcher = inject(OverlayOutsideClickDispatcher);
2521
- _animationsModuleType = inject(ANIMATION_MODULE_TYPE, { optional: true });
2522
- _idGenerator = inject(_IdGenerator);
2523
- _renderer = inject(RendererFactory2).createRenderer(null, null);
2524
- _appRef;
2525
- _styleLoader = inject(_CdkPrivateStyleLoader);
2526
2582
  constructor() { }
2527
2583
  /**
2528
2584
  * Creates an overlay.
@@ -2530,15 +2586,7 @@ class Overlay {
2530
2586
  * @returns Reference to the created overlay.
2531
2587
  */
2532
2588
  create(config) {
2533
- // This is done in the overlay container as well, but we have it here
2534
- // since it's common to mock out the overlay container in tests.
2535
- this._styleLoader.load(_CdkOverlayStyleLoader);
2536
- const host = this._createHostElement();
2537
- const pane = this._createPaneElement(host);
2538
- const portalOutlet = this._createPortalOutlet(pane);
2539
- const overlayConfig = new OverlayConfig(config);
2540
- overlayConfig.direction = overlayConfig.direction || this._directionality.value;
2541
- return new OverlayRef(portalOutlet, host, pane, overlayConfig, this._ngZone, this._keyboardDispatcher, this._document, this._location, this._outsideClickDispatcher, config?.disableAnimations ?? this._animationsModuleType === 'NoopAnimations', this._injector.get(EnvironmentInjector), this._renderer);
2589
+ return createOverlayRef(this._injector, config);
2542
2590
  }
2543
2591
  /**
2544
2592
  * Gets a position builder that can be used, via fluent API,
@@ -2548,40 +2596,6 @@ class Overlay {
2548
2596
  position() {
2549
2597
  return this._positionBuilder;
2550
2598
  }
2551
- /**
2552
- * Creates the DOM element for an overlay and appends it to the overlay container.
2553
- * @returns Newly-created pane element
2554
- */
2555
- _createPaneElement(host) {
2556
- const pane = this._document.createElement('div');
2557
- pane.id = this._idGenerator.getId('cdk-overlay-');
2558
- pane.classList.add('cdk-overlay-pane');
2559
- host.appendChild(pane);
2560
- return pane;
2561
- }
2562
- /**
2563
- * Creates the host element that wraps around an overlay
2564
- * and can be used for advanced positioning.
2565
- * @returns Newly-create host element.
2566
- */
2567
- _createHostElement() {
2568
- const host = this._document.createElement('div');
2569
- this._overlayContainer.getContainerElement().appendChild(host);
2570
- return host;
2571
- }
2572
- /**
2573
- * Create a DomPortalOutlet into which the overlay content can be loaded.
2574
- * @param pane The DOM element to turn into a portal outlet.
2575
- * @returns A portal outlet for the given DOM element.
2576
- */
2577
- _createPortalOutlet(pane) {
2578
- // We have to resolve the ApplicationRef later in order to allow people
2579
- // to use overlay-based providers during app initialization.
2580
- if (!this._appRef) {
2581
- this._appRef = this._injector.get(ApplicationRef);
2582
- }
2583
- return new DomPortalOutlet(pane, this._appRef, this._injector);
2584
- }
2585
2599
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: Overlay, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2586
2600
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0-next.5", ngImport: i0, type: Overlay, providedIn: 'root' });
2587
2601
  }
@@ -3044,5 +3058,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.5",
3044
3058
  }]
3045
3059
  }] });
3046
3060
 
3047
- export { BlockScrollStrategy, CdkConnectedOverlay, CdkOverlayOrigin, CloseScrollStrategy, ConnectedOverlayPositionChange, ConnectionPositionPair, FlexibleConnectedPositionStrategy, GlobalPositionStrategy, NoopScrollStrategy, Overlay, OverlayConfig, OverlayContainer, OverlayKeyboardDispatcher, OverlayModule, OverlayOutsideClickDispatcher, OverlayPositionBuilder, OverlayRef, RepositionScrollStrategy, STANDARD_DROPDOWN_ADJACENT_POSITIONS, STANDARD_DROPDOWN_BELOW_POSITIONS, ScrollStrategyOptions, ScrollingVisibility, validateHorizontalPosition, validateVerticalPosition };
3048
- //# sourceMappingURL=overlay-module-UgjfuiDh.mjs.map
3061
+ export { BlockScrollStrategy, CdkConnectedOverlay, CdkOverlayOrigin, CloseScrollStrategy, ConnectedOverlayPositionChange, ConnectionPositionPair, FlexibleConnectedPositionStrategy, GlobalPositionStrategy, NoopScrollStrategy, Overlay, OverlayConfig, OverlayContainer, OverlayKeyboardDispatcher, OverlayModule, OverlayOutsideClickDispatcher, OverlayPositionBuilder, OverlayRef, RepositionScrollStrategy, STANDARD_DROPDOWN_ADJACENT_POSITIONS, STANDARD_DROPDOWN_BELOW_POSITIONS, ScrollStrategyOptions, ScrollingVisibility, createBlockScrollStrategy, createCloseScrollStrategy, createFlexibleConnectedPositionStrategy, createGlobalPositionStrategy, createNoopScrollStrategy, createOverlayRef, createRepositionScrollStrategy, validateHorizontalPosition, validateVerticalPosition };
3062
+ //# sourceMappingURL=overlay-module-BcjSxQND.mjs.map