@angular/cdk 12.2.6 → 12.2.10

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 (41) hide show
  1. package/a11y/live-announcer/live-announcer.d.ts +1 -1
  2. package/bundles/cdk-a11y.umd.js.map +1 -1
  3. package/bundles/cdk-drag-drop.umd.js +2 -1
  4. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  5. package/bundles/cdk-layout.umd.js +9 -5
  6. package/bundles/cdk-layout.umd.js.map +1 -1
  7. package/bundles/cdk-overlay.umd.js +22 -23
  8. package/bundles/cdk-overlay.umd.js.map +1 -1
  9. package/bundles/cdk-platform.umd.js +28 -0
  10. package/bundles/cdk-platform.umd.js.map +1 -1
  11. package/bundles/cdk.umd.js +1 -1
  12. package/bundles/cdk.umd.js.map +1 -1
  13. package/esm2015/a11y/focus-monitor/focus-monitor.js +1 -1
  14. package/esm2015/a11y/live-announcer/live-announcer.js +1 -1
  15. package/esm2015/drag-drop/drag-ref.js +3 -2
  16. package/esm2015/layout/media-matcher.js +10 -6
  17. package/esm2015/overlay/overlay-container.js +8 -15
  18. package/esm2015/overlay/overlay-ref.js +19 -13
  19. package/esm2015/platform/features/test-environment.js +27 -0
  20. package/esm2015/platform/public-api.js +2 -1
  21. package/esm2015/version.js +1 -1
  22. package/fesm2015/a11y.js.map +1 -1
  23. package/fesm2015/cdk.js +1 -1
  24. package/fesm2015/cdk.js.map +1 -1
  25. package/fesm2015/drag-drop.js +2 -1
  26. package/fesm2015/drag-drop.js.map +1 -1
  27. package/fesm2015/layout.js +9 -5
  28. package/fesm2015/layout.js.map +1 -1
  29. package/fesm2015/overlay.js +25 -26
  30. package/fesm2015/overlay.js.map +1 -1
  31. package/fesm2015/platform.js +28 -1
  32. package/fesm2015/platform.js.map +1 -1
  33. package/overlay/index.metadata.json +1 -1
  34. package/overlay/overlay-container.d.ts +1 -1
  35. package/overlay/overlay-ref.d.ts +2 -0
  36. package/package.json +1 -1
  37. package/platform/features/test-environment.d.ts +9 -0
  38. package/platform/index.metadata.json +1 -1
  39. package/platform/public-api.d.ts +1 -0
  40. package/schematics/ng-add/index.js +1 -1
  41. package/schematics/ng-add/index.mjs +1 -1
@@ -71,7 +71,7 @@
71
71
  * MediaQueryList for the query provided.
72
72
  */
73
73
  MediaMatcher.prototype.matchMedia = function (query) {
74
- if (this._platform.WEBKIT) {
74
+ if (this._platform.WEBKIT || this._platform.BLINK) {
75
75
  createEmptyStyleRule(query);
76
76
  }
77
77
  return this._matchMedia(query);
@@ -86,8 +86,13 @@
86
86
  { type: i1.Platform }
87
87
  ]; };
88
88
  /**
89
- * For Webkit engines that only trigger the MediaQueryListListener when
90
- * there is at least one CSS selector for the respective media query.
89
+ * Creates an empty stylesheet that is used to work around browser inconsistencies related to
90
+ * `matchMedia`. At the time of writing, it handles the following cases:
91
+ * 1. On WebKit browsers, a media query has to have at least one rule in order for `matchMedia`
92
+ * to fire. We work around it by declaring a dummy stylesheet with a `@media` declaration.
93
+ * 2. In some cases Blink browsers will stop firing the `matchMedia` listener if none of the rules
94
+ * inside the `@media` match existing elements on the page. We work around it by having one rule
95
+ * targeting the `body`. See https://github.com/angular/components/issues/23546.
91
96
  */
92
97
  function createEmptyStyleRule(query) {
93
98
  if (mediaQueriesForWebkitCompatibility.has(query)) {
@@ -100,8 +105,7 @@
100
105
  document.head.appendChild(mediaQueryStyleNode);
101
106
  }
102
107
  if (mediaQueryStyleNode.sheet) {
103
- mediaQueryStyleNode.sheet
104
- .insertRule("@media " + query + " {.fx-query-test{ }}", 0);
108
+ mediaQueryStyleNode.sheet.insertRule("@media " + query + " {body{ }}", 0);
105
109
  mediaQueriesForWebkitCompatibility.add(query);
106
110
  }
107
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cdk-layout.umd.js","sources":["../../../../../src/cdk/layout/layout-module.ts","../../../../../src/cdk/layout/media-matcher.ts","../../../../../src/cdk/layout/breakpoints-observer.ts","../../../../../src/cdk/layout/breakpoints.ts","../../../../../src/cdk/layout/public-api.ts","../../../../../src/cdk/layout/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 */\nimport {NgModule} from '@angular/core';\n\n\n@NgModule({})\nexport class LayoutModule {}\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 */\nimport {Injectable} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n/** Global registry for all dynamically-created, injected media queries. */\nconst mediaQueriesForWebkitCompatibility: Set<string> = new Set<string>();\n\n/** Style tag that holds all of the dynamically-created media queries. */\nlet mediaQueryStyleNode: HTMLStyleElement | undefined;\n\n/** A utility for calling matchMedia queries. */\n@Injectable({providedIn: 'root'})\nexport class MediaMatcher {\n /** The internal matchMedia method to return back a MediaQueryList like object. */\n private _matchMedia: (query: string) => MediaQueryList;\n\n constructor(private _platform: Platform) {\n this._matchMedia = this._platform.isBrowser && window.matchMedia ?\n // matchMedia is bound to the window scope intentionally as it is an illegal invocation to\n // call it from a different scope.\n window.matchMedia.bind(window) :\n noopMatchMedia;\n }\n\n /**\n * Evaluates the given media query and returns the native MediaQueryList from which results\n * can be retrieved.\n * Confirms the layout engine will trigger for the selector query provided and returns the\n * MediaQueryList for the query provided.\n */\n matchMedia(query: string): MediaQueryList {\n if (this._platform.WEBKIT) {\n createEmptyStyleRule(query);\n }\n return this._matchMedia(query);\n }\n}\n\n/**\n * For Webkit engines that only trigger the MediaQueryListListener when\n * there is at least one CSS selector for the respective media query.\n */\nfunction createEmptyStyleRule(query: string) {\n if (mediaQueriesForWebkitCompatibility.has(query)) {\n return;\n }\n\n try {\n if (!mediaQueryStyleNode) {\n mediaQueryStyleNode = document.createElement('style');\n mediaQueryStyleNode.setAttribute('type', 'text/css');\n document.head!.appendChild(mediaQueryStyleNode);\n }\n\n if (mediaQueryStyleNode.sheet) {\n (mediaQueryStyleNode.sheet as CSSStyleSheet)\n .insertRule(`@media ${query} {.fx-query-test{ }}`, 0);\n mediaQueriesForWebkitCompatibility.add(query);\n }\n } catch (e) {\n console.error(e);\n }\n}\n\n/** No-op matchMedia replacement for non-browser platforms. */\nfunction noopMatchMedia(query: string): MediaQueryList {\n // Use `as any` here to avoid adding additional necessary properties for\n // the noop matcher.\n return {\n matches: query === 'all' || query === '',\n media: query,\n addListener: () => {},\n removeListener: () => {}\n } as any;\n}\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\nimport {coerceArray} from '@angular/cdk/coercion';\nimport {Injectable, NgZone, OnDestroy} from '@angular/core';\nimport {combineLatest, concat, Observable, Observer, Subject} from 'rxjs';\nimport {debounceTime, map, skip, startWith, take, takeUntil} from 'rxjs/operators';\nimport {MediaMatcher} from './media-matcher';\n\n\n/** The current state of a layout breakpoint. */\nexport interface BreakpointState {\n /** Whether the breakpoint is currently matching. */\n matches: boolean;\n /**\n * A key boolean pair for each query provided to the observe method,\n * with its current matched state.\n */\n breakpoints: {\n [key: string]: boolean;\n };\n}\n\n/** The current state of a layout breakpoint. */\ninterface InternalBreakpointState {\n /** Whether the breakpoint is currently matching. */\n matches: boolean;\n /** The media query being to be matched */\n query: string;\n}\n\ninterface Query {\n observable: Observable<InternalBreakpointState>;\n mql: MediaQueryList;\n}\n\n/** Utility for checking the matching state of @media queries. */\n@Injectable({providedIn: 'root'})\nexport class BreakpointObserver implements OnDestroy {\n /** A map of all media queries currently being listened for. */\n private _queries = new Map<string, Query>();\n /** A subject for all other observables to takeUntil based on. */\n private readonly _destroySubject = new Subject<void>();\n\n constructor(private _mediaMatcher: MediaMatcher, private _zone: NgZone) {}\n\n /** Completes the active subject, signalling to all other observables to complete. */\n ngOnDestroy() {\n this._destroySubject.next();\n this._destroySubject.complete();\n }\n\n /**\n * Whether one or more media queries match the current viewport size.\n * @param value One or more media queries to check.\n * @returns Whether any of the media queries match.\n */\n isMatched(value: string | readonly string[]): boolean {\n const queries = splitQueries(coerceArray(value));\n return queries.some(mediaQuery => this._registerQuery(mediaQuery).mql.matches);\n }\n\n /**\n * Gets an observable of results for the given queries that will emit new results for any changes\n * in matching of the given queries.\n * @param value One or more media queries to check.\n * @returns A stream of matches for the given queries.\n */\n observe(value: string | readonly string[]): Observable<BreakpointState> {\n const queries = splitQueries(coerceArray(value));\n const observables = queries.map(query => this._registerQuery(query).observable);\n\n let stateObservable = combineLatest(observables);\n // Emit the first state immediately, and then debounce the subsequent emissions.\n stateObservable = concat(\n stateObservable.pipe(take(1)),\n stateObservable.pipe(skip(1), debounceTime(0)));\n return stateObservable.pipe(map(breakpointStates => {\n const response: BreakpointState = {\n matches: false,\n breakpoints: {},\n };\n breakpointStates.forEach(({matches, query}) => {\n response.matches = response.matches || matches;\n response.breakpoints[query] = matches;\n });\n return response;\n }));\n }\n\n /** Registers a specific query to be listened for. */\n private _registerQuery(query: string): Query {\n // Only set up a new MediaQueryList if it is not already being listened for.\n if (this._queries.has(query)) {\n return this._queries.get(query)!;\n }\n\n const mql = this._mediaMatcher.matchMedia(query);\n\n // Create callback for match changes and add it is as a listener.\n const queryObservable = new Observable((observer: Observer<MediaQueryList>) => {\n // Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed\n // back into the zone because matchMedia is only included in Zone.js by loading the\n // webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not\n // have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js\n // patches it.\n const handler = (e: any) => this._zone.run(() => observer.next(e));\n mql.addListener(handler);\n\n return () => {\n mql.removeListener(handler);\n };\n }).pipe(\n startWith(mql),\n map(({matches}) => ({query, matches})),\n takeUntil(this._destroySubject)\n );\n\n // Add the MediaQueryList to the set of queries.\n const output = {observable: queryObservable, mql};\n this._queries.set(query, output);\n return output;\n }\n}\n\n/**\n * Split each query string into separate query strings if two queries are provided as comma\n * separated.\n */\nfunction splitQueries(queries: readonly string[]): readonly string[] {\n return queries.map(query => query.split(','))\n .reduce((a1, a2) => a1.concat(a2))\n .map(query => query.trim());\n}\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// PascalCase is being used as Breakpoints is used like an enum.\n// tslint:disable-next-line:variable-name\nexport const Breakpoints = {\n XSmall: '(max-width: 599.98px)',\n Small: '(min-width: 600px) and (max-width: 959.98px)',\n Medium: '(min-width: 960px) and (max-width: 1279.98px)',\n Large: '(min-width: 1280px) and (max-width: 1919.98px)',\n XLarge: '(min-width: 1920px)',\n\n Handset: '(max-width: 599.98px) and (orientation: portrait), ' +\n '(max-width: 959.98px) and (orientation: landscape)',\n Tablet: '(min-width: 600px) and (max-width: 839.98px) and (orientation: portrait), ' +\n '(min-width: 960px) and (max-width: 1279.98px) and (orientation: landscape)',\n Web: '(min-width: 840px) and (orientation: portrait), ' +\n '(min-width: 1280px) and (orientation: landscape)',\n\n HandsetPortrait: '(max-width: 599.98px) and (orientation: portrait)',\n TabletPortrait: '(min-width: 600px) and (max-width: 839.98px) and (orientation: portrait)',\n WebPortrait: '(min-width: 840px) and (orientation: portrait)',\n\n HandsetLandscape: '(max-width: 959.98px) and (orientation: landscape)',\n TabletLandscape: '(min-width: 960px) and (max-width: 1279.98px) and (orientation: landscape)',\n WebLandscape: '(min-width: 1280px) and (orientation: landscape)',\n};\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 {LayoutModule} from './layout-module';\nexport {BreakpointObserver, BreakpointState} from './breakpoints-observer';\nexport {Breakpoints} from './breakpoints';\nexport {MediaMatcher} from './media-matcher';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["NgModule","Injectable","Platform","Subject","coerceArray","combineLatest","conc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,kDAAkD;QAEvD,eAAe,EAAE,mDAAmD;QACpE,cAAc,EAAE,0EAA0E;QAC1F,WAAW,EAAE,gDAAgD;QAE7D,gBAAgB,EAAE,oDAAoD;QACtE,eAAe,EAAE,4EAA4E;QAC7F,YAAY,EAAE,kDAAkD;;;IC7BlE;;;;;;;;ICAA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"cdk-layout.umd.js","sources":["../../../../../src/cdk/layout/layout-module.ts","../../../../../src/cdk/layout/media-matcher.ts","../../../../../src/cdk/layout/breakpoints-observer.ts","../../../../../src/cdk/layout/breakpoints.ts","../../../../../src/cdk/layout/public-api.ts","../../../../../src/cdk/layout/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 */\nimport {NgModule} from '@angular/core';\n\n\n@NgModule({})\nexport class LayoutModule {}\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 */\nimport {Injectable} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n/** Global registry for all dynamically-created, injected media queries. */\nconst mediaQueriesForWebkitCompatibility: Set<string> = new Set<string>();\n\n/** Style tag that holds all of the dynamically-created media queries. */\nlet mediaQueryStyleNode: HTMLStyleElement | undefined;\n\n/** A utility for calling matchMedia queries. */\n@Injectable({providedIn: 'root'})\nexport class MediaMatcher {\n /** The internal matchMedia method to return back a MediaQueryList like object. */\n private _matchMedia: (query: string) => MediaQueryList;\n\n constructor(private _platform: Platform) {\n this._matchMedia = this._platform.isBrowser && window.matchMedia ?\n // matchMedia is bound to the window scope intentionally as it is an illegal invocation to\n // call it from a different scope.\n window.matchMedia.bind(window) :\n noopMatchMedia;\n }\n\n /**\n * Evaluates the given media query and returns the native MediaQueryList from which results\n * can be retrieved.\n * Confirms the layout engine will trigger for the selector query provided and returns the\n * MediaQueryList for the query provided.\n */\n matchMedia(query: string): MediaQueryList {\n if (this._platform.WEBKIT || this._platform.BLINK) {\n createEmptyStyleRule(query);\n }\n return this._matchMedia(query);\n }\n}\n\n/**\n * Creates an empty stylesheet that is used to work around browser inconsistencies related to\n * `matchMedia`. At the time of writing, it handles the following cases:\n * 1. On WebKit browsers, a media query has to have at least one rule in order for `matchMedia`\n * to fire. We work around it by declaring a dummy stylesheet with a `@media` declaration.\n * 2. In some cases Blink browsers will stop firing the `matchMedia` listener if none of the rules\n * inside the `@media` match existing elements on the page. We work around it by having one rule\n * targeting the `body`. See https://github.com/angular/components/issues/23546.\n */\nfunction createEmptyStyleRule(query: string) {\n if (mediaQueriesForWebkitCompatibility.has(query)) {\n return;\n }\n\n try {\n if (!mediaQueryStyleNode) {\n mediaQueryStyleNode = document.createElement('style');\n mediaQueryStyleNode.setAttribute('type', 'text/css');\n document.head!.appendChild(mediaQueryStyleNode);\n }\n\n if (mediaQueryStyleNode.sheet) {\n mediaQueryStyleNode.sheet.insertRule(`@media ${query} {body{ }}`, 0);\n mediaQueriesForWebkitCompatibility.add(query);\n }\n } catch (e) {\n console.error(e);\n }\n}\n\n/** No-op matchMedia replacement for non-browser platforms. */\nfunction noopMatchMedia(query: string): MediaQueryList {\n // Use `as any` here to avoid adding additional necessary properties for\n // the noop matcher.\n return {\n matches: query === 'all' || query === '',\n media: query,\n addListener: () => {},\n removeListener: () => {}\n } as any;\n}\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\nimport {coerceArray} from '@angular/cdk/coercion';\nimport {Injectable, NgZone, OnDestroy} from '@angular/core';\nimport {combineLatest, concat, Observable, Observer, Subject} from 'rxjs';\nimport {debounceTime, map, skip, startWith, take, takeUntil} from 'rxjs/operators';\nimport {MediaMatcher} from './media-matcher';\n\n\n/** The current state of a layout breakpoint. */\nexport interface BreakpointState {\n /** Whether the breakpoint is currently matching. */\n matches: boolean;\n /**\n * A key boolean pair for each query provided to the observe method,\n * with its current matched state.\n */\n breakpoints: {\n [key: string]: boolean;\n };\n}\n\n/** The current state of a layout breakpoint. */\ninterface InternalBreakpointState {\n /** Whether the breakpoint is currently matching. */\n matches: boolean;\n /** The media query being to be matched */\n query: string;\n}\n\ninterface Query {\n observable: Observable<InternalBreakpointState>;\n mql: MediaQueryList;\n}\n\n/** Utility for checking the matching state of @media queries. */\n@Injectable({providedIn: 'root'})\nexport class BreakpointObserver implements OnDestroy {\n /** A map of all media queries currently being listened for. */\n private _queries = new Map<string, Query>();\n /** A subject for all other observables to takeUntil based on. */\n private readonly _destroySubject = new Subject<void>();\n\n constructor(private _mediaMatcher: MediaMatcher, private _zone: NgZone) {}\n\n /** Completes the active subject, signalling to all other observables to complete. */\n ngOnDestroy() {\n this._destroySubject.next();\n this._destroySubject.complete();\n }\n\n /**\n * Whether one or more media queries match the current viewport size.\n * @param value One or more media queries to check.\n * @returns Whether any of the media queries match.\n */\n isMatched(value: string | readonly string[]): boolean {\n const queries = splitQueries(coerceArray(value));\n return queries.some(mediaQuery => this._registerQuery(mediaQuery).mql.matches);\n }\n\n /**\n * Gets an observable of results for the given queries that will emit new results for any changes\n * in matching of the given queries.\n * @param value One or more media queries to check.\n * @returns A stream of matches for the given queries.\n */\n observe(value: string | readonly string[]): Observable<BreakpointState> {\n const queries = splitQueries(coerceArray(value));\n const observables = queries.map(query => this._registerQuery(query).observable);\n\n let stateObservable = combineLatest(observables);\n // Emit the first state immediately, and then debounce the subsequent emissions.\n stateObservable = concat(\n stateObservable.pipe(take(1)),\n stateObservable.pipe(skip(1), debounceTime(0)));\n return stateObservable.pipe(map(breakpointStates => {\n const response: BreakpointState = {\n matches: false,\n breakpoints: {},\n };\n breakpointStates.forEach(({matches, query}) => {\n response.matches = response.matches || matches;\n response.breakpoints[query] = matches;\n });\n return response;\n }));\n }\n\n /** Registers a specific query to be listened for. */\n private _registerQuery(query: string): Query {\n // Only set up a new MediaQueryList if it is not already being listened for.\n if (this._queries.has(query)) {\n return this._queries.get(query)!;\n }\n\n const mql = this._mediaMatcher.matchMedia(query);\n\n // Create callback for match changes and add it is as a listener.\n const queryObservable = new Observable((observer: Observer<MediaQueryList>) => {\n // Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed\n // back into the zone because matchMedia is only included in Zone.js by loading the\n // webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not\n // have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js\n // patches it.\n const handler = (e: any) => this._zone.run(() => observer.next(e));\n mql.addListener(handler);\n\n return () => {\n mql.removeListener(handler);\n };\n }).pipe(\n startWith(mql),\n map(({matches}) => ({query, matches})),\n takeUntil(this._destroySubject)\n );\n\n // Add the MediaQueryList to the set of queries.\n const output = {observable: queryObservable, mql};\n this._queries.set(query, output);\n return output;\n }\n}\n\n/**\n * Split each query string into separate query strings if two queries are provided as comma\n * separated.\n */\nfunction splitQueries(queries: readonly string[]): readonly string[] {\n return queries.map(query => query.split(','))\n .reduce((a1, a2) => a1.concat(a2))\n .map(query => query.trim());\n}\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// PascalCase is being used as Breakpoints is used like an enum.\n// tslint:disable-next-line:variable-name\nexport const Breakpoints = {\n XSmall: '(max-width: 599.98px)',\n Small: '(min-width: 600px) and (max-width: 959.98px)',\n Medium: '(min-width: 960px) and (max-width: 1279.98px)',\n Large: '(min-width: 1280px) and (max-width: 1919.98px)',\n XLarge: '(min-width: 1920px)',\n\n Handset: '(max-width: 599.98px) and (orientation: portrait), ' +\n '(max-width: 959.98px) and (orientation: landscape)',\n Tablet: '(min-width: 600px) and (max-width: 839.98px) and (orientation: portrait), ' +\n '(min-width: 960px) and (max-width: 1279.98px) and (orientation: landscape)',\n Web: '(min-width: 840px) and (orientation: portrait), ' +\n '(min-width: 1280px) and (orientation: landscape)',\n\n HandsetPortrait: '(max-width: 599.98px) and (orientation: portrait)',\n TabletPortrait: '(min-width: 600px) and (max-width: 839.98px) and (orientation: portrait)',\n WebPortrait: '(min-width: 840px) and (orientation: portrait)',\n\n HandsetLandscape: '(max-width: 959.98px) and (orientation: landscape)',\n TabletLandscape: '(min-width: 960px) and (max-width: 1279.98px) and (orientation: landscape)',\n WebLandscape: '(min-width: 1280px) and (orientation: landscape)',\n};\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 {LayoutModule} from './layout-module';\nexport {BreakpointObserver, BreakpointState} from './breakpoints-observer';\nexport {Breakpoints} from './breakpoints';\nexport {MediaMatcher} from './media-matcher';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["NgModule","Injectable","Platform","Subject","coerceArray","combineLatest","concat","take","skip","debounceTime","map","Observable","startWith","takeUntil","NgZone"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;;;;;;;;QAWA;;;;;gBADCA,WAAQ,SAAC,EAAE;;;ICVZ;;;;;;;IAUA;IACA,IAAM,kCAAkC,GAAgB,IAAI,GAAG,EAAU,CAAC;IAE1E;IACA,IAAI,mBAAiD,CAAC;IAEtD;;QAME,sBAAoB,SAAmB;YAAnB,cAAS,GAAT,SAAS,CAAU;YACrC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,IAAI,MAAM,CAAC,UAAU;;;gBAG9D,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;gBAC9B,cAAc,CAAC;SAClB;;;;;;;QAQD,iCAAU,GAAV,UAAW,KAAa;YACtB,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;gBACjD,oBAAoB,CAAC,KAAK,CAAC,CAAC;aAC7B;YACD,OAAO,IAAI,CAAC,WAAW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B;QAC9C,OAAO,OAAO,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAA,CAAC;aAC9B,MAAM,CAAC,UAAC,EAAE,EAAE,EAAE,IAAK,OAAA,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,GAAA,CAAC;aACjC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,IAAI,EAAE,GAAA,CAAC,CAAC;IAC5C;;IC1IA;;;;;;;IAOA;IACA;QACa,WAAW,GAAG;QACzB,MAAM,EAAE,uBAAuB;QAC/B,KAAK,EAAE,8CAA8C;QACrD,MAAM,EAAE,+CAA+C;QACvD,KAAK,EAAE,gDAAgD;QACvD,MAAM,EAAE,qBAAqB;QAE7B,OAAO,EAAE,qDAAqD;YACrD,oDAAoD;QAC7D,MAAM,EAAE,4EAA4E;YAC5E,4EAA4E;QACpF,GAAG,EAAE,kDAAkD;YAClD,kDAAkD;QAEvD,eAAe,EAAE,mDAAmD;QACpE,cAAc,EAAE,0EAA0E;QAC1F,WAAW,EAAE,gDAAgD;QAE7D,gBAAgB,EAAE,oDAAoD;QACtE,eAAe,EAAE,4EAA4E;QAC7F,YAAY,EAAE,kDAAkD;;;IC7BlE;;;;;;;;ICAA;;;;;;;;;;;;;;;"}
@@ -1023,16 +1023,6 @@
1023
1023
  * Use of this source code is governed by an MIT-style license that can be
1024
1024
  * found in the LICENSE file at https://angular.io/license
1025
1025
  */
1026
- var globalsForTest = (typeof window !== 'undefined' ? window : {});
1027
- /**
1028
- * Whether we're in a testing environment.
1029
- * TODO(crisbeto): remove this once we have an overlay testing module or Angular starts tearing
1030
- * down the testing `NgModule` (see https://github.com/angular/angular/issues/18831).
1031
- */
1032
- var isTestEnvironment = (typeof globalsForTest.__karma__ !== 'undefined' && !!globalsForTest.__karma__) ||
1033
- (typeof globalsForTest.jasmine !== 'undefined' && !!globalsForTest.jasmine) ||
1034
- (typeof globalsForTest.jest !== 'undefined' && !!globalsForTest.jest) ||
1035
- (typeof globalsForTest.Mocha !== 'undefined' && !!globalsForTest.Mocha);
1036
1026
  /** Container inside which all overlays will render. */
1037
1027
  var OverlayContainer = /** @class */ (function () {
1038
1028
  function OverlayContainer(document, _platform) {
@@ -1047,7 +1037,7 @@
1047
1037
  };
1048
1038
  /**
1049
1039
  * This method returns the overlay container element. It will lazily
1050
- * create the element the first time it is called to facilitate using
1040
+ * create the element the first time it is called to facilitate using
1051
1041
  * the container in non-browser environments.
1052
1042
  * @returns the container element
1053
1043
  */
@@ -1063,7 +1053,10 @@
1063
1053
  */
1064
1054
  OverlayContainer.prototype._createContainer = function () {
1065
1055
  var containerClass = 'cdk-overlay-container';
1066
- if (this._platform.isBrowser || isTestEnvironment) {
1056
+ // TODO(crisbeto): remove the testing check once we have an overlay testing
1057
+ // module or Angular starts tearing down the testing `NgModule`. See:
1058
+ // https://github.com/angular/angular/issues/18831
1059
+ if (this._platform.isBrowser || i2._isTestEnvironment()) {
1067
1060
  var oppositePlatformContainers = this._document.querySelectorAll("." + containerClass + "[platform=\"server\"], " +
1068
1061
  ("." + containerClass + "[platform=\"test\"]"));
1069
1062
  // Remove any old containers from the opposite platform.
@@ -1083,7 +1076,7 @@
1083
1076
  // module which does the cleanup, we try to detect that we're in a test environment and we
1084
1077
  // always clear the container. See #17006.
1085
1078
  // TODO(crisbeto): remove the test environment check once we have an overlay testing module.
1086
- if (isTestEnvironment) {
1079
+ if (i2._isTestEnvironment()) {
1087
1080
  container.setAttribute('platform', 'test');
1088
1081
  }
1089
1082
  else if (!this._platform.isBrowser) {
@@ -1260,7 +1253,7 @@
1260
1253
  this._positionStrategy.dispose();
1261
1254
  }
1262
1255
  this._disposeScrollStrategy();
1263
- this.detachBackdrop();
1256
+ this._disposeBackdrop(this._backdropElement);
1264
1257
  this._locationChanges.unsubscribe();
1265
1258
  this._keyboardDispatcher.remove(this);
1266
1259
  this._portalOutlet.dispose();
@@ -1446,15 +1439,7 @@
1446
1439
  if (backdropToDetach) {
1447
1440
  backdropToDetach.removeEventListener('click', _this._backdropClickHandler);
1448
1441
  backdropToDetach.removeEventListener('transitionend', finishDetach);
1449
- if (backdropToDetach.parentNode) {
1450
- backdropToDetach.parentNode.removeChild(backdropToDetach);
1451
- }
1452
- }
1453
- // It is possible that a new portal has been attached to this overlay since we started
1454
- // removing the backdrop. If that is the case, only clear the backdrop reference if it
1455
- // is still the same instance that we started to remove.
1456
- if (_this._backdropElement == backdropToDetach) {
1457
- _this._backdropElement = null;
1442
+ _this._disposeBackdrop(backdropToDetach);
1458
1443
  }
1459
1444
  if (_this._config.backdropClass) {
1460
1445
  _this._toggleClasses(backdropToDetach, _this._config.backdropClass, false);
@@ -1522,6 +1507,20 @@
1522
1507
  }
1523
1508
  }
1524
1509
  };
1510
+ /** Removes a backdrop element from the DOM. */
1511
+ OverlayRef.prototype._disposeBackdrop = function (backdrop) {
1512
+ if (backdrop) {
1513
+ if (backdrop.parentNode) {
1514
+ backdrop.parentNode.removeChild(backdrop);
1515
+ }
1516
+ // It is possible that a new portal has been attached to this overlay since we started
1517
+ // removing the backdrop. If that is the case, only clear the backdrop reference if it
1518
+ // is still the same instance that we started to remove.
1519
+ if (this._backdropElement === backdrop) {
1520
+ this._backdropElement = null;
1521
+ }
1522
+ }
1523
+ };
1525
1524
  return OverlayRef;
1526
1525
  }());
1527
1526