@angular/cdk 7.1.0 → 7.2.2

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 (267) hide show
  1. package/LICENSE +1 -1
  2. package/_a11y.scss +1 -1
  3. package/a11y/typings/focus-monitor/focus-monitor.d.ts +20 -5
  4. package/a11y/typings/focus-trap/focus-trap.d.ts +2 -0
  5. package/a11y/typings/index.metadata.json +1 -1
  6. package/bundles/cdk-a11y.umd.js +428 -197
  7. package/bundles/cdk-a11y.umd.js.map +1 -1
  8. package/bundles/cdk-a11y.umd.min.js +1 -1
  9. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  10. package/bundles/cdk-accordion.umd.js +16 -9
  11. package/bundles/cdk-accordion.umd.js.map +1 -1
  12. package/bundles/cdk-accordion.umd.min.js.map +1 -1
  13. package/bundles/cdk-bidi.umd.js +11 -6
  14. package/bundles/cdk-bidi.umd.js.map +1 -1
  15. package/bundles/cdk-bidi.umd.min.js.map +1 -1
  16. package/bundles/cdk-coercion.umd.js +25 -9
  17. package/bundles/cdk-coercion.umd.js.map +1 -1
  18. package/bundles/cdk-coercion.umd.min.js +1 -1
  19. package/bundles/cdk-coercion.umd.min.js.map +1 -1
  20. package/bundles/cdk-collections.umd.js +28 -5
  21. package/bundles/cdk-collections.umd.js.map +1 -1
  22. package/bundles/cdk-collections.umd.min.js.map +1 -1
  23. package/bundles/cdk-drag-drop.umd.js +2297 -973
  24. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  25. package/bundles/cdk-drag-drop.umd.min.js +2 -1
  26. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  27. package/bundles/cdk-keycodes.umd.js +12 -2
  28. package/bundles/cdk-keycodes.umd.js.map +1 -1
  29. package/bundles/cdk-layout.umd.js +29 -22
  30. package/bundles/cdk-layout.umd.js.map +1 -1
  31. package/bundles/cdk-layout.umd.min.js +1 -1
  32. package/bundles/cdk-layout.umd.min.js.map +1 -1
  33. package/bundles/cdk-observers.umd.js +27 -8
  34. package/bundles/cdk-observers.umd.js.map +1 -1
  35. package/bundles/cdk-observers.umd.min.js +1 -1
  36. package/bundles/cdk-observers.umd.min.js.map +1 -1
  37. package/bundles/cdk-overlay.umd.js +586 -240
  38. package/bundles/cdk-overlay.umd.js.map +1 -1
  39. package/bundles/cdk-overlay.umd.min.js +2 -2
  40. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  41. package/bundles/cdk-platform.umd.js +50 -28
  42. package/bundles/cdk-platform.umd.js.map +1 -1
  43. package/bundles/cdk-platform.umd.min.js.map +1 -1
  44. package/bundles/cdk-portal.umd.js +17 -10
  45. package/bundles/cdk-portal.umd.js.map +1 -1
  46. package/bundles/cdk-portal.umd.min.js.map +1 -1
  47. package/bundles/cdk-scrolling.umd.js +148 -50
  48. package/bundles/cdk-scrolling.umd.js.map +1 -1
  49. package/bundles/cdk-scrolling.umd.min.js +1 -1
  50. package/bundles/cdk-scrolling.umd.min.js.map +1 -1
  51. package/bundles/cdk-stepper.umd.js +69 -27
  52. package/bundles/cdk-stepper.umd.js.map +1 -1
  53. package/bundles/cdk-stepper.umd.min.js +1 -1
  54. package/bundles/cdk-stepper.umd.min.js.map +1 -1
  55. package/bundles/cdk-table.umd.js +189 -51
  56. package/bundles/cdk-table.umd.js.map +1 -1
  57. package/bundles/cdk-table.umd.min.js +1 -1
  58. package/bundles/cdk-table.umd.min.js.map +1 -1
  59. package/bundles/cdk-text-field.umd.js +76 -38
  60. package/bundles/cdk-text-field.umd.js.map +1 -1
  61. package/bundles/cdk-text-field.umd.min.js +1 -1
  62. package/bundles/cdk-text-field.umd.min.js.map +1 -1
  63. package/bundles/cdk-tree.umd.js +71 -34
  64. package/bundles/cdk-tree.umd.js.map +1 -1
  65. package/bundles/cdk-tree.umd.min.js +1 -1
  66. package/bundles/cdk-tree.umd.min.js.map +1 -1
  67. package/bundles/cdk.umd.js +5 -4
  68. package/bundles/cdk.umd.js.map +1 -1
  69. package/bundles/cdk.umd.min.js +1 -1
  70. package/bundles/cdk.umd.min.js.map +1 -1
  71. package/coercion/typings/element.d.ts +13 -0
  72. package/coercion/typings/index.metadata.json +1 -1
  73. package/coercion/typings/public-api.d.ts +1 -0
  74. package/drag-drop/typings/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
  75. package/drag-drop/typings/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  76. package/drag-drop/typings/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  77. package/drag-drop/typings/directives/drag.d.ts +110 -0
  78. package/{typings/esm5/drag-drop → drag-drop/typings/directives}/drop-list-group.d.ts +3 -0
  79. package/drag-drop/typings/{drop-list.d.ts → directives/drop-list.d.ts} +32 -72
  80. package/drag-drop/typings/drag-drop-registry.d.ts +8 -3
  81. package/drag-drop/typings/drag-events.d.ts +14 -7
  82. package/{typings/esm5/drag-drop/drag.d.ts → drag-drop/typings/drag-ref.d.ts} +152 -83
  83. package/drag-drop/typings/drop-list-container.d.ts +19 -3
  84. package/drag-drop/typings/drop-list-ref.d.ts +234 -0
  85. package/drag-drop/typings/index.d.ts +1 -0
  86. package/drag-drop/typings/index.metadata.json +1 -1
  87. package/drag-drop/typings/public-api.d.ts +13 -6
  88. package/esm2015/a11y.js +306 -182
  89. package/esm2015/a11y.js.map +1 -1
  90. package/esm2015/accordion.js +16 -11
  91. package/esm2015/accordion.js.map +1 -1
  92. package/esm2015/bidi.js +13 -8
  93. package/esm2015/bidi.js.map +1 -1
  94. package/esm2015/cdk.js +7 -6
  95. package/esm2015/cdk.js.map +1 -1
  96. package/esm2015/coercion.js +25 -8
  97. package/esm2015/coercion.js.map +1 -1
  98. package/esm2015/collections.js +22 -7
  99. package/esm2015/collections.js.map +1 -1
  100. package/esm2015/drag-drop.js +1774 -864
  101. package/esm2015/drag-drop.js.map +1 -1
  102. package/esm2015/keycodes.js +14 -4
  103. package/esm2015/keycodes.js.map +1 -1
  104. package/esm2015/layout.js +29 -19
  105. package/esm2015/layout.js.map +1 -1
  106. package/esm2015/observers.js +16 -11
  107. package/esm2015/observers.js.map +1 -1
  108. package/esm2015/overlay.js +373 -213
  109. package/esm2015/overlay.js.map +1 -1
  110. package/esm2015/platform.js +53 -31
  111. package/esm2015/platform.js.map +1 -1
  112. package/esm2015/portal.js +14 -10
  113. package/esm2015/portal.js.map +1 -1
  114. package/esm2015/scrolling.js +111 -51
  115. package/esm2015/scrolling.js.map +1 -1
  116. package/esm2015/stepper.js +56 -30
  117. package/esm2015/stepper.js.map +1 -1
  118. package/esm2015/table.js +96 -48
  119. package/esm2015/table.js.map +1 -1
  120. package/esm2015/text-field.js +54 -37
  121. package/esm2015/text-field.js.map +1 -1
  122. package/esm2015/tree.js +55 -36
  123. package/esm2015/tree.js.map +1 -1
  124. package/esm5/a11y.es5.js +432 -201
  125. package/esm5/a11y.es5.js.map +1 -1
  126. package/esm5/accordion.es5.js +18 -11
  127. package/esm5/accordion.es5.js.map +1 -1
  128. package/esm5/bidi.es5.js +13 -8
  129. package/esm5/bidi.es5.js.map +1 -1
  130. package/esm5/cdk.es5.js +7 -6
  131. package/esm5/cdk.es5.js.map +1 -1
  132. package/esm5/coercion.es5.js +25 -8
  133. package/esm5/coercion.es5.js.map +1 -1
  134. package/esm5/collections.es5.js +35 -7
  135. package/esm5/collections.es5.js.map +1 -1
  136. package/esm5/drag-drop.es5.js +2358 -1035
  137. package/esm5/drag-drop.es5.js.map +1 -1
  138. package/esm5/keycodes.es5.js +14 -4
  139. package/esm5/keycodes.es5.js.map +1 -1
  140. package/esm5/layout.es5.js +31 -24
  141. package/esm5/layout.es5.js.map +1 -1
  142. package/esm5/observers.es5.js +30 -11
  143. package/esm5/observers.es5.js.map +1 -1
  144. package/esm5/overlay.es5.js +590 -244
  145. package/esm5/overlay.es5.js.map +1 -1
  146. package/esm5/platform.es5.js +52 -30
  147. package/esm5/platform.es5.js.map +1 -1
  148. package/esm5/portal.es5.js +19 -12
  149. package/esm5/portal.es5.js.map +1 -1
  150. package/esm5/scrolling.es5.js +150 -52
  151. package/esm5/scrolling.es5.js.map +1 -1
  152. package/esm5/stepper.es5.js +71 -30
  153. package/esm5/stepper.es5.js.map +1 -1
  154. package/esm5/table.es5.js +191 -53
  155. package/esm5/table.es5.js.map +1 -1
  156. package/esm5/text-field.es5.js +75 -37
  157. package/esm5/text-field.es5.js.map +1 -1
  158. package/esm5/tree.es5.js +74 -37
  159. package/esm5/tree.es5.js.map +1 -1
  160. package/overlay/typings/index.metadata.json +1 -1
  161. package/overlay/typings/overlay-directives.d.ts +0 -2
  162. package/overlay/typings/overlay-ref.d.ts +1 -1
  163. package/package.json +4 -4
  164. package/portal/typings/portal.d.ts +1 -1
  165. package/schematics/migration.json +5 -0
  166. package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts +2 -2
  167. package/schematics/ng-update/index.d.ts +2 -0
  168. package/schematics/ng-update/index.js +5 -0
  169. package/schematics/ng-update/index.js.map +1 -1
  170. package/schematics/ng-update/target-version.d.ts +7 -1
  171. package/schematics/ng-update/target-version.js +10 -0
  172. package/schematics/ng-update/target-version.js.map +1 -1
  173. package/schematics/ng-update/upgrade-data.js +2 -1
  174. package/schematics/ng-update/upgrade-data.js.map +1 -1
  175. package/schematics/ng-update/upgrade-rules/index.js +3 -2
  176. package/schematics/ng-update/upgrade-rules/index.js.map +1 -1
  177. package/schematics/utils/ast/ng-module-imports.d.ts +1 -1
  178. package/schematics/utils/ast/ng-module-imports.js +25 -13
  179. package/schematics/utils/ast/ng-module-imports.js.map +1 -1
  180. package/schematics/utils/get-project.js +2 -1
  181. package/schematics/utils/get-project.js.map +1 -1
  182. package/schematics/utils/parse5-element.js +3 -2
  183. package/schematics/utils/parse5-element.js.map +1 -1
  184. package/schematics/utils/project-targets.js +2 -1
  185. package/schematics/utils/project-targets.js.map +1 -1
  186. package/schematics/utils/version-agnostic-typescript.js +3 -2
  187. package/schematics/utils/version-agnostic-typescript.js.map +1 -1
  188. package/scrolling/typings/index.metadata.json +1 -1
  189. package/stepper/typings/index.metadata.json +1 -1
  190. package/stepper/typings/stepper.d.ts +13 -1
  191. package/text-field/typings/autosize.d.ts +6 -0
  192. package/text-field/typings/index.metadata.json +1 -1
  193. package/tree/typings/control/base-tree-control.d.ts +1 -1
  194. package/tree/typings/control/nested-tree-control.d.ts +2 -2
  195. package/tree/typings/control/tree-control.d.ts +1 -1
  196. package/tree/typings/nested-node.d.ts +5 -5
  197. package/typings/a11y/focus-monitor/focus-monitor.d.ts +20 -5
  198. package/typings/a11y/focus-trap/focus-trap.d.ts +2 -0
  199. package/typings/a11y/index.metadata.json +1 -1
  200. package/typings/coercion/element.d.ts +13 -0
  201. package/typings/coercion/index.metadata.json +1 -1
  202. package/typings/coercion/public-api.d.ts +1 -0
  203. package/typings/drag-drop/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
  204. package/typings/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  205. package/typings/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  206. package/typings/drag-drop/directives/drag.d.ts +110 -0
  207. package/typings/drag-drop/{drop-list-group.d.ts → directives/drop-list-group.d.ts} +3 -0
  208. package/typings/{esm5/drag-drop → drag-drop/directives}/drop-list.d.ts +32 -72
  209. package/typings/drag-drop/drag-drop-registry.d.ts +8 -3
  210. package/typings/drag-drop/drag-events.d.ts +14 -7
  211. package/typings/drag-drop/{drag.d.ts → drag-ref.d.ts} +152 -83
  212. package/typings/drag-drop/drop-list-container.d.ts +19 -3
  213. package/typings/drag-drop/drop-list-ref.d.ts +234 -0
  214. package/typings/drag-drop/index.d.ts +1 -0
  215. package/typings/drag-drop/index.metadata.json +1 -1
  216. package/typings/drag-drop/public-api.d.ts +13 -6
  217. package/typings/esm5/a11y/focus-monitor/focus-monitor.d.ts +20 -5
  218. package/typings/esm5/a11y/focus-trap/focus-trap.d.ts +2 -0
  219. package/typings/esm5/a11y/index.metadata.json +1 -1
  220. package/typings/esm5/coercion/element.d.ts +13 -0
  221. package/typings/esm5/coercion/index.metadata.json +1 -1
  222. package/typings/esm5/coercion/public-api.d.ts +1 -0
  223. package/typings/esm5/drag-drop/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
  224. package/typings/esm5/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
  225. package/typings/esm5/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
  226. package/typings/esm5/drag-drop/directives/drag.d.ts +110 -0
  227. package/{drag-drop/typings → typings/esm5/drag-drop/directives}/drop-list-group.d.ts +3 -0
  228. package/typings/{drag-drop → esm5/drag-drop/directives}/drop-list.d.ts +32 -72
  229. package/typings/esm5/drag-drop/drag-drop-registry.d.ts +8 -3
  230. package/typings/esm5/drag-drop/drag-events.d.ts +14 -7
  231. package/{drag-drop/typings/drag.d.ts → typings/esm5/drag-drop/drag-ref.d.ts} +152 -83
  232. package/typings/esm5/drag-drop/drop-list-container.d.ts +19 -3
  233. package/typings/esm5/drag-drop/drop-list-ref.d.ts +234 -0
  234. package/typings/esm5/drag-drop/index.d.ts +1 -0
  235. package/typings/esm5/drag-drop/index.metadata.json +1 -1
  236. package/typings/esm5/drag-drop/public-api.d.ts +13 -6
  237. package/typings/esm5/index.metadata.json +1 -1
  238. package/typings/esm5/overlay/index.metadata.json +1 -1
  239. package/typings/esm5/overlay/overlay-directives.d.ts +0 -2
  240. package/typings/esm5/overlay/overlay-ref.d.ts +1 -1
  241. package/typings/esm5/portal/portal.d.ts +1 -1
  242. package/typings/esm5/scrolling/index.metadata.json +1 -1
  243. package/typings/esm5/stepper/index.metadata.json +1 -1
  244. package/typings/esm5/stepper/stepper.d.ts +13 -1
  245. package/typings/esm5/text-field/autosize.d.ts +6 -0
  246. package/typings/esm5/text-field/index.metadata.json +1 -1
  247. package/typings/esm5/tree/control/base-tree-control.d.ts +1 -1
  248. package/typings/esm5/tree/control/nested-tree-control.d.ts +2 -2
  249. package/typings/esm5/tree/control/tree-control.d.ts +1 -1
  250. package/typings/esm5/tree/nested-node.d.ts +5 -5
  251. package/typings/index.metadata.json +1 -1
  252. package/typings/overlay/index.metadata.json +1 -1
  253. package/typings/overlay/overlay-directives.d.ts +0 -2
  254. package/typings/overlay/overlay-ref.d.ts +1 -1
  255. package/typings/portal/portal.d.ts +1 -1
  256. package/typings/schematics/ng-update/index.d.ts +2 -0
  257. package/typings/schematics/ng-update/target-version.d.ts +7 -1
  258. package/typings/schematics/utils/ast/ng-module-imports.d.ts +1 -1
  259. package/typings/scrolling/index.metadata.json +1 -1
  260. package/typings/stepper/index.metadata.json +1 -1
  261. package/typings/stepper/stepper.d.ts +13 -1
  262. package/typings/text-field/autosize.d.ts +6 -0
  263. package/typings/text-field/index.metadata.json +1 -1
  264. package/typings/tree/control/base-tree-control.d.ts +1 -1
  265. package/typings/tree/control/nested-tree-control.d.ts +2 -2
  266. package/typings/tree/control/tree-control.d.ts +1 -1
  267. package/typings/tree/nested-node.d.ts +5 -5
@@ -53,7 +53,7 @@ var __assign = function() {
53
53
 
54
54
  /**
55
55
  * @fileoverview added by tsickle
56
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
56
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
57
57
  */
58
58
  /**
59
59
  * Strategy that will prevent the user from scrolling while the overlay is visible.
@@ -90,7 +90,7 @@ BlockScrollStrategy = /** @class */ (function () {
90
90
  function () {
91
91
  if (this._canBeEnabled()) {
92
92
  /** @type {?} */
93
- var root = /** @type {?} */ ((this._document.documentElement));
93
+ var root = (/** @type {?} */ (this._document.documentElement));
94
94
  this._previousScrollPosition = this._viewportRuler.getViewportScrollPosition();
95
95
  // Cache the previous inline styles in case the user had set them.
96
96
  this._previousHTMLStyles.left = root.style.left || '';
@@ -115,13 +115,13 @@ BlockScrollStrategy = /** @class */ (function () {
115
115
  function () {
116
116
  if (this._isEnabled) {
117
117
  /** @type {?} */
118
- var html = /** @type {?} */ ((this._document.documentElement));
118
+ var html = (/** @type {?} */ (this._document.documentElement));
119
119
  /** @type {?} */
120
- var body = /** @type {?} */ ((this._document.body));
120
+ var body = (/** @type {?} */ (this._document.body));
121
121
  /** @type {?} */
122
- var htmlStyle = /** @type {?} */ (html.style);
122
+ var htmlStyle = (/** @type {?} */ (html.style));
123
123
  /** @type {?} */
124
- var bodyStyle = /** @type {?} */ (body.style);
124
+ var bodyStyle = (/** @type {?} */ (body.style));
125
125
  /** @type {?} */
126
126
  var previousHtmlScrollBehavior = htmlStyle.scrollBehavior || '';
127
127
  /** @type {?} */
@@ -139,14 +139,19 @@ BlockScrollStrategy = /** @class */ (function () {
139
139
  }
140
140
  };
141
141
  /**
142
+ * @private
142
143
  * @return {?}
143
144
  */
144
145
  BlockScrollStrategy.prototype._canBeEnabled = /**
146
+ * @private
145
147
  * @return {?}
146
148
  */
147
149
  function () {
150
+ // Since the scroll strategies can't be singletons, we have to use a global CSS class
151
+ // (`cdk-global-scrollblock`) to make sure that we don't try to disable global
152
+ // scrolling multiple times.
148
153
  /** @type {?} */
149
- var html = /** @type {?} */ ((this._document.documentElement));
154
+ var html = (/** @type {?} */ (this._document.documentElement));
150
155
  if (html.classList.contains('cdk-global-scrollblock') || this._isEnabled) {
151
156
  return false;
152
157
  }
@@ -161,7 +166,7 @@ BlockScrollStrategy = /** @class */ (function () {
161
166
 
162
167
  /**
163
168
  * @fileoverview added by tsickle
164
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
169
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
165
170
  */
166
171
  /**
167
172
  * Returns an error to be thrown when attempting to attach an already-attached scroll strategy.
@@ -173,7 +178,7 @@ function getMatScrollStrategyAlreadyAttachedError() {
173
178
 
174
179
  /**
175
180
  * @fileoverview added by tsickle
176
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
181
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
177
182
  */
178
183
  /**
179
184
  * Strategy that will close the overlay as soon as the user starts scrolling.
@@ -237,7 +242,7 @@ CloseScrollStrategy = /** @class */ (function () {
237
242
  this._scrollSubscription = stream.subscribe(function () {
238
243
  /** @type {?} */
239
244
  var scrollPosition = _this._viewportRuler.getViewportScrollPosition().top;
240
- if (Math.abs(scrollPosition - _this._initialScrollPosition) > /** @type {?} */ ((/** @type {?} */ ((_this._config)).threshold))) {
245
+ if (Math.abs(scrollPosition - _this._initialScrollPosition) > (/** @type {?} */ ((/** @type {?} */ (_this._config)).threshold))) {
241
246
  _this._detach();
242
247
  }
243
248
  else {
@@ -269,7 +274,7 @@ CloseScrollStrategy = /** @class */ (function () {
269
274
 
270
275
  /**
271
276
  * @fileoverview added by tsickle
272
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
277
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
273
278
  */
274
279
 
275
280
  /**
@@ -316,7 +321,7 @@ NoopScrollStrategy = /** @class */ (function () {
316
321
 
317
322
  /**
318
323
  * @fileoverview added by tsickle
319
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
324
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
320
325
  */
321
326
 
322
327
  // TODO(jelbourn): move this to live with the rest of the scrolling code
@@ -364,7 +369,7 @@ function isElementClippedByScrolling(element, scrollContainers) {
364
369
 
365
370
  /**
366
371
  * @fileoverview added by tsickle
367
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
372
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
368
373
  */
369
374
  /**
370
375
  * Strategy that will update the element position as the user is scrolling.
@@ -418,6 +423,8 @@ RepositionScrollStrategy = /** @class */ (function () {
418
423
  /** @type {?} */
419
424
  var overlayRect = _this._overlayRef.overlayElement.getBoundingClientRect();
420
425
  var _a = _this._viewportRuler.getViewportSize(), width = _a.width, height = _a.height;
426
+ // TODO(crisbeto): include all ancestor scroll containers here once
427
+ // we have a way of exposing the trigger element to the scroll strategy.
421
428
  /** @type {?} */
422
429
  var parentRects = [{ width: width, height: height, bottom: height, right: width, top: 0, left: 0 }];
423
430
  if (isElementScrolledOutsideView(overlayRect, parentRects)) {
@@ -448,7 +455,7 @@ RepositionScrollStrategy = /** @class */ (function () {
448
455
 
449
456
  /**
450
457
  * @fileoverview added by tsickle
451
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
458
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
452
459
  */
453
460
  /**
454
461
  * Options for how an overlay will handle scrolling.
@@ -499,12 +506,12 @@ var ScrollStrategyOptions = /** @class */ (function () {
499
506
 
500
507
  /**
501
508
  * @fileoverview added by tsickle
502
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
509
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
503
510
  */
504
511
 
505
512
  /**
506
513
  * @fileoverview added by tsickle
507
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
514
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
508
515
  */
509
516
  /**
510
517
  * Initial configuration used when creating an overlay.
@@ -540,7 +547,7 @@ OverlayConfig = /** @class */ (function () {
540
547
  if (config) {
541
548
  Object.keys(config).forEach(function (k) {
542
549
  /** @type {?} */
543
- var key = /** @type {?} */ (k);
550
+ var key = (/** @type {?} */ (k));
544
551
  if (typeof config[key] !== 'undefined') {
545
552
  _this[key] = config[key];
546
553
  }
@@ -552,7 +559,7 @@ OverlayConfig = /** @class */ (function () {
552
559
 
553
560
  /**
554
561
  * @fileoverview added by tsickle
555
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
562
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
556
563
  */
557
564
  /**
558
565
  * The points of the origin element and the overlay element to connect.
@@ -631,8 +638,7 @@ ScrollingVisibility = /** @class */ (function () {
631
638
  * The change event emitted by the strategy when a fallback position is used.
632
639
  */
633
640
  var ConnectedOverlayPositionChange = /** @class */ (function () {
634
- function ConnectedOverlayPositionChange(connectionPair, /** @docs-private */
635
- scrollableViewProperties) {
641
+ function ConnectedOverlayPositionChange(connectionPair, scrollableViewProperties) {
636
642
  this.connectionPair = connectionPair;
637
643
  this.scrollableViewProperties = scrollableViewProperties;
638
644
  }
@@ -672,7 +678,7 @@ function validateHorizontalPosition(property, value) {
672
678
 
673
679
  /**
674
680
  * @fileoverview added by tsickle
675
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
681
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
676
682
  */
677
683
  /**
678
684
  * Service for dispatching keyboard events that land on the body to appropriate overlay ref,
@@ -759,12 +765,15 @@ var OverlayKeyboardDispatcher = /** @class */ (function () {
759
765
  this._detach();
760
766
  }
761
767
  };
768
+ /** Detaches the global keyboard event listener. */
762
769
  /**
763
770
  * Detaches the global keyboard event listener.
771
+ * @private
764
772
  * @return {?}
765
773
  */
766
774
  OverlayKeyboardDispatcher.prototype._detach = /**
767
775
  * Detaches the global keyboard event listener.
776
+ * @private
768
777
  * @return {?}
769
778
  */
770
779
  function () {
@@ -792,16 +801,17 @@ var OverlayKeyboardDispatcher = /** @class */ (function () {
792
801
  function OVERLAY_KEYBOARD_DISPATCHER_PROVIDER_FACTORY(dispatcher, _document) {
793
802
  return dispatcher || new OverlayKeyboardDispatcher(_document);
794
803
  }
795
- /** *
804
+ /**
796
805
  * \@docs-private \@deprecated \@breaking-change 8.0.0
797
- @type {?} */
806
+ * @type {?}
807
+ */
798
808
  var OVERLAY_KEYBOARD_DISPATCHER_PROVIDER = {
799
809
  // If there is already an OverlayKeyboardDispatcher available, use that.
800
810
  // Otherwise, provide a new one.
801
811
  provide: OverlayKeyboardDispatcher,
802
812
  deps: [
803
813
  [new core.Optional(), new core.SkipSelf(), OverlayKeyboardDispatcher],
804
- /** @type {?} */ ((
814
+ (/** @type {?} */ (
805
815
  // Coerce to `InjectionToken` so that the `deps` match the "shape"
806
816
  // of the type expected by Angular
807
817
  common.DOCUMENT))
@@ -811,7 +821,7 @@ var OVERLAY_KEYBOARD_DISPATCHER_PROVIDER = {
811
821
 
812
822
  /**
813
823
  * @fileoverview added by tsickle
814
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
824
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
815
825
  */
816
826
  /**
817
827
  * Container inside which all overlays will render.
@@ -862,11 +872,13 @@ var OverlayContainer = /** @class */ (function () {
862
872
  /**
863
873
  * Create the overlay container element, which is simply a div
864
874
  * with the 'cdk-overlay-container' class on the document body.
875
+ * @protected
865
876
  * @return {?}
866
877
  */
867
878
  OverlayContainer.prototype._createContainer = /**
868
879
  * Create the overlay container element, which is simply a div
869
880
  * with the 'cdk-overlay-container' class on the document body.
881
+ * @protected
870
882
  * @return {?}
871
883
  */
872
884
  function () {
@@ -895,23 +907,23 @@ var OverlayContainer = /** @class */ (function () {
895
907
  function OVERLAY_CONTAINER_PROVIDER_FACTORY(parentContainer, _document) {
896
908
  return parentContainer || new OverlayContainer(_document);
897
909
  }
898
- /** *
910
+ /**
899
911
  * \@docs-private \@deprecated \@breaking-change 8.0.0
900
- @type {?} */
912
+ * @type {?}
913
+ */
901
914
  var OVERLAY_CONTAINER_PROVIDER = {
902
915
  // If there is already an OverlayContainer available, use that. Otherwise, provide a new one.
903
916
  provide: OverlayContainer,
904
917
  deps: [
905
918
  [new core.Optional(), new core.SkipSelf(), OverlayContainer],
906
- /** @type {?} */ (common.DOCUMENT // We need to use the InjectionToken somewhere to keep TS happy
907
- ) // We need to use the InjectionToken somewhere to keep TS happy
919
+ (/** @type {?} */ (common.DOCUMENT))
908
920
  ],
909
921
  useFactory: OVERLAY_CONTAINER_PROVIDER_FACTORY
910
922
  };
911
923
 
912
924
  /**
913
925
  * @fileoverview added by tsickle
914
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
926
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
915
927
  */
916
928
  /**
917
929
  * Reference to an overlay that has been created with the Overlay service.
@@ -937,7 +949,7 @@ OverlayRef = /** @class */ (function () {
937
949
  this._attachments = new rxjs.Subject();
938
950
  this._detachments = new rxjs.Subject();
939
951
  this._locationChanges = rxjs.Subscription.EMPTY;
940
- this._keydownEventsObservable = rxjs.Observable.create(function (observer) {
952
+ this._keydownEventsObservable = new rxjs.Observable(function (observer) {
941
953
  /** @type {?} */
942
954
  var subscription = _this._keydownEvents.subscribe(observer);
943
955
  _this._keydownEventSubscriptions++;
@@ -1137,9 +1149,9 @@ OverlayRef = /** @class */ (function () {
1137
1149
  this._keydownEvents.complete();
1138
1150
  if (this._host && this._host.parentNode) {
1139
1151
  this._host.parentNode.removeChild(this._host);
1140
- this._host = /** @type {?} */ ((null));
1152
+ this._host = (/** @type {?} */ (null));
1141
1153
  }
1142
- this._previousHostParent = this._pane = /** @type {?} */ ((null));
1154
+ this._previousHostParent = this._pane = (/** @type {?} */ (null));
1143
1155
  if (isAttached) {
1144
1156
  this._detachments.next();
1145
1157
  }
@@ -1205,13 +1217,13 @@ OverlayRef = /** @class */ (function () {
1205
1217
  function () {
1206
1218
  return this._keydownEventsObservable;
1207
1219
  };
1208
- /** Gets the the current overlay configuration, which is immutable. */
1220
+ /** Gets the current overlay configuration, which is immutable. */
1209
1221
  /**
1210
- * Gets the the current overlay configuration, which is immutable.
1222
+ * Gets the current overlay configuration, which is immutable.
1211
1223
  * @return {?}
1212
1224
  */
1213
1225
  OverlayRef.prototype.getConfig = /**
1214
- * Gets the the current overlay configuration, which is immutable.
1226
+ * Gets the current overlay configuration, which is immutable.
1215
1227
  * @return {?}
1216
1228
  */
1217
1229
  function () {
@@ -1304,23 +1316,29 @@ OverlayRef = /** @class */ (function () {
1304
1316
  }
1305
1317
  return typeof direction === 'string' ? direction : direction.value;
1306
1318
  };
1319
+ /** Updates the text direction of the overlay panel. */
1307
1320
  /**
1308
1321
  * Updates the text direction of the overlay panel.
1322
+ * @private
1309
1323
  * @return {?}
1310
1324
  */
1311
1325
  OverlayRef.prototype._updateElementDirection = /**
1312
1326
  * Updates the text direction of the overlay panel.
1327
+ * @private
1313
1328
  * @return {?}
1314
1329
  */
1315
1330
  function () {
1316
1331
  this._host.setAttribute('dir', this.getDirection());
1317
1332
  };
1333
+ /** Updates the size of the overlay element based on the overlay config. */
1318
1334
  /**
1319
1335
  * Updates the size of the overlay element based on the overlay config.
1336
+ * @private
1320
1337
  * @return {?}
1321
1338
  */
1322
1339
  OverlayRef.prototype._updateElementSize = /**
1323
1340
  * Updates the size of the overlay element based on the overlay config.
1341
+ * @private
1324
1342
  * @return {?}
1325
1343
  */
1326
1344
  function () {
@@ -1333,25 +1351,31 @@ OverlayRef = /** @class */ (function () {
1333
1351
  style.maxWidth = coercion.coerceCssPixelValue(this._config.maxWidth);
1334
1352
  style.maxHeight = coercion.coerceCssPixelValue(this._config.maxHeight);
1335
1353
  };
1354
+ /** Toggles the pointer events for the overlay pane element. */
1336
1355
  /**
1337
1356
  * Toggles the pointer events for the overlay pane element.
1357
+ * @private
1338
1358
  * @param {?} enablePointer
1339
1359
  * @return {?}
1340
1360
  */
1341
1361
  OverlayRef.prototype._togglePointerEvents = /**
1342
1362
  * Toggles the pointer events for the overlay pane element.
1363
+ * @private
1343
1364
  * @param {?} enablePointer
1344
1365
  * @return {?}
1345
1366
  */
1346
1367
  function (enablePointer) {
1347
1368
  this._pane.style.pointerEvents = enablePointer ? 'auto' : 'none';
1348
1369
  };
1370
+ /** Attaches a backdrop for this overlay. */
1349
1371
  /**
1350
1372
  * Attaches a backdrop for this overlay.
1373
+ * @private
1351
1374
  * @return {?}
1352
1375
  */
1353
1376
  OverlayRef.prototype._attachBackdrop = /**
1354
1377
  * Attaches a backdrop for this overlay.
1378
+ * @private
1355
1379
  * @return {?}
1356
1380
  */
1357
1381
  function () {
@@ -1362,11 +1386,10 @@ OverlayRef = /** @class */ (function () {
1362
1386
  this._backdropElement.classList.add('cdk-overlay-backdrop');
1363
1387
  if (this._config.backdropClass) {
1364
1388
  this._toggleClasses(this._backdropElement, this._config.backdropClass, true);
1365
- } /** @type {?} */
1366
- ((
1389
+ }
1367
1390
  // Insert the backdrop before the pane in the DOM order,
1368
1391
  // in order to handle stacked overlays properly.
1369
- this._host.parentElement)).insertBefore(this._backdropElement, this._host);
1392
+ (/** @type {?} */ (this._host.parentElement)).insertBefore(this._backdropElement, this._host);
1370
1393
  // Forward backdrop clicks such that the consumer of the overlay can perform whatever
1371
1394
  // action desired when such a click occurs (usually closing the overlay).
1372
1395
  this._backdropElement.addEventListener('click', function (event) { return _this._backdropClick.next(event); });
@@ -1390,6 +1413,14 @@ OverlayRef = /** @class */ (function () {
1390
1413
  * that should be behind it, was destroyed. The next time both of them are opened,
1391
1414
  * the stacking will be wrong, because the detached element's pane will still be
1392
1415
  * in its original DOM position.
1416
+ */
1417
+ /**
1418
+ * Updates the stacking order of the element, moving it to the top if necessary.
1419
+ * This is required in cases where one overlay was detached, while another one,
1420
+ * that should be behind it, was destroyed. The next time both of them are opened,
1421
+ * the stacking will be wrong, because the detached element's pane will still be
1422
+ * in its original DOM position.
1423
+ * @private
1393
1424
  * @return {?}
1394
1425
  */
1395
1426
  OverlayRef.prototype._updateStackingOrder = /**
@@ -1398,11 +1429,12 @@ OverlayRef = /** @class */ (function () {
1398
1429
  * that should be behind it, was destroyed. The next time both of them are opened,
1399
1430
  * the stacking will be wrong, because the detached element's pane will still be
1400
1431
  * in its original DOM position.
1432
+ * @private
1401
1433
  * @return {?}
1402
1434
  */
1403
1435
  function () {
1404
1436
  if (this._host.nextSibling) {
1405
- /** @type {?} */ ((this._host.parentNode)).appendChild(this._host);
1437
+ (/** @type {?} */ (this._host.parentNode)).appendChild(this._host);
1406
1438
  }
1407
1439
  };
1408
1440
  /** Detaches the backdrop (if any) associated with the overlay. */
@@ -1436,13 +1468,13 @@ OverlayRef = /** @class */ (function () {
1436
1468
  _this._backdropElement = null;
1437
1469
  }
1438
1470
  if (_this._config.backdropClass) {
1439
- _this._toggleClasses(/** @type {?} */ ((backdropToDetach)), _this._config.backdropClass, false);
1471
+ _this._toggleClasses((/** @type {?} */ (backdropToDetach)), _this._config.backdropClass, false);
1440
1472
  }
1441
1473
  clearTimeout(timeoutId);
1442
1474
  };
1443
1475
  backdropToDetach.classList.remove('cdk-overlay-backdrop-showing');
1444
1476
  this._ngZone.runOutsideAngular(function () {
1445
- /** @type {?} */ ((backdropToDetach)).addEventListener('transitionend', finishDetach);
1477
+ (/** @type {?} */ (backdropToDetach)).addEventListener('transitionend', finishDetach);
1446
1478
  });
1447
1479
  // If the backdrop doesn't have a transition, the `transitionend` event won't fire.
1448
1480
  // In this case we make it unclickable and we try to remove it after a delay.
@@ -1452,8 +1484,10 @@ OverlayRef = /** @class */ (function () {
1452
1484
  // either async or fakeAsync.
1453
1485
  timeoutId = this._ngZone.runOutsideAngular(function () { return setTimeout(finishDetach, 500); });
1454
1486
  };
1487
+ /** Toggles a single CSS class or an array of classes on an element. */
1455
1488
  /**
1456
1489
  * Toggles a single CSS class or an array of classes on an element.
1490
+ * @private
1457
1491
  * @param {?} element
1458
1492
  * @param {?} cssClasses
1459
1493
  * @param {?} isAdd
@@ -1461,6 +1495,7 @@ OverlayRef = /** @class */ (function () {
1461
1495
  */
1462
1496
  OverlayRef.prototype._toggleClasses = /**
1463
1497
  * Toggles a single CSS class or an array of classes on an element.
1498
+ * @private
1464
1499
  * @param {?} element
1465
1500
  * @param {?} cssClasses
1466
1501
  * @param {?} isAdd
@@ -1474,12 +1509,15 @@ OverlayRef = /** @class */ (function () {
1474
1509
  isAdd ? classList.add(cssClass) : classList.remove(cssClass);
1475
1510
  });
1476
1511
  };
1512
+ /** Detaches the overlay content next time the zone stabilizes. */
1477
1513
  /**
1478
1514
  * Detaches the overlay content next time the zone stabilizes.
1515
+ * @private
1479
1516
  * @return {?}
1480
1517
  */
1481
1518
  OverlayRef.prototype._detachContentWhenStable = /**
1482
1519
  * Detaches the overlay content next time the zone stabilizes.
1520
+ * @private
1483
1521
  * @return {?}
1484
1522
  */
1485
1523
  function () {
@@ -1488,6 +1526,9 @@ OverlayRef = /** @class */ (function () {
1488
1526
  // if the consumer is using `zone-patch-rxjs`, the `Subscription.unsubscribe` call will
1489
1527
  // be patched to run inside the zone, which will throw us into an infinite loop.
1490
1528
  this._ngZone.runOutsideAngular(function () {
1529
+ // We can't remove the host here immediately, because the overlay pane's content
1530
+ // might still be animating. This stream helps us avoid interrupting the animation
1531
+ // by waiting for the pane to become empty.
1491
1532
  /** @type {?} */
1492
1533
  var subscription = _this._ngZone.onStable
1493
1534
  .asObservable()
@@ -1513,11 +1554,14 @@ OverlayRef = /** @class */ (function () {
1513
1554
 
1514
1555
  /**
1515
1556
  * @fileoverview added by tsickle
1516
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
1557
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1517
1558
  */
1518
- /** *
1559
+ // TODO: refactor clipping detection into a separate thing (part of scrolling module)
1560
+ // TODO: doesn't handle both flexible width and height when it has to scroll along both axis.
1561
+ /**
1519
1562
  * Class to be added to the overlay bounding box.
1520
- @type {?} */
1563
+ * @type {?}
1564
+ */
1521
1565
  var boundingBoxClass = 'cdk-overlay-connected-position-bounding-box';
1522
1566
  /**
1523
1567
  * A strategy for positioning overlays. Using this strategy, an overlay is given an
@@ -1603,7 +1647,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
1603
1647
  /**
1604
1648
  * Observable sequence of position changes.
1605
1649
  */
1606
- this.positionChanges = rxjs.Observable.create(function (observer) {
1650
+ this.positionChanges = new rxjs.Observable(function (observer) {
1607
1651
  /** @type {?} */
1608
1652
  var subscription = _this._positionChanges.subscribe(observer);
1609
1653
  _this._positionChangeSubscriptions++;
@@ -1731,18 +1775,25 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
1731
1775
  var overlayRect = this._overlayRect;
1732
1776
  /** @type {?} */
1733
1777
  var viewportRect = this._viewportRect;
1778
+ // Positions where the overlay will fit with flexible dimensions.
1734
1779
  /** @type {?} */
1735
1780
  var flexibleFits = [];
1781
+ // Fallback if none of the preferred positions fit within the viewport.
1736
1782
  /** @type {?} */
1737
1783
  var fallback;
1738
1784
  // Go through each of the preferred positions looking for a good fit.
1739
1785
  // If a good fit is found, it will be applied immediately.
1740
1786
  for (var _i = 0, _a = this._preferredPositions; _i < _a.length; _i++) {
1741
1787
  var pos = _a[_i];
1788
+ // Get the exact (x, y) coordinate for the point-of-origin on the origin element.
1742
1789
  /** @type {?} */
1743
1790
  var originPoint = this._getOriginPoint(originRect, pos);
1791
+ // From that point-of-origin, get the exact (x, y) coordinate for the top-left corner of the
1792
+ // overlay in this position. We use the top-left corner for calculations and later translate
1793
+ // this into an appropriate (top, left, bottom, right) style.
1744
1794
  /** @type {?} */
1745
1795
  var overlayPoint = this._getOverlayPoint(originPoint, overlayRect, pos);
1796
+ // Calculate how well the overlay would fit into the viewport with this point.
1746
1797
  /** @type {?} */
1747
1798
  var overlayFit = this._getOverlayFit(overlayPoint, overlayRect, viewportRect, pos);
1748
1799
  // If the overlay, without any further work, fits into the viewport, use this position.
@@ -1788,7 +1839,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
1788
1839
  }
1789
1840
  }
1790
1841
  this._isPushed = false;
1791
- this._applyPosition(/** @type {?} */ ((bestFit)).position, /** @type {?} */ ((bestFit)).origin);
1842
+ this._applyPosition((/** @type {?} */ (bestFit)).position, (/** @type {?} */ (bestFit)).origin);
1792
1843
  return;
1793
1844
  }
1794
1845
  // When none of the preferred positions fit within the viewport, take the position
@@ -1796,12 +1847,12 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
1796
1847
  if (this._canPush) {
1797
1848
  // TODO(jelbourn): after pushing, the opening "direction" of the overlay might not make sense.
1798
1849
  this._isPushed = true;
1799
- this._applyPosition(/** @type {?} */ ((fallback)).position, /** @type {?} */ ((fallback)).originPoint);
1850
+ this._applyPosition((/** @type {?} */ (fallback)).position, (/** @type {?} */ (fallback)).originPoint);
1800
1851
  return;
1801
1852
  }
1802
1853
  // All options for getting the overlay within the viewport have been exhausted, so go with the
1803
1854
  // position that went off-screen the least.
1804
- this._applyPosition(/** @type {?} */ ((fallback)).position, /** @type {?} */ ((fallback)).originPoint);
1855
+ this._applyPosition((/** @type {?} */ (fallback)).position, (/** @type {?} */ (fallback)).originPoint);
1805
1856
  };
1806
1857
  /**
1807
1858
  * @return {?}
@@ -1831,7 +1882,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
1831
1882
  // We can't use `_resetBoundingBoxStyles` here, because it resets
1832
1883
  // some properties to zero, rather than removing them.
1833
1884
  if (this._boundingBox) {
1834
- extendStyles(this._boundingBox.style, /** @type {?} */ ({
1885
+ extendStyles(this._boundingBox.style, (/** @type {?} */ ({
1835
1886
  top: '',
1836
1887
  left: '',
1837
1888
  right: '',
@@ -1840,7 +1891,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
1840
1891
  width: '',
1841
1892
  alignItems: '',
1842
1893
  justifyContent: '',
1843
- }));
1894
+ })));
1844
1895
  }
1845
1896
  if (this._pane) {
1846
1897
  this._resetOverlayElementStyles();
@@ -1850,7 +1901,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
1850
1901
  }
1851
1902
  this.detach();
1852
1903
  this._positionChanges.complete();
1853
- this._overlayRef = this._boundingBox = /** @type {?} */ ((null));
1904
+ this._overlayRef = this._boundingBox = (/** @type {?} */ (null));
1854
1905
  this._isDisposed = true;
1855
1906
  };
1856
1907
  /**
@@ -1910,23 +1961,27 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
1910
1961
  */
1911
1962
  /**
1912
1963
  * Adds new preferred positions.
1964
+ * @template THIS
1965
+ * @this {THIS}
1913
1966
  * @param {?} positions List of positions options for this overlay.
1914
- * @return {?}
1967
+ * @return {THIS}
1915
1968
  */
1916
1969
  FlexibleConnectedPositionStrategy.prototype.withPositions = /**
1917
1970
  * Adds new preferred positions.
1971
+ * @template THIS
1972
+ * @this {THIS}
1918
1973
  * @param {?} positions List of positions options for this overlay.
1919
- * @return {?}
1974
+ * @return {THIS}
1920
1975
  */
1921
1976
  function (positions) {
1922
- this._preferredPositions = positions;
1977
+ (/** @type {?} */ (this))._preferredPositions = positions;
1923
1978
  // If the last calculated position object isn't part of the positions anymore, clear
1924
1979
  // it in order to avoid it being picked up if the consumer tries to re-apply.
1925
- if (positions.indexOf(/** @type {?} */ ((this._lastPosition))) === -1) {
1926
- this._lastPosition = null;
1980
+ if (positions.indexOf((/** @type {?} */ ((/** @type {?} */ (this))._lastPosition))) === -1) {
1981
+ (/** @type {?} */ (this))._lastPosition = null;
1927
1982
  }
1928
- this._validatePositions();
1929
- return this;
1983
+ (/** @type {?} */ (this))._validatePositions();
1984
+ return (/** @type {?} */ (this));
1930
1985
  };
1931
1986
  /**
1932
1987
  * Sets a minimum distance the overlay may be positioned to the edge of the viewport.
@@ -1934,65 +1989,81 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
1934
1989
  */
1935
1990
  /**
1936
1991
  * Sets a minimum distance the overlay may be positioned to the edge of the viewport.
1992
+ * @template THIS
1993
+ * @this {THIS}
1937
1994
  * @param {?} margin Required margin between the overlay and the viewport edge in pixels.
1938
- * @return {?}
1995
+ * @return {THIS}
1939
1996
  */
1940
1997
  FlexibleConnectedPositionStrategy.prototype.withViewportMargin = /**
1941
1998
  * Sets a minimum distance the overlay may be positioned to the edge of the viewport.
1999
+ * @template THIS
2000
+ * @this {THIS}
1942
2001
  * @param {?} margin Required margin between the overlay and the viewport edge in pixels.
1943
- * @return {?}
2002
+ * @return {THIS}
1944
2003
  */
1945
2004
  function (margin) {
1946
- this._viewportMargin = margin;
1947
- return this;
2005
+ (/** @type {?} */ (this))._viewportMargin = margin;
2006
+ return (/** @type {?} */ (this));
1948
2007
  };
1949
2008
  /** Sets whether the overlay's width and height can be constrained to fit within the viewport. */
1950
2009
  /**
1951
2010
  * Sets whether the overlay's width and height can be constrained to fit within the viewport.
2011
+ * @template THIS
2012
+ * @this {THIS}
1952
2013
  * @param {?=} flexibleDimensions
1953
- * @return {?}
2014
+ * @return {THIS}
1954
2015
  */
1955
2016
  FlexibleConnectedPositionStrategy.prototype.withFlexibleDimensions = /**
1956
2017
  * Sets whether the overlay's width and height can be constrained to fit within the viewport.
2018
+ * @template THIS
2019
+ * @this {THIS}
1957
2020
  * @param {?=} flexibleDimensions
1958
- * @return {?}
2021
+ * @return {THIS}
1959
2022
  */
1960
2023
  function (flexibleDimensions) {
1961
2024
  if (flexibleDimensions === void 0) { flexibleDimensions = true; }
1962
- this._hasFlexibleDimensions = flexibleDimensions;
1963
- return this;
2025
+ (/** @type {?} */ (this))._hasFlexibleDimensions = flexibleDimensions;
2026
+ return (/** @type {?} */ (this));
1964
2027
  };
1965
2028
  /** Sets whether the overlay can grow after the initial open via flexible width/height. */
1966
2029
  /**
1967
2030
  * Sets whether the overlay can grow after the initial open via flexible width/height.
2031
+ * @template THIS
2032
+ * @this {THIS}
1968
2033
  * @param {?=} growAfterOpen
1969
- * @return {?}
2034
+ * @return {THIS}
1970
2035
  */
1971
2036
  FlexibleConnectedPositionStrategy.prototype.withGrowAfterOpen = /**
1972
2037
  * Sets whether the overlay can grow after the initial open via flexible width/height.
2038
+ * @template THIS
2039
+ * @this {THIS}
1973
2040
  * @param {?=} growAfterOpen
1974
- * @return {?}
2041
+ * @return {THIS}
1975
2042
  */
1976
2043
  function (growAfterOpen) {
1977
2044
  if (growAfterOpen === void 0) { growAfterOpen = true; }
1978
- this._growAfterOpen = growAfterOpen;
1979
- return this;
2045
+ (/** @type {?} */ (this))._growAfterOpen = growAfterOpen;
2046
+ return (/** @type {?} */ (this));
1980
2047
  };
1981
2048
  /** Sets whether the overlay can be pushed on-screen if none of the provided positions fit. */
1982
2049
  /**
1983
2050
  * Sets whether the overlay can be pushed on-screen if none of the provided positions fit.
2051
+ * @template THIS
2052
+ * @this {THIS}
1984
2053
  * @param {?=} canPush
1985
- * @return {?}
2054
+ * @return {THIS}
1986
2055
  */
1987
2056
  FlexibleConnectedPositionStrategy.prototype.withPush = /**
1988
2057
  * Sets whether the overlay can be pushed on-screen if none of the provided positions fit.
2058
+ * @template THIS
2059
+ * @this {THIS}
1989
2060
  * @param {?=} canPush
1990
- * @return {?}
2061
+ * @return {THIS}
1991
2062
  */
1992
2063
  function (canPush) {
1993
2064
  if (canPush === void 0) { canPush = true; }
1994
- this._canPush = canPush;
1995
- return this;
2065
+ (/** @type {?} */ (this))._canPush = canPush;
2066
+ return (/** @type {?} */ (this));
1996
2067
  };
1997
2068
  /**
1998
2069
  * Sets whether the overlay's position should be locked in after it is positioned
@@ -2004,20 +2075,24 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2004
2075
  * Sets whether the overlay's position should be locked in after it is positioned
2005
2076
  * initially. When an overlay is locked in, it won't attempt to reposition itself
2006
2077
  * when the position is re-applied (e.g. when the user scrolls away).
2078
+ * @template THIS
2079
+ * @this {THIS}
2007
2080
  * @param {?=} isLocked Whether the overlay should locked in.
2008
- * @return {?}
2081
+ * @return {THIS}
2009
2082
  */
2010
2083
  FlexibleConnectedPositionStrategy.prototype.withLockedPosition = /**
2011
2084
  * Sets whether the overlay's position should be locked in after it is positioned
2012
2085
  * initially. When an overlay is locked in, it won't attempt to reposition itself
2013
2086
  * when the position is re-applied (e.g. when the user scrolls away).
2087
+ * @template THIS
2088
+ * @this {THIS}
2014
2089
  * @param {?=} isLocked Whether the overlay should locked in.
2015
- * @return {?}
2090
+ * @return {THIS}
2016
2091
  */
2017
2092
  function (isLocked) {
2018
2093
  if (isLocked === void 0) { isLocked = true; }
2019
- this._positionLocked = isLocked;
2020
- return this;
2094
+ (/** @type {?} */ (this))._positionLocked = isLocked;
2095
+ return (/** @type {?} */ (this));
2021
2096
  };
2022
2097
  /**
2023
2098
  * Sets the origin element, relative to which to position the overlay.
@@ -2025,17 +2100,21 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2025
2100
  */
2026
2101
  /**
2027
2102
  * Sets the origin element, relative to which to position the overlay.
2103
+ * @template THIS
2104
+ * @this {THIS}
2028
2105
  * @param {?} origin Reference to the new origin element.
2029
- * @return {?}
2106
+ * @return {THIS}
2030
2107
  */
2031
2108
  FlexibleConnectedPositionStrategy.prototype.setOrigin = /**
2032
2109
  * Sets the origin element, relative to which to position the overlay.
2110
+ * @template THIS
2111
+ * @this {THIS}
2033
2112
  * @param {?} origin Reference to the new origin element.
2034
- * @return {?}
2113
+ * @return {THIS}
2035
2114
  */
2036
2115
  function (origin) {
2037
- this._origin = origin instanceof core.ElementRef ? origin.nativeElement : origin;
2038
- return this;
2116
+ (/** @type {?} */ (this))._origin = coercion.coerceElement(origin);
2117
+ return (/** @type {?} */ (this));
2039
2118
  };
2040
2119
  /**
2041
2120
  * Sets the default offset for the overlay's connection point on the x-axis.
@@ -2043,17 +2122,21 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2043
2122
  */
2044
2123
  /**
2045
2124
  * Sets the default offset for the overlay's connection point on the x-axis.
2125
+ * @template THIS
2126
+ * @this {THIS}
2046
2127
  * @param {?} offset New offset in the X axis.
2047
- * @return {?}
2128
+ * @return {THIS}
2048
2129
  */
2049
2130
  FlexibleConnectedPositionStrategy.prototype.withDefaultOffsetX = /**
2050
2131
  * Sets the default offset for the overlay's connection point on the x-axis.
2132
+ * @template THIS
2133
+ * @this {THIS}
2051
2134
  * @param {?} offset New offset in the X axis.
2052
- * @return {?}
2135
+ * @return {THIS}
2053
2136
  */
2054
2137
  function (offset) {
2055
- this._offsetX = offset;
2056
- return this;
2138
+ (/** @type {?} */ (this))._offsetX = offset;
2139
+ return (/** @type {?} */ (this));
2057
2140
  };
2058
2141
  /**
2059
2142
  * Sets the default offset for the overlay's connection point on the y-axis.
@@ -2061,17 +2144,21 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2061
2144
  */
2062
2145
  /**
2063
2146
  * Sets the default offset for the overlay's connection point on the y-axis.
2147
+ * @template THIS
2148
+ * @this {THIS}
2064
2149
  * @param {?} offset New offset in the Y axis.
2065
- * @return {?}
2150
+ * @return {THIS}
2066
2151
  */
2067
2152
  FlexibleConnectedPositionStrategy.prototype.withDefaultOffsetY = /**
2068
2153
  * Sets the default offset for the overlay's connection point on the y-axis.
2154
+ * @template THIS
2155
+ * @this {THIS}
2069
2156
  * @param {?} offset New offset in the Y axis.
2070
- * @return {?}
2157
+ * @return {THIS}
2071
2158
  */
2072
2159
  function (offset) {
2073
- this._offsetY = offset;
2074
- return this;
2160
+ (/** @type {?} */ (this))._offsetY = offset;
2161
+ return (/** @type {?} */ (this));
2075
2162
  };
2076
2163
  /**
2077
2164
  * Configures that the position strategy should set a `transform-origin` on some elements
@@ -2086,31 +2173,40 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2086
2173
  * inside the overlay, depending on the current position that is being applied. This is
2087
2174
  * useful for the cases where the origin of an animation can change depending on the
2088
2175
  * alignment of the overlay.
2176
+ * @template THIS
2177
+ * @this {THIS}
2089
2178
  * @param {?} selector CSS selector that will be used to find the target
2090
2179
  * elements onto which to set the transform origin.
2091
- * @return {?}
2180
+ * @return {THIS}
2092
2181
  */
2093
2182
  FlexibleConnectedPositionStrategy.prototype.withTransformOriginOn = /**
2094
2183
  * Configures that the position strategy should set a `transform-origin` on some elements
2095
2184
  * inside the overlay, depending on the current position that is being applied. This is
2096
2185
  * useful for the cases where the origin of an animation can change depending on the
2097
2186
  * alignment of the overlay.
2187
+ * @template THIS
2188
+ * @this {THIS}
2098
2189
  * @param {?} selector CSS selector that will be used to find the target
2099
2190
  * elements onto which to set the transform origin.
2100
- * @return {?}
2191
+ * @return {THIS}
2101
2192
  */
2102
2193
  function (selector) {
2103
- this._transformOriginSelector = selector;
2104
- return this;
2194
+ (/** @type {?} */ (this))._transformOriginSelector = selector;
2195
+ return (/** @type {?} */ (this));
2105
2196
  };
2106
2197
  /**
2107
2198
  * Gets the (x, y) coordinate of a connection point on the origin based on a relative position.
2199
+ */
2200
+ /**
2201
+ * Gets the (x, y) coordinate of a connection point on the origin based on a relative position.
2202
+ * @private
2108
2203
  * @param {?} originRect
2109
2204
  * @param {?} pos
2110
2205
  * @return {?}
2111
2206
  */
2112
2207
  FlexibleConnectedPositionStrategy.prototype._getOriginPoint = /**
2113
2208
  * Gets the (x, y) coordinate of a connection point on the origin based on a relative position.
2209
+ * @private
2114
2210
  * @param {?} originRect
2115
2211
  * @param {?} pos
2116
2212
  * @return {?}
@@ -2143,6 +2239,11 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2143
2239
  /**
2144
2240
  * Gets the (x, y) coordinate of the top-left corner of the overlay given a given position and
2145
2241
  * origin point to which the overlay should be connected.
2242
+ */
2243
+ /**
2244
+ * Gets the (x, y) coordinate of the top-left corner of the overlay given a given position and
2245
+ * origin point to which the overlay should be connected.
2246
+ * @private
2146
2247
  * @param {?} originPoint
2147
2248
  * @param {?} overlayRect
2148
2249
  * @param {?} pos
@@ -2151,12 +2252,15 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2151
2252
  FlexibleConnectedPositionStrategy.prototype._getOverlayPoint = /**
2152
2253
  * Gets the (x, y) coordinate of the top-left corner of the overlay given a given position and
2153
2254
  * origin point to which the overlay should be connected.
2255
+ * @private
2154
2256
  * @param {?} originPoint
2155
2257
  * @param {?} overlayRect
2156
2258
  * @param {?} pos
2157
2259
  * @return {?}
2158
2260
  */
2159
2261
  function (originPoint, overlayRect, pos) {
2262
+ // Calculate the (overlayStartX, overlayStartY), the start of the
2263
+ // potential overlay position relative to the origin point.
2160
2264
  /** @type {?} */
2161
2265
  var overlayStartX;
2162
2266
  if (pos.overlayX == 'center') {
@@ -2182,8 +2286,10 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2182
2286
  y: originPoint.y + overlayStartY,
2183
2287
  };
2184
2288
  };
2289
+ /** Gets how well an overlay at the given point will fit within the viewport. */
2185
2290
  /**
2186
2291
  * Gets how well an overlay at the given point will fit within the viewport.
2292
+ * @private
2187
2293
  * @param {?} point
2188
2294
  * @param {?} overlay
2189
2295
  * @param {?} viewport
@@ -2192,6 +2298,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2192
2298
  */
2193
2299
  FlexibleConnectedPositionStrategy.prototype._getOverlayFit = /**
2194
2300
  * Gets how well an overlay at the given point will fit within the viewport.
2301
+ * @private
2195
2302
  * @param {?} point
2196
2303
  * @param {?} overlay
2197
2304
  * @param {?} viewport
@@ -2211,6 +2318,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2211
2318
  if (offsetY) {
2212
2319
  y += offsetY;
2213
2320
  }
2321
+ // How much the overlay would overflow at this position, on each side.
2214
2322
  /** @type {?} */
2215
2323
  var leftOverflow = 0 - x;
2216
2324
  /** @type {?} */
@@ -2219,6 +2327,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2219
2327
  var topOverflow = 0 - y;
2220
2328
  /** @type {?} */
2221
2329
  var bottomOverflow = (y + overlay.height) - viewport.height;
2330
+ // Visible parts of the element on each axis.
2222
2331
  /** @type {?} */
2223
2332
  var visibleWidth = this._subtractOverflows(overlay.width, leftOverflow, rightOverflow);
2224
2333
  /** @type {?} */
@@ -2234,6 +2343,13 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2234
2343
  };
2235
2344
  /**
2236
2345
  * Whether the overlay can fit within the viewport when it may resize either its width or height.
2346
+ * @param fit How well the overlay fits in the viewport at some position.
2347
+ * @param point The (x, y) coordinates of the overlat at some position.
2348
+ * @param viewport The geometry of the viewport.
2349
+ */
2350
+ /**
2351
+ * Whether the overlay can fit within the viewport when it may resize either its width or height.
2352
+ * @private
2237
2353
  * @param {?} fit How well the overlay fits in the viewport at some position.
2238
2354
  * @param {?} point The (x, y) coordinates of the overlat at some position.
2239
2355
  * @param {?} viewport The geometry of the viewport.
@@ -2241,6 +2357,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2241
2357
  */
2242
2358
  FlexibleConnectedPositionStrategy.prototype._canFitWithFlexibleDimensions = /**
2243
2359
  * Whether the overlay can fit within the viewport when it may resize either its width or height.
2360
+ * @private
2244
2361
  * @param {?} fit How well the overlay fits in the viewport at some position.
2245
2362
  * @param {?} point The (x, y) coordinates of the overlat at some position.
2246
2363
  * @param {?} viewport The geometry of the viewport.
@@ -2270,6 +2387,18 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2270
2387
  * the viewport, the top-left corner will be pushed on-screen (with overflow occuring on the
2271
2388
  * right and bottom).
2272
2389
  *
2390
+ * @param start Starting point from which the overlay is pushed.
2391
+ * @param overlay Dimensions of the overlay.
2392
+ * @param scrollPosition Current viewport scroll position.
2393
+ * @returns The point at which to position the overlay after pushing. This is effectively a new
2394
+ * originPoint.
2395
+ */
2396
+ /**
2397
+ * Gets the point at which the overlay can be "pushed" on-screen. If the overlay is larger than
2398
+ * the viewport, the top-left corner will be pushed on-screen (with overflow occuring on the
2399
+ * right and bottom).
2400
+ *
2401
+ * @private
2273
2402
  * @param {?} start Starting point from which the overlay is pushed.
2274
2403
  * @param {?} overlay Dimensions of the overlay.
2275
2404
  * @param {?} scrollPosition Current viewport scroll position.
@@ -2281,6 +2410,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2281
2410
  * the viewport, the top-left corner will be pushed on-screen (with overflow occuring on the
2282
2411
  * right and bottom).
2283
2412
  *
2413
+ * @private
2284
2414
  * @param {?} start Starting point from which the overlay is pushed.
2285
2415
  * @param {?} overlay Dimensions of the overlay.
2286
2416
  * @param {?} scrollPosition Current viewport scroll position.
@@ -2299,6 +2429,8 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2299
2429
  }
2300
2430
  /** @type {?} */
2301
2431
  var viewport = this._viewportRect;
2432
+ // Determine how much the overlay goes outside the viewport on each
2433
+ // side, which we'll use to decide which direction to push it.
2302
2434
  /** @type {?} */
2303
2435
  var overflowRight = Math.max(start.x + overlay.width - viewport.right, 0);
2304
2436
  /** @type {?} */
@@ -2307,6 +2439,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2307
2439
  var overflowTop = Math.max(viewport.top - scrollPosition.top - start.y, 0);
2308
2440
  /** @type {?} */
2309
2441
  var overflowLeft = Math.max(viewport.left - scrollPosition.left - start.x, 0);
2442
+ // Amount by which to push the overlay in each axis such that it remains on-screen.
2310
2443
  /** @type {?} */
2311
2444
  var pushX = 0;
2312
2445
  /** @type {?} */
@@ -2334,12 +2467,19 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2334
2467
  };
2335
2468
  /**
2336
2469
  * Applies a computed position to the overlay and emits a position change.
2470
+ * @param position The position preference
2471
+ * @param originPoint The point on the origin element where the overlay is connected.
2472
+ */
2473
+ /**
2474
+ * Applies a computed position to the overlay and emits a position change.
2475
+ * @private
2337
2476
  * @param {?} position The position preference
2338
2477
  * @param {?} originPoint The point on the origin element where the overlay is connected.
2339
2478
  * @return {?}
2340
2479
  */
2341
2480
  FlexibleConnectedPositionStrategy.prototype._applyPosition = /**
2342
2481
  * Applies a computed position to the overlay and emits a position change.
2482
+ * @private
2343
2483
  * @param {?} position The position preference
2344
2484
  * @param {?} originPoint The point on the origin element where the overlay is connected.
2345
2485
  * @return {?}
@@ -2365,13 +2505,16 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2365
2505
  }
2366
2506
  this._isInitialRender = false;
2367
2507
  };
2508
+ /** Sets the transform origin based on the configured selector and the passed-in position. */
2368
2509
  /**
2369
2510
  * Sets the transform origin based on the configured selector and the passed-in position.
2511
+ * @private
2370
2512
  * @param {?} position
2371
2513
  * @return {?}
2372
2514
  */
2373
2515
  FlexibleConnectedPositionStrategy.prototype._setTransformOrigin = /**
2374
2516
  * Sets the transform origin based on the configured selector and the passed-in position.
2517
+ * @private
2375
2518
  * @param {?} position
2376
2519
  * @return {?}
2377
2520
  */
@@ -2380,7 +2523,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2380
2523
  return;
2381
2524
  }
2382
2525
  /** @type {?} */
2383
- var elements = /** @type {?} */ ((this._boundingBox)).querySelectorAll(this._transformOriginSelector);
2526
+ var elements = (/** @type {?} */ (this._boundingBox)).querySelectorAll(this._transformOriginSelector);
2384
2527
  /** @type {?} */
2385
2528
  var xOrigin;
2386
2529
  /** @type {?} */
@@ -2403,6 +2546,13 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2403
2546
  *
2404
2547
  * This method does no measuring and applies no styles so that we can cheaply compute the
2405
2548
  * bounds for all positions and choose the best fit based on these results.
2549
+ */
2550
+ /**
2551
+ * Gets the position and size of the overlay's sizing container.
2552
+ *
2553
+ * This method does no measuring and applies no styles so that we can cheaply compute the
2554
+ * bounds for all positions and choose the best fit based on these results.
2555
+ * @private
2406
2556
  * @param {?} origin
2407
2557
  * @param {?} position
2408
2558
  * @return {?}
@@ -2412,6 +2562,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2412
2562
  *
2413
2563
  * This method does no measuring and applies no styles so that we can cheaply compute the
2414
2564
  * bounds for all positions and choose the best fit based on these results.
2565
+ * @private
2415
2566
  * @param {?} origin
2416
2567
  * @param {?} position
2417
2568
  * @return {?}
@@ -2430,7 +2581,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2430
2581
  if (position.overlayY === 'top') {
2431
2582
  // Overlay is opening "downward" and thus is bound by the bottom viewport edge.
2432
2583
  top = origin.y;
2433
- height = viewport.bottom - origin.y;
2584
+ height = viewport.height - top + this._viewportMargin;
2434
2585
  }
2435
2586
  else if (position.overlayY === 'bottom') {
2436
2587
  // Overlay is opening "upward" and thus is bound by the top viewport edge. We need to add
@@ -2440,6 +2591,10 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2440
2591
  height = viewport.height - bottom + this._viewportMargin;
2441
2592
  }
2442
2593
  else {
2594
+ // If neither top nor bottom, it means that the overlay is vertically centered on the
2595
+ // origin point. Note that we want the position relative to the viewport, rather than
2596
+ // the page, which is why we don't use something like `viewport.bottom - origin.y` and
2597
+ // `origin.y - viewport.top`.
2443
2598
  /** @type {?} */
2444
2599
  var smallestDistanceToViewportEdge = Math.min(viewport.bottom - origin.y + viewport.top, origin.y);
2445
2600
  /** @type {?} */
@@ -2450,9 +2605,11 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2450
2605
  top = origin.y - (previousHeight / 2);
2451
2606
  }
2452
2607
  }
2608
+ // The overlay is opening 'right-ward' (the content flows to the right).
2453
2609
  /** @type {?} */
2454
2610
  var isBoundedByRightViewportEdge = (position.overlayX === 'start' && !isRtl) ||
2455
2611
  (position.overlayX === 'end' && isRtl);
2612
+ // The overlay is opening 'left-ward' (the content flows to the left).
2456
2613
  /** @type {?} */
2457
2614
  var isBoundedByLeftViewportEdge = (position.overlayX === 'end' && !isRtl) ||
2458
2615
  (position.overlayX === 'start' && isRtl);
@@ -2471,6 +2628,10 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2471
2628
  width = viewport.right - origin.x;
2472
2629
  }
2473
2630
  else {
2631
+ // If neither start nor end, it means that the overlay is horizontally centered on the
2632
+ // origin point. Note that we want the position relative to the viewport, rather than
2633
+ // the page, which is why we don't use something like `viewport.right - origin.x` and
2634
+ // `origin.x - viewport.left`.
2474
2635
  /** @type {?} */
2475
2636
  var smallestDistanceToViewportEdge = Math.min(viewport.right - origin.x + viewport.left, origin.x);
2476
2637
  /** @type {?} */
@@ -2481,12 +2642,20 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2481
2642
  left = origin.x - (previousWidth / 2);
2482
2643
  }
2483
2644
  }
2484
- return { top: /** @type {?} */ ((top)), left: /** @type {?} */ ((left)), bottom: /** @type {?} */ ((bottom)), right: /** @type {?} */ ((right)), width: width, height: height };
2645
+ return { top: (/** @type {?} */ (top)), left: (/** @type {?} */ (left)), bottom: (/** @type {?} */ (bottom)), right: (/** @type {?} */ (right)), width: width, height: height };
2485
2646
  };
2486
2647
  /**
2487
2648
  * Sets the position and size of the overlay's sizing wrapper. The wrapper is positioned on the
2488
2649
  * origin's connection point and stetches to the bounds of the viewport.
2489
2650
  *
2651
+ * @param origin The point on the origin element where the overlay is connected.
2652
+ * @param position The position preference
2653
+ */
2654
+ /**
2655
+ * Sets the position and size of the overlay's sizing wrapper. The wrapper is positioned on the
2656
+ * origin's connection point and stetches to the bounds of the viewport.
2657
+ *
2658
+ * @private
2490
2659
  * @param {?} origin The point on the origin element where the overlay is connected.
2491
2660
  * @param {?} position The position preference
2492
2661
  * @return {?}
@@ -2495,6 +2664,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2495
2664
  * Sets the position and size of the overlay's sizing wrapper. The wrapper is positioned on the
2496
2665
  * origin's connection point and stetches to the bounds of the viewport.
2497
2666
  *
2667
+ * @private
2498
2668
  * @param {?} origin The point on the origin element where the overlay is connected.
2499
2669
  * @param {?} position The position preference
2500
2670
  * @return {?}
@@ -2509,7 +2679,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2509
2679
  boundingBoxRect.width = Math.min(boundingBoxRect.width, this._lastBoundingBoxSize.width);
2510
2680
  }
2511
2681
  /** @type {?} */
2512
- var styles = /** @type {?} */ ({});
2682
+ var styles = (/** @type {?} */ ({}));
2513
2683
  if (this._hasExactPosition()) {
2514
2684
  styles.top = styles.left = '0';
2515
2685
  styles.bottom = styles.right = '';
@@ -2547,18 +2717,21 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2547
2717
  }
2548
2718
  }
2549
2719
  this._lastBoundingBoxSize = boundingBoxRect;
2550
- extendStyles(/** @type {?} */ ((this._boundingBox)).style, styles);
2720
+ extendStyles((/** @type {?} */ (this._boundingBox)).style, styles);
2551
2721
  };
2722
+ /** Resets the styles for the bounding box so that a new positioning can be computed. */
2552
2723
  /**
2553
2724
  * Resets the styles for the bounding box so that a new positioning can be computed.
2725
+ * @private
2554
2726
  * @return {?}
2555
2727
  */
2556
2728
  FlexibleConnectedPositionStrategy.prototype._resetBoundingBoxStyles = /**
2557
2729
  * Resets the styles for the bounding box so that a new positioning can be computed.
2730
+ * @private
2558
2731
  * @return {?}
2559
2732
  */
2560
2733
  function () {
2561
- extendStyles(/** @type {?} */ ((this._boundingBox)).style, /** @type {?} */ ({
2734
+ extendStyles((/** @type {?} */ (this._boundingBox)).style, (/** @type {?} */ ({
2562
2735
  top: '0',
2563
2736
  left: '0',
2564
2737
  right: '0',
@@ -2567,40 +2740,47 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2567
2740
  width: '',
2568
2741
  alignItems: '',
2569
2742
  justifyContent: '',
2570
- }));
2743
+ })));
2571
2744
  };
2745
+ /** Resets the styles for the overlay pane so that a new positioning can be computed. */
2572
2746
  /**
2573
2747
  * Resets the styles for the overlay pane so that a new positioning can be computed.
2748
+ * @private
2574
2749
  * @return {?}
2575
2750
  */
2576
2751
  FlexibleConnectedPositionStrategy.prototype._resetOverlayElementStyles = /**
2577
2752
  * Resets the styles for the overlay pane so that a new positioning can be computed.
2753
+ * @private
2578
2754
  * @return {?}
2579
2755
  */
2580
2756
  function () {
2581
- extendStyles(this._pane.style, /** @type {?} */ ({
2757
+ extendStyles(this._pane.style, (/** @type {?} */ ({
2582
2758
  top: '',
2583
2759
  left: '',
2584
2760
  bottom: '',
2585
2761
  right: '',
2586
2762
  position: '',
2587
- }));
2763
+ transform: '',
2764
+ })));
2588
2765
  };
2766
+ /** Sets positioning styles to the overlay element. */
2589
2767
  /**
2590
2768
  * Sets positioning styles to the overlay element.
2769
+ * @private
2591
2770
  * @param {?} originPoint
2592
2771
  * @param {?} position
2593
2772
  * @return {?}
2594
2773
  */
2595
2774
  FlexibleConnectedPositionStrategy.prototype._setOverlayElementStyles = /**
2596
2775
  * Sets positioning styles to the overlay element.
2776
+ * @private
2597
2777
  * @param {?} originPoint
2598
2778
  * @param {?} position
2599
2779
  * @return {?}
2600
2780
  */
2601
2781
  function (originPoint, position) {
2602
2782
  /** @type {?} */
2603
- var styles = /** @type {?} */ ({});
2783
+ var styles = (/** @type {?} */ ({}));
2604
2784
  if (this._hasExactPosition()) {
2605
2785
  /** @type {?} */
2606
2786
  var scrollPosition = this._viewportRuler.getViewportScrollPosition();
@@ -2610,6 +2790,11 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2610
2790
  else {
2611
2791
  styles.position = 'static';
2612
2792
  }
2793
+ // Use a transform to apply the offsets. We do this because the `center` positions rely on
2794
+ // being in the normal flex flow and setting a `top` / `left` at all will completely throw
2795
+ // off the position. We also can't use margins, because they won't have an effect in some
2796
+ // cases where the element doesn't have anything to "push off of". Finally, this works
2797
+ // better both with flexible and non-flexible positioning.
2613
2798
  /** @type {?} */
2614
2799
  var transformString = '';
2615
2800
  /** @type {?} */
@@ -2634,8 +2819,10 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2634
2819
  }
2635
2820
  extendStyles(this._pane.style, styles);
2636
2821
  };
2822
+ /** Gets the exact top/bottom for the overlay when not using flexible sizing or when pushing. */
2637
2823
  /**
2638
2824
  * Gets the exact top/bottom for the overlay when not using flexible sizing or when pushing.
2825
+ * @private
2639
2826
  * @param {?} position
2640
2827
  * @param {?} originPoint
2641
2828
  * @param {?} scrollPosition
@@ -2643,19 +2830,25 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2643
2830
  */
2644
2831
  FlexibleConnectedPositionStrategy.prototype._getExactOverlayY = /**
2645
2832
  * Gets the exact top/bottom for the overlay when not using flexible sizing or when pushing.
2833
+ * @private
2646
2834
  * @param {?} position
2647
2835
  * @param {?} originPoint
2648
2836
  * @param {?} scrollPosition
2649
2837
  * @return {?}
2650
2838
  */
2651
2839
  function (position, originPoint, scrollPosition) {
2840
+ // Reset any existing styles. This is necessary in case the
2841
+ // preferred position has changed since the last `apply`.
2652
2842
  /** @type {?} */
2653
- var styles = /** @type {?} */ ({ top: null, bottom: null });
2843
+ var styles = (/** @type {?} */ ({ top: null, bottom: null }));
2654
2844
  /** @type {?} */
2655
2845
  var overlayPoint = this._getOverlayPoint(originPoint, this._overlayRect, position);
2656
2846
  if (this._isPushed) {
2657
2847
  overlayPoint = this._pushOverlayOnScreen(overlayPoint, this._overlayRect, scrollPosition);
2658
2848
  }
2849
+ // @breaking-change 8.0.0 Currently the `_overlayContainer` is optional in order to avoid a
2850
+ // breaking change. The null check here can be removed once the `_overlayContainer` becomes
2851
+ // a required parameter.
2659
2852
  /** @type {?} */
2660
2853
  var virtualKeyboardOffset = this._overlayContainer ?
2661
2854
  this._overlayContainer.getContainerElement().getBoundingClientRect().top : 0;
@@ -2667,8 +2860,10 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2667
2860
  // We want to set either `top` or `bottom` based on whether the overlay wants to appear
2668
2861
  // above or below the origin and the direction in which the element will expand.
2669
2862
  if (position.overlayY === 'bottom') {
2863
+ // When using `bottom`, we adjust the y position such that it is the distance
2864
+ // from the bottom of the viewport rather than the top.
2670
2865
  /** @type {?} */
2671
- var documentHeight = /** @type {?} */ ((this._document.documentElement)).clientHeight;
2866
+ var documentHeight = (/** @type {?} */ (this._document.documentElement)).clientHeight;
2672
2867
  styles.bottom = documentHeight - (overlayPoint.y + this._overlayRect.height) + "px";
2673
2868
  }
2674
2869
  else {
@@ -2676,8 +2871,10 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2676
2871
  }
2677
2872
  return styles;
2678
2873
  };
2874
+ /** Gets the exact left/right for the overlay when not using flexible sizing or when pushing. */
2679
2875
  /**
2680
2876
  * Gets the exact left/right for the overlay when not using flexible sizing or when pushing.
2877
+ * @private
2681
2878
  * @param {?} position
2682
2879
  * @param {?} originPoint
2683
2880
  * @param {?} scrollPosition
@@ -2685,19 +2882,26 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2685
2882
  */
2686
2883
  FlexibleConnectedPositionStrategy.prototype._getExactOverlayX = /**
2687
2884
  * Gets the exact left/right for the overlay when not using flexible sizing or when pushing.
2885
+ * @private
2688
2886
  * @param {?} position
2689
2887
  * @param {?} originPoint
2690
2888
  * @param {?} scrollPosition
2691
2889
  * @return {?}
2692
2890
  */
2693
2891
  function (position, originPoint, scrollPosition) {
2892
+ // Reset any existing styles. This is necessary in case the preferred position has
2893
+ // changed since the last `apply`.
2694
2894
  /** @type {?} */
2695
- var styles = /** @type {?} */ ({ left: null, right: null });
2895
+ var styles = (/** @type {?} */ ({ left: null, right: null }));
2696
2896
  /** @type {?} */
2697
2897
  var overlayPoint = this._getOverlayPoint(originPoint, this._overlayRect, position);
2698
2898
  if (this._isPushed) {
2699
2899
  overlayPoint = this._pushOverlayOnScreen(overlayPoint, this._overlayRect, scrollPosition);
2700
2900
  }
2901
+ // We want to set either `left` or `right` based on whether the overlay wants to appear "before"
2902
+ // or "after" the origin, which determines the direction in which the element will expand.
2903
+ // For the horizontal axis, the meaning of "before" and "after" change based on whether the
2904
+ // page is in RTL or LTR.
2701
2905
  /** @type {?} */
2702
2906
  var horizontalStyleProperty;
2703
2907
  if (this._isRtl()) {
@@ -2710,7 +2914,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2710
2914
  // from the right edge of the viewport rather than the left edge.
2711
2915
  if (horizontalStyleProperty === 'right') {
2712
2916
  /** @type {?} */
2713
- var documentWidth = /** @type {?} */ ((this._document.documentElement)).clientWidth;
2917
+ var documentWidth = (/** @type {?} */ (this._document.documentElement)).clientWidth;
2714
2918
  styles.right = documentWidth - (overlayPoint.x + this._overlayRect.width) + "px";
2715
2919
  }
2716
2920
  else {
@@ -2721,18 +2925,28 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2721
2925
  /**
2722
2926
  * Gets the view properties of the trigger and overlay, including whether they are clipped
2723
2927
  * or completely outside the view of any of the strategy's scrollables.
2928
+ */
2929
+ /**
2930
+ * Gets the view properties of the trigger and overlay, including whether they are clipped
2931
+ * or completely outside the view of any of the strategy's scrollables.
2932
+ * @private
2724
2933
  * @return {?}
2725
2934
  */
2726
2935
  FlexibleConnectedPositionStrategy.prototype._getScrollVisibility = /**
2727
2936
  * Gets the view properties of the trigger and overlay, including whether they are clipped
2728
2937
  * or completely outside the view of any of the strategy's scrollables.
2938
+ * @private
2729
2939
  * @return {?}
2730
2940
  */
2731
2941
  function () {
2942
+ // Note: needs fresh rects since the position could've changed.
2732
2943
  /** @type {?} */
2733
2944
  var originBounds = this._origin.getBoundingClientRect();
2734
2945
  /** @type {?} */
2735
2946
  var overlayBounds = this._pane.getBoundingClientRect();
2947
+ // TODO(jelbourn): instead of needing all of the client rects for these scrolling containers
2948
+ // every time, we should be able to use the scrollTop of the containers if the size of those
2949
+ // containers hasn't changed.
2736
2950
  /** @type {?} */
2737
2951
  var scrollContainerBounds = this.scrollables.map(function (scrollable) {
2738
2952
  return scrollable.getElementRef().nativeElement.getBoundingClientRect();
@@ -2744,14 +2958,17 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2744
2958
  isOverlayOutsideView: isElementScrolledOutsideView(overlayBounds, scrollContainerBounds),
2745
2959
  };
2746
2960
  };
2961
+ /** Subtracts the amount that an element is overflowing on an axis from it's length. */
2747
2962
  /**
2748
2963
  * Subtracts the amount that an element is overflowing on an axis from it's length.
2964
+ * @private
2749
2965
  * @param {?} length
2750
2966
  * @param {...?} overflows
2751
2967
  * @return {?}
2752
2968
  */
2753
2969
  FlexibleConnectedPositionStrategy.prototype._subtractOverflows = /**
2754
2970
  * Subtracts the amount that an element is overflowing on an axis from it's length.
2971
+ * @private
2755
2972
  * @param {?} length
2756
2973
  * @param {...?} overflows
2757
2974
  * @return {?}
@@ -2765,19 +2982,27 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2765
2982
  return currentValue - Math.max(currentOverflow, 0);
2766
2983
  }, length);
2767
2984
  };
2985
+ /** Narrows the given viewport rect by the current _viewportMargin. */
2768
2986
  /**
2769
2987
  * Narrows the given viewport rect by the current _viewportMargin.
2988
+ * @private
2770
2989
  * @return {?}
2771
2990
  */
2772
2991
  FlexibleConnectedPositionStrategy.prototype._getNarrowedViewportRect = /**
2773
2992
  * Narrows the given viewport rect by the current _viewportMargin.
2993
+ * @private
2774
2994
  * @return {?}
2775
2995
  */
2776
2996
  function () {
2997
+ // We recalculate the viewport rect here ourselves, rather than using the ViewportRuler,
2998
+ // because we want to use the `clientWidth` and `clientHeight` as the base. The difference
2999
+ // being that the client properties don't include the scrollbar, as opposed to `innerWidth`
3000
+ // and `innerHeight` that do. This is necessary, because the overlay container uses
3001
+ // 100% `width` and `height` which don't include the scrollbar either.
2777
3002
  /** @type {?} */
2778
- var width = /** @type {?} */ ((this._document.documentElement)).clientWidth;
3003
+ var width = (/** @type {?} */ (this._document.documentElement)).clientWidth;
2779
3004
  /** @type {?} */
2780
- var height = /** @type {?} */ ((this._document.documentElement)).clientHeight;
3005
+ var height = (/** @type {?} */ (this._document.documentElement)).clientHeight;
2781
3006
  /** @type {?} */
2782
3007
  var scrollPosition = this._viewportRuler.getViewportScrollPosition();
2783
3008
  return {
@@ -2789,36 +3014,45 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2789
3014
  height: height - (2 * this._viewportMargin),
2790
3015
  };
2791
3016
  };
3017
+ /** Whether the we're dealing with an RTL context */
2792
3018
  /**
2793
3019
  * Whether the we're dealing with an RTL context
3020
+ * @private
2794
3021
  * @return {?}
2795
3022
  */
2796
3023
  FlexibleConnectedPositionStrategy.prototype._isRtl = /**
2797
3024
  * Whether the we're dealing with an RTL context
3025
+ * @private
2798
3026
  * @return {?}
2799
3027
  */
2800
3028
  function () {
2801
3029
  return this._overlayRef.getDirection() === 'rtl';
2802
3030
  };
3031
+ /** Determines whether the overlay uses exact or flexible positioning. */
2803
3032
  /**
2804
3033
  * Determines whether the overlay uses exact or flexible positioning.
3034
+ * @private
2805
3035
  * @return {?}
2806
3036
  */
2807
3037
  FlexibleConnectedPositionStrategy.prototype._hasExactPosition = /**
2808
3038
  * Determines whether the overlay uses exact or flexible positioning.
3039
+ * @private
2809
3040
  * @return {?}
2810
3041
  */
2811
3042
  function () {
2812
3043
  return !this._hasFlexibleDimensions || this._isPushed;
2813
3044
  };
3045
+ /** Retrieves the offset of a position along the x or y axis. */
2814
3046
  /**
2815
3047
  * Retrieves the offset of a position along the x or y axis.
3048
+ * @private
2816
3049
  * @param {?} position
2817
3050
  * @param {?} axis
2818
3051
  * @return {?}
2819
3052
  */
2820
3053
  FlexibleConnectedPositionStrategy.prototype._getOffset = /**
2821
3054
  * Retrieves the offset of a position along the x or y axis.
3055
+ * @private
2822
3056
  * @param {?} position
2823
3057
  * @param {?} axis
2824
3058
  * @return {?}
@@ -2831,12 +3065,15 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2831
3065
  }
2832
3066
  return position.offsetY == null ? this._offsetY : position.offsetY;
2833
3067
  };
3068
+ /** Validates that the current position match the expected values. */
2834
3069
  /**
2835
3070
  * Validates that the current position match the expected values.
3071
+ * @private
2836
3072
  * @return {?}
2837
3073
  */
2838
3074
  FlexibleConnectedPositionStrategy.prototype._validatePositions = /**
2839
3075
  * Validates that the current position match the expected values.
3076
+ * @private
2840
3077
  * @return {?}
2841
3078
  */
2842
3079
  function () {
@@ -2852,13 +3089,16 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2852
3089
  validateVerticalPosition('overlayY', pair.overlayY);
2853
3090
  });
2854
3091
  };
3092
+ /** Adds a single CSS class or an array of classes on the overlay panel. */
2855
3093
  /**
2856
3094
  * Adds a single CSS class or an array of classes on the overlay panel.
3095
+ * @private
2857
3096
  * @param {?} cssClasses
2858
3097
  * @return {?}
2859
3098
  */
2860
3099
  FlexibleConnectedPositionStrategy.prototype._addPanelClasses = /**
2861
3100
  * Adds a single CSS class or an array of classes on the overlay panel.
3101
+ * @private
2862
3102
  * @param {?} cssClasses
2863
3103
  * @return {?}
2864
3104
  */
@@ -2873,12 +3113,15 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2873
3113
  });
2874
3114
  }
2875
3115
  };
3116
+ /** Clears the classes that the position strategy has applied from the overlay panel. */
2876
3117
  /**
2877
3118
  * Clears the classes that the position strategy has applied from the overlay panel.
3119
+ * @private
2878
3120
  * @return {?}
2879
3121
  */
2880
3122
  FlexibleConnectedPositionStrategy.prototype._clearPanelClasses = /**
2881
3123
  * Clears the classes that the position strategy has applied from the overlay panel.
3124
+ * @private
2882
3125
  * @return {?}
2883
3126
  */
2884
3127
  function () {
@@ -2907,7 +3150,7 @@ function extendStyles(dest, source) {
2907
3150
 
2908
3151
  /**
2909
3152
  * @fileoverview added by tsickle
2910
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
3153
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2911
3154
  */
2912
3155
  /**
2913
3156
  * A strategy for positioning overlays. Using this strategy, an overlay is given an
@@ -3094,26 +3337,30 @@ ConnectedPositionStrategy = /** @class */ (function () {
3094
3337
  */
3095
3338
  /**
3096
3339
  * Adds a new preferred fallback position.
3340
+ * @template THIS
3341
+ * @this {THIS}
3097
3342
  * @param {?} originPos
3098
3343
  * @param {?} overlayPos
3099
3344
  * @param {?=} offsetX
3100
3345
  * @param {?=} offsetY
3101
- * @return {?}
3346
+ * @return {THIS}
3102
3347
  */
3103
3348
  ConnectedPositionStrategy.prototype.withFallbackPosition = /**
3104
3349
  * Adds a new preferred fallback position.
3350
+ * @template THIS
3351
+ * @this {THIS}
3105
3352
  * @param {?} originPos
3106
3353
  * @param {?} overlayPos
3107
3354
  * @param {?=} offsetX
3108
3355
  * @param {?=} offsetY
3109
- * @return {?}
3356
+ * @return {THIS}
3110
3357
  */
3111
3358
  function (originPos, overlayPos, offsetX, offsetY) {
3112
3359
  /** @type {?} */
3113
3360
  var position = new ConnectionPositionPair(originPos, overlayPos, offsetX, offsetY);
3114
- this._preferredPositions.push(position);
3115
- this._positionStrategy.withPositions(this._preferredPositions);
3116
- return this;
3361
+ (/** @type {?} */ (this))._preferredPositions.push(position);
3362
+ (/** @type {?} */ (this))._positionStrategy.withPositions((/** @type {?} */ (this))._preferredPositions);
3363
+ return (/** @type {?} */ (this));
3117
3364
  };
3118
3365
  /**
3119
3366
  * Sets the layout direction so the overlay's position can be adjusted to match.
@@ -3121,25 +3368,29 @@ ConnectedPositionStrategy = /** @class */ (function () {
3121
3368
  */
3122
3369
  /**
3123
3370
  * Sets the layout direction so the overlay's position can be adjusted to match.
3371
+ * @template THIS
3372
+ * @this {THIS}
3124
3373
  * @param {?} dir New layout direction.
3125
- * @return {?}
3374
+ * @return {THIS}
3126
3375
  */
3127
3376
  ConnectedPositionStrategy.prototype.withDirection = /**
3128
3377
  * Sets the layout direction so the overlay's position can be adjusted to match.
3378
+ * @template THIS
3379
+ * @this {THIS}
3129
3380
  * @param {?} dir New layout direction.
3130
- * @return {?}
3381
+ * @return {THIS}
3131
3382
  */
3132
3383
  function (dir) {
3133
3384
  // Since the direction might be declared before the strategy is attached,
3134
3385
  // we save the value in a temporary property and we'll transfer it to the
3135
3386
  // overlay ref on attachment.
3136
- if (this._overlayRef) {
3137
- this._overlayRef.setDirection(dir);
3387
+ if ((/** @type {?} */ (this))._overlayRef) {
3388
+ (/** @type {?} */ (this))._overlayRef.setDirection(dir);
3138
3389
  }
3139
3390
  else {
3140
- this._direction = dir;
3391
+ (/** @type {?} */ (this))._direction = dir;
3141
3392
  }
3142
- return this;
3393
+ return (/** @type {?} */ (this));
3143
3394
  };
3144
3395
  /**
3145
3396
  * Sets an offset for the overlay's connection point on the x-axis
@@ -3147,17 +3398,21 @@ ConnectedPositionStrategy = /** @class */ (function () {
3147
3398
  */
3148
3399
  /**
3149
3400
  * Sets an offset for the overlay's connection point on the x-axis
3401
+ * @template THIS
3402
+ * @this {THIS}
3150
3403
  * @param {?} offset New offset in the X axis.
3151
- * @return {?}
3404
+ * @return {THIS}
3152
3405
  */
3153
3406
  ConnectedPositionStrategy.prototype.withOffsetX = /**
3154
3407
  * Sets an offset for the overlay's connection point on the x-axis
3408
+ * @template THIS
3409
+ * @this {THIS}
3155
3410
  * @param {?} offset New offset in the X axis.
3156
- * @return {?}
3411
+ * @return {THIS}
3157
3412
  */
3158
3413
  function (offset) {
3159
- this._positionStrategy.withDefaultOffsetX(offset);
3160
- return this;
3414
+ (/** @type {?} */ (this))._positionStrategy.withDefaultOffsetX(offset);
3415
+ return (/** @type {?} */ (this));
3161
3416
  };
3162
3417
  /**
3163
3418
  * Sets an offset for the overlay's connection point on the y-axis
@@ -3165,17 +3420,21 @@ ConnectedPositionStrategy = /** @class */ (function () {
3165
3420
  */
3166
3421
  /**
3167
3422
  * Sets an offset for the overlay's connection point on the y-axis
3423
+ * @template THIS
3424
+ * @this {THIS}
3168
3425
  * @param {?} offset New offset in the Y axis.
3169
- * @return {?}
3426
+ * @return {THIS}
3170
3427
  */
3171
3428
  ConnectedPositionStrategy.prototype.withOffsetY = /**
3172
3429
  * Sets an offset for the overlay's connection point on the y-axis
3430
+ * @template THIS
3431
+ * @this {THIS}
3173
3432
  * @param {?} offset New offset in the Y axis.
3174
- * @return {?}
3433
+ * @return {THIS}
3175
3434
  */
3176
3435
  function (offset) {
3177
- this._positionStrategy.withDefaultOffsetY(offset);
3178
- return this;
3436
+ (/** @type {?} */ (this))._positionStrategy.withDefaultOffsetY(offset);
3437
+ return (/** @type {?} */ (this));
3179
3438
  };
3180
3439
  /**
3181
3440
  * Sets whether the overlay's position should be locked in after it is positioned
@@ -3187,19 +3446,23 @@ ConnectedPositionStrategy = /** @class */ (function () {
3187
3446
  * Sets whether the overlay's position should be locked in after it is positioned
3188
3447
  * initially. When an overlay is locked in, it won't attempt to reposition itself
3189
3448
  * when the position is re-applied (e.g. when the user scrolls away).
3449
+ * @template THIS
3450
+ * @this {THIS}
3190
3451
  * @param {?} isLocked Whether the overlay should locked in.
3191
- * @return {?}
3452
+ * @return {THIS}
3192
3453
  */
3193
3454
  ConnectedPositionStrategy.prototype.withLockedPosition = /**
3194
3455
  * Sets whether the overlay's position should be locked in after it is positioned
3195
3456
  * initially. When an overlay is locked in, it won't attempt to reposition itself
3196
3457
  * when the position is re-applied (e.g. when the user scrolls away).
3458
+ * @template THIS
3459
+ * @this {THIS}
3197
3460
  * @param {?} isLocked Whether the overlay should locked in.
3198
- * @return {?}
3461
+ * @return {THIS}
3199
3462
  */
3200
3463
  function (isLocked) {
3201
- this._positionStrategy.withLockedPosition(isLocked);
3202
- return this;
3464
+ (/** @type {?} */ (this))._positionStrategy.withLockedPosition(isLocked);
3465
+ return (/** @type {?} */ (this));
3203
3466
  };
3204
3467
  /**
3205
3468
  * Overwrites the current set of positions with an array of new ones.
@@ -3207,18 +3470,22 @@ ConnectedPositionStrategy = /** @class */ (function () {
3207
3470
  */
3208
3471
  /**
3209
3472
  * Overwrites the current set of positions with an array of new ones.
3473
+ * @template THIS
3474
+ * @this {THIS}
3210
3475
  * @param {?} positions Position pairs to be set on the strategy.
3211
- * @return {?}
3476
+ * @return {THIS}
3212
3477
  */
3213
3478
  ConnectedPositionStrategy.prototype.withPositions = /**
3214
3479
  * Overwrites the current set of positions with an array of new ones.
3480
+ * @template THIS
3481
+ * @this {THIS}
3215
3482
  * @param {?} positions Position pairs to be set on the strategy.
3216
- * @return {?}
3483
+ * @return {THIS}
3217
3484
  */
3218
3485
  function (positions) {
3219
- this._preferredPositions = positions.slice();
3220
- this._positionStrategy.withPositions(this._preferredPositions);
3221
- return this;
3486
+ (/** @type {?} */ (this))._preferredPositions = positions.slice();
3487
+ (/** @type {?} */ (this))._positionStrategy.withPositions((/** @type {?} */ (this))._preferredPositions);
3488
+ return (/** @type {?} */ (this));
3222
3489
  };
3223
3490
  /**
3224
3491
  * Sets the origin element, relative to which to position the overlay.
@@ -3226,29 +3493,34 @@ ConnectedPositionStrategy = /** @class */ (function () {
3226
3493
  */
3227
3494
  /**
3228
3495
  * Sets the origin element, relative to which to position the overlay.
3496
+ * @template THIS
3497
+ * @this {THIS}
3229
3498
  * @param {?} origin Reference to the new origin element.
3230
- * @return {?}
3499
+ * @return {THIS}
3231
3500
  */
3232
3501
  ConnectedPositionStrategy.prototype.setOrigin = /**
3233
3502
  * Sets the origin element, relative to which to position the overlay.
3503
+ * @template THIS
3504
+ * @this {THIS}
3234
3505
  * @param {?} origin Reference to the new origin element.
3235
- * @return {?}
3506
+ * @return {THIS}
3236
3507
  */
3237
3508
  function (origin) {
3238
- this._positionStrategy.setOrigin(origin);
3239
- return this;
3509
+ (/** @type {?} */ (this))._positionStrategy.setOrigin(origin);
3510
+ return (/** @type {?} */ (this));
3240
3511
  };
3241
3512
  return ConnectedPositionStrategy;
3242
3513
  }());
3243
3514
 
3244
3515
  /**
3245
3516
  * @fileoverview added by tsickle
3246
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
3517
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3247
3518
  */
3248
3519
 
3249
- /** *
3520
+ /**
3250
3521
  * Class to be added to the overlay pane wrapper.
3251
- @type {?} */
3522
+ * @type {?}
3523
+ */
3252
3524
  var wrapperClass = 'cdk-global-overlay-wrapper';
3253
3525
  /**
3254
3526
  * A strategy for positioning overlays. Using this strategy, an overlay is given an
@@ -3301,20 +3573,24 @@ GlobalPositionStrategy = /** @class */ (function () {
3301
3573
  */
3302
3574
  /**
3303
3575
  * Sets the top position of the overlay. Clears any previously set vertical position.
3576
+ * @template THIS
3577
+ * @this {THIS}
3304
3578
  * @param {?=} value New top offset.
3305
- * @return {?}
3579
+ * @return {THIS}
3306
3580
  */
3307
3581
  GlobalPositionStrategy.prototype.top = /**
3308
3582
  * Sets the top position of the overlay. Clears any previously set vertical position.
3583
+ * @template THIS
3584
+ * @this {THIS}
3309
3585
  * @param {?=} value New top offset.
3310
- * @return {?}
3586
+ * @return {THIS}
3311
3587
  */
3312
3588
  function (value) {
3313
3589
  if (value === void 0) { value = ''; }
3314
- this._bottomOffset = '';
3315
- this._topOffset = value;
3316
- this._alignItems = 'flex-start';
3317
- return this;
3590
+ (/** @type {?} */ (this))._bottomOffset = '';
3591
+ (/** @type {?} */ (this))._topOffset = value;
3592
+ (/** @type {?} */ (this))._alignItems = 'flex-start';
3593
+ return (/** @type {?} */ (this));
3318
3594
  };
3319
3595
  /**
3320
3596
  * Sets the left position of the overlay. Clears any previously set horizontal position.
@@ -3322,20 +3598,24 @@ GlobalPositionStrategy = /** @class */ (function () {
3322
3598
  */
3323
3599
  /**
3324
3600
  * Sets the left position of the overlay. Clears any previously set horizontal position.
3601
+ * @template THIS
3602
+ * @this {THIS}
3325
3603
  * @param {?=} value New left offset.
3326
- * @return {?}
3604
+ * @return {THIS}
3327
3605
  */
3328
3606
  GlobalPositionStrategy.prototype.left = /**
3329
3607
  * Sets the left position of the overlay. Clears any previously set horizontal position.
3608
+ * @template THIS
3609
+ * @this {THIS}
3330
3610
  * @param {?=} value New left offset.
3331
- * @return {?}
3611
+ * @return {THIS}
3332
3612
  */
3333
3613
  function (value) {
3334
3614
  if (value === void 0) { value = ''; }
3335
- this._rightOffset = '';
3336
- this._leftOffset = value;
3337
- this._justifyContent = 'flex-start';
3338
- return this;
3615
+ (/** @type {?} */ (this))._rightOffset = '';
3616
+ (/** @type {?} */ (this))._leftOffset = value;
3617
+ (/** @type {?} */ (this))._justifyContent = 'flex-start';
3618
+ return (/** @type {?} */ (this));
3339
3619
  };
3340
3620
  /**
3341
3621
  * Sets the bottom position of the overlay. Clears any previously set vertical position.
@@ -3343,20 +3623,24 @@ GlobalPositionStrategy = /** @class */ (function () {
3343
3623
  */
3344
3624
  /**
3345
3625
  * Sets the bottom position of the overlay. Clears any previously set vertical position.
3626
+ * @template THIS
3627
+ * @this {THIS}
3346
3628
  * @param {?=} value New bottom offset.
3347
- * @return {?}
3629
+ * @return {THIS}
3348
3630
  */
3349
3631
  GlobalPositionStrategy.prototype.bottom = /**
3350
3632
  * Sets the bottom position of the overlay. Clears any previously set vertical position.
3633
+ * @template THIS
3634
+ * @this {THIS}
3351
3635
  * @param {?=} value New bottom offset.
3352
- * @return {?}
3636
+ * @return {THIS}
3353
3637
  */
3354
3638
  function (value) {
3355
3639
  if (value === void 0) { value = ''; }
3356
- this._topOffset = '';
3357
- this._bottomOffset = value;
3358
- this._alignItems = 'flex-end';
3359
- return this;
3640
+ (/** @type {?} */ (this))._topOffset = '';
3641
+ (/** @type {?} */ (this))._bottomOffset = value;
3642
+ (/** @type {?} */ (this))._alignItems = 'flex-end';
3643
+ return (/** @type {?} */ (this));
3360
3644
  };
3361
3645
  /**
3362
3646
  * Sets the right position of the overlay. Clears any previously set horizontal position.
@@ -3364,20 +3648,24 @@ GlobalPositionStrategy = /** @class */ (function () {
3364
3648
  */
3365
3649
  /**
3366
3650
  * Sets the right position of the overlay. Clears any previously set horizontal position.
3651
+ * @template THIS
3652
+ * @this {THIS}
3367
3653
  * @param {?=} value New right offset.
3368
- * @return {?}
3654
+ * @return {THIS}
3369
3655
  */
3370
3656
  GlobalPositionStrategy.prototype.right = /**
3371
3657
  * Sets the right position of the overlay. Clears any previously set horizontal position.
3658
+ * @template THIS
3659
+ * @this {THIS}
3372
3660
  * @param {?=} value New right offset.
3373
- * @return {?}
3661
+ * @return {THIS}
3374
3662
  */
3375
3663
  function (value) {
3376
3664
  if (value === void 0) { value = ''; }
3377
- this._leftOffset = '';
3378
- this._rightOffset = value;
3379
- this._justifyContent = 'flex-end';
3380
- return this;
3665
+ (/** @type {?} */ (this))._leftOffset = '';
3666
+ (/** @type {?} */ (this))._rightOffset = value;
3667
+ (/** @type {?} */ (this))._justifyContent = 'flex-end';
3668
+ return (/** @type {?} */ (this));
3381
3669
  };
3382
3670
  /**
3383
3671
  * Sets the overlay width and clears any previously set width.
@@ -3389,25 +3677,29 @@ GlobalPositionStrategy = /** @class */ (function () {
3389
3677
  * Sets the overlay width and clears any previously set width.
3390
3678
  * @deprecated Pass the `width` through the `OverlayConfig`.
3391
3679
  * \@breaking-change 8.0.0
3680
+ * @template THIS
3681
+ * @this {THIS}
3392
3682
  * @param {?=} value New width for the overlay
3393
- * @return {?}
3683
+ * @return {THIS}
3394
3684
  */
3395
3685
  GlobalPositionStrategy.prototype.width = /**
3396
3686
  * Sets the overlay width and clears any previously set width.
3397
3687
  * @deprecated Pass the `width` through the `OverlayConfig`.
3398
3688
  * \@breaking-change 8.0.0
3689
+ * @template THIS
3690
+ * @this {THIS}
3399
3691
  * @param {?=} value New width for the overlay
3400
- * @return {?}
3692
+ * @return {THIS}
3401
3693
  */
3402
3694
  function (value) {
3403
3695
  if (value === void 0) { value = ''; }
3404
- if (this._overlayRef) {
3405
- this._overlayRef.updateSize({ width: value });
3696
+ if ((/** @type {?} */ (this))._overlayRef) {
3697
+ (/** @type {?} */ (this))._overlayRef.updateSize({ width: value });
3406
3698
  }
3407
3699
  else {
3408
- this._width = value;
3700
+ (/** @type {?} */ (this))._width = value;
3409
3701
  }
3410
- return this;
3702
+ return (/** @type {?} */ (this));
3411
3703
  };
3412
3704
  /**
3413
3705
  * Sets the overlay height and clears any previously set height.
@@ -3419,25 +3711,29 @@ GlobalPositionStrategy = /** @class */ (function () {
3419
3711
  * Sets the overlay height and clears any previously set height.
3420
3712
  * @deprecated Pass the `height` through the `OverlayConfig`.
3421
3713
  * \@breaking-change 8.0.0
3714
+ * @template THIS
3715
+ * @this {THIS}
3422
3716
  * @param {?=} value New height for the overlay
3423
- * @return {?}
3717
+ * @return {THIS}
3424
3718
  */
3425
3719
  GlobalPositionStrategy.prototype.height = /**
3426
3720
  * Sets the overlay height and clears any previously set height.
3427
3721
  * @deprecated Pass the `height` through the `OverlayConfig`.
3428
3722
  * \@breaking-change 8.0.0
3723
+ * @template THIS
3724
+ * @this {THIS}
3429
3725
  * @param {?=} value New height for the overlay
3430
- * @return {?}
3726
+ * @return {THIS}
3431
3727
  */
3432
3728
  function (value) {
3433
3729
  if (value === void 0) { value = ''; }
3434
- if (this._overlayRef) {
3435
- this._overlayRef.updateSize({ height: value });
3730
+ if ((/** @type {?} */ (this))._overlayRef) {
3731
+ (/** @type {?} */ (this))._overlayRef.updateSize({ height: value });
3436
3732
  }
3437
3733
  else {
3438
- this._height = value;
3734
+ (/** @type {?} */ (this))._height = value;
3439
3735
  }
3440
- return this;
3736
+ return (/** @type {?} */ (this));
3441
3737
  };
3442
3738
  /**
3443
3739
  * Centers the overlay horizontally with an optional offset.
@@ -3449,21 +3745,25 @@ GlobalPositionStrategy = /** @class */ (function () {
3449
3745
  * Centers the overlay horizontally with an optional offset.
3450
3746
  * Clears any previously set horizontal position.
3451
3747
  *
3748
+ * @template THIS
3749
+ * @this {THIS}
3452
3750
  * @param {?=} offset Overlay offset from the horizontal center.
3453
- * @return {?}
3751
+ * @return {THIS}
3454
3752
  */
3455
3753
  GlobalPositionStrategy.prototype.centerHorizontally = /**
3456
3754
  * Centers the overlay horizontally with an optional offset.
3457
3755
  * Clears any previously set horizontal position.
3458
3756
  *
3757
+ * @template THIS
3758
+ * @this {THIS}
3459
3759
  * @param {?=} offset Overlay offset from the horizontal center.
3460
- * @return {?}
3760
+ * @return {THIS}
3461
3761
  */
3462
3762
  function (offset) {
3463
3763
  if (offset === void 0) { offset = ''; }
3464
- this.left(offset);
3465
- this._justifyContent = 'center';
3466
- return this;
3764
+ (/** @type {?} */ (this)).left(offset);
3765
+ (/** @type {?} */ (this))._justifyContent = 'center';
3766
+ return (/** @type {?} */ (this));
3467
3767
  };
3468
3768
  /**
3469
3769
  * Centers the overlay vertically with an optional offset.
@@ -3475,21 +3775,25 @@ GlobalPositionStrategy = /** @class */ (function () {
3475
3775
  * Centers the overlay vertically with an optional offset.
3476
3776
  * Clears any previously set vertical position.
3477
3777
  *
3778
+ * @template THIS
3779
+ * @this {THIS}
3478
3780
  * @param {?=} offset Overlay offset from the vertical center.
3479
- * @return {?}
3781
+ * @return {THIS}
3480
3782
  */
3481
3783
  GlobalPositionStrategy.prototype.centerVertically = /**
3482
3784
  * Centers the overlay vertically with an optional offset.
3483
3785
  * Clears any previously set vertical position.
3484
3786
  *
3787
+ * @template THIS
3788
+ * @this {THIS}
3485
3789
  * @param {?=} offset Overlay offset from the vertical center.
3486
- * @return {?}
3790
+ * @return {THIS}
3487
3791
  */
3488
3792
  function (offset) {
3489
3793
  if (offset === void 0) { offset = ''; }
3490
- this.top(offset);
3491
- this._alignItems = 'center';
3492
- return this;
3794
+ (/** @type {?} */ (this)).top(offset);
3795
+ (/** @type {?} */ (this))._alignItems = 'center';
3796
+ return (/** @type {?} */ (this));
3493
3797
  };
3494
3798
  /**
3495
3799
  * Apply the position to the element.
@@ -3573,7 +3877,7 @@ GlobalPositionStrategy = /** @class */ (function () {
3573
3877
  parent.classList.remove(wrapperClass);
3574
3878
  parentStyles.justifyContent = parentStyles.alignItems = styles.marginTop =
3575
3879
  styles.marginBottom = styles.marginLeft = styles.marginRight = styles.position = '';
3576
- this._overlayRef = /** @type {?} */ ((null));
3880
+ this._overlayRef = (/** @type {?} */ (null));
3577
3881
  this._isDisposed = true;
3578
3882
  };
3579
3883
  return GlobalPositionStrategy;
@@ -3581,15 +3885,13 @@ GlobalPositionStrategy = /** @class */ (function () {
3581
3885
 
3582
3886
  /**
3583
3887
  * @fileoverview added by tsickle
3584
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
3888
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3585
3889
  */
3586
3890
  /**
3587
3891
  * Builder for overlay position strategy.
3588
3892
  */
3589
3893
  var OverlayPositionBuilder = /** @class */ (function () {
3590
- function OverlayPositionBuilder(_viewportRuler, _document,
3591
- // @breaking-change 8.0.0 `_platform` and `_overlayContainer` parameters to be made required.
3592
- _platform, _overlayContainer) {
3894
+ function OverlayPositionBuilder(_viewportRuler, _document, _platform, _overlayContainer) {
3593
3895
  this._viewportRuler = _viewportRuler;
3594
3896
  this._document = _document;
3595
3897
  this._platform = _platform;
@@ -3671,12 +3973,15 @@ var OverlayPositionBuilder = /** @class */ (function () {
3671
3973
 
3672
3974
  /**
3673
3975
  * @fileoverview added by tsickle
3674
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
3976
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3675
3977
  */
3676
- /** *
3978
+ /**
3677
3979
  * Next overlay unique ID.
3678
- @type {?} */
3980
+ * @type {?}
3981
+ */
3679
3982
  var nextUniqueId = 0;
3983
+ // Note that Overlay is *not* scoped to the app root because the ComponentFactoryResolver
3984
+ // it needs is different based on where OverlayModule is imported.
3680
3985
  /**
3681
3986
  * Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be
3682
3987
  * used as a low-level building block for other components. Dialogs, tooltips, menus,
@@ -3686,9 +3991,7 @@ var nextUniqueId = 0;
3686
3991
  * An overlay *is* a PortalOutlet, so any kind of Portal can be loaded into one.
3687
3992
  */
3688
3993
  var Overlay = /** @class */ (function () {
3689
- function Overlay(scrollStrategies, _overlayContainer, _componentFactoryResolver, _positionBuilder, _keyboardDispatcher, _injector, _ngZone, _document, _directionality,
3690
- // @breaking-change 8.0.0 `_location` parameter to be made required.
3691
- _location) {
3994
+ function Overlay(scrollStrategies, _overlayContainer, _componentFactoryResolver, _positionBuilder, _keyboardDispatcher, _injector, _ngZone, _document, _directionality, _location) {
3692
3995
  this.scrollStrategies = scrollStrategies;
3693
3996
  this._overlayContainer = _overlayContainer;
3694
3997
  this._componentFactoryResolver = _componentFactoryResolver;
@@ -3747,11 +4050,17 @@ var Overlay = /** @class */ (function () {
3747
4050
  };
3748
4051
  /**
3749
4052
  * Creates the DOM element for an overlay and appends it to the overlay container.
4053
+ * @returns Newly-created pane element
4054
+ */
4055
+ /**
4056
+ * Creates the DOM element for an overlay and appends it to the overlay container.
4057
+ * @private
3750
4058
  * @param {?} host
3751
4059
  * @return {?} Newly-created pane element
3752
4060
  */
3753
4061
  Overlay.prototype._createPaneElement = /**
3754
4062
  * Creates the DOM element for an overlay and appends it to the overlay container.
4063
+ * @private
3755
4064
  * @param {?} host
3756
4065
  * @return {?} Newly-created pane element
3757
4066
  */
@@ -3766,11 +4075,18 @@ var Overlay = /** @class */ (function () {
3766
4075
  /**
3767
4076
  * Creates the host element that wraps around an overlay
3768
4077
  * and can be used for advanced positioning.
4078
+ * @returns Newly-create host element.
4079
+ */
4080
+ /**
4081
+ * Creates the host element that wraps around an overlay
4082
+ * and can be used for advanced positioning.
4083
+ * @private
3769
4084
  * @return {?} Newly-create host element.
3770
4085
  */
3771
4086
  Overlay.prototype._createHostElement = /**
3772
4087
  * Creates the host element that wraps around an overlay
3773
4088
  * and can be used for advanced positioning.
4089
+ * @private
3774
4090
  * @return {?} Newly-create host element.
3775
4091
  */
3776
4092
  function () {
@@ -3781,11 +4097,18 @@ var Overlay = /** @class */ (function () {
3781
4097
  };
3782
4098
  /**
3783
4099
  * Create a DomPortalOutlet into which the overlay content can be loaded.
4100
+ * @param pane The DOM element to turn into a portal outlet.
4101
+ * @returns A portal outlet for the given DOM element.
4102
+ */
4103
+ /**
4104
+ * Create a DomPortalOutlet into which the overlay content can be loaded.
4105
+ * @private
3784
4106
  * @param {?} pane The DOM element to turn into a portal outlet.
3785
4107
  * @return {?} A portal outlet for the given DOM element.
3786
4108
  */
3787
4109
  Overlay.prototype._createPortalOutlet = /**
3788
4110
  * Create a DomPortalOutlet into which the overlay content can be loaded.
4111
+ * @private
3789
4112
  * @param {?} pane The DOM element to turn into a portal outlet.
3790
4113
  * @return {?} A portal outlet for the given DOM element.
3791
4114
  */
@@ -3818,11 +4141,12 @@ var Overlay = /** @class */ (function () {
3818
4141
 
3819
4142
  /**
3820
4143
  * @fileoverview added by tsickle
3821
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
4144
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3822
4145
  */
3823
- /** *
4146
+ /**
3824
4147
  * Default set of positions for the overlay. Follows the behavior of a dropdown.
3825
- @type {?} */
4148
+ * @type {?}
4149
+ */
3826
4150
  var defaultPositionList = [
3827
4151
  {
3828
4152
  originX: 'start',
@@ -3849,9 +4173,10 @@ var defaultPositionList = [
3849
4173
  overlayY: 'top'
3850
4174
  }
3851
4175
  ];
3852
- /** *
4176
+ /**
3853
4177
  * Injection token that determines the scroll handling while the connected overlay is open.
3854
- @type {?} */
4178
+ * @type {?}
4179
+ */
3855
4180
  var CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY = new core.InjectionToken('cdk-connected-overlay-scroll-strategy');
3856
4181
  /**
3857
4182
  * Directive applied to an element to make it usable as an origin for an Overlay using a
@@ -4068,7 +4393,10 @@ var CdkConnectedOverlay = /** @class */ (function () {
4068
4393
  * @return {?}
4069
4394
  */
4070
4395
  function () {
4071
- this._destroyOverlay();
4396
+ if (this._overlayRef) {
4397
+ this._overlayRef.dispose();
4398
+ }
4399
+ this._backdropSubscription.unsubscribe();
4072
4400
  };
4073
4401
  /**
4074
4402
  * @param {?} changes
@@ -4081,6 +4409,12 @@ var CdkConnectedOverlay = /** @class */ (function () {
4081
4409
  function (changes) {
4082
4410
  if (this._position) {
4083
4411
  this._updatePositionStrategy(this._position);
4412
+ this._overlayRef.updateSize({
4413
+ width: this.width,
4414
+ minWidth: this.minWidth,
4415
+ height: this.height,
4416
+ minHeight: this.minHeight,
4417
+ });
4084
4418
  if (changes['origin'] && this.open) {
4085
4419
  this._position.apply();
4086
4420
  }
@@ -4089,12 +4423,15 @@ var CdkConnectedOverlay = /** @class */ (function () {
4089
4423
  this.open ? this._attachOverlay() : this._detachOverlay();
4090
4424
  }
4091
4425
  };
4426
+ /** Creates an overlay */
4092
4427
  /**
4093
4428
  * Creates an overlay
4429
+ * @private
4094
4430
  * @return {?}
4095
4431
  */
4096
4432
  CdkConnectedOverlay.prototype._createOverlay = /**
4097
4433
  * Creates an overlay
4434
+ * @private
4098
4435
  * @return {?}
4099
4436
  */
4100
4437
  function () {
@@ -4110,12 +4447,15 @@ var CdkConnectedOverlay = /** @class */ (function () {
4110
4447
  }
4111
4448
  });
4112
4449
  };
4450
+ /** Builds the overlay config based on the directive's inputs */
4113
4451
  /**
4114
4452
  * Builds the overlay config based on the directive's inputs
4453
+ * @private
4115
4454
  * @return {?}
4116
4455
  */
4117
4456
  CdkConnectedOverlay.prototype._buildConfig = /**
4118
4457
  * Builds the overlay config based on the directive's inputs
4458
+ * @private
4119
4459
  * @return {?}
4120
4460
  */
4121
4461
  function () {
@@ -4148,13 +4488,16 @@ var CdkConnectedOverlay = /** @class */ (function () {
4148
4488
  }
4149
4489
  return overlayConfig;
4150
4490
  };
4491
+ /** Updates the state of a position strategy, based on the values of the directive inputs. */
4151
4492
  /**
4152
4493
  * Updates the state of a position strategy, based on the values of the directive inputs.
4494
+ * @private
4153
4495
  * @param {?} positionStrategy
4154
4496
  * @return {?}
4155
4497
  */
4156
4498
  CdkConnectedOverlay.prototype._updatePositionStrategy = /**
4157
4499
  * Updates the state of a position strategy, based on the values of the directive inputs.
4500
+ * @private
4158
4501
  * @param {?} positionStrategy
4159
4502
  * @return {?}
4160
4503
  */
@@ -4178,12 +4521,15 @@ var CdkConnectedOverlay = /** @class */ (function () {
4178
4521
  .withViewportMargin(this.viewportMargin)
4179
4522
  .withLockedPosition(this.lockPosition);
4180
4523
  };
4524
+ /** Returns the position strategy of the overlay to be set on the overlay config */
4181
4525
  /**
4182
4526
  * Returns the position strategy of the overlay to be set on the overlay config
4527
+ * @private
4183
4528
  * @return {?}
4184
4529
  */
4185
4530
  CdkConnectedOverlay.prototype._createPositionStrategy = /**
4186
4531
  * Returns the position strategy of the overlay to be set on the overlay config
4532
+ * @private
4187
4533
  * @return {?}
4188
4534
  */
4189
4535
  function () {
@@ -4194,12 +4540,15 @@ var CdkConnectedOverlay = /** @class */ (function () {
4194
4540
  strategy.positionChanges.subscribe(function (p) { return _this.positionChange.emit(p); });
4195
4541
  return strategy;
4196
4542
  };
4543
+ /** Attaches the overlay and subscribes to backdrop clicks if backdrop exists */
4197
4544
  /**
4198
4545
  * Attaches the overlay and subscribes to backdrop clicks if backdrop exists
4546
+ * @private
4199
4547
  * @return {?}
4200
4548
  */
4201
4549
  CdkConnectedOverlay.prototype._attachOverlay = /**
4202
4550
  * Attaches the overlay and subscribes to backdrop clicks if backdrop exists
4551
+ * @private
4203
4552
  * @return {?}
4204
4553
  */
4205
4554
  function () {
@@ -4209,12 +4558,7 @@ var CdkConnectedOverlay = /** @class */ (function () {
4209
4558
  }
4210
4559
  else {
4211
4560
  // Update the overlay size, in case the directive's inputs have changed
4212
- this._overlayRef.updateSize({
4213
- width: this.width,
4214
- minWidth: this.minWidth,
4215
- height: this.height,
4216
- minHeight: this.minHeight,
4217
- });
4561
+ this._overlayRef.getConfig().hasBackdrop = this.hasBackdrop;
4218
4562
  }
4219
4563
  if (!this._overlayRef.hasAttached()) {
4220
4564
  this._overlayRef.attach(this._templatePortal);
@@ -4225,13 +4569,19 @@ var CdkConnectedOverlay = /** @class */ (function () {
4225
4569
  _this.backdropClick.emit(event);
4226
4570
  });
4227
4571
  }
4572
+ else {
4573
+ this._backdropSubscription.unsubscribe();
4574
+ }
4228
4575
  };
4576
+ /** Detaches the overlay and unsubscribes to backdrop clicks if backdrop exists */
4229
4577
  /**
4230
4578
  * Detaches the overlay and unsubscribes to backdrop clicks if backdrop exists
4579
+ * @private
4231
4580
  * @return {?}
4232
4581
  */
4233
4582
  CdkConnectedOverlay.prototype._detachOverlay = /**
4234
4583
  * Detaches the overlay and unsubscribes to backdrop clicks if backdrop exists
4584
+ * @private
4235
4585
  * @return {?}
4236
4586
  */
4237
4587
  function () {
@@ -4241,20 +4591,6 @@ var CdkConnectedOverlay = /** @class */ (function () {
4241
4591
  }
4242
4592
  this._backdropSubscription.unsubscribe();
4243
4593
  };
4244
- /**
4245
- * Destroys the overlay created by this directive.
4246
- * @return {?}
4247
- */
4248
- CdkConnectedOverlay.prototype._destroyOverlay = /**
4249
- * Destroys the overlay created by this directive.
4250
- * @return {?}
4251
- */
4252
- function () {
4253
- if (this._overlayRef) {
4254
- this._overlayRef.dispose();
4255
- }
4256
- this._backdropSubscription.unsubscribe();
4257
- };
4258
4594
  CdkConnectedOverlay.decorators = [
4259
4595
  { type: core.Directive, args: [{
4260
4596
  selector: '[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]',
@@ -4304,9 +4640,10 @@ var CdkConnectedOverlay = /** @class */ (function () {
4304
4640
  function CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay) {
4305
4641
  return function () { return overlay.scrollStrategies.reposition(); };
4306
4642
  }
4307
- /** *
4643
+ /**
4308
4644
  * \@docs-private
4309
- @type {?} */
4645
+ * @type {?}
4646
+ */
4310
4647
  var CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER = {
4311
4648
  provide: CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY,
4312
4649
  deps: [Overlay],
@@ -4315,7 +4652,7 @@ var CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER = {
4315
4652
 
4316
4653
  /**
4317
4654
  * @fileoverview added by tsickle
4318
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
4655
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4319
4656
  */
4320
4657
  var OverlayModule = /** @class */ (function () {
4321
4658
  function OverlayModule() {
@@ -4333,11 +4670,12 @@ var OverlayModule = /** @class */ (function () {
4333
4670
  ];
4334
4671
  return OverlayModule;
4335
4672
  }());
4336
- /** *
4673
+ /**
4337
4674
  * @deprecated Use `OverlayModule` instead.
4338
4675
  * \@breaking-change 8.0.0
4339
4676
  * \@docs-private
4340
- @type {?} */
4677
+ * @type {?}
4678
+ */
4341
4679
  var OVERLAY_PROVIDERS = [
4342
4680
  Overlay,
4343
4681
  OverlayPositionBuilder,
@@ -4349,7 +4687,7 @@ var OVERLAY_PROVIDERS = [
4349
4687
 
4350
4688
  /**
4351
4689
  * @fileoverview added by tsickle
4352
- * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
4690
+ * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4353
4691
  */
4354
4692
  /**
4355
4693
  * Alternative to OverlayContainer that supports correct displaying of overlay elements in
@@ -4376,9 +4714,11 @@ var FullscreenOverlayContainer = /** @class */ (function (_super) {
4376
4714
  }
4377
4715
  };
4378
4716
  /**
4717
+ * @protected
4379
4718
  * @return {?}
4380
4719
  */
4381
4720
  FullscreenOverlayContainer.prototype._createContainer = /**
4721
+ * @protected
4382
4722
  * @return {?}
4383
4723
  */
4384
4724
  function () {
@@ -4388,9 +4728,11 @@ var FullscreenOverlayContainer = /** @class */ (function (_super) {
4388
4728
  this._addFullscreenChangeListener(function () { return _this._adjustParentForFullscreenChange(); });
4389
4729
  };
4390
4730
  /**
4731
+ * @private
4391
4732
  * @return {?}
4392
4733
  */
4393
4734
  FullscreenOverlayContainer.prototype._adjustParentForFullscreenChange = /**
4735
+ * @private
4394
4736
  * @return {?}
4395
4737
  */
4396
4738
  function () {
@@ -4404,10 +4746,12 @@ var FullscreenOverlayContainer = /** @class */ (function (_super) {
4404
4746
  parent.appendChild(this._containerElement);
4405
4747
  };
4406
4748
  /**
4749
+ * @private
4407
4750
  * @param {?} fn
4408
4751
  * @return {?}
4409
4752
  */
4410
4753
  FullscreenOverlayContainer.prototype._addFullscreenChangeListener = /**
4754
+ * @private
4411
4755
  * @param {?} fn
4412
4756
  * @return {?}
4413
4757
  */
@@ -4423,9 +4767,11 @@ var FullscreenOverlayContainer = /** @class */ (function (_super) {
4423
4767
  }
4424
4768
  };
4425
4769
  /**
4770
+ * @private
4426
4771
  * @return {?}
4427
4772
  */
4428
4773
  FullscreenOverlayContainer.prototype._getEventName = /**
4774
+ * @private
4429
4775
  * @return {?}
4430
4776
  */
4431
4777
  function () {
@@ -4436,10 +4782,10 @@ var FullscreenOverlayContainer = /** @class */ (function (_super) {
4436
4782
  else if (this._document.webkitFullscreenEnabled) {
4437
4783
  this._fullScreenEventName = 'webkitfullscreenchange';
4438
4784
  }
4439
- else if ((/** @type {?} */ (this._document)).mozFullScreenEnabled) {
4785
+ else if (((/** @type {?} */ (this._document))).mozFullScreenEnabled) {
4440
4786
  this._fullScreenEventName = 'mozfullscreenchange';
4441
4787
  }
4442
- else if ((/** @type {?} */ (this._document)).msFullscreenEnabled) {
4788
+ else if (((/** @type {?} */ (this._document))).msFullscreenEnabled) {
4443
4789
  this._fullScreenEventName = 'MSFullscreenChange';
4444
4790
  }
4445
4791
  }
@@ -4462,8 +4808,8 @@ var FullscreenOverlayContainer = /** @class */ (function (_super) {
4462
4808
  function () {
4463
4809
  return this._document.fullscreenElement ||
4464
4810
  this._document.webkitFullscreenElement ||
4465
- (/** @type {?} */ (this._document)).mozFullScreenElement ||
4466
- (/** @type {?} */ (this._document)).msFullscreenElement ||
4811
+ ((/** @type {?} */ (this._document))).mozFullScreenElement ||
4812
+ ((/** @type {?} */ (this._document))).msFullscreenElement ||
4467
4813
  null;
4468
4814
  };
4469
4815
  FullscreenOverlayContainer.decorators = [